public final String exceptionExpand(String message,Exception exc){
  StringBuffer aBuffer=new StringBuffer(1000);
  if (message != null) {
    aBuffer.append("User Message=");
    aBuffer.append(message);
    aBuffer.append("\n");
  }
  if (exc == null) {
    aBuffer.append("Exception=(null)\n");
  }
 else {
    aBuffer.append("Exception Class=" + exc.getClass());
    aBuffer.append("\n");
    aBuffer.append("--> toString=");
    aBuffer.append(exc.toString());
    aBuffer.append("\n");
    aBuffer.append("--> Stack=");
    fillStackTrace(aBuffer,exc.getStackTrace());
    aBuffer.append("\n");
  }
  return aBuffer.toString();
}

public final String exceptionExpand ( String message , Exception exc ) { StringBuffer aBuffer = new StringBuffer ( 1000 ) ; if ( message != null ) { aBuffer . append ( "User Message=" ) ; aBuffer . append ( message ) ; aBuffer . append ( "\n" ) ; } if ( exc == null ) { aBuffer . append ( "Exception=(null)\n" ) ; } else { aBuffer . append ( "Exception Class=" + exc . getClass ( ) ) ; aBuffer . append ( "\n" ) ; aBuffer . append ( "--> toString=" ) ; aBuffer . append ( exc . toString ( ) ) ; aBuffer . append ( "\n" ) ; aBuffer . append ( "--> Stack=" ) ; fillStackTrace ( aBuffer , exc . getStackTrace ( ) ) ; aBuffer . append ( "\n" ) ; } return aBuffer . toString ( ) ; }
this expands a message and an exception into something that has both the message , the exception message and the stack trace .
