⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serviceexception.java

📁 噶额外噶外骨骼感广泛高热感 就 啊啊
💻 JAVA
字号:
/*
* @author                        : Neelesh
* @Version                       : 1.0
*
* Development Environment        : Oracle9i JDeveloper
* Name of the Application        : ServiceException.java
* Creation/Modification History  :
*
* Neelesh      31-Dec-2002      Created
* 
*/


package oracle.otnsamples.vsm.services;
// Import java IO classes
import java.io.PrintStream;
import java.io.PrintWriter;


/**
 * An exception to indicate a problem in Services layer.
 * This is the super class of all Service layer exceptions
 * An instance of this exception must be associated with a message code,
 * so that clients can lookup the actual error messages in the locale of thier 
 * interest.
 */
public class ServiceException extends Exception {

  private String messageCode;
  protected Throwable cause;  
  
  /**
   * Default Constructor. Takes no arguments
   */
  public ServiceException() {
  }
  /**
   * Constructor
   * @param <b> message </b> The detailed exception message.
   */
  public ServiceException( String message ) {
    super( message );    
  }
  /**
   * Constructor
   * @param <b> message</b> The detailed exception message.
   * @param <b> messageCode </b> messageCode
   */
  public ServiceException( String message ,String messageCode) {
    super( message );    
    this.messageCode = messageCode;
  }

  /**
   * Returns a message code associated with this instance
   * This code should be used by clients to look up error messages
   * in their preferred language
   * @return <b>String</b> message code
   */
  public String getMessageCode(){
    return messageCode;
  }
  /**
   * Associates a message code with this instance
   * This code should be set by the exception  originator
   * @return <b>value</b> message code
   */

  public void setMessageCode(String value){
    messageCode = value;
  }
  /**
   * This method returns the Throwable class
   * @return <b>cause</b> Throwable class
   * @since 2.0
   */
  public final Throwable getRootCause() {
    return cause;
  }

  /**
   * Override printStackTrace method
   * @param <b>stream</b> The PrintStream class.
   * @since 2.0
   */
  public void printStackTrace( PrintStream stream ) {
    super.printStackTrace( stream );
    if( getRootCause() != null ) {
        stream.print( "The Exception Details are : " );
        getRootCause().printStackTrace( stream );
    }
  }

  /**
   * Override printStackTrace method
   * @param <b>writer</b> The PrintWriter class.
   * @since 2.0
   */
  public void printStackTrace( PrintWriter writer ) {
    super.printStackTrace( writer );
    if( getRootCause() != null ) {
        writer.print( "The Exception Details are : " );
        getRootCause().printStackTrace( writer );
    }
  }
  
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -