Exception Files (EJB Components)

Listing C.39 is the generic exception class, into which any exception occurring in the application is packaged and sent across to the view end to be displayed to the user. This will be put into the ejb_components_src directory, described on Day 16.

Listing C.39 GenericException.java
 /******************************************************************************  * Class Name: GenericException.java  * Description: Generic Exception class  * @author Mandar S. Chitnis, Pravin S. Tiwari, Lakshmi AM.       @version 11.5  * Copyright (c) by Sams Publishing. All Rights Reserved. ******************************************************************************/ package com.sams.learnweblogic7.airlines.exception; import java.util.*; import java.io.*; import java.sql.*;  /** *  This class is a type of Generic Exception for handling all types of         Exception. *  All the other custom exceptions will extend this exception. */ public class GenericException extends Exception {    private Exception exception=null;    private String message="Internal Error Occurred ......            Please try again later.";    /** This is system independent Line seperator     */    private String sep=System.getProperty( "line.separator" );   public GenericException(String message, Exception e )   {     this.message=message;     exception=e;   }   public GenericException(String message)   {     this.message=message;   }   public GenericException(Exception e)   {     exception=e;   }   public String toString()    {      String line="" + sep;      line=new java.util.Date(System.currentTimeMillis ()) + "  :              Message ====)   " + message + sep;      line=line + new java.util.Date(System.currentTimeMillis ()) + "  :              Exception Details ====)   " + exception + "" +sep;      return line;    }   public String getMessage()   {     return message;   } } 


Sams Teach Yourself BEA WebLogic Server 7. 0 in 21 Days
Sams Teach Yourself BEA WebLogic Server 7.0 in 21 Days
ISBN: 0672324334
EAN: 2147483647
Year: 2002
Pages: 339

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net