import java.io.PrintWriter;
import java.io.StringWriter;
try
{
...
}
catch(Exception e)
{
StringWriter buffer = new StringWriter();
PrintWriter msg = new PrintWriter(buffer);
e.printStackTrace(msg);
String exMsg = buffer.toString();
}
-----Original Message-----
From: John McDonald <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Tuesday, December 21, 1999 7:11 PM
Subject: Exception handling
I am writing a very robust web-based application and I would like
excpetions, during runtime, mailed to the system admin. I have an extensive
mail system built into my app, and I can simply pass a String or
StringBuffer object as the parameter for the message content.
The issue is that I can't seem to create a decent exception using
Exception.toString( ) or Exception.getMessage( ). What I generally get from
these are bland and undescriptive messages about the error. eg:
java.lang.NullPointException. No line# and no further description. However,
if I use Exception.printStackTrace( ), I get a VERY descriptive exception,
but I can't seem to create a String from this exception.
Anyone have any ideas?
John D. McDonald
CipherStream Systems
email: [EMAIL PROTECTED]
web: www.cipherstream.com
-------------------------------------------------------
Secure E-Business Is Our Business
-------------------------------------------------------
***********************************************************************
Bear Stearns is not responsible for any recommendation, solicitation,
offer or agreement or any information about any transaction, customer
account or account activity contained in this communication.
***********************************************************************
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html