commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r789226 - in /commons/sandbox/runtime/trunk/src: main/java/org/apache/commons/runtime/ test/org/apache/commons/runtime/
Date Mon, 29 Jun 2009 06:16:41 GMT
Author: mturk
Date: Mon Jun 29 06:16:41 2009
New Revision: 789226

URL: http://svn.apache.org/viewvc?rev=789226&view=rev
Log:
Closed Descriptors are equal and equal to NULL

Modified:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Descriptor.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Descriptor32.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Descriptor64.java
    commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Descriptor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Descriptor.java?rev=789226&r1=789225&r2=789226&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Descriptor.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Descriptor.java
Mon Jun 29 06:16:41 2009
@@ -194,3 +194,4 @@
     public abstract String toString();
 
 }
+

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Descriptor32.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Descriptor32.java?rev=789226&r1=789225&r2=789226&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Descriptor32.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Descriptor32.java
Mon Jun 29 06:16:41 2009
@@ -65,9 +65,8 @@
             return true;
         if (Descriptor32.class != other.getClass())
             return false;
-        if (PHANDLE != 0 && PHANDLE == ((Descriptor32)other).PHANDLE)
-            return true;
-        if (IHANDLE >= 0 && IHANDLE == ((Descriptor32)other).IHANDLE)
+        if (PHANDLE == ((Descriptor32)other).PHANDLE &&
+            IHANDLE == ((Descriptor32)other).IHANDLE)
             return true;
         else
             return false;
@@ -87,3 +86,4 @@
     }
 
 }
+

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Descriptor64.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Descriptor64.java?rev=789226&r1=789225&r2=789226&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Descriptor64.java
(original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Descriptor64.java
Mon Jun 29 06:16:41 2009
@@ -65,9 +65,8 @@
             return true;
         if (Descriptor64.class != other.getClass())
             return false;
-        if (PHANDLE != 0 && PHANDLE == ((Descriptor64)other).PHANDLE)
-            return true;
-        if (IHANDLE >= 0 && IHANDLE == ((Descriptor64)other).IHANDLE)
+        if (PHANDLE == ((Descriptor64)other).PHANDLE &&
+            IHANDLE == ((Descriptor64)other).IHANDLE)
             return true;
         else
             return false;
@@ -87,3 +86,4 @@
     }
 
 }
+

Modified: commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java?rev=789226&r1=789225&r2=789226&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java (original)
+++ commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestPrivate.java Mon
Jun 29 06:16:41 2009
@@ -541,8 +541,10 @@
         d1.close();
         assertFalse("Equals closed", d1.equals(d2));
         d2.close();
-        // They never match if both closed
-        assertFalse("Both closed", d1.equals(d2));
+        // They always match if both closed
+        assertTrue("Both closed", d1.equals(d2));
+        // If closed equals to NULL
+        assertTrue("Not NULL", d1.equals(Descriptor.NULL));
 
         d1 = null;
         d2 = null;
@@ -608,3 +610,4 @@
     }
 
 }
+



Mime
View raw message