Exception: R2CORBA::CORBA::UserException

Inherits:
Exception
  • Object
show all
Defined in:
lib/corba/jbase/exception.rb,
lib/corba/common/exception.rb

Direct Known Subclasses

TypeCode::BadKind, TypeCode::Bounds

Class Method Summary collapse

Methods inherited from Exception

native2r

Class Method Details

._raise(jex) ⇒ Object

Raises:

  • (CORBA::UNKNOWN)


33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/corba/jbase/exception.rb', line 33

def self._raise(jex)
  STDERR.puts "#{jex}\n#{jex.backtrace.join("\n")}" if $VERBOSE and (NativeException === jex)
  if (NativeException === jex and jex.cause.is_a?(Native::UnknownUserException)) or jex.is_a?(Native::UnknownUserException)
    java_ex = jex.is_a?(Native::UnknownUserException) ? jex : jex.cause
    ex = Any.from_java(java_ex.except)
    ex.set_backtrace(jex.backtrace) if NativeException === jex
    raise ex
  elsif (NativeException === jex and jex.cause.is_a?(Native::UserException)) or jex.is_a?(Native::UserException)
    java_ex = jex.is_a?(Native::UserException) ? jex : jex.cause
    exname = java_ex.class.name.split('::').last
    tcs = CORBA::TypeCode.typecodes_for_name(exname) || []
    extc = tcs.detect { |tc| tc.is_a?(TypeCode::Except) && tc.is_compatible?(java_ex) }
    if extc
      ex = extc.from_java(java_ex)
      ex.set_backtrace(jex.backtrace) if NativeException === jex
      raise ex
    end
  end
  raise CORBA::UNKNOWN.new("#{jex}", 0, CORBA::COMPLETED_MAYBE)
end