quintonm 2003/01/02 23:00:17
Modified: src/java/org/apache/turbine/util SystemError.java
Log:
Now extends NestableError from commons-lang
Revision Changes Path
1.3 +25 -65
jakarta-turbine-2/src/java/org/apache/turbine/util/SystemError.java
Index: SystemError.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/util/SystemError.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SystemError.java 11 Jul 2002 16:53:21 -0000 1.2
+++ SystemError.java 3 Jan 2003 07:00:16 -0000 1.3
@@ -54,111 +54,71 @@
* <http://www.apache.org/>.
*/
-import java.io.ByteArrayOutputStream;
-import java.io.PrintWriter;
+import org.apache.commons.lang.exception.NestableError;
/**
* Used for wrapping system errors (exceptions) that may occur in the
* application.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Neeme Praks</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Quinton McCombs</a>
* @version $Id$
*/
-public class SystemError
+public class SystemError extends NestableError
{
- private Exception e;
- private String message;
-
/**
* Constructor.
*
- * @param e An Exception.
+ * @param cause A Throwable object
*/
- public SystemError(Exception e)
+ public SystemError(Throwable cause)
{
- setMessage(e.getMessage());
- setException(e);
+ super(cause);
}
/**
* Constructor.
*
- * @param e An Exception.
- * @param message A String.
+ * @param message Error message
*/
- public SystemError(Exception e, String message)
+ public SystemError(String message)
{
- this(e);
- setMessage(message);
+ super(message);
}
/**
* Constructor.
*
- * @param e An Exception.
- * @param returncode A long.
- */
- public SystemError(Exception e, long returncode)
- {
- this(e, new Long(returncode).toString());
- }
-
- /**
- * Get the message.
- *
- * @return A String.
- */
- public String getMessage()
- {
- return message;
- }
-
- /**
- * Set the message.
- *
+ * @param cause A Throwable object
* @param message A String.
+ * @deprecated Use SystemError(String,Throwable) instead.
*/
- public void setMessage(String message)
+ public SystemError(Throwable cause, String message)
{
- this.message = message;
+ super(message, cause);
}
/**
- * Get the exception.
+ * Constructor.
*
- * @return An Exception.
+ * @param cause A Throwable object
+ * @param message A String.
*/
- public Exception getException()
+ public SystemError(String message, Throwable cause)
{
- return e;
+ super(message, cause);
}
/**
- * Set the exception.
+ * Constructor.
*
- * @param e An Exception.
+ * @param cause A Throwable object
+ * @param returnCode A long.
+ * @deprecated No replacement
*/
- public void setException(Exception e)
+ public SystemError(Throwable cause, long returnCode)
{
- this.e = e;
+ super("Return code = " + Long.toString(returnCode), cause);
}
- /**
- * Get the stack trace.
- *
- * @return A String.
- */
- public String getStackTrace()
- {
- if (e != null)
- {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- e.printStackTrace(new PrintWriter(out,true));
- return out.toString();
- }
- else
- {
- return "";
- }
- }
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>