Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

JetWebDBException Class Reference

Inheritance diagram for JetWebDBException:

Inheritance graph
[legend]
Collaboration diagram for JetWebDBException:

Collaboration graph
[legend]
List of all members.

Detailed Description

Exception thrown by JetWeb DB. May be a wrapper round an SQLException, but may also originate from the DBManager layer.

Author:
S. Butterworth
Version:
Date
2005-11-14 14:08:29 +0000 (Mon, 14 Nov 2005)
Revision
973

Definition at line 19 of file JetWebDBException.java.


Public Member Functions

 JetWebDBException (SQLException originalException, String sql, String data)
 JetWebDBException (String message, String data)
String getMessage ()
void printStackTrace (PrintWriter s)
void printStackTrace (PrintStream s)
Exception getOriginalException ()

Protected Attributes

String data = ""
Exception originalException

Private Attributes

String sql = ""

Constructor & Destructor Documentation

JetWebDBException SQLException  originalException,
String  sql,
String  data
 

JetWebDBException constructor when SQL errors thrown.

Parameters:
originalException 
sql the sql command that resulted in error
data useful in debugging this error

Definition at line 31 of file JetWebDBException.java.

00031                                                                                       {
00032         super(originalException);
00033         this.sql = sql;
00034         this.data = data;
00035     }

JetWebDBException String  message,
String  data
 

JetWebDBException constructor when no sql exception thrown.

Parameters:
message 
data useful in debugging this error

Definition at line 43 of file JetWebDBException.java.

00043                                                           {
00044         super(message, data);
00045     }


Member Function Documentation

String getMessage  ) 
 

Overrides super to show the sql error details (if relevant), and error data (if supplied)

Returns:
error message

Reimplemented from JetWebException.

Definition at line 53 of file JetWebDBException.java.

References JetWebException.getOriginalException(), and JetWebDBException.sql.

00053                                {
00054         StringBuffer b = new StringBuffer();
00055 
00056         if (getOriginalException() == null) {
00057             b.append(super.getMessage());
00058         } else {
00059             b.append(((SQLException) getOriginalException()).getMessage());
00060             b.append("\n:SQL:");
00061             b.append(sql);
00062             b.append("\n:CODE:");
00063             b.append(((SQLException) getOriginalException()).getErrorCode());
00064             b.append("\n:STATE:");
00065             b.append(((SQLException) getOriginalException()).getSQLState());
00066         }
00067 
00068         if (data != "") {
00069             b.append("\n:DATA:");
00070             b.append(data);
00071         }
00072 
00073         return b.toString();
00074     }

Exception getOriginalException  )  [inherited]
 

gets the original exception this exception wraps

Returns:
exception

Definition at line 107 of file JetWebException.java.

Referenced by JobRequestException.getMessage(), and JetWebDBException.getMessage().

00107                                            {
00108     return originalException;
00109     }

void printStackTrace PrintStream  s  )  [inherited]
 

This overrides super to print the original exception stack trace, if there is one. The message and stack trace can be obtained from it.

Parameters:
PrintStream 

Definition at line 67 of file JetWebException.java.

References JetWebException.originalException.

00067                                               {
00068     if (originalException!=null){
00069         originalException.printStackTrace(s);
00070     } else {
00071         super.printStackTrace(s);
00072     }
00073     }

void printStackTrace PrintWriter  s  )  [inherited]
 

This overrides super to print the original exception stack trace, if there is one. The message and stack trace can be obtained from it.

Parameters:
PrintWriter 

Definition at line 54 of file JetWebException.java.

References JetWebException.originalException.

00054                                               {
00055     if (originalException!=null){
00056         originalException.printStackTrace(s);
00057     } else {
00058         super.printStackTrace(s);
00059     }
00060     }


Member Data Documentation

String data = "" [protected, inherited]
 

Definition at line 16 of file JetWebException.java.

Referenced by JetWebException.getMessage().

Exception originalException [protected, inherited]
 

Definition at line 17 of file JetWebException.java.

Referenced by JetWebException.getMessage(), and JetWebException.printStackTrace().

String sql = "" [private]
 

Definition at line 20 of file JetWebDBException.java.

Referenced by JetWebDBException.getMessage().


The documentation for this class was generated from the following file:

Generated Wed Jan 17 09:14:27 GMT 2007