From bdbf6189ebacf320a7aa6aeea52a33db87d06440 Mon Sep 17 00:00:00 2001 From: brett Date: Mon, 1 Mar 2004 01:52:26 +0000 Subject: [PATCH] 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 --- .../maven/changelog/ChangeLogEntry.java | 20 +++++++++++++++++-- changelog/xdocs/changes.xml | 3 +++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/changelog/src/main/org/apache/maven/changelog/ChangeLogEntry.java b/changelog/src/main/org/apache/maven/changelog/ChangeLogEntry.java index 653a44b3..1d7ab957 100644 --- a/changelog/src/main/org/apache/maven/changelog/ChangeLogEntry.java +++ b/changelog/src/main/org/apache/maven/changelog/ChangeLogEntry.java @@ -68,7 +68,7 @@ import java.util.Vector; * @task add time of change to the entry * @task investigate betwixt for toXML method * @author dIon Gillard - * @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\n"); } buffer.append("\t\t\n"); buffer.append("\t\n"); @@ -304,6 +304,22 @@ public class ChangeLogEntry return TIME_FORMAT.format(getDate()); } + /** + * remove a ]]> from comments (replace it with ] ] >). + * @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; + } + /** *

Escape the toString of the given object. * For use in an attribute value.

diff --git a/changelog/xdocs/changes.xml b/changelog/xdocs/changes.xml index 04d81bfc..f663fcc0 100644 --- a/changelog/xdocs/changes.xml +++ b/changelog/xdocs/changes.xml @@ -24,6 +24,9 @@ Add support for Perforce SCM and cleaned up some docs. + + Fix CDATA sections in comments. +