You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RuntimeError: couldn't parse document: Premature end of file.
parse_with at nokogiri/XmlSaxParserContext.java:252
parse_memory at /Users/me/.rvm/gems/jruby-1.6.5/gems/nokogiri-1.5.0-java/lib/nokogiri/xml/sax/parser.rb:110
parse at /Users/me/.rvm/gems/jruby-1.6.5/gems/nokogiri-1.5.0-java/lib/nokogiri/xml/sax/parser.rb:83
(root) at /Users/me/gh/nokogiri_java_test.rb:8
This does not happen with Nokogiri 1.4.x (JRuby) and Nokogiri 1.5.0 (MRI).
Noticed this while running the specs for a project of mine.
The text was updated successfully, but these errors were encountered:
This is not a simple bug though it looks really simple. The reason is Nokogiri accepts various types of inputs, also Java API doesn't have any method to know how many bytes are read during parsing. There's no consistent way to know a given document has whitespace(s) only or empty document. Java parser raises the same exception for both whitespace(s) only and empty documents. Only when given input is a string, Nokogiri counts the size before parsing. If the size is less than 1, Nokogiri raises exception. So, this reported case, won't raise exception.
Running the following code:
results in the following error:
This does not happen with Nokogiri 1.4.x (JRuby) and Nokogiri 1.5.0 (MRI).
Noticed this while running the specs for a project of mine.
The text was updated successfully, but these errors were encountered: