avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/lookup FortressServiceManager.java
Date Tue, 30 Jul 2002 17:37:26 GMT
bloritsch    2002/07/30 10:37:26

  Modified:    fortress/src/java/org/apache/excalibur/fortress/lookup
                        FortressServiceManager.java
  Log:
  update the servicemanader so no NullPointerExceptions are thrown
  
  Revision  Changes    Path
  1.7       +23 -6     jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/lookup/FortressServiceManager.java
  
  Index: FortressServiceManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/lookup/FortressServiceManager.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- FortressServiceManager.java	15 Jul 2002 17:35:22 -0000	1.6
  +++ FortressServiceManager.java	30 Jul 2002 17:37:26 -0000	1.7
  @@ -63,6 +63,11 @@
           m_context = context;
           m_extManager = extManager;
           m_used = new BucketMap();
  +
  +        if ( m_components == null )
  +        {
  +            throw new NullPointerException("The Container is null, the Servicemanager is
unusable");
  +        }
       }
   
       public Object lookup( String role )
  @@ -162,12 +167,24 @@
   
           handler = (ComponentHandler)m_used.remove( component );
   
  -        if( null == handler && null != m_parent )
  +        if( null == handler )
           {
  -            m_parent.release( component );
  -            return;
  +            if ( null == m_parent )
  +            {
  +                /* This is a purplexing problem.  SOmetimes the m_used hash returns
  +                 * null for the component--usually a ThreadSafe component.  When there
  +                 * is no handler and no parent, that is an error condition--but if the
  +                 * component is usually ThreadSafe, the impact is essentially nill.
  +                 */
  +            }
  +            else
  +            {
  +                m_parent.release( component );
  +            }
  +        }
  +        else
  +        {
  +            handler.put( component );
           }
  -
  -        handler.put( component );
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message