Skip to content
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

[JRuby] XML::Reader does not return errors #1586

Closed
flavorjones opened this issue Jan 15, 2017 · 0 comments
Closed

[JRuby] XML::Reader does not return errors #1586

flavorjones opened this issue Jan 15, 2017 · 0 comments
Milestone

Comments

@flavorjones
Copy link
Member

flavorjones commented Jan 15, 2017

What problems are you experiencing?

XML::Reader does not return parse errors on JRuby (though it does with libxml2/MRI).

What's the output from nokogiri -v?

# Nokogiri (1.7.0)
    ---
    warnings: []
    nokogiri: 1.7.0
    ruby:
      version: 2.3.1
      platform: java
      description: jruby 9.1.6.0 (2.3.1) 2016-11-09 0150a76 OpenJDK 64-Bit Server VM 25.111-b14 on 1.8.0_111-8u111-b14-2ubuntu0.16.04.2-b14 [linux-x86_64]
      engine: jruby
      jruby: 9.1.6.0
    xerces: Xerces-J 2.11.0
    nekohtml: NekoHTML 1.9.21

Can you provide a self-contained script that reproduces what you're seeing?

these tests are in test/xml/test_reader.rb already, I've ommitted the skip:

      def test_errors_is_an_array
#        skip "TODO: xerces does not internally call `errors`" if Nokogiri.jruby?
        reader = Nokogiri::XML::Reader(StringIO.new('&bogus;'))
        assert_raises(SyntaxError) {
          reader.read
        }
        assert_equal [SyntaxError], reader.errors.map(&:class)
      end

      def test_pushing_to_non_array_raises_TypeError
#        skip "TODO: xerces does not internally call `errors`" if Nokogiri.jruby?
        reader = Nokogiri::XML::Reader(StringIO.new('&bogus;'))
        def reader.errors
          1
        end
        assert_raises(TypeError) {
          reader.read
        }
      end

and the failures are:

  1) Failure:
Nokogiri::XML::TestReader#test_pushing_to_non_array_raises_TypeError [test/xml/test_reader.rb:203]:
[TypeError] exception expected, not
Class: <Nokogiri::XML::SyntaxError>
Message: <"Nokogiri::XML::SyntaxError">
---Backtrace---
nokogiri/XmlReader.java:355:in `read'
test/xml/test_reader.rb:204:in `block in test_pushing_to_non_array_raises_TypeError'
---------------


  2) Failure:
Nokogiri::XML::TestReader#test_errors_is_an_array [test/xml/test_reader.rb:194]:
Expected: [Nokogiri::XML::SyntaxError]
  Actual: []

this has been a known problem since @knu spotted this in 0af5a8e.

@flavorjones flavorjones added this to the 1.7.1 milestone Feb 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant