Status: New
Owner: ----
New issue 540 by mathieu.carbou: NPE in ProvisionException
http://code.google.com/p/google-guice/issues/detail?id=540
How to reproduce:
throw new ProvisionException(null, new RuntimeException());
Exception:
Exception in thread "main" java.lang.NullPointerException: message
at
com.google.inject.internal.util.Preconditions.checkNotNull(Preconditions.java:200)
at com.google.inject.spi.Message.<init>(Message.java:52)
at
com.google.inject.ProvisionException.<init>(ProvisionException.java:46)
Use case:
When working on mycila-guice (Guice's extensions), I need to sometimes
rethrow the targe texception of a reflection call like below. But the
message can be null. The ProvisionException crashes.
Thus, we are forced to prevent it by doing a String.valueOf(...)
try {
...
} catch (InvocationTargetException e) {
throw new
ProvisionException(String.valueOf(e.getTargetException().getMessage()),
e.getTargetException());
}
--
You received this message because you are subscribed to the Google Groups
"google-guice-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-guice-dev?hl=en.