2016-07-04 10:16:15 +00:00
|
|
|
From 530df7f2f2f6751a06862955fafbe319f86a3808 Mon Sep 17 00:00:00 2001
|
2015-11-26 13:28:54 +00:00
|
|
|
From: Mikolaj Izdebski <mizdebsk@redhat.com>
|
|
|
|
Date: Thu, 26 Nov 2015 14:18:48 +0100
|
2016-07-04 10:16:15 +00:00
|
|
|
Subject: [PATCH 2/3] Try to procect builddep MOJO against patological cases
|
2015-11-26 13:28:54 +00:00
|
|
|
|
|
|
|
- Clone model before processing it to avoid
|
|
|
|
UnsupportedOperationException (rhbz#1276729).
|
|
|
|
- Guard against NullPointerException.
|
|
|
|
- Inject a deep copy of resolutions to avoid
|
|
|
|
ConcurrentModificationException.
|
|
|
|
---
|
|
|
|
.../xmvn/connector/aether/XMvnMojoExecutionListener.java | 2 +-
|
|
|
|
.../src/main/java/org/fedoraproject/xmvn/mojo/BuilddepMojo.java | 5 ++++-
|
|
|
|
2 files changed, 5 insertions(+), 2 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnMojoExecutionListener.java b/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnMojoExecutionListener.java
|
|
|
|
index 16f30db..7adfe44 100644
|
|
|
|
--- a/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnMojoExecutionListener.java
|
|
|
|
+++ b/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnMojoExecutionListener.java
|
|
|
|
@@ -222,7 +222,7 @@ public class XMvnMojoExecutionListener
|
|
|
|
for ( BeanProperty<Object> property : new BeanProperties( mojo.getClass() ) )
|
|
|
|
{
|
|
|
|
if ( property.getName().equals( "resolutions" ) )
|
|
|
|
- property.set( mojo, Collections.unmodifiableList( resolutions ) );
|
|
|
|
+ property.set( mojo, Collections.unmodifiableList( new ArrayList<>( resolutions ) ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
diff --git a/xmvn-mojo/src/main/java/org/fedoraproject/xmvn/mojo/BuilddepMojo.java b/xmvn-mojo/src/main/java/org/fedoraproject/xmvn/mojo/BuilddepMojo.java
|
|
|
|
index 8bbdf5f..dd6a8f5 100644
|
|
|
|
--- a/xmvn-mojo/src/main/java/org/fedoraproject/xmvn/mojo/BuilddepMojo.java
|
|
|
|
+++ b/xmvn-mojo/src/main/java/org/fedoraproject/xmvn/mojo/BuilddepMojo.java
|
|
|
|
@@ -139,7 +139,7 @@ public class BuilddepMojo
|
|
|
|
Set<Artifact> artifacts = new LinkedHashSet<>();
|
|
|
|
for ( MavenProject project : reactorProjects )
|
|
|
|
{
|
|
|
|
- Model model = project.getModel();
|
|
|
|
+ Model model = project.getModel().clone();
|
|
|
|
String modelId = model.getLocation( "" ).getSource().getModelId();
|
|
|
|
BuildDependencyVisitor visitor = new BuildDependencyVisitor( modelId );
|
|
|
|
modelProcessor.processModel( model, visitor );
|
|
|
|
@@ -149,6 +149,9 @@ public class BuilddepMojo
|
|
|
|
Set<NamespacedArtifact> deps = new LinkedHashSet<>();
|
|
|
|
for ( String[] resolution : resolutions )
|
|
|
|
{
|
|
|
|
+ if ( resolution == null )
|
|
|
|
+ continue;
|
|
|
|
+
|
|
|
|
Artifact artifact = new DefaultArtifact( resolution[0] );
|
|
|
|
String compatVersion = resolution[1];
|
|
|
|
String namespace = resolution[2];
|
|
|
|
--
|
2016-07-04 10:16:15 +00:00
|
|
|
2.7.4
|
2015-11-26 13:28:54 +00:00
|
|
|
|