directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz (JIRA)" <>
Subject [jira] Closed: (DIRNAMING-5) Logic error in getFactoryClassName implementations
Date Wed, 22 Dec 2004 16:35:05 GMT
     [ ]
Phil Steitz closed DIRNAMING-5:

    Resolution: Invalid

Null should be returned on the control path indicated. 

> Logic error in getFactoryClassName implementations
> --------------------------------------------------
>          Key: DIRNAMING-5
>          URL:
>      Project: Directory naming
>         Type: Bug
>     Reporter: Phil Steitz
>     Assignee: Phil Steitz

> o.a.c.naming.EJBRef, ResourceEnvRef, ResourceLinkRef, ResourceRef and TransactionRef
all override getFactoryClassName in javax.naming.Reference with the following code:
> public String getFactoryClassName() {
>     String factory = super.getFactoryClassName();
>     if (factory != null) {
>         return factory;
>     } else {
>         factory = System.getProperty(Context.OBJECT_FACTORIES);
>         if (factory != null) {
>             return null;
>         } else {
>             return DEFAULT_FACTORY;
>         }
>     }
>  }
> All have constructors that allow the factory class and factory to be provided and passed
to the superclass constructor and all define a default factory whose name is DEFAULT_FACTORY.
 What looks incorrect to me is returning null if the factory is not set (so first test above
fails), but the system Context.OBJECT_FACTORIES property is set.  This will happen if the
version of the constructor that does not take the factory as an argument is used to construct
the Reference but the system property is set.  In this case, I would expect the system-defined
object factories to be tried first and then the DEFAULT_FACTORY.  Therefore, I think "return
null" above should be changed to "return factory" or the system property check should be dropped.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
If you want more information on JIRA, or have a bug to report see:

View raw message