diff options
author | Omair Majid <[email protected]> | 2011-09-21 14:45:25 -0400 |
---|---|---|
committer | Omair Majid <[email protected]> | 2011-09-21 14:45:25 -0400 |
commit | 9de7a66d1cc25bdccaf582d6eafd28120f8d4b38 (patch) | |
tree | 1f11274263e853d9ce33048651046982a081139e | |
parent | 6453aa0e312f7ed16b065308b93ec20cb51c28a3 (diff) |
PR766 javaws fails to parse an <argument> node that contains CDATA
2011-09-21 Omair Majid <[email protected]>
PR766: javaws fails to parse an <argument> node that contains CDATA
* netx/net/sourceforge/nanoxml/XMLElement.java
(sanitizeInput): Do not remove CDATA sections along with comments.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | netx/net/sourceforge/nanoxml/XMLElement.java | 34 |
2 files changed, 35 insertions, 5 deletions
@@ -1,3 +1,9 @@ +2011-09-21 Omair Majid <[email protected]> + + PR766: javaws fails to parse an <argument> node that contains CDATA + * netx/net/sourceforge/nanoxml/XMLElement.java + (sanitizeInput): Do not remove CDATA sections along with comments. + 2011-09-20 Omair Majid <[email protected]> * tests/netx/unit/net/sourceforge/jnlp/ParserCornerCases.java diff --git a/netx/net/sourceforge/nanoxml/XMLElement.java b/netx/net/sourceforge/nanoxml/XMLElement.java index 3ba4206..662b6cb 100644 --- a/netx/net/sourceforge/nanoxml/XMLElement.java +++ b/netx/net/sourceforge/nanoxml/XMLElement.java @@ -1166,7 +1166,7 @@ public class XMLElement { * @param pout The PipedOutputStream that will be receiving the filtered * xml file. */ - public void sanitizeInput(InputStreamReader isr, PipedOutputStream pout) { + public void sanitizeInput(Reader isr, OutputStream pout) { try { PrintStream out = new PrintStream(pout); @@ -1220,11 +1220,35 @@ public class XMLElement { this.sanitizeCharReadTooMuch = next; - // If the next char is a ? or !, then we've hit a special tag, + // If the next chars are !--, then we've hit a comment tag, // and should skip it. - if (prev == '<' && (next == '!' || next == '?')) { - this.skipSpecialTag(0); - this.sanitizeCharReadTooMuch = '\0'; + if (ch == '<' && sanitizeCharReadTooMuch == '!') { + ch = (char) this.reader.read(); + if (ch == '-') { + ch = (char) this.reader.read(); + if (ch == '-') { + this.skipComment(); + this.sanitizeCharReadTooMuch = '\0'; + } else { + out.print('<'); + out.print('!'); + out.print('-'); + this.sanitizeCharReadTooMuch = ch; + if (JNLPRuntime.isDebug()) { + System.out.print('<'); + System.out.print('!'); + System.out.print('-'); + } + } + } else { + out.print('<'); + out.print('!'); + this.sanitizeCharReadTooMuch = ch; + if (JNLPRuntime.isDebug()) { + System.out.print('<'); + System.out.print('!'); + } + } } // Otherwise we haven't hit a comment, and we should write ch. else { |