You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by mc...@apache.org on 2011/06/25 21:53:51 UTC

svn commit: r1139605 - /felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java

Author: mcculls
Date: Sat Jun 25 19:53:50 2011
New Revision: 1139605

URL: http://svn.apache.org/viewvc?rev=1139605&view=rev
Log:
FELIX-1985: warn when duplicate paths appear in Include-Resource

Modified:
    felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java

Modified: felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java?rev=1139605&r1=1139604&r2=1139605&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java (original)
+++ felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java Sat Jun 25 19:53:50 2011
@@ -297,18 +297,33 @@ public class BundlePlugin extends Abstra
             List errors = builder.getErrors();
             List warnings = builder.getWarnings();
 
+            String warningPrefix = "Warning building bundle " + currentProject.getArtifact() + " : ";
             for ( Iterator w = warnings.iterator(); w.hasNext(); )
             {
                 String msg = ( String ) w.next();
-                getLog().warn( "Warning building bundle " + currentProject.getArtifact() + " : " + msg );
+                getLog().warn( warningPrefix + msg );
             }
+
+            boolean hasErrors = false;
+            String errorPrefix = "Error building bundle " + currentProject.getArtifact() + " : ";
+            String fileNotFound = "Input file does not exist: ";
             for ( Iterator e = errors.iterator(); e.hasNext(); )
             {
                 String msg = ( String ) e.next();
-                getLog().error( "Error building bundle " + currentProject.getArtifact() + " : " + msg );
+                if ( msg.startsWith( fileNotFound ) && msg.endsWith( "~" ) )
+                {
+                    // treat as warning; this error happens when you have duplicate entries in Include-Resource
+                    String duplicate = Processor.removeDuplicateMarker( msg.substring( fileNotFound.length() ) );
+                    getLog().warn( warningPrefix + "Duplicate path '" + duplicate  + "' in Include-Resource" );
+                }
+                else
+                {
+                    getLog().error( errorPrefix + msg );
+                    hasErrors = true;
+                }
             }
 
-            if ( errors.size() > 0 )
+            if ( hasErrors )
             {
                 String failok = builder.getProperty( "-failok" );
                 if ( null == failok || "false".equalsIgnoreCase( failok ) )