JRuby (please use github issues at http://bugs.jruby.org)
  1. JRuby (please use github issues at http://bugs.jruby.org)
  2. JRUBY-6641

Java Exceptions Can Only Be Rescued if First in Exception List When Running in Interpreted Mode

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.7.0.pre1
    • Fix Version/s: JRuby 1.7.0.pre1
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      If you pass multiple exception classes to a rescue class and are running in interpreted mode, Java exceptions can only be rescued if first in the list.

      Example code to reproduce:
      require 'java'
      begin
      java.sql.DriverManager.getConnection('jdbc:mysql:blah')
      rescue StandardError, java.sql.SQLException => e
      puts "Caught exception"
      end

      That should print "Caught exception" but instead prints the stack trace when run as "jruby -X-C rescue.rb". If you reverse the order of the rescue arguments, it prints "Caught exception" as expected.

        Activity

        Hide
        Ben Browning added a comment -

        Pull request submitted - https://github.com/jruby/jruby/pull/157

        Show
        Ben Browning added a comment - Pull request submitted - https://github.com/jruby/jruby/pull/157
        Hide
        Douglas Campos added a comment -

        merged, thanks!

        Show
        Douglas Campos added a comment - merged, thanks!

          People

          • Assignee:
            Douglas Campos
            Reporter:
            Ben Browning
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: