crafterm    2002/07/16 05:35:45

  Modified:    component/src/java/org/apache/avalon/excalibur/component
                        DefaultComponentFactory.java
  Log:
  Added catch for ClassCastException which might occur if a Serviceable
  component is looked up inside of a ComponentManager, but does not
  implement Component.
  
  The exception is explicitly rethrown as a ServiceException to alert the
  caller about the problem (rather than continue as a RuntimeException).
  
  Revision  Changes    Path
  1.6       +7 -1      
jakarta-avalon-excalibur/component/src/java/org/apache/avalon/excalibur/component/DefaultComponentFactory.java
  
  Index: DefaultComponentFactory.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/component/src/java/org/apache/avalon/excalibur/component/DefaultComponentFactory.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DefaultComponentFactory.java      12 Jul 2002 10:56:50 -0000      1.5
  +++ DefaultComponentFactory.java      16 Jul 2002 12:35:45 -0000      1.6
  @@ -401,6 +401,12 @@
                   addUnreleased( component );
                   return component;
               }
  +            catch( ClassCastException e )
  +            {
  +                throw new ServiceException( role,
  +                                            "Casting exception (does your 
Serviceable implement Component)",
  +                                            e );
  +            }
               catch( ComponentException e )
               {
                   throw new ServiceException( e.getRole(),
  
  
  

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

Reply via email to