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

Made Exception#set_backtrace compliant with Ruby documentation #2068

Merged
merged 2 commits into from Nov 2, 2014

Conversation

@pabloatplumbee
Copy link
Contributor

@pabloatplumbee pabloatplumbee commented Oct 23, 2014

This change fixes #1919, and makes jRuby complaint with Exception#set_backtrace documentation, which states that:

The backtrace must be an array of String objects or a single String in the format described in #backtrace.

This behaviour is confirmed in different MRI versions:

ruby-1.9.3-p545

1.9.3-p545 :001 > Exception.new.set_backtrace 'foo'
 => ["foo"] 
1.9.3-p545 :002 > 

ruby-2.0.0-p0

irb(main):001:0>  Exception.new.set_backtrace 'foo'
=> ["foo"]

ruby-2.1.1

2.1.1 :001 > Exception.new.set_backtrace 'foo'
 => ["foo"] 

But not in jruby:

jruby-1.7.11

jruby-1.7.11 :001 >  Exception.new.set_backtrace 'foo'
TypeError: backtrace must be Array of String
    from org/jruby/RubyException.java:95:in `set_backtrace'
    from (irb):1:in `evaluate'
    from org/jruby/RubyKernel.java:1121:in `eval'
    from org/jruby/RubyKernel.java:1521:in `loop'
    from org/jruby/RubyKernel.java:1284:in `catch'
    from org/jruby/RubyKernel.java:1284:in `catch'
    from /home/pablo/.rvm/rubies/jruby-1.7.11/bin/irb:13:in `(root)'

jruby-1.7.13

jruby-1.7.13 :001 >  Exception.new.set_backtrace 'foo'
TypeError: backtrace must be Array of String
    from org/jruby/RubyException.java:95:in `set_backtrace'
    from (irb):1:in `evaluate'
    from org/jruby/RubyKernel.java:1101:in `eval'
    from org/jruby/RubyKernel.java:1501:in `loop'
    from org/jruby/RubyKernel.java:1264:in `catch'
    from org/jruby/RubyKernel.java:1264:in `catch'
    from /home/pablo/.rvm/rubies/jruby-1.7.13/bin/irb:13:in `(root)'
@headius
Copy link
Member

@headius headius commented Nov 2, 2014

Looks good...is there a test for this somewhere? If not, you can add to our regression suite (spec/regression) or to MRI or RubySpec. We use them all.

headius added a commit that referenced this pull request Nov 2, 2014
Made Exception#set_backtrace compliant with Ruby documentation
@headius headius merged commit ceb199a into jruby:jruby-1_7 Nov 2, 2014
1 check failed
1 check failed
@enebo
continuous-integration/travis-ci The Travis CI build failed
Details
@headius
Copy link
Member

@headius headius commented Nov 2, 2014

Wow, ok, I totally missed that the second file modified was a test. No worries, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants