org.inria.ns.reflex.structures
Class LocalizableException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by org.inria.ns.reflex.structures.LocalizableException
All Implemented Interfaces:
Serializable, Localizable
Direct Known Subclasses:
BadCatalogFormatException, ExecutionException, InitializationException, XMLException

public class LocalizableException
extends Exception
implements Localizable

An exception that allows to localize the cause in a file.

Author:
Philippe Poulard
See Also:
Serialized Form

Constructor Summary
LocalizableException()
          Create a new instance of localizable exception.
LocalizableException(Localizable localizable, String msg)
          Constructs an instance of LocalizableException with the specified localizable and detail message.
LocalizableException(Localizable localizable, String message, Throwable cause)
          Create a new instance of localizable exception.
LocalizableException(Localizable localizable, Throwable cause)
          Constructs an instance of LocalizableException with the specified localizable and cause.
LocalizableException(String message)
          Create a new instance of localizable exception.
LocalizableException(String message, Throwable cause)
          Create a new instance of localizable exception.
LocalizableException(Throwable cause)
          Create a new instance of localizable exception.
 
Method Summary
 String getLocalizedMessage()
          Return a formatted message.
 XFile getLocation()
          Get the location of this error.
 boolean isLocalizable()
          Indicates if this error is localizable or not.
 void setLocation(XFile location)
          Set the location of this error.
 boolean wasTraced()
          Indicates if this exception was already traced.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LocalizableException

public LocalizableException()
Create a new instance of localizable exception.


LocalizableException

public LocalizableException(String message)
Create a new instance of localizable exception.

Parameters:
message - The message.

LocalizableException

public LocalizableException(String message,
                            Throwable cause)
Create a new instance of localizable exception.

Parameters:
message - The message.
cause - The cause.

LocalizableException

public LocalizableException(Throwable cause)
Create a new instance of localizable exception.

Parameters:
cause - The cause.

LocalizableException

public LocalizableException(Localizable localizable,
                            Throwable cause)
Constructs an instance of LocalizableException with the specified localizable and cause.

Parameters:
localizable - The localizable that contains the source file in fault, or null.
cause - The Throwable exception that interfered with the normal initialization operation, making the exception necessary.

LocalizableException

public LocalizableException(Localizable localizable,
                            String msg)
Constructs an instance of LocalizableException with the specified localizable and detail message.

Parameters:
localizable - The localizable that contains the source file in fault, or null.
msg - The detail message.

LocalizableException

public LocalizableException(Localizable localizable,
                            String message,
                            Throwable cause)
Create a new instance of localizable exception.

Parameters:
localizable - The localizable that contains the source file in fault, or null.
message - The message.
cause - The cause.
Method Detail

getLocation

public XFile getLocation()
                  throws UnlocalizableException
Get the location of this error.

Specified by:
getLocation in interface Localizable
Returns:
The file that cause the error.
Throws:
UnlocalizableException - If this error is not localizable.
See Also:
Localizable.getLocation()

setLocation

public void setLocation(XFile location)
                 throws UnlocalizableException
Set the location of this error.

Specified by:
setLocation in interface Localizable
Parameters:
location - The file that cause the error.
Throws:
UnlocalizableException - If a base URI is irrelevant for this instance.
See Also:
Localizable.setLocation(org.inria.ns.reflex.modules.io.XFile)

isLocalizable

public boolean isLocalizable()
Indicates if this error is localizable or not.

Specified by:
isLocalizable in interface Localizable
Returns:
true if this error is localizable, false otherwise.
See Also:
Localizable.isLocalizable()

wasTraced

public boolean wasTraced()
Indicates if this exception was already traced. Once called, this exception is considered to be traced.

Returns:
true if this exception has been already traced, false otherwise.

getLocalizedMessage

public String getLocalizedMessage()
Return a formatted message.

Overrides:
getLocalizedMessage in class Throwable
Returns:
The file where is located the error, if known.
See Also:
Throwable.getLocalizedMessage()