harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vasily Zakharov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-4748) [classlib][swing][html] CSS parser displays errors
Date Tue, 11 Sep 2007 11:22:32 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-4748?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12526423
] 

Vasily Zakharov commented on HARMONY-4748:
------------------------------------------

It turned out the problem was in my proxy server that caches the http://www.apache.org/style/style.css
file, referenced from http://www.apache.org, and returns it in GZIPped format, with Content-Encoding
set to gzip. Browsers handle that ok so I never knew the problem existed, but RI and Harmony
all tried to parse gzipped file as CSS and failed.

So, the problem is not in CSS parser, but in HTML reader, probably in HTMLEditorKit.getStyleSheet()
and HTMLDocument.HTMLReader.LinkAction.loadCSS(). Additional code needs to be added to check
the Content-Encoding and unzip the stylesheet if necessary.

RI has the same problem, but it's still a problem anyway.


> [classlib][swing][html] CSS parser displays errors
> --------------------------------------------------
>
>                 Key: HARMONY-4748
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4748
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Vasily Zakharov
>            Priority: Minor
>
> org.apache.harmony.x.swing.text.html.cssparser.CSSParser displays the following errors
when trying to open the http://www.apache.org/ page:
> CSSParser: failed to parse '' at [1, 1] 
> CSSParser: failed to parse '+' at [1, 20] 
> CSSParser: failed to parse '' at [2, 188] 
> Here's the reproducer:
> import javax.swing.JFrame;
> import javax.swing.JEditorPane;
> public class Test {
>     public static void main(String argv[]) {
>         try {
>             JFrame frame = new JFrame();
>             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
>             JEditorPane pane = new JEditorPane("http://www.apache.org/");
>             frame.getContentPane().add(pane);
>             frame.setSize(200, 300);
>             frame.setVisible(true);
>         } catch (Exception e) {
>             e.printStackTrace(System.out);
>         }
>     }
> }
> Investigation shows that the errors occur at the following point:
> 	at org.apache.harmony.x.swing.text.html.cssparser.CSSLogger.logError(CSSLogger.java:29)
> 	at org.apache.harmony.x.swing.text.html.cssparser.CSSParser.skipTillRuleSetEnd(CSSParser.java:30)
> 	at org.apache.harmony.x.swing.text.html.cssparser.CSSParser.skipTillExpressionEnd(CSSParser.java:546)
> 	at org.apache.harmony.x.swing.text.html.cssparser.CSSParser.styleSheetBody(CSSParser.java:134)
> 	at org.apache.harmony.x.swing.text.html.cssparser.CSSParser.styleSheet(CSSParser.java:75)
> 	at org.apache.harmony.x.swing.text.html.cssparser.CSSParser.cssGrammar(CSSParser.java:54)
> 	at org.apache.harmony.x.swing.text.html.cssparser.CSSParser.parse(CSSParser.java:11)
> 	at javax.swing.text.html.StyleSheet.parseSheet(StyleSheet.java:1156)
> 	at javax.swing.text.html.StyleSheet.loadRules(StyleSheet.java:995)
> 	at javax.swing.text.html.HTMLDocument$HTMLReader$LinkAction.loadCSS(HTMLDocument.java:535)
> 	at javax.swing.text.html.HTMLDocument$HTMLReader$LinkAction.start(HTMLDocument.java:524)
> 	at javax.swing.text.html.HTMLDocument$HTMLReader.handleSimpleTag(HTMLDocument.java:627)
> 	at javax.swing.text.html.parser.DocumentParser.handleEmptyTag(DocumentParser.java:70)
> 	at javax.swing.text.html.parser.Parser.startTag(Parser.java:431)
> 	at javax.swing.text.html.parser.Parser$ParserHandlerImpl.iHaveNewStartTag(Parser.java:592)
> 	at javax.swing.text.html.parser.CUP$ParserCup$actions.CUP$ParserCup$do_action(ParserCup.java:939)
> 	at javax.swing.text.html.parser.ParserCup.do_action(ParserCup.java:221)
> 	at java_cup.runtime.lr_parser.parse(lr_parser.java:569)
> 	at javax.swing.text.html.parser.Parser$ParserHandlerImpl.parse(Parser.java:59)
> 	at javax.swing.text.html.parser.Parser.parse(Parser.java:399)
> 	at javax.swing.text.html.parser.DocumentParser.parse(DocumentParser.java:98)
> 	at javax.swing.text.html.parser.ParserDelegator.parse(ParserDelegator.java:80)
> 	at javax.swing.text.html.HTMLEditorKit.read(HTMLEditorKit.java:736)
> 	at javax.swing.JEditorPane.documentLoading(JEditorPane.java:68)
> 	at javax.swing.JEditorPane.setPage(JEditorPane.java:697)
> 	at javax.swing.JEditorPane.setPage(JEditorPane.java:591)
> 	at javax.swing.JEditorPane.<init>(JEditorPane.java:298)
> 	at Test.main(Test.java:8)
> Further investigation is complicated because of HARMONY-4660 that throws NPE when page
is parsed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message