Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jTidy fails with Null pointer exception incase of white space before <br> #32

Open
sirsusar opened this issue Jun 15, 2020 · 1 comment
Labels
information-required The issue is incomplete. More information is required.

Comments

@sirsusar
Copy link

Hi ,

I'm using jTidy version 1.0.2 and here is my configuration set up

    Tidy tidy = new Tidy();
     tidy.setInputEncoding("UTF-8");
     tidy.setOutputEncoding("UTF-8");
     tidy.setForceOutput(true);
     tidy.setWrapSection(false);
     tidy.setWraplen(0);
     tidy.setShowErrors(0);
     tidy.setShowWarnings(false);
     tidy.setEscapeCdata(true);
     tidy.setFixComments(true);
     tidy.setIndentCdata(true);
     tidy.setDropProprietaryTags(true);

Few of my html documents fail when I try parsing them using jTidy and after debugging I found that it was space before
that is causing the issue . Is there anyway I can handle this whitespace please advice ?

Here is the error from console
Exception in thread "main" java.lang.NullPointerException
at org.w3c.tidy.PPrint.afterSpace(PPrint.java:1358)
at org.w3c.tidy.PPrint.afterSpace(PPrint.java:1366)
at org.w3c.tidy.PPrint.printTag(PPrint.java:1423)
at org.w3c.tidy.PPrint.printTree(PPrint.java:2209)
at org.w3c.tidy.PPrint.printTree(PPrint.java:2306)
at org.w3c.tidy.PPrint.printTree(PPrint.java:2363)
at org.w3c.tidy.PPrint.printTree(PPrint.java:2363)
at org.w3c.tidy.PPrint.printTree(PPrint.java:2363)
at org.w3c.tidy.PPrint.printTree(PPrint.java:2363)
at org.w3c.tidy.PPrint.printTree(PPrint.java:2152)

@haumacher haumacher added the information-required The issue is incomplete. More information is required. label Feb 13, 2023
@haumacher
Copy link
Collaborator

Can you please attach the HTML source code that causes the error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
information-required The issue is incomplete. More information is required.
Projects
None yet
Development

No branches or pull requests

2 participants