harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r957214 [2/2] - in /harmony/enhanced/java/branches/java6: ./ classlib/ classlib/depends/libs/ classlib/modules/beans/src/main/java/java/beans/ classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/ classlib/modules/...
Date Wed, 23 Jun 2010 14:25:38 GMT
Modified: harmony/enhanced/java/branches/java6/classlib/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerModPowTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerModPowTest.java?rev=957214&r1=957213&r2=957214&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerModPowTest.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerModPowTest.java
Wed Jun 23 14:25:36 2010
@@ -47,6 +47,13 @@ public class BigIntegerModPowTest extend
 		} catch (ArithmeticException e) {
 			assertEquals("Improper exception message", "BigInteger: modulus not positive", e.getMessage());
 		}
+
+        try {
+            BigInteger.ZERO.modPow(new BigInteger("-1"), new BigInteger("10"));
+            fail("ArithmeticException has not been caught");
+        } catch (ArithmeticException e) {
+            // expected
+        }
 	}
 
 	/**
@@ -95,6 +102,29 @@ public class BigIntegerModPowTest extend
 		assertEquals("incorrect sign", 1, result.signum());
 	}
 
+    public void testModPowZeroExp() {
+        BigInteger exp = new BigInteger("0");
+        BigInteger[] base = new BigInteger[] {new BigInteger("-1"), new BigInteger("0"),
new BigInteger("1")};
+        BigInteger[] mod = new BigInteger[] {new BigInteger("2"), new BigInteger("10"), new
BigInteger("2147483648")};
+
+        for (int i = 0; i < base.length; ++i) {
+            for (int j = 0; j < mod.length; ++j) {
+                assertEquals(base[i] + " modePow(" + exp + ", " + mod[j]
+                        + ") should be " + BigInteger.ONE, BigInteger.ONE,
+                        base[i].modPow(exp, mod[j]));
+            }
+        }
+
+        mod = new BigInteger[] {new BigInteger("1")};
+        for (int i = 0; i < base.length; ++i) {
+            for (int j = 0; j < mod.length; ++j) {
+                assertEquals(base[i] + " modePow(" + exp + ", " + mod[j]
+                        + ") should be " + BigInteger.ZERO, BigInteger.ZERO,
+                        base[i].modPow(exp, mod[j]));
+            }
+        }
+    }
+
 	/**
 	 * modInverse: non-positive modulus
 	 */

Modified: harmony/enhanced/java/branches/java6/classlib/modules/nio/src/main/native/nio/shared/AddressUtil.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/nio/src/main/native/nio/shared/AddressUtil.c?rev=957214&r1=957213&r2=957214&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/nio/src/main/native/nio/shared/AddressUtil.c
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/nio/src/main/native/nio/shared/AddressUtil.c
Wed Jun 23 14:25:36 2010
@@ -27,17 +27,34 @@ JNIEXPORT jlong JNICALL Java_org_apache_
 	jclass descriptorCLS;
 	jfieldID descriptorFID;
 	hysocket_t hysocketP;
+
 	//TODO add to cache
 	descriptorCLS = (*env)->FindClass (env, "java/io/FileDescriptor");
 	if (NULL == descriptorCLS){
 		return 0;
 	}
+
 	descriptorFID = (*env)->GetFieldID (env, descriptorCLS, "descriptor", "J");
 	if (NULL == descriptorFID){
 		return 0;
 	}
+
 	hysocketP = (hysocket_t) ((IDATA)((*env)->GetLongField (env, fd, descriptorFID)));
-	return SOCKET_CAST(hysocketP);
+    if (NULL == hysocketP) {
+        return 0;
+    }
+
+#if defined(WIN32) || defined(WIN64)
+    if (hysocketP->flags & SOCKET_IPV4_OPEN_MASK) {
+        return (jlong)(hysocketP->ipv4);
+    } else if (hysocketP->flags & SOCKET_IPV6_OPEN_MASK) {
+        return (jlong)(hysocketP->ipv6);
+    } else {
+        return 0;
+    }
+#else 
+    return (jlong)(hysocketP->sock);
+#endif
 }
 
 

Modified: harmony/enhanced/java/branches/java6/classlib/modules/swing/src/main/java/common/javax/swing/tree/DefaultMutableTreeNode.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/swing/src/main/java/common/javax/swing/tree/DefaultMutableTreeNode.java?rev=957214&r1=957213&r2=957214&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/swing/src/main/java/common/javax/swing/tree/DefaultMutableTreeNode.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/swing/src/main/java/common/javax/swing/tree/DefaultMutableTreeNode.java
Wed Jun 23 14:25:36 2010
@@ -505,8 +505,17 @@ public class DefaultMutableTreeNode impl
         return getUserObject() != null ? getUserObject().toString() : null;
     }
 
+    @Override
     public Object clone() {
-        return new DefaultMutableTreeNode(getUserObject());
+        try {
+            DefaultMutableTreeNode clone = (DefaultMutableTreeNode) super.clone();
+            // Spec says the new node must have no parent or children
+            clone.parent = null;
+            clone.children = null;
+            return clone;
+        } catch (CloneNotSupportedException e) {
+            throw new RuntimeException(e);
+        }
     }
 
 

Modified: harmony/enhanced/java/branches/java6/classlib/modules/swing/src/test/api/java.injected/javax/swing/JTree_DynamicUtilTreeNodeTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/branches/java6/classlib/modules/swing/src/test/api/java.injected/javax/swing/JTree_DynamicUtilTreeNodeTest.java?rev=957214&r1=957213&r2=957214&view=diff
==============================================================================
--- harmony/enhanced/java/branches/java6/classlib/modules/swing/src/test/api/java.injected/javax/swing/JTree_DynamicUtilTreeNodeTest.java
(original)
+++ harmony/enhanced/java/branches/java6/classlib/modules/swing/src/test/api/java.injected/javax/swing/JTree_DynamicUtilTreeNodeTest.java
Wed Jun 23 14:25:36 2010
@@ -148,6 +148,13 @@ public class JTree_DynamicUtilTreeNodeTe
         assertTrue(node.loadedChildren);
     }
 
+    public void testClone() {
+        Object obj = new Object();
+        DynamicUtilTreeNode t = new DynamicUtilTreeNode(obj, obj);
+        Object cl = t.clone();
+        assertEquals(t.getClass(), cl.getClass());
+    }
+
     public void testChildren() throws Exception {
         DynamicUtilTreeNode node = new DynamicUtilTreeNode("value", new Object[] { "1", "2"
});
         assertFalse(node.loadedChildren);

Propchange: harmony/enhanced/java/branches/java6/common_resources/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun 23 14:25:36 2010
@@ -1,4 +1,4 @@
 /harmony/enhanced/java/branches/mrh/common_resources:935751-941490
-/harmony/enhanced/java/trunk/common_resources:929253-953280
+/harmony/enhanced/java/trunk/common_resources:929253-956455
 /harmony/enhanced/trunk/common_resources:476395-929252
 /incubator/harmony/enhanced/trunk/common_resources:292550-476394

Propchange: harmony/enhanced/java/branches/java6/drlvm/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun 23 14:25:36 2010
@@ -1,5 +1,5 @@
 /harmony/enhanced/java/branches/mrh/drlvm:935751-941490
-/harmony/enhanced/java/trunk/drlvm:929253-953280
+/harmony/enhanced/java/trunk/drlvm:929253-956455
 /harmony/enhanced/trunk/drlvm:476395-929252
 /harmony/enhanced/trunk/working_vm:476396-920147
 /incubator/harmony/enhanced/trunk/working_vm:423974-476394

Propchange: harmony/enhanced/java/branches/java6/jdktools/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun 23 14:25:36 2010
@@ -1,4 +1,4 @@
-/harmony/enhanced/java/trunk/jdktools:929253-953280
+/harmony/enhanced/java/trunk/jdktools:929253-956455
 /harmony/enhanced/jdktools/trunk:630107-925933
 /harmony/enhanced/trunk/jdktools:476395-929252
 /harmony/enhanced/trunk/working_jdktools:476396-920147



Mime
View raw message