Top Fields Constructors Methods
org.jruby.exceptions

public Class RaiseException

extends JumpException
Class Inheritance
Known Direct Subclasses
org.jruby.exceptions.Exception
Imports
org.jruby.Ruby, .RubyArray, .RubyClass, .RubyException, .RubyInstanceConfig, .RubyStandardError, .RubyString, org.jruby.ir.runtime.IRRuntimeHelpers, org.jruby.javasupport.JavaUtil, org.jruby.runtime.JavaSites, .ThreadContext, org.jruby.runtime.backtrace.RubyStackTraceElement, .TraceType, org.jruby.runtime.builtin.IRubyObject, java.lang.reflect.Member, java.util.Arrays

Field Summary

Modifier and TypeField and Description
private RubyException
private String
private static final long
Inherited from org.jruby.exceptions.JumpException:
SPECIAL_JUMP

Constructor Summary

AccessConstructor and Description
protected
RaiseException(String message, RubyException exception)

public
RaiseException(Throwable cause, NativeException nativeException)
Deprecated

public
RaiseException(RubyException exception)
Deprecated

public
RaiseException(RubyException exception, boolean unused)
Deprecated

public
RaiseException(RubyException exception, IRubyObject backtrace)
Deprecated

public
RaiseException(Ruby runtime, RubyClass exceptionClass, String msg)
Deprecated

public
RaiseException(Ruby runtime, RubyClass exceptionClass, String msg, boolean unused)
Deprecated

public
RaiseException(Ruby runtime, RubyClass exceptionClass, String msg, IRubyObject backtrace)
Deprecated

public
RaiseException(Ruby runtime, RubyClass exceptionClass, String msg, IRubyObject backtrace, boolean unused)
Deprecated

Method Summary

Modifier and TypeMethod and Description
public static RaiseException
createNativeRaiseException(Ruby runtime, Throwable cause)
Deprecated

public static RaiseException
createNativeRaiseException(Ruby runtime, Throwable cause, Member target)
Deprecated

private void
public final Throwable
fillInStackTrace()

Overrides org.jruby.exceptions.JumpException.fillInStackTrace.

This method don't do anything for performance reasons.

private void
private static RubyClass
findExceptionClass(ThreadContext context, String exceptionPath)

public static RaiseException

Returns:

a RaiseException instance appropriate for the target Ruby exception class
from
(Ruby
the current JRuby runtime
runtime
,
RubyClass
the class of the exception to construct and raise
exceptionClass
,
String
a simple message for the exception
msg
)

Construct a new throwable RaiseException appropriate for the target Ruby exception class.

public static RaiseException

Returns:

a RaiseException instance appropriate for the target Ruby exception class
from
(Ruby
the current JRuby runtime
runtime
,
RubyClass
the class of the exception to construct and raise
exceptionClass
,
String
a simple message for the exception
msg
,
IRubyObject
a Ruby object (usually an Array) to use for the exception's backtrace
backtrace
)

Construct a new throwable RaiseException appropriate for the target Ruby exception class.

public static RaiseException

Returns:

a RaiseException instance appropriate for the target Ruby exception class
from
(Ruby
the current JRuby runtime
runtime
,
RubyClass
the class of the exception to construct and raise
exceptionClass
,
IRubyObject...
the arguments for the exception's constructor
args
)

Construct a new throwable RaiseException appropriate for the target Ruby exception class.

public static RaiseException

Returns:

a RaiseException instance appropriate for the target Ruby exception class
from
(Ruby
the current JRuby runtime
runtime
,
String
a string representing the fully-qualified constant path to look up the exception
exceptionPath
,
String
a simple message for the exception
msg
)

Construct a new throwable RaiseException appropriate for the target Ruby exception class.

public static RaiseException

Returns:

a RaiseException instance appropriate for the target Ruby exception class
from
(Ruby
the current JRuby runtime
runtime
,
String
a string representing the fully-qualified constant path to look up the exception
exceptionPath
,
String
a simple message for the exception
msg
,
IRubyObject
a Ruby object (usually an Array) to use for the exception's backtrace
backtrace
)

Construct a new throwable RaiseException appropriate for the target Ruby exception class.

public static RaiseException

Returns:

a RaiseException instance appropriate for the target Ruby exception class
from
(Ruby
the current JRuby runtimeString exceptionPath
runtime
,
String exceptionPath, IRubyObject...
the arguments for the exception's constructor
args
)

Construct a new throwable RaiseException appropriate for the target Ruby exception class.

public static RaiseException
from(RubyException exception, IRubyObject backtrace)
Deprecated

public Throwable
getCause()

Overrides java.lang.Throwable.getCause.

Returns the cause of this throwable or null if the cause is nonexistent or unknown.

public final RubyException

Returns:

Returns a RubyException
getException
()

Gets the exception

public String
getMessage()

Overrides java.lang.Throwable.getMessage.

Returns the detail message string of this throwable.

private static boolean
public static StackTraceElement[]
private void
preRaise(ThreadContext context, IRubyObject backtrace, boolean capture)

private void
preRaise(ThreadContext context, StackTraceElement[] javaTrace)
Deprecated

private boolean
protected final void
setException(RubyException
The exception to set
newException
)

Sets the exception

protected final void
setException(RubyException newException, boolean unused)
Deprecated

private void
private static JavaSites.RaiseExceptionSites
private StackTraceElement[]
Inherited from org.jruby.exceptions.JumpException:
originalFillInStackTrace

Field Detail

exceptionback to summary
private RubyException exception
providedMessageback to summary
private String providedMessage
serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.jruby.exceptions.JumpException.serialVersionUID.

Constructor Detail

RaiseExceptionback to summary
protected RaiseException(String message, RubyException exception)
RaiseExceptionback to summary
public RaiseException(Throwable cause, NativeException nativeException)

Deprecated

Annotations
@Deprecated
RaiseExceptionback to summary
public RaiseException(RubyException exception)

Deprecated

Annotations
@Deprecated
RaiseExceptionback to summary
public RaiseException(RubyException exception, boolean unused)

Deprecated

Annotations
@Deprecated
RaiseExceptionback to summary
public RaiseException(RubyException exception, IRubyObject backtrace)

Deprecated

Annotations
@Deprecated
RaiseExceptionback to summary
public RaiseException(Ruby runtime, RubyClass exceptionClass, String msg)

Deprecated

Annotations
@Deprecated
RaiseExceptionback to summary
public RaiseException(Ruby runtime, RubyClass exceptionClass, String msg, boolean unused)

Deprecated

Annotations
@Deprecated
RaiseExceptionback to summary
public RaiseException(Ruby runtime, RubyClass exceptionClass, String msg, IRubyObject backtrace)

Deprecated

Annotations
@Deprecated
RaiseExceptionback to summary
public RaiseException(Ruby runtime, RubyClass exceptionClass, String msg, IRubyObject backtrace, boolean unused)

Deprecated

Annotations
@Deprecated

Method Detail

createNativeRaiseExceptionback to summary
public static RaiseException createNativeRaiseException(Ruby runtime, Throwable cause)

Deprecated

Annotations
@Deprecated
createNativeRaiseExceptionback to summary
public static RaiseException createNativeRaiseException(Ruby runtime, Throwable cause, Member target)

Deprecated

Annotations
@Deprecated
doSetLastErrorback to summary
private void doSetLastError(final ThreadContext context)
fillInStackTraceback to summary
public final Throwable fillInStackTrace()

Overrides org.jruby.exceptions.JumpException.fillInStackTrace.

Doc from org.jruby.exceptions.JumpException.fillInStackTrace.

This method don't do anything for performance reasons.

Returns:Throwable

Doc from java.lang.Throwable.fillInStackTrace.

a reference to this Throwable instance.

Annotations
@Override
fillInStackTraceSkipPreRaiseback to summary
private void fillInStackTraceSkipPreRaise()
findExceptionClassback to summary
private static RubyClass findExceptionClass(ThreadContext context, String exceptionPath)
fromback to summary
public static RaiseException from(Ruby runtime, RubyClass exceptionClass, String msg)

Construct a new throwable RaiseException appropriate for the target Ruby exception class. Note that this will produce a RaiseException that has fully prepared for being thrown, including:

  • Populating the stack trace based on the current thread
  • Setting the cause to any currently in-flight exception
  • Setting the thread-local $! "error info" to this exception
This constructor should not be used to create a RubyException object to be raised on a different thread.
Parameters
runtime:Ruby

the current JRuby runtime

exceptionClass:RubyClass

the class of the exception to construct and raise

msg:String

a simple message for the exception

Returns:RaiseException

a RaiseException instance appropriate for the target Ruby exception class

fromback to summary
public static RaiseException from(Ruby runtime, RubyClass exceptionClass, String msg, IRubyObject backtrace)

Construct a new throwable RaiseException appropriate for the target Ruby exception class.

Parameters
runtime:Ruby

the current JRuby runtime

exceptionClass:RubyClass

the class of the exception to construct and raise

msg:String

a simple message for the exception

backtrace:IRubyObject

a Ruby object (usually an Array) to use for the exception's backtrace

Returns:RaiseException

a RaiseException instance appropriate for the target Ruby exception class

fromback to summary
public static RaiseException from(Ruby runtime, RubyClass exceptionClass, IRubyObject... args)

Construct a new throwable RaiseException appropriate for the target Ruby exception class.

Parameters
runtime:Ruby

the current JRuby runtime

exceptionClass:RubyClass

the class of the exception to construct and raise

args:IRubyObject[]

the arguments for the exception's constructor

Returns:RaiseException

a RaiseException instance appropriate for the target Ruby exception class

fromback to summary
public static RaiseException from(Ruby runtime, String exceptionPath, String msg)

Construct a new throwable RaiseException appropriate for the target Ruby exception class.

Parameters
runtime:Ruby

the current JRuby runtime

exceptionPath:String

a string representing the fully-qualified constant path to look up the exception

msg:String

a simple message for the exception

Returns:RaiseException

a RaiseException instance appropriate for the target Ruby exception class

fromback to summary
public static RaiseException from(Ruby runtime, String exceptionPath, String msg, IRubyObject backtrace)

Construct a new throwable RaiseException appropriate for the target Ruby exception class.

Parameters
runtime:Ruby

the current JRuby runtime

exceptionPath:String

a string representing the fully-qualified constant path to look up the exception

msg:String

a simple message for the exception

backtrace:IRubyObject

a Ruby object (usually an Array) to use for the exception's backtrace

Returns:RaiseException

a RaiseException instance appropriate for the target Ruby exception class

fromback to summary
public static RaiseException from(Ruby runtime, String exceptionPath, IRubyObject... args)

Construct a new throwable RaiseException appropriate for the target Ruby exception class.

Parameters
runtime:Ruby

the current JRuby runtimeString exceptionPath

args:IRubyObject[]

the arguments for the exception's constructor

Returns:RaiseException

a RaiseException instance appropriate for the target Ruby exception class

fromback to summary
public static RaiseException from(RubyException exception, IRubyObject backtrace)

Deprecated

Annotations
@Deprecated
getCauseback to summary
public Throwable getCause()

Overrides java.lang.Throwable.getCause.

Doc from java.lang.Throwable.getCause.

Returns the cause of this throwable or null if the cause is nonexistent or unknown. (The cause is the throwable that caused this throwable to get thrown.)

This implementation returns the cause that was supplied via one of the constructors requiring a Throwable, or that was set after creation with the initCause(Throwable) method. While it is typically unnecessary to override this method, a subclass can override it to return a cause set by some other means. This is appropriate for a "legacy chained throwable" that predates the addition of chained exceptions to Throwable. Note that it is not necessary to override any of the PrintStackTrace methods, all of which invoke the getCause method to determine the cause of a throwable.

Returns:Throwable

the cause of this throwable or null if the cause is nonexistent or unknown.

Annotations
@Override
getExceptionback to summary
public final RubyException getException()

Gets the exception

Returns:RubyException

Returns a RubyException

getMessageback to summary
public String getMessage()

Overrides java.lang.Throwable.getMessage.

Doc from java.lang.Throwable.getMessage.

Returns the detail message string of this throwable.

Returns:String

the detail message string of this Throwable instance (which may be null).

Annotations
@Override
isEmptyArrayback to summary
private static boolean isEmptyArray(final IRubyObject ary)
javaTraceFromRubyTraceback to summary
public static StackTraceElement[] javaTraceFromRubyTrace(RubyStackTraceElement[] trace)
preRaiseback to summary
private void preRaise(ThreadContext context, IRubyObject backtrace, boolean capture)
preRaiseback to summary
private void preRaise(ThreadContext context, StackTraceElement[] javaTrace)

Deprecated

Annotations
@Deprecated
requiresBacktraceback to summary
private boolean requiresBacktrace(ThreadContext context)
setExceptionback to summary
protected final void setException(RubyException newException)

Sets the exception

Parameters
newException:RubyException

The exception to set

setExceptionback to summary
protected final void setException(RubyException newException, boolean unused)

Deprecated

Annotations
@Deprecated
setStackTraceFromExceptionback to summary
private void setStackTraceFromException()
sitesback to summary
private static JavaSites.RaiseExceptionSites sites(ThreadContext context)
skipFillInStackTracePartback to summary
private StackTraceElement[] skipFillInStackTracePart(StackTraceElement[] trace)