geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r1232770 - /geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/DependencyChangeMojo.java
Date Wed, 18 Jan 2012 07:38:03 GMT
Author: djencks
Date: Wed Jan 18 07:38:02 2012
New Revision: 1232770

URL: http://svn.apache.org/viewvc?rev=1232770&view=rev
Log:
try to make DependencyChangeMojo ignore corrupted dependencies.xml files

Modified:
    geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/DependencyChangeMojo.java

Modified: geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/DependencyChangeMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/DependencyChangeMojo.java?rev=1232770&r1=1232769&r2=1232770&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/DependencyChangeMojo.java
(original)
+++ geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/DependencyChangeMojo.java
Wed Jan 18 07:38:02 2012
@@ -29,6 +29,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.StringWriter;
+import java.net.MalformedURLException;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
@@ -36,6 +37,7 @@ import java.util.LinkedHashSet;
 import java.util.Comparator;
 
 import javax.xml.bind.JAXBException;
+import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.stream.XMLStreamException;
 
 import org.apache.geronimo.system.plugin.model.PluginXmlUtil;
@@ -43,6 +45,7 @@ import org.apache.geronimo.system.plugin
 import org.apache.geronimo.system.plugin.model.PluginArtifactType;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
+import org.xml.sax.SAXException;
 
 /**
  * Check if the dependencies have changed
@@ -114,6 +117,7 @@ public class DependencyChangeMojo extend
                 test.setImport(null);
             }
             Collection<DependencyType> added = new LinkedHashSet<DependencyType>(dependencies);
+            PluginArtifactType removed = new PluginArtifactType();
             if (dependencyFile.exists()) {
                 //filter dependencies file
                 filter(dependencyFile, filteredDependencyFile);
@@ -121,7 +125,6 @@ public class DependencyChangeMojo extend
                 FileReader in = new FileReader(filteredDependencyFile);
                 try {
                     PluginArtifactType pluginArtifactType = PluginXmlUtil.loadPluginArtifactMetadata(in);
-                    PluginArtifactType removed = new PluginArtifactType();
                     for (DependencyType test: pluginArtifactType.getDependency()) {
                         boolean t1 = added.contains(test);
                         int s1 = added.size();
@@ -138,23 +141,25 @@ public class DependencyChangeMojo extend
                         }
                     }
 
-                    File treeListing = saveTreeListing();
-                    if (!added.isEmpty() || !removed.getDependency().isEmpty()) {
-                        saveDependencyChanges(added, removed, treeListing);
-                        if (overwriteChangedDependencies) {
-                            writeDependencies(toPluginArtifactType(dependencies),  dependencyFile);
-                        }
-                    }
+                } catch (Exception e) {
+                    getLogger().warn("Could not read dependencies.xml file at " + dependencyFile,
e);
                 } finally {
                     in.close();
                 }
+                File treeListing = saveTreeListing();
+                if (!added.isEmpty() || !removed.getDependency().isEmpty()) {
+                    saveDependencyChanges(added, removed, treeListing);
+                    if (overwriteChangedDependencies) {
+                        writeDependencies(toPluginArtifactType(dependencies), dependencyFile);
+                    }
+                }
             } else {
                 writeDependencies(toPluginArtifactType(dependencies),  dependencyFile);
             }
         } catch (MojoFailureException e) {
             throw e;
         } catch (Exception e) {
-            throw new MojoExecutionException("Could not read or write dependency history
info", e);
+            throw new MojoExecutionException("Could not write dependency history info", e);
         }
     }
 



Mime
View raw message