private static String handleException(Exception e) {
String msg = null;
if (e instanceof InvocationTargetException) {
Throwable targetEx = ((InvocationTargetException) e).getTargetException();
if (targetEx != null) {
msg = targetEx.getMessage();
}
} else {
msg = e.getMessage();
}
e.printStackTrace();
return msg;
}