异常:org.htmlparser.util.ParserException: Error in opening a connection to java.io.IOException: Inv...

org.htmlparser.util.ParserException: Error in opening a connection to

java.io.IOException: Invalid argument

异常出现在:

Parser parser = new Parser(html);

解决办法:

新增creatParser()方法

 private static Parser createParser(String html) {
        Lexer mLexer = new Lexer(new Page(html));
        return new Parser(mLexer,new DefaultParserFeedback(DefaultParserFeedback.QUIET));
 }

上面的Parser parser = new Parser(html);

改为:Parser parser = createParser(html);

你可能感兴趣的:(Java)