You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by do...@apache.org on 2002/06/27 09:06:31 UTC

cvs commit: jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/infobuilder ComponentInfoBuilder.java Resources.properties

donaldp     2002/06/27 00:06:31

  Modified:    containerkit/src/java/org/apache/excalibur/containerkit/infobuilder
                        ComponentInfoBuilder.java Resources.properties
  Log:
  Add some checks to make sure null resources are not loaded but instead cause a meaningful exception
  
  Revision  Changes    Path
  1.12      +12 -3     jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/infobuilder/ComponentInfoBuilder.java
  
  Index: ComponentInfoBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/infobuilder/ComponentInfoBuilder.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ComponentInfoBuilder.java	27 Jun 2002 04:48:15 -0000	1.11
  +++ ComponentInfoBuilder.java	27 Jun 2002 07:06:31 -0000	1.12
  @@ -71,6 +71,15 @@
               "/" + classname.replace( '.', '/' ) + ".xinfo";
           final InputStream inputStream =
               classLoader.getResourceAsStream( xinfo );
  +
  +        if( null == inputStream )
  +        {
  +            final String message =
  +                REZ.getString( "builder.missing-info.error",
  +                               classname );
  +            throw new Exception( message );
  +        }
  +
           return build( classname, inputStream );
       }
   
  @@ -84,7 +93,7 @@
        * @throws ConfigurationException if an error occurs
        */
       protected ComponentInfo build( final String classname,
  -                                final String uri )
  +                                   final String uri )
           throws Exception
       {
           final InputSource input = new InputSource( uri );
  @@ -101,7 +110,7 @@
        * @throws ConfigurationException if an error occurs
        */
       private ComponentInfo build( final String classname,
  -                                final InputStream inputSource )
  +                                 final InputStream inputSource )
           throws Exception
       {
           final InputSource input = new InputSource( inputSource );
  
  
  
  1.2       +1 -0      jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/infobuilder/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/infobuilder/Resources.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Resources.properties	23 Jun 2002 12:44:57 -0000	1.1
  +++ Resources.properties	27 Jun 2002 07:06:31 -0000	1.2
  @@ -2,3 +2,4 @@
   builder.creating-info.notice=Creating a ComponentInfo for class "{0}".
   builder.created-info.notice=Constructed ComponentInfo object for class {0}. ComponentInfo contains {1} services, {2} dependencies and {3} context entrys.
   builder.bad-toplevel-element.error=Error the Component implemented by "{0}" has an invalid element at top level of component info descriptor. Expected: "component-info". Actual: "{1}"
  +builder.missing-info.error=Unable to locate resource from which to load info for Component implemented by class "{0}".
  \ No newline at end of file
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>