I am printing Stack Trace to JTextArea
using the below code :
try
{
throw new IOException();
}
catch(IOException e)
{
e.printStackTrace(pw);
ta1.append(sw.toString());
}
pw.flush();
sw.flush();
try
{
throw new SQLException();
}
catch(SQLException e)
{
e.printStackTrace(pw);
ta1.append(sw.toString());
}
It prints out 2 IOException
traces and 1 SQLExeption
trace.
Why is not stringwriter flushed out ?
I want 1 IOException
trace and 1 SQLExeption
trace.
Please suggest proper way to do this.