/** * This method wrapps the throwing of the dns exception. * * @param message The message to put in the exception * @param ex The exception stack. * @exception DNSException */ private void throwTimerException(String message, Throwable ex) throws TimerException { TimerException exception = new TimerException(); exception.message = message; ByteArrayOutputStream output = new ByteArrayOutputStream(); PrintStream outStream = new PrintStream(output); ex.printStackTrace(outStream); outStream.flush(); exception.cause = output.toString(); throw exception; }