Author: ludovicc-guest
Date: 2011-05-18 22:42:15 +0000 (Wed, 18 May 2011)
New Revision: 13694

Modified:
   trunk/maven-repo-helper/debian/changelog
   trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Dependency.java
Log:
Match jar with bundle as they are equivalent

Modified: trunk/maven-repo-helper/debian/changelog
===================================================================
--- trunk/maven-repo-helper/debian/changelog    2011-05-18 20:08:40 UTC (rev 
13693)
+++ trunk/maven-repo-helper/debian/changelog    2011-05-18 22:42:15 UTC (rev 
13694)
@@ -1,3 +1,9 @@
+maven-repo-helper (1.5.2) UNRELEASED; urgency=low
+
+  * Match jar with bundle as they are equivalent
+
+ -- Ludovic Claude <[email protected]>  Thu, 19 May 2011 00:31:08 
+0100
+
 maven-repo-helper (1.5.1) unstable; urgency=low
 
   * Upload to unstable.

Modified: 
trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Dependency.java
===================================================================
--- trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Dependency.java 
2011-05-18 20:08:40 UTC (rev 13693)
+++ trunk/maven-repo-helper/src/main/java/org/debian/maven/repo/Dependency.java 
2011-05-18 22:42:15 UTC (rev 13694)
@@ -132,7 +132,7 @@
         if ((this.artifactId == null) ? (other.artifactId != null) : 
!this.artifactId.equals(other.artifactId)) {
             return false;
         }
-        if ((this.type == null) ? (other.type != null) : 
!this.type.equals(other.type)) {
+        if (!isTypeEquals(this.type, other.type)) {
             return false;
         }
         if ((this.version == null) ? (other.version != null) : 
!this.version.equals(other.version)) {
@@ -159,7 +159,7 @@
         if ((this.artifactId == null) ? (other.artifactId != null) : 
!this.artifactId.equals(other.artifactId)) {
             return false;
         }
-        if ((this.type == null) ? (other.type != null) : 
!this.type.equals(other.type)) {
+        if (!isTypeEquals(this.type, other.type)) {
             return false;
         }
         // Classifier is still important here as it can influence greatly the 
contents of the artifact (a source artifact is very different from a normal 
artifact)
@@ -173,7 +173,7 @@
         int hash = 7;
         hash = 31 * hash + (this.groupId != null ? this.groupId.hashCode() : 
0);
         hash = 31 * hash + (this.artifactId != null ? 
this.artifactId.hashCode() : 0);
-        hash = 31 * hash + (this.type != null ? this.type.hashCode() : 0);
+        // ignore type
         hash = 31 * hash + (this.version != null ? this.version.hashCode() : 
0);
         return hash;
     }
@@ -196,12 +196,7 @@
                 return this.artifactId.compareTo(dependency.artifactId);
             }
         }
-        if (this.type != dependency.type) {
-            if (this.type == null) return -1;
-            if (! this.type.equals(dependency.type)) {
-                return this.type.compareTo(dependency.type);
-            }
-        }
+        // ignore type
         if (this.version != dependency.version) {
             if (this.version == null) return -1;
             if (! this.version.equals(dependency.version)) {
@@ -266,4 +261,14 @@
         return result;
     }
 
+    public static boolean isTypeEquals(String type1, String type2) {
+        if (type1 != null && ("jar".equals(type1) || "bundle".equals(type1))) {
+            return ("jar".equals(type2) || "bundle".equals(type2));
+        }
+        if (type1 != null) {
+            return type1.equals(type2);
+        }
+        return type2 == null;
+    }
+
 }


_______________________________________________
pkg-java-commits mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/pkg-java-commits

Reply via email to