Menu

upgrade problems

Help
2015-12-04
2015-12-05
  • David Matthews

    David Matthews - 2015-12-04

    I use jericho in the jwma project

    this worked fine with version 3.3:-

                    st = p.getContent().toString();
                    //st is a String, now containing a text/html email Part
                    Source source = new Source(st);
                    //the extracted plain text is rendered onto a web page
                    body.append(source.getRenderer().toString().replaceAll("\n", "<br>"));
    

    but breaks by upgrading to 3.4; difficult to understand what's wrong as the web framework (stripes) swallows the servlet exception.

    Any suggestion?

     
    • David Matthews

      David Matthews - 2015-12-05

      further investigation, basically the same code isolated in a simple test:-

      import net.htmlparser.jericho.*;
      public class Test {
          public static void main(String[] args){
              String st = "<h1>title</h1><p>blah blah blah"</p>;
              Source source = new Source(st); 
              System.out.println(source.getRenderer().toString());
          }
       }
      

      This works as expected with both version 3.3 and 3.4!

      so it seems there is some weird problem between jericho-html and the stripes framework, which throws a servlet exception with version 3.4, on code that works fine with 3.3.

      It would be nice to explain (and fix) this, but I'm guessing I should just stick with 3.3

       
  • David Matthews

    David Matthews - 2015-12-05

    Ah! - I move my custom exception handler out of the way and see:-

    java.lang.UnsupportedClassVersionError: net/htmlparser/jericho/Source : Unsupported major.minor version 51.0 (unable to load class net.htmlparser.jericho.Source)

    problem being I'm still on java 1.6

     
  • Martin Jericho

    Martin Jericho - 2015-12-05

    You can create a java 1.6 compatible jar easily by changing the target argument in the build.bat file.

     

Log in to post a comment.