com.acsinet_solutions.util.exception
Class SimpleExceptionDataWriter

java.lang.Object
  extended by com.acsinet_solutions.util.exception.AbstractExceptionDataWriter
      extended by com.acsinet_solutions.util.exception.SimpleExceptionDataWriter
All Implemented Interfaces:
ExceptionDataWriter
Direct Known Subclasses:
CompactExceptionDataWriter

public class SimpleExceptionDataWriter
extends AbstractExceptionDataWriter
implements ExceptionDataWriter

Simple exception data writer that writes exception info to stdout, specially in environments pre JDK 1.4 where no nested exception facilities were incorporated into the platform.

TODO: This class may be modified to work well with nested facilities in JDK 1.4 and higher to avoid repetetive stack trace reporting.

Author:
Santiago Arriaga

Constructor Summary
SimpleExceptionDataWriter()
           
 
Method Summary
protected  void endException()
          Exception end
static java.lang.String getStackTrace(java.lang.Throwable throwable)
          Get a stack trace
protected  void printMessage(java.lang.String message)
          Print message for an exception
static void printStackTrace(java.lang.Throwable throwable)
          Print a stack trace to system error output
protected  void printStackTraceEntry(int line, java.lang.String entry)
          Print an stack trace entry
protected  void startException(boolean start)
          Exception starts
 java.lang.String toString()
          Get the data contents
 
Methods inherited from class com.acsinet_solutions.util.exception.AbstractExceptionDataWriter
getStop, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.acsinet_solutions.util.exception.ExceptionDataWriter
write
 

Constructor Detail

SimpleExceptionDataWriter

public SimpleExceptionDataWriter()
Method Detail

printStackTrace

public static void printStackTrace(java.lang.Throwable throwable)
Print a stack trace to system error output

Parameters:
throwable - A Throwable instance to use

getStackTrace

public static java.lang.String getStackTrace(java.lang.Throwable throwable)
Get a stack trace

Parameters:
throwable - A Throwable instance to use

startException

protected final void startException(boolean start)
                             throws java.io.IOException
Exception starts

Specified by:
startException in class AbstractExceptionDataWriter
Parameters:
start - true if this is the first exception; false otherwise
Throws:
java.io.IOException

endException

protected final void endException()
                           throws java.io.IOException
Exception end

Specified by:
endException in class AbstractExceptionDataWriter
Throws:
java.io.IOException

printMessage

protected final void printMessage(java.lang.String message)
                           throws java.io.IOException
Print message for an exception

Specified by:
printMessage in class AbstractExceptionDataWriter
Parameters:
message - A not-null String instance
Throws:
java.io.IOException

printStackTraceEntry

protected final void printStackTraceEntry(int line,
                                          java.lang.String entry)
                                   throws java.io.IOException
Print an stack trace entry

Specified by:
printStackTraceEntry in class AbstractExceptionDataWriter
Parameters:
pos - The nonnegative line position
entry - A not-null String instance
Throws:
java.io.IOException

toString

public final java.lang.String toString()
Get the data contents

Overrides:
toString in class java.lang.Object