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

[Java] Handle comment nodes #764

Merged
merged 1 commit into from
Oct 21, 2024
Merged

[Java] Handle comment nodes #764

merged 1 commit into from
Oct 21, 2024

Conversation

tushuhei
Copy link
Member

Current Java code does not work with HTML strings that have comment nodes, throwing the following error.

java.util.NoSuchElementException
        at java.base/java.util.ArrayDeque.removeFirst(ArrayDeque.java:363)
        at java.base/java.util.ArrayDeque.pop(ArrayDeque.java:594)
        at com.google.budoux.HTMLProcessor$PhraseResolvingNodeVisitor.tail(HTMLProcessor.java:163)
        at org.jsoup.select.NodeTraversor.traverse(NodeTraversor.java:59)
        at org.jsoup.nodes.Node.traverse(Node.java:707)
        at org.jsoup.nodes.Element.traverse(Element.java:1883)
        at com.google.budoux.HTMLProcessor.resolve(HTMLProcessor.java:194)

This PR fixes this issue by ignoring comment nodes in the node visitor.

@tushuhei tushuhei added the java Pull requests that update Java code label Oct 21, 2024
Copy link
Collaborator

@kojiishi kojiishi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks!

@tushuhei tushuhei merged commit 02fb71c into main Oct 21, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
java Pull requests that update Java code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants