FileDocCategorySizeDatePackage
XMLSecurityRuntimeException.javaAPI DocJava SE 6 API5257Tue Jun 10 00:23:02 BST 2008com.sun.org.apache.xml.internal.security.exceptions

XMLSecurityRuntimeException

public class XMLSecurityRuntimeException extends RuntimeException
The mother of all runtime Exceptions in this bundle. It allows exceptions to have their messages translated to the different locales. The xmlsecurity_en.properties file contains this line:
xml.WrongElement = Can't create a {0} from a {1} element
Usage in the Java source is:
{
Object exArgs[] = { Constants._TAG_TRANSFORMS, "BadElement" };

throw new XMLSecurityException("xml.WrongElement", exArgs);
}
Additionally, if another Exception has been caught, we can supply it, too>
try {
...
} catch (Exception oldEx) {
Object exArgs[] = { Constants._TAG_TRANSFORMS, "BadElement" };

throw new XMLSecurityException("xml.WrongElement", exArgs, oldEx);
}
author
Christian Geuer-Pollmann

Fields Summary
private static final long
serialVersionUID
protected Exception
originalException
Field originalException
protected String
msgID
Field msgID
Constructors Summary
public XMLSecurityRuntimeException()
Constructor XMLSecurityRuntimeException


         
     

      super("Missing message string");

      this.msgID = null;
      this.originalException = null;
   
public XMLSecurityRuntimeException(String _msgID)
Constructor XMLSecurityRuntimeException

param
_msgID


      super(I18n.getExceptionMessage(_msgID));

      this.msgID = _msgID;
      this.originalException = null;
   
public XMLSecurityRuntimeException(String _msgID, Object[] exArgs)
Constructor XMLSecurityRuntimeException

param
_msgID
param
exArgs


      super(MessageFormat.format(I18n.getExceptionMessage(_msgID), exArgs));

      this.msgID = _msgID;
      this.originalException = null;
   
public XMLSecurityRuntimeException(Exception _originalException)
Constructor XMLSecurityRuntimeException

param
_originalException


      super("Missing message ID to locate message string in resource bundle \""
            + Constants.exceptionMessagesResourceBundleBase
            + "\". Original Exception was a "
            + _originalException.getClass().getName() + " and message "
            + _originalException.getMessage());

      this.originalException = _originalException;
   
public XMLSecurityRuntimeException(String _msgID, Exception _originalException)
Constructor XMLSecurityRuntimeException

param
_msgID
param
_originalException


      super(I18n.getExceptionMessage(_msgID, _originalException));

      this.msgID = _msgID;
      this.originalException = _originalException;
   
public XMLSecurityRuntimeException(String _msgID, Object[] exArgs, Exception _originalException)
Constructor XMLSecurityRuntimeException

param
_msgID
param
exArgs
param
_originalException


      super(MessageFormat.format(I18n.getExceptionMessage(_msgID), exArgs));

      this.msgID = _msgID;
      this.originalException = _originalException;
   
Methods Summary
public java.lang.StringgetMsgID()
Method getMsgID

return
the messageId


      if (msgID == null) {
         return "Missing message ID";
      } 
      return msgID;      
   
public java.lang.ExceptiongetOriginalException()
Method getOriginalException

return
the original exception

      return originalException;
   
public voidprintStackTrace(java.io.PrintWriter printwriter)
Method printStackTrace

param
printwriter


      super.printStackTrace(printwriter);

      if (this.originalException != null) {
         this.originalException.printStackTrace(printwriter);
      }
   
public voidprintStackTrace(java.io.PrintStream printstream)
Method printStackTrace

param
printstream


      super.printStackTrace(printstream);

      if (this.originalException != null) {
         this.originalException.printStackTrace(printstream);
      }
   
public voidprintStackTrace()
Method printStackTrace


      synchronized (System.err) {
         super.printStackTrace(System.err);

         if (this.originalException != null) {
            this.originalException.printStackTrace(System.err);
         }
      }
   
public java.lang.StringtoString()

inheritDoc


      String s = this.getClass().getName();
      String message = super.getLocalizedMessage();

      if (message != null) {
         message = s + ": " + message;
      } else {
         message = s;
      }

      if (originalException != null) {
         message = message + "\nOriginal Exception was "
                   + originalException.toString();
      }

      return message;