harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r545052 - in /harmony/enhanced/classlib/branches/java6/modules/luni/src: main/java/java/io/IOException.java test/java/tests/api/java/io/IOExceptionTest.java
Date Thu, 07 Jun 2007 03:45:09 GMT
Author: pyang
Date: Wed Jun  6 20:45:08 2007
New Revision: 545052

URL: http://svn.apache.org/viewvc?view=rev&rev=545052
Log:
Apply patch for HARMONY-4056([classlib][luni][java6]new methods in java.io.IOException)

Modified:
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/IOException.java
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/io/IOExceptionTest.java

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/IOException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/IOException.java?view=diff&rev=545052&r1=545051&r2=545052
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/IOException.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/io/IOException.java
Wed Jun  6 20:45:08 2007
@@ -42,4 +42,29 @@
     public IOException(String detailMessage) {
         super(detailMessage);
     }
+    
+    /**
+     * Constructs a new instance of this class with detail message and cause
+     * filled in.
+     * 
+     * @param message
+     *            The detail message for the exception.
+     * @param cause
+     *            The detail cause for the exception.
+     * @since 1.6
+     */
+    public IOException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * Constructs a new instance of this class with its detail cause filled in.
+     * 
+     * @param cause
+     *            The detail cause for the exception.
+     * @since 1.6
+     */
+    public IOException(Throwable cause) {
+        super(cause == null ? null : cause.toString(), cause);
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/io/IOExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/io/IOExceptionTest.java?view=diff&rev=545052&r1=545051&r2=545052
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/io/IOExceptionTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/io/IOExceptionTest.java
Wed Jun  6 20:45:08 2007
@@ -51,6 +51,52 @@
 		fail("Failed to generate exception");
 	}
 
+    /**
+     * @tests java.io.IOException#IOException(java.lang.String,
+     *        java.lang.Throwable)
+     * @since 1.6
+     */
+    public void test_ConstructorLString_LThrowable() {
+        // Test for constructor java.io.IOException(java.lang.String, java.lang.Throwable)
+
+        IOException ioException = new IOException(
+                "A dummy IOException", new Throwable("A dummy Throwable")); //$NON-NLS-1$//$NON-NLS-2$
+        assertEquals("A dummy IOException", ioException.getMessage()); //$NON-NLS-1$
+
+        try {
+            throw new IOException(
+                    "A dummy error", new Throwable("Some error message")); //$NON-NLS-1$
//$NON-NLS-2$
+        } catch (IOException e) {
+            return;
+        } catch (Exception e) {
+            fail("Exception during IOException test" + e.toString()); //$NON-NLS-1$
+        }
+        fail("Failed to generate exception"); //$NON-NLS-1$
+    }
+
+    /**
+     * @tests java.io.IOException#IOException(java.lang.Throwable)
+     * @since 1.6
+     */
+    public void test_Constructor_LThrowable() {
+        // Test for constructor java.io.IOException(java.lang.Throwable)
+        Throwable cause = new Throwable("A dummy Throwable"); //$NON-NLS-1$
+        IOException ioException = new IOException(cause); 
+        assertEquals(cause.toString(), ioException.getMessage());
+        
+        ioException = new IOException((Throwable)null);
+        assertNull(ioException.getMessage());
+        
+        try {
+            throw new IOException(new Throwable("Some error message")); //$NON-NLS-1$
+        } catch (IOException e) {
+            return;
+        } catch (Exception e) {
+            fail("Exception during IOException test" + e.toString()); //$NON-NLS-1$
+        }
+        fail("Failed to generate exception"); //$NON-NLS-1$
+    }
+    
 	/**
 	 * Sets up the fixture, for example, open a network connection. This method
 	 * is called before a test is executed.



Mime
View raw message