tenderlove/nokogiri — Issue #620: Inconsistent behavior of Nokogiri 1.5.0 Java
Author: rubiii
Created: 2012-02-17 18:15:53+00:00
State: open

Running the following code:

``` ruby
require "rubygems"
require "nokogiri"

class Document < Nokogiri::XML::SAX::Document; end

document = Document.new
parser = Nokogiri::XML::SAX::Parser.new document
parser.parse(" ")
```

results in the following error:

```
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 (Java) and Nokogiri 1.5.0 (Native).
Noticed this while [running the specs](http://travis-ci.org/#!/rubiii/nori/builds/692758) for a project of mine.