felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsav...@apache.org
Subject svn commit: r918229 - in /felix/trunk/sigil/common: core.tests/src/org/apache/felix/sigil/core/internal/ core.tests/src/org/apache/felix/sigil/core/internal/model/ core.tests/src/org/apache/felix/sigil/core/internal/model/osgi/ core/src/org/apache/feli...
Date Tue, 02 Mar 2010 22:32:31 GMT
Author: dsavage
Date: Tue Mar  2 22:32:31 2010
New Revision: 918229

URL: http://svn.apache.org/viewvc?rev=918229&view=rev
Log:
Fix for npe found in FELIX-2159 missing ()'s

Added:
    felix/trunk/sigil/common/core.tests/src/org/apache/felix/sigil/core/internal/
    felix/trunk/sigil/common/core.tests/src/org/apache/felix/sigil/core/internal/model/
    felix/trunk/sigil/common/core.tests/src/org/apache/felix/sigil/core/internal/model/osgi/
    felix/trunk/sigil/common/core.tests/src/org/apache/felix/sigil/core/internal/model/osgi/PackageExportTest.java
Modified:
    felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/osgi/PackageExport.java

Added: felix/trunk/sigil/common/core.tests/src/org/apache/felix/sigil/core/internal/model/osgi/PackageExportTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core.tests/src/org/apache/felix/sigil/core/internal/model/osgi/PackageExportTest.java?rev=918229&view=auto
==============================================================================
--- felix/trunk/sigil/common/core.tests/src/org/apache/felix/sigil/core/internal/model/osgi/PackageExportTest.java
(added)
+++ felix/trunk/sigil/common/core.tests/src/org/apache/felix/sigil/core/internal/model/osgi/PackageExportTest.java
Tue Mar  2 22:32:31 2010
@@ -0,0 +1,43 @@
+package org.apache.felix.sigil.core.internal.model.osgi;
+
+import org.osgi.framework.Version;
+
+import junit.framework.TestCase;
+
+public class PackageExportTest extends TestCase
+{
+    public PackageExportTest( String name )
+    {
+        super( name );
+    }
+
+    public void testEquals() {
+        PackageExport p1 = new PackageExport();
+        p1.setPackageName("foo");
+        p1.setVersion(Version.parseVersion("1.0.0"));
+        
+        PackageExport p2 = new PackageExport();
+        p2.setPackageName("foo");
+        p2.setVersion(Version.parseVersion("1.0.0"));
+        
+        assertTrue( p1.equals( p2 ) );
+        assertTrue( p2.equals( p1 ) );
+        
+        PackageExport p3 = new PackageExport();
+        p3.setPackageName("foo");
+
+        assertFalse( p1.equals( p3 ) );
+        assertFalse( p3.equals( p1 ) );
+        
+        PackageExport p4 = new PackageExport();
+        p4.setVersion(Version.parseVersion("1.0.0"));
+
+        assertFalse( p1.equals( p4 ) );
+        assertFalse( p4.equals( p1 ) );
+        
+        PackageExport p5 = new PackageExport();
+        assertFalse( p1.equals( p5 ) );
+        assertFalse( p5.equals( p1 ) );
+        
+    }
+}

Modified: felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/osgi/PackageExport.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/osgi/PackageExport.java?rev=918229&r1=918228&r2=918229&view=diff
==============================================================================
--- felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/osgi/PackageExport.java
(original)
+++ felix/trunk/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/osgi/PackageExport.java
Tue Mar  2 22:32:31 2010
@@ -175,8 +175,8 @@
         if ( obj == this ) return true;
         try {
             PackageExport e = (PackageExport) obj;
-            return name == null ? e.name == null : name.equals( e.name ) && 
-                version == null ? e.version == null : version.equals( e.version );
+            return (name == null ? e.name == null : name.equals( e.name )) && 
+                (version == null ? e.version == null : version.equals( e.version ));
         }
         catch (ClassCastException e) {
             return false;



Mime
View raw message