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

pretty print broken in jruby 1.6.7 in 1.9 mode #657

Closed
riffraff opened this issue Apr 17, 2012 · 4 comments
Closed

pretty print broken in jruby 1.6.7 in 1.9 mode #657

riffraff opened this issue Apr 17, 2012 · 4 comments

Comments

@riffraff
Copy link

can be reproduced with this code (t.tb)

    require 'test/unit'
    require 'rubygems'
    require 'nokogiri'
    require 'pp'
    class T < Test::Unit::TestCase
      def test_pp_does_not_explode
        doc = Nokogiri::HTML::Document.parse(DATA)
        doc.search('.//*').each do |node|
          pp node
        end
      end
    end
    __END__
    <html>
    </html>

Running it:

$ ruby -v
jruby 1.6.7 (ruby-1.8.7-p357) (2012-02-22 3e82bc8) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_31) [darwin-x86_64-java]
$ ruby mintest.rb 
Loaded suite mintest
Started
#(Element:0x7d2 { name = "html", children = [ #(Text "\n\n\n")] })
.
Finished in 0.264 seconds.

1 tests, 0 assertions, 0 failures, 0 errors
$ ruby --1.9 mintest.rb 
Loaded suite mintest
Started
#(Element:0x7d0 {E
Finished in 0.233000 seconds.

  1) Error:
test_pp_does_not_explode(T):
NoMethodError: undefined method `first' for :name:Symbol
 /Users/riffraff/.rvm/gems/jruby-1.6.7/gems/nokogiri-1.5.2-java/lib/nokogiri/xml/pp/node.rb:37:in `pretty_print'

 1 tests, 0 assertions, 0 failures, 1 errors, 0 skips

 Test run options: --seed 3400

notice that in ruby 1.9 the output is different from jruby in 1.8 mode, due to empty text being stripped, but it does work

$ ruby-1.9.3-p125 mintest.rb 
Run options: 

# Running tests:

#(Element:0x80c313a8 { name = "html" })
.

Finished tests in 0.001246s, 802.5682 tests/s, 0.0000 assertions/s.

1 tests, 0 assertions, 0 failures, 0 errors, 0 skips

Additional data:

$ java -version
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04-413-10M3623)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01-413, mixed mode)


$ uname -a
Darwin mecbucpro.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:32:41 PDT 2011; root:xnu-      1504.15.3~1/RELEASE_X86_64 x86_64

all rubies installed via rvm.

@iRonin
Copy link

iRonin commented Jun 12, 2012

Same issue here:

#(Document:0x2366 {NoMethodError: undefined method `first' for :name:Symbol
    from /Users/cyp/.rvm/gems/jruby-1.6.7.2@global/gems/nokogiri-1.5.3-java/lib/nokogiri/xml/pp/node.rb:37:in `pretty_print'

@yokolet
Copy link
Member

yokolet commented Jun 15, 2012

Same issue in Nokogiri test on 1.9 mode.

This seems to be a JRuby's 1.9 bug. I just opened the ticket, https://jira.codehaus.org/browse/JRUBY-6729 .

@yokolet
Copy link
Member

yokolet commented Jun 27, 2012

I pushed the fix to JRuby master in rev. 7997577 . So, the next JRuby version doesn't have the issue unless the commit won't be reverted :) See what's happen.

@yokolet
Copy link
Member

yokolet commented Nov 25, 2012

The bug has been fixed in JRuby 1.6.8's 1.9 mode. JRuby 1.7.0 (1.9 is default) doesn't have this problem.

I'm going to close this issue.

@yokolet yokolet closed this as completed Nov 25, 2012
xb pushed a commit to xb/jruby that referenced this issue Nov 19, 2013
…nt as well as sparklemotion/nokogiri#657.

The change didn't break test:mri19. However, oddly, test_condvar_wait_exception_handling of test/externals/ruby1.9/ruby/test_thread.rb has become failing often  on my macbook. But, not always. This change might have revealed threadding issue?
qmx pushed a commit to qmx/jruby that referenced this issue Apr 7, 2014
…nt as well as sparklemotion/nokogiri#657.

The change didn't break test:mri19. However, oddly, test_condvar_wait_exception_handling of test/externals/ruby1.9/ruby/test_thread.rb has become failing often  on my macbook. But, not always. This change might have revealed threadding issue?
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

3 participants