Menu

Heap out of memory with TextRenderer

Tinclon
2012-09-24
2013-01-03
  • Tinclon

    Tinclon - 2012-09-24

    The following code produces a

    java.lang.OutOfMemoryError: Java heap space
    

    whenever the html contains an hr tag:

    String text = new Source(html).getRenderer().setMaxLineLength(Integer.MAX_VALUE).toString().trim();
    

    Jericho attempts to append 2 GB of dash ("-") characters to represent the table header row.

    Unfortunately, setting MaxLineLength to  smaller value isn't an option for us, as we need to not have a newline character unless the underlying html specifically calls for it (

    <br/>, <p>, etc.
    

    ).

    Thanks.

     
  • Martin Jericho

    Martin Jericho - 2012-09-24

    Hi tinclon,

    This issue has been addressed in version 3.3 with the Renderer.setHRLineLength method.

    Until version 3.3 is officially released, the development version is available here: 
    http://jericho.htmlparser.net/temp/jericho-html-3.3-dev.zip

    Cheers 
    Martin

     

Log in to post a comment.