# HG changeset patch # User Denis Lila # Date 1291852052 18000 # Node ID 354b60c45df72cf883dbc2e1f4ef94022e64a789 # Parent fe7ca47d85b7a58e3419d20fdbced8052cb1be9f added patches/openjdk/7003777-bad-html-entity-parse.patch changed ChangeLog changed Makefile.am changed NEWS diff -r fe7ca47d85b7 -r 354b60c45df7 ChangeLog --- a/ChangeLog Wed Nov 24 15:02:56 2010 +0000 +++ b/ChangeLog Wed Dec 08 18:47:32 2010 -0500 @@ -1,3 +1,11 @@ +2010-12-08 Denis Lila + + * 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-11-24 Andrew John Hughes * configure.ac: Bump to 1.7.7pre. diff -r fe7ca47d85b7 -r 354b60c45df7 Makefile.am --- a/Makefile.am Wed Nov 24 15:02:56 2010 +0000 +++ b/Makefile.am Wed Dec 08 18:47:32 2010 -0500 @@ -371,10 +371,10 @@ patches/openjdk/6638712-wildcard_types.patch \ patches/openjdk/6650759-missing_inference.patch \ patches/numa_on_early_glibc.patch \ - patches/openjdk/6853592-badwindow-warning-fix.patch \ + patches/openjdk/6853592-badwindow-warning-fix.patch \ patches/snmp.patch \ patches/getannotation-cast.patch \ - patches/applet_hole.patch + patches/openjdk/7003777-bad-html-entity-parse.patch if WITH_ALT_HSBUILD ICEDTEA_PATCHES += patches/hotspot/$(HSBUILD)/openjdk-6886353-ignore_deoptimizealot.patch \ diff -r fe7ca47d85b7 -r 354b60c45df7 NEWS --- a/NEWS Wed Nov 24 15:02:56 2010 +0000 +++ b/NEWS Wed Dec 08 18:47:32 2010 -0500 @@ -49,6 +49,7 @@ - G266295: Provide font configuration for Gentoo. - Provide font configuration for RHEL 6. - RH633510: OpenJDK should use NUMA even if glibc doesn't provide it + - S7003777, RH647674: JTextPane produces incorrect content after parsing the html text * Backports - S6539464, RH500077: Ensure java.lang.Math functions provide consistent results. - S6951319: enable solaris builds using Sun Studio 12 update 1 (fixes PR398). diff -r fe7ca47d85b7 -r 354b60c45df7 patches/openjdk/7003777-bad-html-entity-parse.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/7003777-bad-html-entity-parse.patch Wed Dec 08 18:47:32 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 , 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"); ++ } ++ } ++} ++