mcconnell    2003/09/14 06:14:23

  Modified:    
merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl
                        DefaultContainmentModel.java
  Log:
  Add some additional error handling together with support for block files names with 
a .block suffix.
  
  Revision  Changes    Path
  1.6       +10 -10    
avalon-sandbox/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java
  
  Index: DefaultContainmentModel.java
  ===================================================================
  RCS file: 
/home/cvs/avalon-sandbox/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DefaultContainmentModel.java      9 Sep 2003 13:03:20 -0000       1.5
  +++ DefaultContainmentModel.java      14 Sep 2003 13:14:23 -0000      1.6
  @@ -254,7 +254,8 @@
       */
       public CategoriesDirective getCategories()
       {
  -        if( m_categories == null ) return 
m_context.getContainmentProfile().getCategories();
  +        if( m_categories == null ) 
  +          return m_context.getContainmentProfile().getCategories();
           return m_categories;
       }
   
  @@ -617,7 +618,7 @@
                       throw new ModelException( error, e );
                   }
               }
  -            else if( path.endsWith( ".xml" ) )
  +            else if( path.endsWith( ".xml" ) || path.endsWith( ".block" ))
               {
                   DefaultConfigurationBuilder builder = 
                     new DefaultConfigurationBuilder();
  @@ -635,14 +636,8 @@
               }
               else if( path.endsWith( "/" ) )
               {
  -
                   verifyPath( path );
   
  -                //
  -                // TODO: add validation that the path exists
  -                // before appending 
  -                //
  -
                   final URL blockURL = 
                     new URL( url.toString() + "BLOCK-INF/block.xml" );
   
  @@ -661,10 +656,15 @@
                   return createContainmentModel( 
                     getName( name, profile ), profile, new URL[]{ url }  );
               }
  +            else if( path.endsWith( ".bar" ) )
  +            {
  +                final String error = 
  +                  "Cannot execute a block archive: " + path;
  +                throw new ModelException( error );
  +            }
               else
               {
                   verifyPath( path );
  -
                   return createContainmentModel( name, new URL( path + "/" ) );
               }
           }
  
  
  

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

Reply via email to