Oracle Fusion Middleware
Java API Reference for Oracle PDK Java
11g Release 1 (11.1.1)
E10691-01

oracle.portal
Class PortalException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by oracle.portal.PortalException
All Implemented Interfaces:
java.io.Serializable, oracle.webdb.utils.PortalExceptionIF
Direct Known Subclasses:
PreferenceStoreException

public class PortalException
extends java.lang.Exception
implements oracle.webdb.utils.PortalExceptionIF

The PortalException class represents the Base exception that the Portal Java service library will throw. It encapsulates the NLS needs of the service library by taking the name of a resource bundle, and the name of the associate resource, instead of a literal text string for any error message to be produced. Callers wanting to display the error contained in the Exception can call getMessage() or a new method getMessage(Locale) in order to extract the error message string contained within the exception. Instances of this class can be "chained" together. Whenever one exception is caught and a second one is raised, the second one should be created by specifying the first one as the cause. This avoids the loss of information that is typical in these situations. Hypothetical code snippet: catch (ClassCastException e) { throw new PortalClassCastException(resource, name, e); } The printStackTrace methods in this class override those in the Exception class so that the entire exception chain is displayed. NOTE : If your application lies under different classloader you would have to extend from oracle.portal.PortalException

See Also:
Serialized Form

Constructor Summary
PortalException(java.lang.String msg)
          Deprecated.  
PortalException(java.lang.String resource, java.lang.String name)
          Constructor.
PortalException(java.lang.String resource, java.lang.String name, java.lang.Object[] args)
          Constructor.
PortalException(java.lang.String resource, java.lang.String name, java.lang.Object[] args, java.lang.Throwable cause)
          Construct a Portal exception with a complete set of parameters.
 
Method Summary
 java.lang.Throwable getCause()
          Get the cause of this exception.
 java.lang.String getMessage()
          Get the message from the Exception.
 java.lang.String getMessage(java.util.Locale locale)
          Get the message from the Exception in the requested Locale.
 void printStackTrace()
          Print this exception and its backtrace to the standard error stream.
 void printStackTrace(java.io.PrintStream stream)
          Print this exception and its backtrace to the given stream.
 void printStackTrace(java.io.PrintWriter writer)
          Print this exception and its backtrace to the given print writer.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getStackTrace, initCause, setStackTrace, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PortalException

public PortalException(java.lang.String resource,
                       java.lang.String name,
                       java.lang.Object[] args,
                       java.lang.Throwable cause)
Construct a Portal exception with a complete set of parameters.

Parameters:
resource - the name of the resource bundle with the error string.
name - the name of the resource within the resource bundle.
args - optional arguments formatted into the msg via MessageFormat.
cause - optional cause of this exception.

PortalException

public PortalException(java.lang.String resource,
                       java.lang.String name,
                       java.lang.Object[] args)
Constructor.

Parameters:
resource - the name of the resource bundle with the error string.
name - the name of the resource within the resource bundle.
args - optional arguments formatted into the msg via MessageFormat.

PortalException

public PortalException(java.lang.String resource,
                       java.lang.String name)
Constructor. This is a convenience for calling the full constructor and providing no parameter arguments.

Parameters:
resource - the name of the resource bundle with the error string.
name - the name of the resource within the resource bundle.

PortalException

public PortalException(java.lang.String msg)
Deprecated. 

Constructor. This constructor is deprecated and only here as a placeholder.

Method Detail

getMessage

public java.lang.String getMessage()
Get the message from the Exception.

Overrides:
getMessage in class java.lang.Throwable
Returns:
the string error message, formatted and translated using the default Locale.

getMessage

public java.lang.String getMessage(java.util.Locale locale)
Get the message from the Exception in the requested Locale.

Specified by:
getMessage in interface oracle.webdb.utils.PortalExceptionIF
Parameters:
locale - the locale to use to extract the error message.
Returns:
the string error message, formatted and translated using the requested Locale.

getCause

public java.lang.Throwable getCause()
Get the cause of this exception.

Overrides:
getCause in class java.lang.Throwable
Returns:
the possibly null cause

printStackTrace

public void printStackTrace()
Print this exception and its backtrace to the standard error stream. Note: it is necessary to override this method (and not just the two that follow) because the JDK implementation of Throwable.printStackTrace() calls one of its own private methods instead of printStackTrace(PrintStream stream)!

Overrides:
printStackTrace in class java.lang.Throwable

printStackTrace

public void printStackTrace(java.io.PrintStream stream)
Print this exception and its backtrace to the given stream.

Overrides:
printStackTrace in class java.lang.Throwable
Parameters:
stream - the print stream to use for output.

printStackTrace

public void printStackTrace(java.io.PrintWriter writer)
Print this exception and its backtrace to the given print writer.

Overrides:
printStackTrace in class java.lang.Throwable
Parameters:
writer - the print writer to use for output.

Oracle Fusion Middleware
Java API Reference for Oracle PDK Java
11g Release 1 (11.1.1)
E10691-01

Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.