mcconnell    2003/09/12 14:38:41

  Modified:    merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl
                        DefaultKernelContext.java
  Log:
  Update to allow non-inclusion of credentials.
  
  Revision  Changes    Path
  1.28      +21 -19    
avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernelContext.java
  
  Index: DefaultKernelContext.java
  ===================================================================
  RCS file: 
/home/cvs/avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernelContext.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- DefaultKernelContext.java 12 Sep 2003 16:43:49 -0000      1.27
  +++ DefaultKernelContext.java 12 Sep 2003 21:38:41 -0000      1.28
  @@ -502,27 +502,29 @@
           Configuration proxyConfig = config.getChild( "proxy", false );
           if( proxyConfig != null )
           {
  -            Configuration credentials = proxyConfig.getChild( "credentials" );
  -            final String username = credentials.getChild( "username" ).getValue( 
null );
  -            if( username == null )
  +            DefaultAuthenticator authenticator = null;
  +            Configuration credentials = proxyConfig.getChild( "credentials", false 
);
  +            if( credentials != null )
               {
  -                final String error =
  -                  "Credentials configuration does not contain the required 
'username' element."
  -                  + ConfigurationUtil.list( credentials );
  -                throw new KernelException( error );                
  -            }
  +                final String username = credentials.getChild( "username" 
).getValue( null );
  +                if( username == null )
  +                {
  +                    final String error =
  +                      "Credentials configuration does not contain the required 
'username' element."
  +                      + ConfigurationUtil.list( credentials );
  +                    throw new KernelException( error );                
  +                }
   
  -            final String password = credentials.getChild( "password" ).getValue( 
null );
  -            if( password == null )
  -            {
  -                final String error =
  -                  "Credentials configuration does not contain the required 
'password' element."
  -                  + ConfigurationUtil.list( credentials );
  -                throw new KernelException( error );                
  +                final String password = credentials.getChild( "password" 
).getValue( null );
  +                if( password == null )
  +                {
  +                    final String error =
  +                      "Credentials configuration does not contain the required 
'password' element."
  +                      + ConfigurationUtil.list( credentials );
  +                    throw new KernelException( error );                
  +                }
  +                authenticator = new DefaultAuthenticator( username, password );
               }
  -
  -            DefaultAuthenticator authenticator = 
  -              new DefaultAuthenticator( username, password );
   
               final String host = proxyConfig.getChild( "host" ).getValue( null );
               final int port = proxyConfig.getChild( "port" ).getValueAsInteger( 0 );
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to