tenderlove/nokogiri — Issue #567: java XmlSaxPushParser raises odd error when buffer overflows
Author: samuelkadolph
Created: 2011-11-14 22:00:28+00:00
State: open

When you push a string into the `Nokogiri::XML::Sax::PushParser` that is over 512 characters you get an odd syntax error instead of an error about the buffer overflowing.

```ruby
require "nokogiri"

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

xml = <<-XML

elasticbeanstalk-us-east-1-516445455037
2011-11-14-omega-2a74f431c50ce2d30d72dcc16616aa7596e6f85d.war

1.0.0.alpha12
omega
2011-11-14T20:49:20.332Z
pad
XML

puts xml.size

parser = Parser.new
pusher = Nokogiri::XML::SAX::PushParser.new(parser)
pusher << xml
pusher.finish
```

```
513
Nokogiri::XML::SyntaxError: Element type "Cre" must be followed by either attribute specifications, ">" or "/>".
native_write at nokogiri/XmlSaxPushParser.java:149
write at /Users/i822055/.rvm/gems/jruby-1.6.5/gems/nokogiri-1.5.0-java/lib/nokogiri/xml/sax/push_parser.rb:47
(root) at xml2.rb:24
```

This works fine with the c version of nokogiri.
https://github.com/tenderlove/nokogiri/blob/v1.5.0/ext/java/nokogiri/internals/PushInputStream.java#L79