diff options
author | mcherkas <none@none> | 2013-05-21 03:20:27 +0400 |
---|---|---|
committer | mcherkas <none@none> | 2013-05-21 03:20:27 +0400 |
commit | c88b00930465cbc850778dec09fe8d1d8bf40bf2 (patch) | |
tree | 06077f753128cbcd4abe26b3d4ff138a330355c9 /src/share/classes/javax/swing/text | |
parent | fb5df56aea41afe6fba0ce91ae5f0eab11a1872b (diff) |
7011777: JDK 6 parses html text with script tags within comments differently from previous releases
Reviewed-by: alexsch
Contributed-by: Dmitry Markov <dmitry.markov@oracle.com>
Diffstat (limited to 'src/share/classes/javax/swing/text')
-rw-r--r-- | src/share/classes/javax/swing/text/html/parser/Parser.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/share/classes/javax/swing/text/html/parser/Parser.java b/src/share/classes/javax/swing/text/html/parser/Parser.java index bd0cebc73..d511109c1 100644 --- a/src/share/classes/javax/swing/text/html/parser/Parser.java +++ b/src/share/classes/javax/swing/text/html/parser/Parser.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1980,11 +1980,12 @@ class Parser implements DTDConstants { void parseScript() throws IOException { char[] charsToAdd = new char[SCRIPT_END_TAG.length]; + boolean insideComment = false; /* Here, ch should be the first character after <script> */ while (true) { int i = 0; - while (i < SCRIPT_END_TAG.length + while (!insideComment && i < SCRIPT_END_TAG.length && (SCRIPT_END_TAG[i] == ch || SCRIPT_END_TAG_UPPER_CASE[i] == ch)) { charsToAdd[i] = (char) ch; @@ -2025,6 +2026,13 @@ class Parser implements DTDConstants { break; default: addString(ch); + String str = new String(getChars(0, strpos)); + if (!insideComment && str.endsWith(START_COMMENT)) { + insideComment = true; + } + if (insideComment && str.endsWith(END_COMMENT)) { + insideComment = false; + } ch = readCh(); break; } // switch |