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

soap library doesn't handle the situation where the backtrace is nil

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.6.2
    • Fix Version/s: JRuby 1.6.7
    • Component/s: Core Classes/Modules
    • Labels:
      None
    • Environment:
      mac osx, jruby 1.6.2
    • Number of attachments :
      0

      Description

      on line# 106 in soap/mapping/mapping.rb, it assks e.backtrace and assuming it is never be nil, which is not the case. I tried to do the following in my code:
      was:

      raise message

      now

      error = RuntimeError.new message
      error.set_backtrace([])
      raise error

      The e.backtrace still returns nil

        Activity

        Hide
        Hiroshi Nakamura added a comment -

        Hi again, Yi I assigned it to me since I'm the author of soap4r.

        If I understand correctly, soap module gets an Exception(e) where e.backtrace == nil in your app on JRuby, and it never occurred in CRuby, right?

        Can you create a reproducible example? If it's difficult, would you please show us an inspected result of the exception, by adding 'p e.inspect' in soap/mapping/mapping.rb?

        Show
        Hiroshi Nakamura added a comment - Hi again, Yi I assigned it to me since I'm the author of soap4r. If I understand correctly, soap module gets an Exception(e) where e.backtrace == nil in your app on JRuby, and it never occurred in CRuby, right? Can you create a reproducible example? If it's difficult, would you please show us an inspected result of the exception, by adding 'p e.inspect' in soap/mapping/mapping.rb?
        Hide
        Charles Oliver Nutter added a comment -

        This might be easy to fix with a reproduction or more information. Waiting for that.

        Show
        Charles Oliver Nutter added a comment - This might be easy to fix with a reproduction or more information. Waiting for that.
        Hide
        Hiroshi Nakamura added a comment -

        Marking this as 'Minor' since we're waiting for feedback, and it looks the issue only happen for the reporter.

        Show
        Hiroshi Nakamura added a comment - Marking this as 'Minor' since we're waiting for feedback, and it looks the issue only happen for the reporter.
        Hide
        Yi Wen added a comment - - edited

        Please see the code:

        99 if detail.is_a?(Mapping::SOAPException)
        100 begin
        101 e = detail.to_e
        102 remote_backtrace = e.backtrace
        103 e.set_backtrace(nil)
        104 raise e # ruby sets current caller as local backtrace of e => e2.
        105 rescue Exception => e
        106 e.set_backtrace(remote_backtrace + e.backtrace[1..-1])
        107 raise

        in line 103, the backtrace of e is being set to nil. then being raised again. now in line 106, e.backtrace[1..-1] is used but the e.backtrace is nil because it is set to nil in line 103

        Show
        Yi Wen added a comment - - edited Please see the code: 99 if detail.is_a?(Mapping::SOAPException) 100 begin 101 e = detail.to_e 102 remote_backtrace = e.backtrace 103 e.set_backtrace(nil) 104 raise e # ruby sets current caller as local backtrace of e => e2. 105 rescue Exception => e 106 e.set_backtrace(remote_backtrace + e.backtrace [1..-1] ) 107 raise in line 103, the backtrace of e is being set to nil. then being raised again. now in line 106, e.backtrace [1..-1] is used but the e.backtrace is nil because it is set to nil in line 103
        Hide
        Yi Wen added a comment -

        I am not quite sure the intention here, but just to confirm, I commented line 103 and the my test passed

        Show
        Yi Wen added a comment - I am not quite sure the intention here, but just to confirm, I commented line 103 and the my test passed
        Hide
        Hiroshi Nakamura added a comment -

        Doh, it's exactly me who wrote the line. JRuby should handle that because CRuby does. I'll investigate... Sorry for the inconvenience.

        Show
        Hiroshi Nakamura added a comment - Doh, it's exactly me who wrote the line. JRuby should handle that because CRuby does. I'll investigate... Sorry for the inconvenience.
        Hide
        Yi Wen added a comment -

        thanks

        Show
        Yi Wen added a comment - thanks
        Hide
        Charles Oliver Nutter added a comment -

        If I understand this issue right, I think the following example shows that it's working ok now. Marking as fixed...reopen if you think there's still a problem and can provide a reproduction.

        system ~/projects/jruby2 $ jruby -e "begin; raise; rescue Exception => e; p e.backtrace; e.set_backtrace(nil); begin; raise e; rescue Exception => e; p e.backtrace; end; end"
        ["-e:1:in `(root)'"]
        ["-e:1:in `(root)'"]
        
        Show
        Charles Oliver Nutter added a comment - If I understand this issue right, I think the following example shows that it's working ok now. Marking as fixed...reopen if you think there's still a problem and can provide a reproduction. system ~/projects/jruby2 $ jruby -e "begin; raise; rescue Exception => e; p e.backtrace; e.set_backtrace(nil); begin; raise e; rescue Exception => e; p e.backtrace; end; end" ["-e:1:in `(root)'"] ["-e:1:in `(root)'"]

          People

          • Assignee:
            Hiroshi Nakamura
            Reporter:
            Yi Wen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: