-
-
Notifications
You must be signed in to change notification settings - Fork 905
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
Error Handling for Nokogiri::XML::SAX::Document under jruby seems broken #1847
Comments
Hey, thank you so much for reporting this! I'm not at all confident that the JRuby implementation of the SAX parser has had many eyes on it over the years, and so it's great to hear feedback. I'll make sure someone takes a look at this in the next few days. |
Did some research of my own; my current thinking is that the culprit is -- when the underlying (Java) SAX parser encounters the error, My first reaction is to take out the |
It looks like the XmlSAXPushParser test depends on the current behavior, viz. that unless This is due to the thread juggling on which that implementation is based; the error is thrown by a method executing on a different thread than the one doing the parsing but IIUC it shares the A full fix will have to find a way to propagate the error properly in both cases; one possible way of proceeding is to create separate synchronized error handler that handles the job of communicating between the two threads and delegates the propagation to the Document class defined by the client. |
Still working on a PR; I can make all the tests pass by keeping the try/catch behavior referenced above and calling |
Closed by #1872 |
What problems are you experiencing?
Created a subclass of
Nokogiri::XML::SAX::Document
that raises an exception in the#error
method. Tried to parse a non-well-formed XML document, expecting the error to be raised, but it wasn't.What's the output from
nokogiri -v
?Can you provide a self-contained script that reproduces what you're seeing?
When run under the above configuration. When I change rubies to 2.5.1 and now
nokogiri -v
outputs:I see the expected output:
(for reference, in case GitHub 'cleans' the document, the attribute value in the included XML is \x07, which is not valid for the utf-8 encoding. I also made the document not well-formed in more obvious ways to crank up the error-throwing capabilities.)
The text was updated successfully, but these errors were encountered: