|
model.put(VALUE_MODEL_ATTRIBUTE, e.getTargetException().getCause().getMessage()); |
Scenario:
- a user JMX attribute getter throws
RuntimeException with null getCause() (for whatever reason; it is permitted by the exception contract).
- it is picked up by the cited catch inside JMiniX. It is correctly logged by this line:
log.warn("Error accessing attribute", e);
- But the next line (referenced above) incorrectly assumes
getCause() is always not null and causes NPE on calling getMessage().
- So the user sees not the original error in browser, but overwritten stack trace, this time with NPE, logged by
org.restlet.resource.ServerResource#doCatch (getLogger().log(level, "Exception or error caught in server resource", throwable);)
It makes it hard to debug jmx method failures in browser (you see the irrelevant NPE in causedBy section), you have to go to the app logs to find the original causedBy exception.
jminix/src/main/java/org/jminix/console/resource/AttributeResource.java
Line 150 in 6115206
Scenario:
RuntimeExceptionwith nullgetCause()(for whatever reason; it is permitted by the exception contract).log.warn("Error accessing attribute", e);getCause()is always not null and causes NPE on callinggetMessage().org.restlet.resource.ServerResource#doCatch (getLogger().log(level, "Exception or error caught in server resource", throwable);)It makes it hard to debug jmx method failures in browser (you see the irrelevant NPE in causedBy section), you have to go to the app logs to find the original causedBy exception.