Package org.apache.commons.math
Class MathRuntimeException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.apache.commons.math.MathRuntimeException
-
- All Implemented Interfaces:
Serializable
,MathThrowable
- Direct Known Subclasses:
InvalidMatrixException
,MatrixIndexException
,MatrixVisitorException
public class MathRuntimeException extends RuntimeException implements MathThrowable
Base class for commons-math unchecked exceptions.- Since:
- 2.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MathRuntimeException(String pattern, Object... arguments)
Deprecated.as of 2.2 replaced byMathRuntimeException(Localizable, Object...)
MathRuntimeException(Throwable rootCause)
Constructs a newMathRuntimeException
with specified nestedThrowable
root cause.MathRuntimeException(Throwable rootCause, String pattern, Object... arguments)
Deprecated.as of 2.2 replaced byMathRuntimeException(Throwable, Localizable, Object...)
MathRuntimeException(Throwable rootCause, Localizable pattern, Object... arguments)
Constructs a newMathRuntimeException
with specified formatted detail message and nestedThrowable
root cause.MathRuntimeException(Localizable pattern, Object... arguments)
Constructs a newMathRuntimeException
with specified formatted detail message.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static ArithmeticException
createArithmeticException(String pattern, Object... arguments)
Deprecated.as of 2.2 replaced bycreateArithmeticException(Localizable, Object...)
static ArithmeticException
createArithmeticException(Localizable pattern, Object... arguments)
Constructs a newArithmeticException
with specified formatted detail message.static ArrayIndexOutOfBoundsException
createArrayIndexOutOfBoundsException(String pattern, Object... arguments)
Deprecated.as of 2.2 replaced bycreateArrayIndexOutOfBoundsException(Localizable, Object...)
static ArrayIndexOutOfBoundsException
createArrayIndexOutOfBoundsException(Localizable pattern, Object... arguments)
Constructs a newArrayIndexOutOfBoundsException
with specified formatted detail message.static ConcurrentModificationException
createConcurrentModificationException(String pattern, Object... arguments)
Deprecated.as of 2.2 replaced bycreateConcurrentModificationException(Localizable, Object...)
static ConcurrentModificationException
createConcurrentModificationException(Localizable pattern, Object... arguments)
Constructs a newConcurrentModificationException
with specified formatted detail message.static EOFException
createEOFException(String pattern, Object... arguments)
Deprecated.as of 2.2 replaced bycreateEOFException(Localizable, Object...)
static EOFException
createEOFException(Localizable pattern, Object... arguments)
Constructs a newEOFException
with specified formatted detail message.static IllegalArgumentException
createIllegalArgumentException(String pattern, Object... arguments)
Deprecated.as of 2.2 replaced bycreateIllegalArgumentException(Localizable, Object...)
static IllegalArgumentException
createIllegalArgumentException(Throwable rootCause)
Constructs a newIllegalArgumentException
with specified nestedThrowable
root cause.static IllegalArgumentException
createIllegalArgumentException(Localizable pattern, Object... arguments)
Constructs a newIllegalArgumentException
with specified formatted detail message.static IllegalStateException
createIllegalStateException(String pattern, Object... arguments)
Deprecated.as of 2.2 replaced bycreateIllegalStateException(Localizable, Object...)
static IllegalStateException
createIllegalStateException(Localizable pattern, Object... arguments)
Constructs a newIllegalStateException
with specified formatted detail message.static RuntimeException
createInternalError(Throwable cause)
Create anRuntimeException
for an internal error.static IOException
createIOException(Throwable rootCause)
Constructs a newIOException
with specified nestedThrowable
root cause.static NoSuchElementException
createNoSuchElementException(String pattern, Object... arguments)
Deprecated.as of 2.2 replaced bycreateNoSuchElementException(Localizable, Object...)
static NoSuchElementException
createNoSuchElementException(Localizable pattern, Object... arguments)
Constructs a newNoSuchElementException
with specified formatted detail message.static NullPointerException
createNullPointerException(String pattern, Object... arguments)
Deprecated.as of 2.2 replaced bycreateNullPointerException(Localizable, Object...)
static NullPointerException
createNullPointerException(Localizable pattern, Object... arguments)
Deprecated.in 2.2.static ParseException
createParseException(int offset, String pattern, Object... arguments)
Deprecated.as of 2.2 replaced bycreateParseException(int, Localizable, Object...)
static ParseException
createParseException(int offset, Localizable pattern, Object... arguments)
Constructs a newParseException
with specified formatted detail message.static UnsupportedOperationException
createUnsupportedOperationException(Localizable pattern, Object... arguments)
Deprecated.in 2.2.Object[]
getArguments()
Gets the arguments used to build the message of this throwable.Localizable
getGeneralPattern()
Gets the localizable pattern used to build the general part of the message of this throwable.String
getLocalizedMessage()
Gets the message in the system default locale.String
getMessage()
Gets the message in a conventional US locale.String
getMessage(Locale locale)
Gets the message in a specified locale.String
getPattern()
Deprecated.as of 2.2 replaced bygetSpecificPattern()
andgetGeneralPattern()
Localizable
getSpecificPattern()
Gets the localizable pattern used to build the specific part of the message of this throwable.void
printStackTrace()
Prints the stack trace of this exception to the standard error stream.void
printStackTrace(PrintStream out)
Prints the stack trace of this exception to the specified stream.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getStackTrace, getSuppressed, initCause, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
MathRuntimeException
@Deprecated public MathRuntimeException(String pattern, Object... arguments)
Deprecated.as of 2.2 replaced byMathRuntimeException(Localizable, Object...)
Constructs a newMathRuntimeException
with specified formatted detail message. Message formatting is delegated toMessageFormat
.- Parameters:
pattern
- format specifierarguments
- format arguments
-
MathRuntimeException
public MathRuntimeException(Localizable pattern, Object... arguments)
Constructs a newMathRuntimeException
with specified formatted detail message. Message formatting is delegated toMessageFormat
.- Parameters:
pattern
- format specifierarguments
- format arguments- Since:
- 2.2
-
MathRuntimeException
public MathRuntimeException(Throwable rootCause)
Constructs a newMathRuntimeException
with specified nestedThrowable
root cause.- Parameters:
rootCause
- the exception or error that caused this exception to be thrown.
-
MathRuntimeException
@Deprecated public MathRuntimeException(Throwable rootCause, String pattern, Object... arguments)
Deprecated.as of 2.2 replaced byMathRuntimeException(Throwable, Localizable, Object...)
Constructs a newMathRuntimeException
with specified formatted detail message and nestedThrowable
root cause. Message formatting is delegated toMessageFormat
.- Parameters:
rootCause
- the exception or error that caused this exception to be thrown.pattern
- format specifierarguments
- format arguments
-
MathRuntimeException
public MathRuntimeException(Throwable rootCause, Localizable pattern, Object... arguments)
Constructs a newMathRuntimeException
with specified formatted detail message and nestedThrowable
root cause. Message formatting is delegated toMessageFormat
.- Parameters:
rootCause
- the exception or error that caused this exception to be thrown.pattern
- format specifierarguments
- format arguments- Since:
- 2.2
-
-
Method Detail
-
getPattern
@Deprecated public String getPattern()
Deprecated.as of 2.2 replaced bygetSpecificPattern()
andgetGeneralPattern()
Gets the pattern used to build the message of this throwable.- Returns:
- the pattern used to build the message of this throwable
-
getSpecificPattern
public Localizable getSpecificPattern()
Gets the localizable pattern used to build the specific part of the message of this throwable.- Specified by:
getSpecificPattern
in interfaceMathThrowable
- Returns:
- localizable pattern used to build the specific part of the message of this throwable
- Since:
- 2.2
-
getGeneralPattern
public Localizable getGeneralPattern()
Gets the localizable pattern used to build the general part of the message of this throwable.- Specified by:
getGeneralPattern
in interfaceMathThrowable
- Returns:
- localizable pattern used to build the general part of the message of this throwable
- Since:
- 2.2
-
getArguments
public Object[] getArguments()
Gets the arguments used to build the message of this throwable.- Specified by:
getArguments
in interfaceMathThrowable
- Returns:
- the arguments used to build the message of this throwable
-
getMessage
public String getMessage(Locale locale)
Gets the message in a specified locale.- Specified by:
getMessage
in interfaceMathThrowable
- Parameters:
locale
- Locale in which the message should be translated- Returns:
- localized message
-
getMessage
public String getMessage()
Gets the message in a conventional US locale.- Specified by:
getMessage
in interfaceMathThrowable
- Overrides:
getMessage
in classThrowable
- Returns:
- localized message
-
getLocalizedMessage
public String getLocalizedMessage()
Gets the message in the system default locale.- Specified by:
getLocalizedMessage
in interfaceMathThrowable
- Overrides:
getLocalizedMessage
in classThrowable
- Returns:
- localized message
-
printStackTrace
public void printStackTrace()
Prints the stack trace of this exception to the standard error stream.- Overrides:
printStackTrace
in classThrowable
-
printStackTrace
public void printStackTrace(PrintStream out)
Prints the stack trace of this exception to the specified stream.- Overrides:
printStackTrace
in classThrowable
- Parameters:
out
- thePrintStream
to use for output
-
createArithmeticException
@Deprecated public static ArithmeticException createArithmeticException(String pattern, Object... arguments)
Deprecated.as of 2.2 replaced bycreateArithmeticException(Localizable, Object...)
Constructs a newArithmeticException
with specified formatted detail message. Message formatting is delegated toMessageFormat
.- Parameters:
pattern
- format specifierarguments
- format arguments- Returns:
- built exception
-
createArithmeticException
public static ArithmeticException createArithmeticException(Localizable pattern, Object... arguments)
Constructs a newArithmeticException
with specified formatted detail message. Message formatting is delegated toMessageFormat
.- Parameters:
pattern
- format specifierarguments
- format arguments- Returns:
- built exception
- Since:
- 2.2
-
createArrayIndexOutOfBoundsException
@Deprecated public static ArrayIndexOutOfBoundsException createArrayIndexOutOfBoundsException(String pattern, Object... arguments)
Deprecated.as of 2.2 replaced bycreateArrayIndexOutOfBoundsException(Localizable, Object...)
Constructs a newArrayIndexOutOfBoundsException
with specified formatted detail message. Message formatting is delegated toMessageFormat
.- Parameters:
pattern
- format specifierarguments
- format arguments- Returns:
- built exception
-
createArrayIndexOutOfBoundsException
public static ArrayIndexOutOfBoundsException createArrayIndexOutOfBoundsException(Localizable pattern, Object... arguments)
Constructs a newArrayIndexOutOfBoundsException
with specified formatted detail message. Message formatting is delegated toMessageFormat
.- Parameters:
pattern
- format specifierarguments
- format arguments- Returns:
- built exception
- Since:
- 2.2
-
createEOFException
@Deprecated public static EOFException createEOFException(String pattern, Object... arguments)
Deprecated.as of 2.2 replaced bycreateEOFException(Localizable, Object...)
Constructs a newEOFException
with specified formatted detail message. Message formatting is delegated toMessageFormat
.- Parameters:
pattern
- format specifierarguments
- format arguments- Returns:
- built exception
-
createEOFException
public static EOFException createEOFException(Localizable pattern, Object... arguments)
Constructs a newEOFException
with specified formatted detail message. Message formatting is delegated toMessageFormat
.- Parameters:
pattern
- format specifierarguments
- format arguments- Returns:
- built exception
- Since:
- 2.2
-
createIOException
public static IOException createIOException(Throwable rootCause)
Constructs a newIOException
with specified nestedThrowable
root cause.This factory method allows chaining of other exceptions within an
IOException
even for Java 5. The constructor forIOException
with a cause parameter was introduced only with Java 6.- Parameters:
rootCause
- the exception or error that caused this exception to be thrown.- Returns:
- built exception
-
createIllegalArgumentException
@Deprecated public static IllegalArgumentException createIllegalArgumentException(String pattern, Object... arguments)
Deprecated.as of 2.2 replaced bycreateIllegalArgumentException(Localizable, Object...)
Constructs a newIllegalArgumentException
with specified formatted detail message. Message formatting is delegated toMessageFormat
.- Parameters:
pattern
- format specifierarguments
- format arguments- Returns:
- built exception
-
createIllegalArgumentException
public static IllegalArgumentException createIllegalArgumentException(Localizable pattern, Object... arguments)
Constructs a newIllegalArgumentException
with specified formatted detail message. Message formatting is delegated toMessageFormat
.- Parameters:
pattern
- format specifierarguments
- format arguments- Returns:
- built exception
- Since:
- 2.2
-
createIllegalArgumentException
public static IllegalArgumentException createIllegalArgumentException(Throwable rootCause)
Constructs a newIllegalArgumentException
with specified nestedThrowable
root cause.- Parameters:
rootCause
- the exception or error that caused this exception to be thrown.- Returns:
- built exception
-
createIllegalStateException
@Deprecated public static IllegalStateException createIllegalStateException(String pattern, Object... arguments)
Deprecated.as of 2.2 replaced bycreateIllegalStateException(Localizable, Object...)
Constructs a newIllegalStateException
with specified formatted detail message. Message formatting is delegated toMessageFormat
.- Parameters:
pattern
- format specifierarguments
- format arguments- Returns:
- built exception
-
createIllegalStateException
public static IllegalStateException createIllegalStateException(Localizable pattern, Object... arguments)
Constructs a newIllegalStateException
with specified formatted detail message. Message formatting is delegated toMessageFormat
.- Parameters:
pattern
- format specifierarguments
- format arguments- Returns:
- built exception
- Since:
- 2.2
-
createConcurrentModificationException
@Deprecated public static ConcurrentModificationException createConcurrentModificationException(String pattern, Object... arguments)
Deprecated.as of 2.2 replaced bycreateConcurrentModificationException(Localizable, Object...)
Constructs a newConcurrentModificationException
with specified formatted detail message. Message formatting is delegated toMessageFormat
.- Parameters:
pattern
- format specifierarguments
- format arguments- Returns:
- built exception
-
createConcurrentModificationException
public static ConcurrentModificationException createConcurrentModificationException(Localizable pattern, Object... arguments)
Constructs a newConcurrentModificationException
with specified formatted detail message. Message formatting is delegated toMessageFormat
.- Parameters:
pattern
- format specifierarguments
- format arguments- Returns:
- built exception
- Since:
- 2.2
-
createNoSuchElementException
@Deprecated public static NoSuchElementException createNoSuchElementException(String pattern, Object... arguments)
Deprecated.as of 2.2 replaced bycreateNoSuchElementException(Localizable, Object...)
Constructs a newNoSuchElementException
with specified formatted detail message. Message formatting is delegated toMessageFormat
.- Parameters:
pattern
- format specifierarguments
- format arguments- Returns:
- built exception
-
createNoSuchElementException
public static NoSuchElementException createNoSuchElementException(Localizable pattern, Object... arguments)
Constructs a newNoSuchElementException
with specified formatted detail message. Message formatting is delegated toMessageFormat
.- Parameters:
pattern
- format specifierarguments
- format arguments- Returns:
- built exception
- Since:
- 2.2
-
createUnsupportedOperationException
@Deprecated public static UnsupportedOperationException createUnsupportedOperationException(Localizable pattern, Object... arguments)
Deprecated.in 2.2. Please useMathUnsupportedOperationException
instead.Constructs a newUnsupportedOperationException
with specified formatted detail message. Message formatting is delegated toMessageFormat
.- Parameters:
pattern
- format specifierarguments
- format arguments- Returns:
- built exception
- Since:
- 2.2
-
createNullPointerException
@Deprecated public static NullPointerException createNullPointerException(String pattern, Object... arguments)
Deprecated.as of 2.2 replaced bycreateNullPointerException(Localizable, Object...)
Constructs a newNullPointerException
with specified formatted detail message. Message formatting is delegated toMessageFormat
.- Parameters:
pattern
- format specifierarguments
- format arguments- Returns:
- built exception
-
createNullPointerException
@Deprecated public static NullPointerException createNullPointerException(Localizable pattern, Object... arguments)
Deprecated.in 2.2. Checks for "null" must not be performed in Commons-Math.Constructs a newNullPointerException
with specified formatted detail message. Message formatting is delegated toMessageFormat
.- Parameters:
pattern
- format specifierarguments
- format arguments- Returns:
- built exception
- Since:
- 2.2
-
createParseException
@Deprecated public static ParseException createParseException(int offset, String pattern, Object... arguments)
Deprecated.as of 2.2 replaced bycreateParseException(int, Localizable, Object...)
Constructs a newParseException
with specified formatted detail message. Message formatting is delegated toMessageFormat
.- Parameters:
offset
- offset at which error occurredpattern
- format specifierarguments
- format arguments- Returns:
- built exception
-
createParseException
public static ParseException createParseException(int offset, Localizable pattern, Object... arguments)
Constructs a newParseException
with specified formatted detail message. Message formatting is delegated toMessageFormat
.- Parameters:
offset
- offset at which error occurredpattern
- format specifierarguments
- format arguments- Returns:
- built exception
- Since:
- 2.2
-
createInternalError
public static RuntimeException createInternalError(Throwable cause)
Create anRuntimeException
for an internal error.- Parameters:
cause
- underlying cause- Returns:
- an
RuntimeException
for an internal error
-
-