dgraham 2003/10/19 12:52:33
Modified: dbutils/src/java/org/apache/commons/dbutils DbException.java
Log:
Added javadoc.
Revision Changes Path
1.6 +49 -35
jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/DbException.java
Index: DbException.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/dbutils/src/java/org/apache/commons/dbutils/DbException.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DbException.java 12 Oct 2003 09:37:28 -0000 1.5
+++ DbException.java 19 Oct 2003 19:52:33 -0000 1.6
@@ -1,4 +1,10 @@
-/* ====================================================================
+/*
+ * $Header$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ *
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
@@ -54,62 +60,70 @@
package org.apache.commons.dbutils;
+import java.io.PrintWriter;
+import java.sql.SQLException;
+
/**
- *
- * @author baliuka
+ * An unchecked exception indicating a framework error.
+ *
+ * @author Juozas Baliuka
+ * @author David Graham
*/
-public class DbException extends java.lang.RuntimeException {
-
- private Throwable cause;
+public class DbException extends RuntimeException {
+
+ private Throwable cause = null;
+
/**
- * Creates a new instance of <code>DbException</code> without detail message.
+ * Creates a new instance of <code>DbException</code> without detail
+ * message.
+ * @param cause
*/
public DbException(Throwable cause) {
this.cause = cause;
}
-
-
+
/**
- * Constructs an instance of <code>DbException</code> with the specified detail
message.
- * @param msg the detail message.
+ * Constructs an instance of <code>DbException</code> with the specified
+ * detail message.
+ * @param msg The detail message.
+ * @param cause
*/
public DbException(String msg, Throwable cause) {
super(msg);
this.cause = cause;
}
+
/**
- * Constructs an instance of <code>DbException</code> with the specified detail
message.
+ * Constructs an instance of <code>DbException</code> with the specified
+ * detail message.
* @param msg the detail message.
*/
-
- public DbException(String msg) {
+ public DbException(String msg) {
super(msg);
-
}
-
- public Throwable getCause(){
-
- return cause;
-
+
+ /**
+ * Returns the cause of this exception.
+ * @see java.lang.Throwable#getCause()
+ */
+ public Throwable getCause() {
+ return cause;
}
-
-
- public void printStackTrace(java.io.PrintWriter ps){
- Throwable t = getCause();
- super.printStackTrace(ps);
- if( t != null ){
- ps.println("Caused by:");
- if(t instanceof java.sql.SQLException ){
- DbUtils.printStackTrace( (java.sql.SQLException)t, ps);
- }else {
- t.printStackTrace(ps);
+ public void printStackTrace(PrintWriter pw) {
+ Throwable t = this.getCause();
+ super.printStackTrace(pw);
+
+ if (t == null) {
+ return;
}
- }
+ pw.println("Caused by:");
+ if (t instanceof SQLException) {
+ DbUtils.printStackTrace((SQLException) t, pw);
+ } else {
+ t.printStackTrace(pw);
+ }
}
-
-
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]