Mercurial > hg > release > icedtea6-1.9
changeset 2297:f7e1c7889320
added patches/openjdk/7003777-bad-html-entity-parse.patch
changed ChangeLog
changed Makefile.am
changed NEWS
author | Denis Lila <dlila@redhat.com> |
---|---|
date | Wed, 08 Dec 2010 19:06:41 -0500 |
parents | e24e9650454e |
children | f29c789749d0 |
files | ChangeLog Makefile.am NEWS patches/openjdk/7003777-bad-html-entity-parse.patch |
diffstat | 4 files changed, 91 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Dec 01 20:27:01 2010 +0000 +++ b/ChangeLog Wed Dec 08 19:06:41 2010 -0500 @@ -1,3 +1,11 @@ +2010-12-08 Denis Lila <dlila@redhat.com> + + * Makefile.am: + Added patch. + * patches/openjdk/7003777-bad-html-entity-parse.patch: + Fixed issue where the parsing of tokens such as "&xyz" in html + documents would insert "&xyz;" in the document. + 2010-12-01 Andrew John Hughes <ahughes@redhat.com> * configure.ac: Bump to 1.9.3.
--- a/Makefile.am Wed Dec 01 20:27:01 2010 +0000 +++ b/Makefile.am Wed Dec 08 19:06:41 2010 -0500 @@ -317,7 +317,8 @@ patches/openjdk/6876282-bigdecimal_divide.patch \ patches/f14-fonts.patch \ patches/applet_hole.patch \ - patches/openjdk/7002666-eclipse_cdt_oops_crash.patch + patches/openjdk/7002666-eclipse_cdt_oops_crash.patch \ + patches/openjdk/7003777-bad-html-entity-parse.patch if WITH_ALT_HSBUILD ICEDTEA_PATCHES += \
--- a/NEWS Wed Dec 01 20:27:01 2010 +0000 +++ b/NEWS Wed Dec 08 19:06:41 2010 -0500 @@ -69,6 +69,7 @@ * Fixes - Fix build failure on S390 - RH633510: OpenJDK should use NUMA even if glibc doesn't provide it + - S7003777, RH647674: JTextPane produces incorrect content after parsing the html text * NetX - New man page for javaws * Plugin
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/7003777-bad-html-entity-parse.patch Wed Dec 08 19:06:41 2010 -0500 @@ -0,0 +1,80 @@ +diff -U5 -r --new-file openjdk.old/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java openjdk/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java +--- openjdk.old/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java 2010-11-30 16:41:02.011095918 -0500 ++++ openjdk/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java 2010-11-30 16:23:10.068090762 -0500 +@@ -966,10 +966,14 @@ + } + } else if (!parseIdentifier(false)) { + char data[] = {'&'}; + return data; + } ++ // We need this in case the entity does not exist. If it doesn't then ++ // we only want to return "&identifier;" if the semicolon was actually ++ // there. Otherwise we return "&identifier". ++ boolean chWasSemicolon = false; + switch (ch) { + case '\n': + ln++; + ch = readCh(); + lfCount++; +@@ -986,10 +990,11 @@ + } + break; + + case ';': + ch = readCh(); ++ chWasSemicolon = true; + break; + } + + String nm = getString(pos); + Entity ent = dtd.getEntity(nm); +@@ -1006,11 +1011,11 @@ + if (nm.length() == 0) { + error("invalid.entref", nm); + return new char[0]; + } + /* given that there is not a match restore the entity reference */ +- String str = "&" + nm + ";"; ++ String str = "&" + nm + (chWasSemicolon ? ";" : ""); + + char b[] = new char[str.length()]; + str.getChars(0, b.length, b, 0); + return b; + } +diff -U5 -r --new-file openjdk.old/jdk/test/javax/swing/text/html/Test7003777.java openjdk/jdk/test/javax/swing/text/html/Test7003777.java +--- openjdk.old/jdk/test/javax/swing/text/html/Test7003777.java 1969-12-31 19:00:00.000000000 -0500 ++++ openjdk/jdk/test/javax/swing/text/html/Test7003777.java 2010-11-30 16:16:13.419104648 -0500 +@@ -0,0 +1,33 @@ ++/* ++ @test ++ @bug 7003777 ++ @summary html nonexistent entities not parsed properly when the ";" is missing. ++ @author Denis Lila <dlila@redhat.com>, cnsturgeon2000@yahoo.com ++ @run main Test7003777 ++ */ ++import javax.swing.JTextPane; ++import javax.swing.text.BadLocationException; ++ ++/** ++ * Test7003777.java ++ * ++ * Summary: Check that invalid html entities are parsed "properly". ++ * (see code below for what that means). ++ */ ++ ++public class Test7003777 { ++ public static void main(String[] args) throws BadLocationException { ++ JTextPane pane = new JTextPane(); ++ pane.setContentType("text/html"); ++ String content = "&somenonvalidentity"; ++ pane.setText(content); ++ ++ // The bug we're testing consisted of a ';' being inserted after the ++ // entity during the parsing. ++ String out = pane.getDocument().getText(0, pane.getDocument().getLength()); ++ if (out.charAt(out.length() - 1) == ';') { ++ throw new RuntimeException("bad non existent html entity parse"); ++ } ++ } ++} ++