This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag 
org.apache.sling.provisioning.model-1.6.0
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-provisioning-model.git

commit 52c62dff5075a101a25dd4cabd8eb5b95de32298
Author: Carsten Ziegeler <cziege...@apache.org>
AuthorDate: Sun Oct 30 10:26:48 2016 +0000

    SLING-6215 : Catch IllegalArgumentException when comparing versions
    
    git-svn-id: 
https://svn.apache.org/repos/asf/sling/trunk/tooling/support/provisioning-model@1767139
 13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/provisioning/model/MergeUtility.java     | 24 +++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/provisioning/model/MergeUtility.java 
b/src/main/java/org/apache/sling/provisioning/model/MergeUtility.java
index 0d18a05..86f3203 100644
--- a/src/main/java/org/apache/sling/provisioning/model/MergeUtility.java
+++ b/src/main/java/org/apache/sling/provisioning/model/MergeUtility.java
@@ -141,13 +141,23 @@ public abstract class MergeUtility {
                                     searchGroup.remove(found);
                                     foundStartLevel = 
searchGroup.getStartLevel();
                                 } else {
-                                    final Version baseVersion = new 
Version(found.getVersion());
-                                    final Version mergeVersion = new 
Version(artifact.getVersion());
-                                    if ( baseVersion.compareTo(mergeVersion) 
<= 0 ) {
-                                        searchGroup.remove(found);
-                                        foundStartLevel = 
searchGroup.getStartLevel();
-                                    } else {
-                                        addArtifact = false;
+                                    try {
+                                        final Version baseVersion = new 
Version(found.getVersion());
+                                        final Version mergeVersion = new 
Version(artifact.getVersion());
+                                        if ( 
baseVersion.compareTo(mergeVersion) <= 0 ) {
+                                            searchGroup.remove(found);
+                                            foundStartLevel = 
searchGroup.getStartLevel();
+                                        } else {
+                                            addArtifact = false;
+                                        }
+                                    } catch ( final IllegalArgumentException 
iae) {
+                                        // if at least one version is not a 
valid maven version
+                                        if ( 
found.getVersion().compareTo(artifact.getVersion()) <= 0 ) {
+                                            searchGroup.remove(found);
+                                            foundStartLevel = 
searchGroup.getStartLevel();
+                                        } else {
+                                            addArtifact = false;
+                                        }
                                     }
                                 }
                             }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <commits@sling.apache.org>.

Reply via email to