Menu

java.util.EmptyStackException

2013-04-04
2018-06-25
  • Hayri Bakici

    Hayri Bakici - 2013-04-04

    Hi, I have a problem regarding the parsing of css. I followed the instructions as they are described here. My code looks like the following:

    CSSOMParser parser = new CSSOMParser();
    InputSource source = new InputSource(new StringReader("p {color:#000000}"));
    CSSStyleSheet sheet = parser.parseStyleSheet(source, null, null);

    However the last line throws me the following exception:

    java.util.EmptyStackException
    at java.util.Stack.peek(Stack.java:85)
    at java.util.Stack.pop(Stack.java:67)
    at com.steadystate.css.parser.CSSOMParser$CSSOMHandler.endDocument(CSSOMParser.java:269)
    at com.steadystate.css.parser.AbstractSACParser.handleEndDocument(AbstractSACParser.java:449)
    at com.steadystate.css.parser.SACParserCSS21.styleSheet(SACParserCSS21.java:54)
    at com.steadystate.css.parser.AbstractSACParser.parseStyleSheet(AbstractSACParser.java:277)
    at com.steadystate.css.parser.SACParserCSS21.parseStyleSheet(SACParserCSS21.java:21)
    at com.steadystate.css.parser.CSSOMParser.parseStyleSheet(CSSOMParser.java:144)

    Thanks in advance

    EDIT:

    I found the problem, the parser was running on a different ClassLoader, therefore it was not able to work. This Question can be closed.

     

    Last edit: Hayri Bakici 2013-04-05
  • Hieu Rocker

    Hieu Rocker - 2018-06-25

    I'm getting the same issue. But not sure what was your ClassLoader issue. I don't see any ClassLoader here.

    @Hayri: can you give more details?

     
  • Hieu Rocker

    Hieu Rocker - 2018-06-25

    Okay, I found out that CSSOMParser is not threadsafed. Fixed by using separate CSSOMParser instance each time.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.