You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2009/04/29 00:18:06 UTC

svn commit: r769569 - in /maven/components/branches/maven-2.2.x/maven-core/src/main/java/org/apache/maven: ConfigurationInterpolator.java lifecycle/DefaultLifecycleExecutor.java

Author: jdcasey
Date: Tue Apr 28 22:18:06 2009
New Revision: 769569

URL: http://svn.apache.org/viewvc?rev=769569&view=rev
Log:
[MNG-4137] Initialize configInterpolator in case a custom component descriptor is provided for the lifecycle manager which doesn't wire in this field. This behavior is the same as that done for the modelInterpolator field, both of which cause NPE's in Hudson.

Modified:
    maven/components/branches/maven-2.2.x/maven-core/src/main/java/org/apache/maven/ConfigurationInterpolator.java
    maven/components/branches/maven-2.2.x/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java

Modified: maven/components/branches/maven-2.2.x/maven-core/src/main/java/org/apache/maven/ConfigurationInterpolator.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.2.x/maven-core/src/main/java/org/apache/maven/ConfigurationInterpolator.java?rev=769569&r1=769568&r2=769569&view=diff
==============================================================================
--- maven/components/branches/maven-2.2.x/maven-core/src/main/java/org/apache/maven/ConfigurationInterpolator.java (original)
+++ maven/components/branches/maven-2.2.x/maven-core/src/main/java/org/apache/maven/ConfigurationInterpolator.java Tue Apr 28 22:18:06 2009
@@ -6,6 +6,8 @@
 public interface ConfigurationInterpolator
 {
     
+    String ROLE = ConfigurationInterpolator.class.getName();
+    
     Object interpolate( Object configObject, MavenProject project, ProjectBuilderConfiguration config )
         throws ConfigurationInterpolationException;
 

Modified: maven/components/branches/maven-2.2.x/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.2.x/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java?rev=769569&r1=769568&r2=769569&view=diff
==============================================================================
--- maven/components/branches/maven-2.2.x/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java (original)
+++ maven/components/branches/maven-2.2.x/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java Tue Apr 28 22:18:06 2009
@@ -1957,6 +1957,19 @@
                 throw new InitializationException( "Failed to lookup model interpolator after it was NOT injected via component requirement." );
             }
         }
+        
+        if ( configInterpolator == null )
+        {
+            warnOfIncompleteComponentConfiguration( ConfigurationInterpolator.ROLE );
+            try
+            {
+                configInterpolator = (ConfigurationInterpolator) container.lookup( ConfigurationInterpolator.ROLE );
+            }
+            catch ( ComponentLookupException e )
+            {
+                throw new InitializationException( "Failed to lookup plugin-configuration interpolator after it was NOT injected via component requirement." );
+            }
+        }
     }
     
     private void warnOfIncompleteComponentConfiguration( String role )