Browse Source

Move CDATA escaping to the writer to make it harder to get a CDATA in another CDATA

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272199 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
656bd7e92a
2 changed files with 3 additions and 5 deletions
  1. +1
    -3
      src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java
  2. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogWriter.java

+ 1
- 3
src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java View File

@@ -162,7 +162,6 @@ class ChangeLogParser
//so we can save it
final int end = m_comment.length() - lineSeparator.length(); //was -1
m_comment = m_comment.substring( 0, end );
m_comment = "<![CDATA[" + m_comment + "]]>";
saveEntry();
m_status = GET_FILE;
}
@@ -170,7 +169,6 @@ class ChangeLogParser
{
final int end = m_comment.length() - lineSeparator.length(); //was -1
m_comment = m_comment.substring( 0, end );
m_comment = "<![CDATA[" + m_comment + "]]>";
m_status = GET_PREVIOUS_REV;
}
else
@@ -228,7 +226,7 @@ class ChangeLogParser

if( m_userList.containsKey( m_author ) )
{
m_author = "<![CDATA[" + m_userList.getProperty( m_author ) + "]]>";
m_author = m_userList.getProperty( m_author );
}

m_status = GET_COMMENT;


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogWriter.java View File

@@ -98,7 +98,7 @@ class ChangeLogWriter
output.println( "\t<entry>" );
output.println( "\t\t<date>" + c_outputDate.format( entry.getDate() ) + "</date>" );
output.println( "\t\t<time>" + c_outputTime.format( entry.getDate() ) + "</time>" );
output.println( "\t\t<author>" + entry.getAuthor() + "</author>" );
output.println( "\t\t<author><![CDATA[" + entry.getAuthor() + "]]></author>" );

final Enumeration enumeration = entry.getFiles().elements();
while( enumeration.hasMoreElements() )
@@ -116,7 +116,7 @@ class ChangeLogWriter

output.println( "\t\t</file>" );
}
output.println( "\t\t<msg>" + entry.getComment() + "</msg>" );
output.println( "\t\t<msg><![CDATA[" + entry.getComment() + "]]></msg>" );
output.println( "\t</entry>" );
}
}

Loading…
Cancel
Save