You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ch...@apache.org on 2008/09/17 10:36:30 UTC

svn commit: r696197 - in /harmony/enhanced: classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerCloneExceptionTest.java drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Throwable.java

Author: chunrong
Date: Wed Sep 17 01:36:28 2008
New Revision: 696197

URL: http://svn.apache.org/viewvc?rev=696197&view=rev
Log:
Apply patch for HARMONY-5971: Change Throwable.initCause() to behave the same as the one in luni

Modified:
    harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerCloneExceptionTest.java
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Throwable.java

Modified: harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerCloneExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerCloneExceptionTest.java?rev=696197&r1=696196&r2=696197&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerCloneExceptionTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/server/ServerCloneExceptionTest.java Wed Sep 17 01:36:28 2008
@@ -68,8 +68,8 @@
         assertNull(e.detail);
         try {
             e.initCause(e);
-            fail("No expected IllegalArgumentException");
-        } catch (IllegalArgumentException exception) {
+            fail("No expected IllegalStateException");
+        } catch (IllegalStateException exception) {
             // expected
         }
     }

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Throwable.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Throwable.java?rev=696197&r1=696196&r2=696197&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Throwable.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/java/lang/Throwable.java Wed Sep 17 01:36:28 2008
@@ -118,16 +118,16 @@
      * @com.intel.drl.spec_ref 
      */
 	public Throwable initCause(Throwable initialCause) {
-		if (initialCause == this) {
+		if (cause == this) {
+			if (initialCause != this) {
+				cause = initialCause;
+				return this;
+			}
 			throw new IllegalArgumentException("A throwable cannot be its own cause.");
 		}
 		// second call of initCause(Throwable)
-		if (cause != this) {
-			throw new IllegalStateException("A cause can be set at most once." + 
+		throw new IllegalStateException("A cause can be set at most once." + 
                     " Illegal attempt to re-set the cause of " + this);
-		}
-		cause = initialCause;
-		return this;
 	}
 
     /**