PR: MPCHANGELOG-30

Fix CDATA sections in comments


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114766 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
brett 2004-03-01 01:52:26 +00:00
parent 23288e17e7
commit bdbf6189eb
2 changed files with 21 additions and 2 deletions

View File

@ -68,7 +68,7 @@ import java.util.Vector;
* @task add time of change to the entry
* @task investigate betwixt for toXML method
* @author <a href="mailto:dion@multitask.com.au">dIon Gillard</a>
* @version $Id: ChangeLogEntry.java,v 1.2 2003/07/04 16:24:46 evenisse Exp $
* @version $Id: ChangeLogEntry.java,v 1.3 2004/03/01 01:52:26 brett Exp $
*/
public class ChangeLogEntry
{
@ -209,7 +209,7 @@ public class ChangeLogEntry
buffer.append("\t\t</file>\n");
}
buffer.append("\t\t<msg><![CDATA[")
.append(comment)
.append(removeCDataEnd(comment))
.append("]]></msg>\n");
buffer.append("\t</changelog-entry>\n");
@ -304,6 +304,22 @@ public class ChangeLogEntry
return TIME_FORMAT.format(getDate());
}
/**
* remove a <code>]]></code> from comments (replace it with <code>] ] ></code>).
* @param message
* @return
*/
private String removeCDataEnd(String message)
{
// check for invalid sequence ]]>
int endCdata;
while (message != null && (endCdata = message.indexOf("]]>")) > -1)
{
message = message.substring(0, endCdata) + "] ] >" + message.substring(endCdata + 3, message.length());
}
return message;
}
/**
* <p>Escape the <code>toString</code> of the given object.
* For use in an attribute value.</p>

View File

@ -24,6 +24,9 @@
<action dev="jcrossley" type="update" issue="MPCHANGELOG-7">
Add support for Perforce SCM and cleaned up some docs.
</action>
<action dev="brett" type="fix" issue="MPCHANGELOG-30" due-to="fabrizio giustina">
Fix CDATA sections in comments.
</action>
</release>
<release version="1.3" date="2003-09-29">