I'm working on a Java library that has an annotation processor. To trap exceptions I wrote code similar to the following code:
public class KriptonProcessor extends AbstractProcessor {
@Override
public boolean process(final Set<? extends TypeElement> annotations, final RoundEnvironment roundEnv) {
try {
...
return true;
} catch (Throwable e) {
String msg = StringUtils.nvl(e.getMessage());
error(null, e.getClass().getCanonicalName() + ": " + msg);
e.printStackTrace();
}
return true;
}
}
When an exception occurs, actually it's displayed as:
e: error: java.lang.NullPointerException:
While I was expecting the full stack trace, useful to detect where is the problem. Any ideas to accomplish this task?
Thanks in advance.