avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/component/src/java/org/apache/avalon/excalibur/component ExcaliburComponentManager.java ExcaliburComponentSelector.java
Date Thu, 22 Aug 2002 22:56:10 GMT
leif        2002/08/22 15:56:10

  Modified:    component/src/java/org/apache/avalon/excalibur/component
                        ExcaliburComponentManager.java
                        ExcaliburComponentSelector.java
  Log:
  Modify error messages so that it is easier to spot space problems in role names.
  
  Revision  Changes    Path
  1.15      +32 -24    jakarta-avalon-excalibur/component/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentManager.java
  
  Index: ExcaliburComponentManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/component/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentManager.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ExcaliburComponentManager.java	22 Aug 2002 08:36:57 -0000	1.14
  +++ ExcaliburComponentManager.java	22 Aug 2002 22:56:10 -0000	1.15
  @@ -150,13 +150,15 @@
           {
               if( getLogger().isWarnEnabled() )
               {
  -                getLogger().warn( "Looking up component on an uninitialized ComponentLocator:
" + role );
  +                getLogger().warn(
  +                    "Looking up component on an uninitialized ComponentLocator [" + role
+ "]" );
               }
           }
   
           if( m_disposed )
           {
  -            throw new IllegalStateException( "You cannot lookup components on a disposed
ComponentLocator" );
  +            throw new IllegalStateException(
  +                "You cannot lookup components on a disposed ComponentLocator" );
           }
   
           if( null == role )
  @@ -203,7 +205,8 @@
                   {
                       if( getLogger().isDebugEnabled() )
                       {
  -                        getLogger().debug( "Could not find ComponentHandler, attempting
to create one for role: " + role );
  +                        getLogger().debug( "Could not find ComponentHandler, attempting
to create "
  +                            + "one for role [" + role + "]" );
                       }
   
                       try
  @@ -237,13 +240,14 @@
               }
               else
               {
  -                getLogger().debug( "Component requested without a RoleManager set.\nThat
means thisComponentDirectoryr was not configured." );
  +                getLogger().debug( "Component requested without a RoleManager set.\n"
  +                    + "That means setRoleManager() was not called during initialization."
);
               }
           }
   
           if( null == handler )
           {
  -            final String message = "Could not find component for role: " + role;
  +            final String message = "Could not find component for role [" + role + "]";
               if( getLogger().isDebugEnabled() )
               {
                   getLogger().debug( message );
  @@ -274,7 +278,7 @@
                   final String message = "Could not access the Component";
                   if( getLogger().isDebugEnabled() )
                   {
  -                    getLogger().debug( message + " for role: " + role, e );
  +                    getLogger().debug( message + " for role [" + role + "]", e );
                   }
   
                   throw new ComponentException( role, message, e );
  @@ -285,7 +289,7 @@
               final String message = "Could not access the Component";
               if( getLogger().isDebugEnabled() )
               {
  -                getLogger().debug( message + " for role: " + role, e );
  +                getLogger().debug( message + " for role [" + role + "]", e );
               }
   
               throw new ComponentException( role, message, e );
  @@ -424,8 +428,8 @@
                       {
                           if( getLogger().isDebugEnabled() )
                           {
  -                            getLogger().debug( "Adding component (" + role + " = " +
  -                                               className + ")" );
  +                            getLogger().debug( "Adding component (" + role + " = "
  +                                + className + ")" );
                           }
   
                           final Class clazz = m_loader.loadClass( className );
  @@ -437,8 +441,9 @@
   
                           if( getLogger().isErrorEnabled() )
                           {
  -                            getLogger().error( message + className + " for role " + role
+
  -                                               " on configuration element " + configurations[
i ].getName(), cnfe );
  +                            getLogger().error( message + className + " for role " + role
  +                                + " on configuration element " + configurations[ i ].getName(),
  +                                cnfe );
                           }
   
                           throw new ConfigurationException( message, cnfe );
  @@ -449,8 +454,9 @@
   
                           if( getLogger().isErrorEnabled() )
                           {
  -                            getLogger().error( message + className + " for role " + role
+
  -                                               " on configuration element " + configurations[
i ].getName(), ce );
  +                            getLogger().error( message + className + " for role " + role
  +                                + " on configuration element " + configurations[ i ].getName(),
  +                                ce );
                           }
   
                           throw new ConfigurationException( message, ce );
  @@ -520,8 +526,8 @@
                   {
                       if( getLogger().isErrorEnabled() )
                       {
  -                        getLogger().error( "Caught an exception trying to initialize "
+
  -                                           "the component handler.", e );
  +                        getLogger().error( "Caught an exception trying to initialize "
  +                            + "the component handler.", e );
                       }
                   }
               }
  @@ -555,8 +561,8 @@
                       {
                           if( getLogger().isErrorEnabled() )
                           {
  -                            getLogger().error( "Caught an exception trying to initialize
" +
  -                                               "the component handler.", e );
  +                            getLogger().error( "Caught an exception trying to initialize
"
  +                                + "the component handler.", e );
                           }
                       }
                   }
  @@ -593,8 +599,8 @@
                           if( forceDisposal && getLogger().isWarnEnabled() )
                           {
                               getLogger().warn
  -                                ( "disposing of handler for unreleased component"
  -                                  + " (role: " + role + ")" );
  +                                ( "disposing of handler for unreleased component."
  +                                  + " role [" + role + "]" );
                           }
   
                           handler.dispose();
  @@ -796,14 +802,15 @@
       {
           if( m_initialized )
           {
  -            throw new ComponentException( role, "Cannot add components to an initialized
ComponentLocator" );
  +            throw new ComponentException( role,
  +                "Cannot add components to an initialized ComponentLocator" );
           }
   
           try
           {
               if( getLogger().isDebugEnabled() )
               {
  -                getLogger().debug( "Attempting to get Handler for: " + role );
  +                getLogger().debug( "Attempting to get Handler for role [" + role + "]"
);
               }
   
               final ComponentHandler handler = getComponentHandler( component,
  @@ -836,7 +843,8 @@
       {
           if( m_initialized )
           {
  -            throw new IllegalStateException( "Cannot add components to an initialized ComponentLocator"
);
  +            throw new IllegalStateException(
  +                "Cannot add components to an initialized ComponentLocator" );
           }
   
           try
  @@ -851,7 +859,7 @@
           {
               if( getLogger().isWarnEnabled() )
               {
  -                getLogger().warn( "Could not set up Component for role: " + role, e );
  +                getLogger().warn( "Could not set up Component for role [" + role + "]",
e );
               }
           }
       }
  
  
  
  1.14      +32 -23    jakarta-avalon-excalibur/component/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentSelector.java
  
  Index: ExcaliburComponentSelector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/component/src/java/org/apache/avalon/excalibur/component/ExcaliburComponentSelector.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ExcaliburComponentSelector.java	18 Aug 2002 14:40:22 -0000	1.13
  +++ ExcaliburComponentSelector.java	22 Aug 2002 22:56:10 -0000	1.14
  @@ -161,18 +161,21 @@
           {
               if( getLogger().isWarnEnabled() )
               {
  -                getLogger().warn( "Looking up component on an uninitialized ComponentLocator:
" + hint );
  +                getLogger().warn( "Looking up component on an uninitialized ComponentLocator
"
  +                    + "with hint [" + hint + "]" );
               }
           }
   
           if( m_disposed )
           {
  -            throw new IllegalStateException( "You cannot select a Component from a disposed
ComponentSelector" );
  +            throw new IllegalStateException(
  +                "You cannot select a Component from a disposed ComponentSelector" );
           }
   
           if( null == hint )
           {
  -            final String message = getName() + ": ComponentSelector Attempted to retrieve
component with null hint.";
  +            final String message = getName()
  +                + ": ComponentSelector Attempted to retrieve component with null hint.";
               if( getLogger().isErrorEnabled() )
               {
                   getLogger().error( message );
  @@ -186,7 +189,8 @@
           // Retrieve the instance of the requested component
           if( null == handler )
           {
  -            final String message = getName() + ": ComponentSelector could not find the
component for hint: " + hint;
  +            final String message = getName()
  +                + ": ComponentSelector could not find the component for hint [" + hint
+ "]";
               if( getLogger().isDebugEnabled() )
               {
                   getLogger().debug( message );
  @@ -207,7 +211,8 @@
           }
           catch( final Exception e )
           {
  -            final String message = getName() + ": ComponentSelector could not access the
Component for hint: " + hint;
  +            final String message = getName()
  +                + ": ComponentSelector could not access the Component for hint [" + hint
+ "]";
   
               if( getLogger().isDebugEnabled() )
               {
  @@ -218,7 +223,8 @@
   
           if( null == component )
           {
  -            final String message = getName() + ": ComponentSelector could not find the
component for hint: " + hint;
  +            final String message = getName()
  +                + ": ComponentSelector could not find the component for hint [" + hint
+ "]";
               if( getLogger().isDebugEnabled() )
               {
                   getLogger().debug( message );
  @@ -269,8 +275,8 @@
   
           if( null == handler )
           {
  -            getLogger().warn( "Attempted to release a " + component.getClass().getName()
+
  -                              " but its handler could not be located." );
  +            getLogger().warn( "Attempted to release a " + component.getClass().getName()
  +                + " but its handler could not be located." );
               return;
           }
   
  @@ -367,8 +373,8 @@
               catch( final ClassNotFoundException cnfe )
               {
                   final String message =
  -                    "The component instance for '" + hint +
  -                    "' has an invalid class name (" + className + ").";
  +                    "The component instance for hint [" + hint
  +                    + "] has an invalid class name (" + className + ").";
                   if( getLogger().isErrorEnabled() )
                   {
                       getLogger().error( message, cnfe );
  @@ -380,8 +386,8 @@
               {
                   if( getLogger().isErrorEnabled() )
                   {
  -                    getLogger().error( "The component instance for '" + hint +
  -                                       "' is not valid.", ce );
  +                    getLogger().error(
  +                        "The component instance for hint [" + hint + "] is not valid.",
ce );
                   }
   
                   throw new ConfigurationException( "Could not set up component", ce );
  @@ -390,7 +396,7 @@
               {
                   if( getLogger().isErrorEnabled() )
                   {
  -                    getLogger().error( "Unexpected exception for hint: " + hint, e );
  +                    getLogger().error( "Unexpected exception for hint [" + hint + "]",
e );
                   }
                   throw new ConfigurationException( "Unexpected exception", e );
               }
  @@ -434,8 +440,8 @@
                   {
                       if( getLogger().isDebugEnabled() )
                       {
  -                        getLogger().debug( "Caught an exception trying to initialize "
+
  -                                           "of the component handler.", e );
  +                        getLogger().debug( "Caught an exception trying to initialize "
  +                            + "of the component handler.", e );
                       }
                   }
   
  @@ -666,7 +672,8 @@
       {
           if( m_initialized )
           {
  -            throw new ComponentException( hint.toString(), "Cannot add components to an
initialized ComponentSelector", null );
  +            throw new ComponentException( hint.toString(),
  +                "Cannot add components to an initialized ComponentSelector", null );
           }
   
           try
  @@ -685,13 +692,14 @@
   
               if( getLogger().isDebugEnabled() )
               {
  -                getLogger().debug( "Adding " + component.getName() + " for " + hint.toString()
);
  +                getLogger().debug(
  +                    "Adding " + component.getName() + " for hint [" + hint.toString() +
"]" );
               }
           }
           catch( final Exception e )
           {
               final String message =
  -                "Could not set up Component for hint: " + hint;
  +                "Could not set up Component for hint [ " + hint + "]";
               if( getLogger().isErrorEnabled() )
               {
                   getLogger().error( message, e );
  @@ -709,7 +717,8 @@
       {
           if( m_initialized )
           {
  -            throw new IllegalStateException( "Cannot add components to an initialized ComponentSelector"
);
  +            throw new IllegalStateException(
  +                "Cannot add components to an initialized ComponentSelector" );
           }
   
           try
  @@ -723,15 +732,15 @@
   
               if( getLogger().isDebugEnabled() )
               {
  -                getLogger().debug( "Adding " + instance.getClass().getName() +
  -                                   " for " + hint.toString() );
  +                getLogger().debug( "Adding " + instance.getClass().getName()
  +                    + " for hint [" + hint.toString() + "]" );
               }
           }
           catch( final Exception e )
           {
               if( getLogger().isErrorEnabled() )
               {
  -                getLogger().error( "Could not set up Component for hint: " + hint, e );
  +                getLogger().error( "Could not set up Component for hint [" + hint + "]",
e );
               }
           }
       }
  
  
  

--
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