|
Business Components | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Throwable | +--java.lang.Exception | +--java.lang.RuntimeException | +--oracle.jbo.JboException
Top level exception for the JBO package.
All exceptions thrown from the Business Components for Java framework should be subclasses of this exception.
This class provides a single point for the localization and formatting of Exception messages.
Translation of a message's text occurs at the time
the client calls getLocalizedMessage()
rather than at
creation time since the client may need to present the message in
one a number of different languages (refer to DAC for details).
The components of a message are:
Additional components may be introduced in future.
Most subclasses of JboException
will provide a
value for the error code in a specialized constructor.
Exceptions generated by applications.
Applications may define subclasses of most JBO exceptions. To do this the application should override the following methods to provide the correct set of values for the messaging services:
Constructor Summary | |
JboException(java.lang.Class resBundleClass,
java.lang.String errorCode,
java.lang.Object[] params)
Creates a translatable exception. |
|
JboException(java.lang.String message)
Create a non-formattable exception. |
|
JboException(java.lang.String message,
java.lang.String errorCode,
java.lang.Object[] params)
Creates a formattable but non-localizable exception. |
|
JboException(java.lang.Throwable ex)
Converts an exception into a non-formattable JboException . |
Method Summary | |
void |
addToDetails(java.lang.Object obj)
Adds to the list of details. |
java.lang.String |
getBaseMessage()
Gets the message without localizing it or inserting parameters. |
java.lang.String |
getDetailMessage()
Constructs a message incorporating the list of details. |
java.lang.Object[] |
getDetails()
Gets the list of objects and exceptions that spawned this message. |
java.lang.String |
getErrorCode()
Gets the error code. |
java.lang.Object[] |
getErrorParameters()
Gets the error message parameters. |
protected JboExceptionHelper |
getJboExceptionHelper()
Get the Helper object for this exception. |
java.lang.String |
getLocalizedBaseMessage(java.util.Locale l)
Localizes the message text for a specific Locale , but without
inserting parameters. |
java.lang.String |
getLocalizedMessage(java.util.Locale l)
Formats the message text for a specific Locale . |
java.lang.String |
getMessage()
Formats the message text for the default locale. |
java.lang.String |
getProductCode()
Gets the product code. |
java.lang.Class |
getResourceClass()
Gets the class of the resource bundle used to localize messages. |
java.lang.String |
getResourceName()
Gets the name of the ResourceBundle used to localize messages. |
static java.lang.String |
getTypeNameFromId(int id)
|
boolean |
isLocalizable()
Tests this message's localizability. |
void |
printStackTrace()
Prints this Throwable and its backtrace to the
standard error stream. |
void |
printStackTrace(java.io.PrintStream s)
Prints this Throwable and its backtrace to the
specified print stream. |
void |
printStackTrace(java.io.PrintWriter s)
Prints this Throwable and its backtrace to the specified
print writer. |
void |
setApplicationModule(ApplicationModule am)
|
void |
setDetails(java.lang.Object[] details)
Sets the list of details. |
protected void |
setErrorParameters(java.lang.Object[] params)
Resets the error parameters. |
Methods inherited from class java.lang.Throwable |
fillInStackTrace,
getLocalizedMessage,
toString |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public JboException(java.lang.String message, java.lang.String errorCode, java.lang.Object[] params)
If a localizable exception is desired, use the
JboException(Class, String, Object[])
constructor.
message
- the unformatted text of the message.errorCode
- an error code.params
- the error message's parameters.ResourceBundle
public JboException(java.lang.String message)
message
- the text of the message.public JboException(java.lang.Throwable ex)
JboException
.ex
- an excpetion to be added to the details list.public JboException(java.lang.Class resBundleClass, java.lang.String errorCode, java.lang.Object[] params)
resBundleClass
- the base class of the ResourceBundle
that will supply the message text.errorCode
- error code; a key associated with a message in the
resource bundle.params
- the error message's parameters.ResourceBundle
Method Detail |
public java.lang.String getMessage()
public java.lang.String getLocalizedMessage(java.util.Locale l)
Locale
.l
- a locale.public java.lang.String getBaseMessage()
public java.lang.Class getResourceClass()
ResourceBundle
.public java.lang.String getLocalizedBaseMessage(java.util.Locale l)
Locale
, but without
inserting parameters.l
- a locale.public java.lang.String getResourceName()
ResourceBundle
used to localize messages.public java.lang.Object[] getErrorParameters()
protected void setErrorParameters(java.lang.Object[] params)
public java.lang.String getErrorCode()
public java.lang.String getProductCode()
JBO_PRODUCT_CODE
.public java.lang.Object[] getDetails()
public java.lang.String getDetailMessage()
public void setDetails(java.lang.Object[] details)
details
- an array which replaces the current list of details.
array in this exception object.public void addToDetails(java.lang.Object obj)
obj
- an object to add to the details list.public boolean isLocalizable()
true
if this message can be localized.protected JboExceptionHelper getJboExceptionHelper()
JboExceptionHelper
public static java.lang.String getTypeNameFromId(int id)
public void setApplicationModule(ApplicationModule am)
public void printStackTrace()
Throwable
and its backtrace to the
standard error stream. This method prints a stack trace for this
Throwable
object on the error output stream that is
the value of the field System.err
. The first line of
output contains the result of the Throwable.toString()
method for
this object. Remaining lines represent data previously recorded by
the method Throwable.fillInStackTrace()
. The format of this
information depends on the implementation, but the following
example may be regarded as typical:
This example was produced by running the program:java.lang.NullPointerException at MyClass.mash(MyClass.java:9) at MyClass.crunch(MyClass.java:6) at MyClass.main(MyClass.java:3)
class MyClass { public static void main(String[] argv) { crunch(null); } static void crunch(int[] a) { mash(a); } static void mash(int[] b) { System.out.println(b[0]); } }
java.lang.System#err
public void printStackTrace(java.io.PrintStream s)
Throwable
and its backtrace to the
specified print stream.public void printStackTrace(java.io.PrintWriter s)
Throwable
and its backtrace to the specified
print writer.
|
Business Components | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |