svn commit: rev 23232 - avalon/trunk/runtime/composition/impl/src/java/org/apache/avalon/composition/model/impl

[email protected]
Newsgroups gmane.comp.jakarta.avalon.cvs
Message-ID <[email protected]>
Author: niclas
Date: Sun Jul 25 09:46:16 2004
New Revision: 23232

Modified:
   avalon/trunk/runtime/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModelAssemblyHelper.java
Log:
Optional dependency didn't really work. Fixed.

Modified: avalon/trunk/runtime/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModelAssemblyHelper.java
==============================================================================
--- avalon/trunk/runtime/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModelAssemblyHelper.java	(original)
+++ avalon/trunk/runtime/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModelAssemblyHelper.java	Sun Jul 25 09:46:16 2004
@@ -207,7 +207,7 @@
         //
 
         DependencyModel[] dependencies = model.getDependencyModels();
-        for( int i=0; i<dependencies.length; i++ )
+        for( int i=0; i < dependencies.length; i++ )
         {
             DependencyModel dependency = dependencies[i];
             if( null == dependency.getProvider() )
@@ -221,10 +221,13 @@
                 }
                 catch( Throwable e )
                 {
-                    final String error = 
-                      "Unable to assemble component: " + model 
-                      + " due to a service provider establishment failure.";
-                    throw new AssemblyException( error, e );
+                    if( dependency.getDependency().isRequired() )
+                    {
+                        final String error = 
+                          "Unable to assemble component: " + model 
+                          + " due to a service provider establishment failure.";
+                        throw new AssemblyException( error, e );
+                    }
                 }
                 finally
                 {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.