[picocontainer-scm] [jira] Commented: (PICO-370) JNDIProvided unsafe handling of JNDIObjectReference.get may cause NPE
"Paul Hammant (JIRA)" <jira-yCVjj/[email protected]>
| Newsgroups | gmane.comp.java.picocontainer.cvs |
|---|---|
| Message-ID | <23259512.27538.1274447352489.JavaMail.haus-jira@codehaus01.managed.contegix.com> |
[ http://jira.codehaus.org/browse/PICO-370?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=222066#action_222066 ]
Paul Hammant commented on PICO-370:
-----------------------------------
Mathieu, can you update the patch ans I'll apply it ?
> JNDIProvided unsafe handling of JNDIObjectReference.get may cause NPE
> ---------------------------------------------------------------------
>
> Key: PICO-370
> URL: http://jira.codehaus.org/browse/PICO-370
> Project: PicoContainer
> Issue Type: Bug
> Components: PicoContainer Gems
> Affects Versions: 2.10
> Reporter: Mathieu Rozieres
> Priority: Minor
>
> JNDIObjectReference.get return a null value if the JNDI lookup failed with a NameNotFoundException. (JNDIObjectReference.java:51-62 in my 2.10.2 sources jar ).
> There are two possible NPE regarding this behaviour in JNDIProvided class. Here are the code snipped :
> {code}
> public JNDIProvided(final JNDIObjectReference<T> reference) {
> this(reference.get().getClass(),reference);
> }
> {code}
> {code}
> // JNDIObjectReference<T> jndiReference;
> public Class<? extends T> getComponentImplementation() {
> return (Class<? extends T>) jndiReference.get().getClass();
> }
> {code}
> A solution can be to write the following method inside JNDIObjectReference and to call it instead of getting the class of the context.lookup result (moreover it may saves some JNDI lookup too)
> {code}
> public Class<?> returnedClass {
> ParameterizedType parameterizedType = (ParameterizedType) getClass().getGenericSuperClass();
> return (Class) parameterizedtype.getActualTypeArguments()[0];
> }
> {code}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
<a href="http://xircles.codehaus.org/manage_email">http://xircles.codehaus.org/manage_email</a>