directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz (JIRA)" <directory-...@incubator.apache.org>
Subject [jira] Closed: (DIRNAMING-5) Logic error in getFactoryClassName implementations
Date Wed, 22 Dec 2004 16:35:05 GMT
     [ http://nagoya.apache.org/jira/browse/DIRNAMING-5?page=history ]
     
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: http://nagoya.apache.org/jira/browse/DIRNAMING-5
>      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:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Mime
View raw message