allelopath
asked on
override printstacktrace
I am getting an exception in when running my program in eclipse. The entire trace is not shown. It displays some of the lines, but then is stays "and 12 more lines"
mtamonkey said that this issue was reported as a BUG to sun.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4775147
It's not something that they'll FIX, but they do list the customer's workaround which was to override the printstacktrace function.
The exception class is com.mysql.jdbc.exceptions. jdbc4.Comm unications Exception
I should create my own CommunicationsException?
package com.mycompany.exceptions;
public class CommunicationsException {
public void printStackTrace(PrintWrite r s) {
// what goes here?
}
}
mtamonkey said that this issue was reported as a BUG to sun.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4775147
It's not something that they'll FIX, but they do list the customer's workaround which was to override the printstacktrace function.
The exception class is com.mysql.jdbc.exceptions.
I should create my own CommunicationsException?
package com.mycompany.exceptions;
public class CommunicationsException {
public void printStackTrace(PrintWrite
// what goes here?
}
}
ASKER
I'm not following you... i have this:
try {
connection = DriverManager.getConnectio n(url, user, password);
statement = connection.createStatement ();
} catch (SQLException e) {
e.printStackTrace();
System.exit(-1);
}
What do I do?
try {
connection = DriverManager.getConnectio
statement = connection.createStatement
} catch (SQLException e) {
e.printStackTrace();
System.exit(-1);
}
What do I do?
Instead of
>> e.printStackTrace();
Try
for (StackTraceElement ste : e.getStackTrace()) {
System.err.println(e);
}
>> e.printStackTrace();
Try
for (StackTraceElement ste : e.getStackTrace()) {
System.err.println(e);
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yes, but there's no good reason to create a List from the StackTraceElement[]
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
:-)
and print it yourself