0. 什么时候用catch,什么时候用throws
http://stackoverflow.com/questions/11853348/throwing-and-catching-exceptions
Throwing and Catching Exceptions
http://www.onjava.com/pub/a/onjava/2003/11/19/exceptions.html
Best Practices for Exception Handling
1. print exception
Printing Exception Message in java http://stackoverflow.com/questions/15722763/printing-exception-message-in-java
try { // ---- } catch (javax.script.ScriptException ex) { System.out.println(ex.getMessage()); }
2. print stack trace
http://stackoverflow.com/questions/2560368/what-is-the-use-of-printstacktrace-method-in-java
catch(IOException ioe) { ioe.printStackTrace(); }
no error trace
for (StackTraceElement ste : Thread.currentThread().getStackTrace()) { System.out.println(ste); }
http://stackoverflow.com/questions/1069066/get-current-stack-trace-in-java Get current stack trace in Java
http://stackoverflow.com/questions/1149703/stacktrace-to-string-in-java Stacktrace to string in Java