You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by bl...@apache.org on 2002/07/30 19:37:26 UTC

cvs commit: jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/lookup FortressServiceManager.java

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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>