org.orekit.errors
Class OrekitException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by org.orekit.errors.OrekitException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
FrameAncestorException, PropagationException, TimeStampedCacheException

public class OrekitException
extends Exception

This class is the base class for all specific exceptions thrown by the orekit classes.

When the orekit classes throw exceptions that are specific to the package, these exceptions are always subclasses of OrekitException. When exceptions that are already covered by the standard java API should be thrown, like ArrayIndexOutOfBoundsException or InvalidParameterException, these standard exceptions are thrown rather than the commons-math specific ones.

This class also provides utility methods to throw some standard java exceptions with localized messages.

Author:
Luc Maisonobe
See Also:
Serialized Form

Constructor Summary
OrekitException(ExceptionContextProvider provider)
          Simple constructor.
OrekitException(Localizable specifier, Object... parts)
          Simple constructor.
OrekitException(Localizable message, Throwable cause)
          Simple constructor.
OrekitException(OrekitException exception)
          Copy constructor.
OrekitException(Throwable cause, Localizable specifier, Object... parts)
          Simple constructor.
 
Method Summary
static IllegalArgumentException createIllegalArgumentException(Localizable specifier, Object... parts)
          Create an IllegalArgumentException with localized message.
static IllegalStateException createIllegalStateException(Localizable specifier, Object... parts)
          Create an IllegalStateException with localized message.
static RuntimeException createInternalError(Throwable cause)
          Create an RuntimeException for an internal error.
static ParseException createParseException(Localizable specifier, Object... parts)
          Create an ParseException with localized message.
 String getLocalizedMessage()
          
 String getMessage()
          
 String getMessage(Locale locale)
          Gets the message in a specified locale.
 Object[] getParts()
          Get the variable parts of the error message.
 Localizable getSpecifier()
          Get the localizable specifier of the error message.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OrekitException

public OrekitException(Localizable specifier,
                       Object... parts)
Simple constructor. Build an exception with a translated and formatted message

Parameters:
specifier - format specifier (to be translated)
parts - parts to insert in the format (no translation)

OrekitException

public OrekitException(OrekitException exception)
Copy constructor.

Parameters:
exception - exception to copy from
Since:
5.1

OrekitException

public OrekitException(Localizable message,
                       Throwable cause)
Simple constructor. Build an exception from a cause and with a specified message

Parameters:
message - descriptive message
cause - underlying cause

OrekitException

public OrekitException(Throwable cause,
                       Localizable specifier,
                       Object... parts)
Simple constructor. Build an exception from a cause and with a translated and formatted message

Parameters:
cause - underlying cause
specifier - format specifier (to be translated)
parts - parts to insert in the format (no translation)

OrekitException

public OrekitException(ExceptionContextProvider provider)
Simple constructor. Build an exception from an Apache Commons Math exception context context

Parameters:
provider - underlying exception context provider
Since:
6.0
Method Detail

getMessage

public String getMessage(Locale locale)
Gets the message in a specified locale.

Parameters:
locale - Locale in which the message should be translated
Returns:
localized message
Since:
5.0

getMessage

public String getMessage()

Overrides:
getMessage in class Throwable

getLocalizedMessage

public String getLocalizedMessage()

Overrides:
getLocalizedMessage in class Throwable

getSpecifier

public Localizable getSpecifier()
Get the localizable specifier of the error message.

Returns:
localizable specifier of the error message
Since:
5.1

getParts

public Object[] getParts()
Get the variable parts of the error message.

Returns:
a copy of the variable parts of the error message
Since:
5.1

createIllegalArgumentException

public static IllegalArgumentException createIllegalArgumentException(Localizable specifier,
                                                                      Object... parts)
Create an IllegalArgumentException with localized message.

Parameters:
specifier - format specifier (to be translated)
parts - parts to insert in the format (no translation)
Returns:
an IllegalArgumentException with localized message

createIllegalStateException

public static IllegalStateException createIllegalStateException(Localizable specifier,
                                                                Object... parts)
Create an IllegalStateException with localized message.

Parameters:
specifier - format specifier (to be translated)
parts - parts to insert in the format (no translation)
Returns:
an IllegalStateException with localized message

createParseException

public static ParseException createParseException(Localizable specifier,
                                                  Object... parts)
Create an ParseException with localized message.

Parameters:
specifier - format specifier (to be translated)
parts - parts to insert in the format (no translation)
Returns:
an ParseException with localized message

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 © 2016 CNES. All Rights Reserved.