-
-
Notifications
You must be signed in to change notification settings - Fork 903
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
[bug] jruby NPE when serializing an unparented HTML node #2559
Comments
I've investigated the reported bug in the Nokogiri project, and I believe I've identified the cause. It seems that the issue lies within the isHtmlScript and isHtmlStyle functions, where a NullPointerException occurs due to the inability to evaluate a null object in Java. To address this, I suggest making the following modifications:
As this is my first contribution to the project, I'm excited to learn from your feedback. I will open a draft PR to propose these changes and verify their effectiveness. Thank you for your guidance and support! |
@cbasguti Thank you for taking a look at this issue! I'll take a look at your PR and comment there. |
**What problem is this PR intended to solve?** Closes #2559 This PR aims to solve issue #2559 in the Nokogiri project. After investigating the reported bug, it was identified that a NullPointerException occurs in the isHtmlScript and isHtmlStyle functions due to the inability to evaluate a null object in Java. The proposed solution involves adding a null check for the getParentNode() method's return value and logging an appropriate message if the parent node is null or does not match the expected tag name. A draft PR will be opened to implement these modifications and gather feedback for effectiveness. **Have you included adequate test coverage?** As this is my first contribution to the project, I am uncertain about the appropriate location to include the corresponding test. However, I am committed to ensuring adequate test coverage for this change and will collaborate with the project team to determine the best approach. **Does this change affect the behavior of either the C or the Java implementations?** This change only affects the Java implementation, as the issue of a NullPointerException is specific to that platform. The C implementation does not encounter this problem.
Please describe the bug
results in
Expected behavior
Unparented nodes should serialize normally, as they do in the CRuby implementation
The text was updated successfully, but these errors were encountered: