org.apache.commons.math
Class MathRuntimeException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by 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
Version:
$Revision: 1070725 $ $Date: 2011-02-15 02:31:12 +0100 (mar. 15 févr. 2011) $
See Also:
Serialized Form

Constructor Summary
MathRuntimeException(Localizable pattern, Object... arguments)
          Constructs a new MathRuntimeException with specified formatted detail message.
MathRuntimeException(String pattern, Object... arguments)
          Deprecated. as of 2.2 replaced by MathRuntimeException(Localizable, Object...)
MathRuntimeException(Throwable rootCause)
          Constructs a new MathRuntimeException with specified nested Throwable root cause.
MathRuntimeException(Throwable rootCause, Localizable pattern, Object... arguments)
          Constructs a new MathRuntimeException with specified formatted detail message and nested Throwable root cause.
MathRuntimeException(Throwable rootCause, String pattern, Object... arguments)
          Deprecated. as of 2.2 replaced by MathRuntimeException(Throwable, Localizable, Object...)
 
Method Summary
static ArithmeticException createArithmeticException(Localizable pattern, Object... arguments)
          Constructs a new ArithmeticException with specified formatted detail message.
static ArithmeticException createArithmeticException(String pattern, Object... arguments)
          Deprecated. as of 2.2 replaced by createArithmeticException(Localizable, Object...)
static ArrayIndexOutOfBoundsException createArrayIndexOutOfBoundsException(Localizable pattern, Object... arguments)
          Constructs a new ArrayIndexOutOfBoundsException with specified formatted detail message.
static ArrayIndexOutOfBoundsException createArrayIndexOutOfBoundsException(String pattern, Object... arguments)
          Deprecated. as of 2.2 replaced by createArrayIndexOutOfBoundsException(Localizable, Object...)
static ConcurrentModificationException createConcurrentModificationException(Localizable pattern, Object... arguments)
          Constructs a new ConcurrentModificationException with specified formatted detail message.
static ConcurrentModificationException createConcurrentModificationException(String pattern, Object... arguments)
          Deprecated. as of 2.2 replaced by createConcurrentModificationException(Localizable, Object...)
static EOFException createEOFException(Localizable pattern, Object... arguments)
          Constructs a new EOFException with specified formatted detail message.
static EOFException createEOFException(String pattern, Object... arguments)
          Deprecated. as of 2.2 replaced by createEOFException(Localizable, Object...)
static IllegalArgumentException createIllegalArgumentException(Localizable pattern, Object... arguments)
          Constructs a new IllegalArgumentException with specified formatted detail message.
static IllegalArgumentException createIllegalArgumentException(String pattern, Object... arguments)
          Deprecated. as of 2.2 replaced by createIllegalArgumentException(Localizable, Object...)
static IllegalArgumentException createIllegalArgumentException(Throwable rootCause)
          Constructs a new IllegalArgumentException with specified nested Throwable root cause.
static IllegalStateException createIllegalStateException(Localizable pattern, Object... arguments)
          Constructs a new IllegalStateException with specified formatted detail message.
static IllegalStateException createIllegalStateException(String pattern, Object... arguments)
          Deprecated. as of 2.2 replaced by createIllegalStateException(Localizable, Object...)
static RuntimeException createInternalError(Throwable cause)
          Create an RuntimeException for an internal error.
static IOException createIOException(Throwable rootCause)
          Constructs a new IOException with specified nested Throwable root cause.
static NoSuchElementException createNoSuchElementException(Localizable pattern, Object... arguments)
          Constructs a new NoSuchElementException with specified formatted detail message.
static NoSuchElementException createNoSuchElementException(String pattern, Object... arguments)
          Deprecated. as of 2.2 replaced by createNoSuchElementException(Localizable, Object...)
static NullPointerException createNullPointerException(Localizable pattern, Object... arguments)
          Deprecated. in 2.2. Checks for "null" must not be performed in Commons-Math.
static NullPointerException createNullPointerException(String pattern, Object... arguments)
          Deprecated. as of 2.2 replaced by createNullPointerException(Localizable, Object...)
static ParseException createParseException(int offset, Localizable pattern, Object... arguments)
          Constructs a new ParseException with specified formatted detail message.
static ParseException createParseException(int offset, String pattern, Object... arguments)
          Deprecated. as of 2.2 replaced by createParseException(int, Localizable, Object...)
static UnsupportedOperationException createUnsupportedOperationException(Localizable pattern, Object... arguments)
          Deprecated. in 2.2. Please use MathUnsupportedOperationException instead.
 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 by getSpecificPattern() and getGeneralPattern()
 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
fillInStackTrace, getCause, getStackTrace, initCause, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MathRuntimeException

@Deprecated
public MathRuntimeException(String pattern,
                                       Object... arguments)
Deprecated. as of 2.2 replaced by MathRuntimeException(Localizable, Object...)

Constructs a new MathRuntimeException with specified formatted detail message. Message formatting is delegated to MessageFormat.

Parameters:
pattern - format specifier
arguments - format arguments

MathRuntimeException

public MathRuntimeException(Localizable pattern,
                            Object... arguments)
Constructs a new MathRuntimeException with specified formatted detail message. Message formatting is delegated to MessageFormat.

Parameters:
pattern - format specifier
arguments - format arguments
Since:
2.2

MathRuntimeException

public MathRuntimeException(Throwable rootCause)
Constructs a new MathRuntimeException with specified nested Throwable 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 by MathRuntimeException(Throwable, Localizable, Object...)

Constructs a new MathRuntimeException with specified formatted detail message and nested Throwable root cause. Message formatting is delegated to MessageFormat.

Parameters:
rootCause - the exception or error that caused this exception to be thrown.
pattern - format specifier
arguments - format arguments

MathRuntimeException

public MathRuntimeException(Throwable rootCause,
                            Localizable pattern,
                            Object... arguments)
Constructs a new MathRuntimeException with specified formatted detail message and nested Throwable root cause. Message formatting is delegated to MessageFormat.

Parameters:
rootCause - the exception or error that caused this exception to be thrown.
pattern - format specifier
arguments - format arguments
Since:
2.2
Method Detail

getPattern

@Deprecated
public String getPattern()
Deprecated. as of 2.2 replaced by getSpecificPattern() and getGeneralPattern()

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 interface MathThrowable
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 interface MathThrowable
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 interface MathThrowable
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 interface MathThrowable
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 interface MathThrowable
Overrides:
getMessage in class Throwable
Returns:
localized message

getLocalizedMessage

public String getLocalizedMessage()
Gets the message in the system default locale.

Specified by:
getLocalizedMessage in interface MathThrowable
Overrides:
getLocalizedMessage in class Throwable
Returns:
localized message

printStackTrace

public void printStackTrace()
Prints the stack trace of this exception to the standard error stream.

Overrides:
printStackTrace in class Throwable

printStackTrace

public void printStackTrace(PrintStream out)
Prints the stack trace of this exception to the specified stream.

Overrides:
printStackTrace in class Throwable
Parameters:
out - the PrintStream to use for output

createArithmeticException

@Deprecated
public static ArithmeticException createArithmeticException(String pattern,
                                                                       Object... arguments)
Deprecated. as of 2.2 replaced by createArithmeticException(Localizable, Object...)

Constructs a new ArithmeticException with specified formatted detail message. Message formatting is delegated to MessageFormat.

Parameters:
pattern - format specifier
arguments - format arguments
Returns:
built exception

createArithmeticException

public static ArithmeticException createArithmeticException(Localizable pattern,
                                                            Object... arguments)
Constructs a new ArithmeticException with specified formatted detail message. Message formatting is delegated to MessageFormat.

Parameters:
pattern - format specifier
arguments - format arguments
Returns:
built exception
Since:
2.2

createArrayIndexOutOfBoundsException

@Deprecated
public static ArrayIndexOutOfBoundsException createArrayIndexOutOfBoundsException(String pattern,
                                                                                             Object... arguments)
Deprecated. as of 2.2 replaced by createArrayIndexOutOfBoundsException(Localizable, Object...)

Constructs a new ArrayIndexOutOfBoundsException with specified formatted detail message. Message formatting is delegated to MessageFormat.

Parameters:
pattern - format specifier
arguments - format arguments
Returns:
built exception

createArrayIndexOutOfBoundsException

public static ArrayIndexOutOfBoundsException createArrayIndexOutOfBoundsException(Localizable pattern,
                                                                                  Object... arguments)
Constructs a new ArrayIndexOutOfBoundsException with specified formatted detail message. Message formatting is delegated to MessageFormat.

Parameters:
pattern - format specifier
arguments - format arguments
Returns:
built exception
Since:
2.2

createEOFException

@Deprecated
public static EOFException createEOFException(String pattern,
                                                         Object... arguments)
Deprecated. as of 2.2 replaced by createEOFException(Localizable, Object...)

Constructs a new EOFException with specified formatted detail message. Message formatting is delegated to MessageFormat.

Parameters:
pattern - format specifier
arguments - format arguments
Returns:
built exception

createEOFException

public static EOFException createEOFException(Localizable pattern,
                                              Object... arguments)
Constructs a new EOFException with specified formatted detail message. Message formatting is delegated to MessageFormat.

Parameters:
pattern - format specifier
arguments - format arguments
Returns:
built exception
Since:
2.2

createIOException

public static IOException createIOException(Throwable rootCause)
Constructs a new IOException with specified nested Throwable root cause.

This factory method allows chaining of other exceptions within an IOException even for Java 5. The constructor for IOException 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 by createIllegalArgumentException(Localizable, Object...)

Constructs a new IllegalArgumentException with specified formatted detail message. Message formatting is delegated to MessageFormat.

Parameters:
pattern - format specifier
arguments - format arguments
Returns:
built exception

createIllegalArgumentException

public static IllegalArgumentException createIllegalArgumentException(Localizable pattern,
                                                                      Object... arguments)
Constructs a new IllegalArgumentException with specified formatted detail message. Message formatting is delegated to MessageFormat.

Parameters:
pattern - format specifier
arguments - format arguments
Returns:
built exception
Since:
2.2

createIllegalArgumentException

public static IllegalArgumentException createIllegalArgumentException(Throwable rootCause)
Constructs a new IllegalArgumentException with specified nested Throwable 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 by createIllegalStateException(Localizable, Object...)

Constructs a new IllegalStateException with specified formatted detail message. Message formatting is delegated to MessageFormat.

Parameters:
pattern - format specifier
arguments - format arguments
Returns:
built exception

createIllegalStateException

public static IllegalStateException createIllegalStateException(Localizable pattern,
                                                                Object... arguments)
Constructs a new IllegalStateException with specified formatted detail message. Message formatting is delegated to MessageFormat.

Parameters:
pattern - format specifier
arguments - format arguments
Returns:
built exception
Since:
2.2

createConcurrentModificationException

@Deprecated
public static ConcurrentModificationException createConcurrentModificationException(String pattern,
                                                                                               Object... arguments)
Deprecated. as of 2.2 replaced by createConcurrentModificationException(Localizable, Object...)

Constructs a new ConcurrentModificationException with specified formatted detail message. Message formatting is delegated to MessageFormat.

Parameters:
pattern - format specifier
arguments - format arguments
Returns:
built exception

createConcurrentModificationException

public static ConcurrentModificationException createConcurrentModificationException(Localizable pattern,
                                                                                    Object... arguments)
Constructs a new ConcurrentModificationException with specified formatted detail message. Message formatting is delegated to MessageFormat.

Parameters:
pattern - format specifier
arguments - format arguments
Returns:
built exception
Since:
2.2

createNoSuchElementException

@Deprecated
public static NoSuchElementException createNoSuchElementException(String pattern,
                                                                             Object... arguments)
Deprecated. as of 2.2 replaced by createNoSuchElementException(Localizable, Object...)

Constructs a new NoSuchElementException with specified formatted detail message. Message formatting is delegated to MessageFormat.

Parameters:
pattern - format specifier
arguments - format arguments
Returns:
built exception

createNoSuchElementException

public static NoSuchElementException createNoSuchElementException(Localizable pattern,
                                                                  Object... arguments)
Constructs a new NoSuchElementException with specified formatted detail message. Message formatting is delegated to MessageFormat.

Parameters:
pattern - format specifier
arguments - format arguments
Returns:
built exception
Since:
2.2

createUnsupportedOperationException

@Deprecated
public static UnsupportedOperationException createUnsupportedOperationException(Localizable pattern,
                                                                                           Object... arguments)
Deprecated. in 2.2. Please use MathUnsupportedOperationException instead.

Constructs a new UnsupportedOperationException with specified formatted detail message. Message formatting is delegated to MessageFormat.

Parameters:
pattern - format specifier
arguments - format arguments
Returns:
built exception
Since:
2.2

createNullPointerException

@Deprecated
public static NullPointerException createNullPointerException(String pattern,
                                                                         Object... arguments)
Deprecated. as of 2.2 replaced by createNullPointerException(Localizable, Object...)

Constructs a new NullPointerException with specified formatted detail message. Message formatting is delegated to MessageFormat.

Parameters:
pattern - format specifier
arguments - 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 new NullPointerException with specified formatted detail message. Message formatting is delegated to MessageFormat.

Parameters:
pattern - format specifier
arguments - 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 by createParseException(int, Localizable, Object...)

Constructs a new ParseException with specified formatted detail message. Message formatting is delegated to MessageFormat.

Parameters:
offset - offset at which error occurred
pattern - format specifier
arguments - format arguments
Returns:
built exception

createParseException

public static ParseException createParseException(int offset,
                                                  Localizable pattern,
                                                  Object... arguments)
Constructs a new ParseException with specified formatted detail message. Message formatting is delegated to MessageFormat.

Parameters:
offset - offset at which error occurred
pattern - format specifier
arguments - format arguments
Returns:
built exception
Since:
2.2

createInternalError

public static RuntimeException createInternalError(Throwable cause)
Create an RuntimeException for an internal error.

Parameters:
cause - underlying cause
Returns:
an RuntimeException for an internal error


Copyright © 2003-2011 The Apache Software Foundation. All Rights Reserved.