Menu

NullPointerException in Source.java

Joe
2010-07-28
2013-01-03
  • Joe

    Joe - 2010-07-28

    Hi,

    I actually submitted an artifact, then realized I should have posted here first.

    The problem is that I am using Jericho parser in my project, and am having trouble getting the code executed on a third party crawler.

    They run my jar file under a vert strict java.policy file and Source.class.getPackage() returns null, causing a  null pointer exception at line 100: Source.class.getPackage().getName().

    I have included my code snippet which alleviates this problem.

    static String _PACKAGE_NAME;
    static {
    Package pkg = Source.class.getPackage();
    if (pkg != null) {
    _PACKAGE_NAME = pkg.getName(); // "net.htmlparser.jericho"
    } else {
    _PACKAGE_NAME = "net.htmlparser.jericho";
    }
    }

    static final String PACKAGE_NAME = _PACKAGE_NAME;

     
  • Martin Jericho

    Martin Jericho - 2010-07-28

    Thanks for the bug report.  This will be fixed in release 3.2.

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

     

Log in to post a comment.