You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by to...@apache.org on 2008/05/01 05:14:38 UTC

svn commit: r652421 [4/6] - in /harmony/enhanced/classlib/branches/java6/modules: beans/src/main/java/java/beans/ beans/src/main/java/org/apache/harmony/beans/editors/ beans/src/test/java/org/apache/harmony/beans/tests/java/beans/ imageio/src/main/java...

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/IllegalArgumentExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/IllegalArgumentExceptionTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/IllegalArgumentExceptionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/IllegalArgumentExceptionTest.java Wed Apr 30 20:14:31 2008
@@ -43,6 +43,23 @@
 	}
     
     /**
+     * @tests {@link java.lang.IllegalArgumentException#IllegalArgumentException(Throwable)}
+     */
+    public void test_ConstructorLjava_lang_Throwable() {
+        Throwable emptyThrowable = new Exception();
+        IllegalArgumentException emptyException = new IllegalArgumentException(emptyThrowable);
+        assertEquals(emptyThrowable.getClass().getName(), emptyException.getMessage());
+        assertEquals(emptyThrowable.getClass().getName(), emptyException.getLocalizedMessage());
+        assertEquals(emptyThrowable.getClass().getName(), emptyException.getCause().toString());
+
+        Throwable exception = new Exception("msg");
+        IllegalArgumentException e = new IllegalArgumentException(exception);
+        assertEquals(exception.getClass().getName() + ": " + "msg", e.getMessage());
+        assertEquals(exception.getClass().getName(), emptyException.getLocalizedMessage());
+        assertEquals(exception.getClass().getName(), emptyException.getCause().toString());
+    }
+    
+    /**
      * @tests java.lang.IllegalArgumentException#IllegalArgumentException(String,Throwable)
      */
     @SuppressWarnings("nls")

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/IllegalStateExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/IllegalStateExceptionTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/IllegalStateExceptionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/IllegalStateExceptionTest.java Wed Apr 30 20:14:31 2008
@@ -41,6 +41,41 @@
         assertEquals("fixture", e.getMessage());
         assertNull(e.getCause());
     }
+    
+    /**
+     * @tests {@link java.land.IllegalStateException#IllIllegalStateException(java.lang.Throwable)}
+     */
+    public void test_ConstructorLjava_lang_Throwable() {
+        Throwable emptyThrowable = new Exception();
+        IllegalStateException emptyException = new IllegalStateException(emptyThrowable);
+        assertEquals(emptyThrowable.getClass().getName(), emptyException.getMessage());
+        assertEquals(emptyThrowable.getClass().getName(), emptyException.getLocalizedMessage());
+        assertEquals(emptyThrowable.getClass().getName(), emptyException.getCause().toString());
+
+        Throwable throwable = new Exception("msg");
+        IllegalStateException exception = new IllegalStateException(throwable);
+        assertEquals(throwable.getClass().getName() + ": " + "msg", exception.getMessage());
+        assertEquals(throwable.getClass().getName(), emptyException.getLocalizedMessage());
+        assertEquals(throwable.getClass().getName(), emptyException.getCause().toString());
+    }
+
+    /**
+     * @tests {@link java.land.IllegalStateException#IllIllegalStateException(java.lang.String, java.lang.Throwable)}
+     */
+    public void test_ConstructorLjava_lang_StringLjava_lang_Throwable() {
+        Throwable emptyThrowable = new Exception();
+        IllegalStateException emptyException = new IllegalStateException("msg", emptyThrowable);
+        assertEquals("msg", emptyException.getMessage());
+        assertEquals("msg", emptyException.getLocalizedMessage());
+        assertEquals(emptyThrowable.getClass().getName(), emptyException.getCause().toString());
+
+        Throwable throwable = new Exception("msg_exception");
+        IllegalStateException exception = new IllegalStateException("msg", throwable);
+        assertEquals("msg", exception.getMessage());
+        assertEquals("msg", exception.getLocalizedMessage());
+        assertEquals(throwable.getClass().getName() + ": " + throwable.getMessage(), exception
+                .getCause().toString());
+    }
 
     /**
      * @tests serialization/deserialization.

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/RuntimeExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/RuntimeExceptionTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/RuntimeExceptionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/RuntimeExceptionTest.java Wed Apr 30 20:14:31 2008
@@ -39,4 +39,21 @@
         assertEquals("fixture", e.getMessage());
         assertNull(e.getCause());
     }
+    
+    /**
+     * @tests {@link java.lang.RuntimeException#RuntimeException(Throwable)}
+     */
+    public void test_ConstructorLjava_lang_Throwable() {
+        Throwable emptyThrowable = new Exception();
+        RuntimeException emptyException = new RuntimeException(emptyThrowable);
+        assertEquals(emptyThrowable.getClass().getName(), emptyException.getMessage());
+        assertEquals(emptyThrowable.getClass().getName(), emptyException.getLocalizedMessage());
+        assertEquals(emptyThrowable.getClass().getName(), emptyException.getCause().toString());
+
+        Throwable throwable = new Exception("msg");
+        RuntimeException exception = new RuntimeException(throwable);
+        assertEquals(throwable.getClass().getName() + ": " + "msg", exception.getMessage());
+        assertEquals(throwable.getClass().getName(), emptyException.getLocalizedMessage());
+        assertEquals(throwable.getClass().getName(), emptyException.getCause().toString());
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/UnsupportedOperationExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/UnsupportedOperationExceptionTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/UnsupportedOperationExceptionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/UnsupportedOperationExceptionTest.java Wed Apr 30 20:14:31 2008
@@ -41,6 +41,45 @@
         assertEquals("fixture", e.getMessage());
         assertNull(e.getCause());
     }
+    
+    /**
+     * @tests {@link java.land.UnsupportedOperationException#UnsupportedOperationException(java.lang.Throwable)}
+     */
+    public void test_ConstructorLjava_lang_Throwable() {
+        Throwable emptyThrowable = new Exception();
+        UnsupportedOperationException emptyException = new UnsupportedOperationException(
+                emptyThrowable);
+        assertEquals(emptyThrowable.getClass().getName(), emptyException.getMessage());
+        assertEquals(emptyThrowable.getClass().getName(), emptyException.getLocalizedMessage());
+        assertEquals(emptyThrowable.getClass().getName(), emptyException.getCause().toString());
+
+        Throwable throwable = new Exception("msg");
+        UnsupportedOperationException exception = new UnsupportedOperationException(throwable);
+        assertEquals(throwable.getClass().getName() + ": " + "msg", exception.getMessage());
+        assertEquals(throwable.getClass().getName(), emptyException.getLocalizedMessage());
+        assertEquals(throwable.getClass().getName(), emptyException.getCause().toString());
+    }
+
+    /**
+     * @tests {@link java.land.UnsupportedOperationException#UnsupportedOperationException(java.lang.String, java.lang.Throwable)}
+     */
+    public void test_ConstructorLjava_lang_StringLjava_lang_Throwable() {
+        Throwable emptyThrowable = new Exception();
+        UnsupportedOperationException emptyException = new UnsupportedOperationException(
+                "msg", emptyThrowable);
+        assertEquals("msg", emptyException.getMessage());
+        assertEquals("msg", emptyException.getLocalizedMessage());
+        assertEquals(emptyThrowable.getClass().getName(), emptyException.getCause().toString());
+
+        Throwable throwable = new Exception("msg_exception");
+        UnsupportedOperationException exception = new UnsupportedOperationException(
+                "msg", throwable);
+        assertEquals("msg", exception.getMessage());
+        assertEquals("msg", exception.getLocalizedMessage());
+        assertEquals(throwable.getClass().getName() + ": " + throwable.getMessage(), exception
+                .getCause().toString());
+    }
+    
 	
     /**
      * @tests serialization/deserialization.

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/DatagramSocketTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/DatagramSocketTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/DatagramSocketTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/DatagramSocketTest.java Wed Apr 30 20:14:31 2008
@@ -23,6 +23,7 @@
 import java.net.DatagramPacket;
 import java.net.DatagramSocket;
 import java.net.DatagramSocketImpl;
+import java.net.DatagramSocketImplFactory;
 import java.net.Inet4Address;
 import java.net.Inet6Address;
 import java.net.InetAddress;
@@ -35,6 +36,8 @@
 import java.net.UnknownHostException;
 import java.util.Date;
 
+import org.apache.harmony.luni.net.SocketImplProvider;
+
 import tests.support.Support_Configuration;
 import tests.support.Support_PortManager;
 
@@ -932,6 +935,38 @@
             d.close();
         }
     }
+    
+    /**
+     * @tests {@link java.net.DatagramSocket#setDatagramSocketImplFactory(DatagramSocketImplFactory)}
+     */
+    public void test_set_Datagram_SocketImpl_Factory() throws IOException {
+        DatagramSocketImplFactory factory = new MockDatagramSocketImplFactory();
+        // Should not throw SocketException when set DatagramSocketImplFactory
+        // for the first time.
+        DatagramSocket.setDatagramSocketImplFactory(factory);
+
+        try {
+            DatagramSocket.setDatagramSocketImplFactory(null);
+            fail("Should throw SocketException");
+        } catch (SocketException e) {
+            // Expected
+        }
+
+        try {
+            DatagramSocket.setDatagramSocketImplFactory(factory);
+            fail("Should throw SocketException");
+        } catch (SocketException e) {
+            // Expected
+        }
+    }
+
+    private class MockDatagramSocketImplFactory implements
+            DatagramSocketImplFactory {
+
+        public DatagramSocketImpl createDatagramSocketImpl() {
+            return SocketImplProvider.getDatagramSocketImpl();
+        }
+    }
 
     /**
      * @tests java.net.DatagramSocket#setSendBufferSize(int)

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/HttpURLConnectionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/HttpURLConnectionTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/HttpURLConnectionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/HttpURLConnectionTest.java Wed Apr 30 20:14:31 2008
@@ -24,6 +24,7 @@
 import java.net.CacheResponse;
 import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
+import java.net.ProtocolException;
 import java.net.ResponseCache;
 import java.net.SocketPermission;
 import java.net.URI;
@@ -584,6 +585,72 @@
     }
     
     /**
+     * @tests {@link java.net.HttpURLConnection#setFollowRedirects(boolean)}
+     * @tests {@link java.net.HttpURLConnection#getFollowRedirects()}
+     */
+    public void test_followRedirects() {
+        assertTrue("The default value of followRedirects is not true",
+                HttpURLConnection.getFollowRedirects());
+
+        HttpURLConnection.setFollowRedirects(false);
+        assertFalse(HttpURLConnection.getFollowRedirects());
+
+        HttpURLConnection.setFollowRedirects(true);
+        assertTrue(HttpURLConnection.getFollowRedirects());
+    }
+
+    /**
+     * @throws ProtocolException 
+     * @tests {@link java.net.HttpURLConnection#setRequestMethod(String)}
+     * @tests {@link java.net.HttpURLConnection#getRequestMethod()}
+     */
+    public void test_requestMethod() throws MalformedURLException, ProtocolException{
+        URL url = new URL("http://harmony.apache.org/");
+        
+        HttpURLConnection con = new MyHttpURLConnection(url);
+        assertEquals("The default value of requestMethod is not \"GET\"", "GET",
+                con.getRequestMethod());
+
+        String[] methods = { "GET", "DELETE", "HEAD", "OPTIONS", "POST", "PUT",
+                "TRACE" };
+        // Nomal set. Should not throw ProtocolException
+        for (String method : methods) {
+            con.setRequestMethod(method);
+            assertEquals("The value of requestMethod is not " + method, method,
+                    con.getRequestMethod());
+        }
+            
+        try {
+            con.setRequestMethod("Wrong method");
+            fail("Should throw ProtocolException");
+        } catch (ProtocolException e) {
+            // Expected
+        }
+    }
+
+    private static class MyHttpURLConnection extends HttpURLConnection {
+
+        protected MyHttpURLConnection(URL url) {
+            super(url);
+        }
+
+        @Override
+        public void disconnect() {
+            // do nothing
+        }
+
+        @Override
+        public boolean usingProxy() {
+            return false;
+        }
+
+        @Override
+        public void connect() throws IOException {
+            // do nothing
+        }
+    }
+    
+    /**
      * @tests java.net.URLConnection#getPermission()
      */
     public void test_Permission() throws Exception {

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/Inet6AddressTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/Inet6AddressTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/Inet6AddressTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/Inet6AddressTest.java Wed Apr 30 20:14:31 2008
@@ -854,6 +854,19 @@
 		assertNull(v6Addr.getScopedInterface());
 	}
 
+    /**
+     * @tests {@link java.net.Inet6Address#hashCode()}
+     */
+    public void test_hashCode() throws UnknownHostException{
+        byte[] addr = { (byte) 0xFE, (byte) 0x80, 0, 0, 0, 0, 0, 0, 0x02, 0x11,
+                0x25, (byte) 0xFF, (byte) 0xFE, (byte) 0xF8, (byte) 0x7C,
+                (byte) 0xB2 };
+        Inet6Address address1, address2;
+        
+        address1 = Inet6Address.getByAddress("123", addr, 0);
+        address2 = Inet6Address.getByAddress("1234", addr, 0);
+        assertEquals(address1.hashCode(), address2.hashCode());
+    }
 	
 	int bytesToInt(byte bytes[], int start) {
 

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/InetAddressTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/InetAddressTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/InetAddressTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/InetAddressTest.java Wed Apr 30 20:14:31 2008
@@ -129,6 +129,23 @@
             }
         }
     }
+    
+    /**
+     * @tests java.net.InetAddress#getByName(String)
+     */
+    public void test_getByNameUnknownHostException() {
+        // Related to HARMONY-5784
+
+        // loop a few times to flex the negative cache paths
+        for (int i = 0; i < 5; i++) {
+            try {
+                InetAddress.getByName("unknown.unknown.bad");
+                fail("An UnknownHostException should have been thrown");
+            } catch (UnknownHostException e) {
+                assertEquals("unknown.unknown.bad", e.getMessage());
+            }
+        }
+    }
 
     /**
      * @tests java.net.InetAddress#equals(java.lang.Object)

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/ServerSocketTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/ServerSocketTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/ServerSocketTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/ServerSocketTest.java Wed Apr 30 20:14:31 2008
@@ -30,10 +30,13 @@
 import java.net.SocketAddress;
 import java.net.SocketException;
 import java.net.SocketImpl;
+import java.net.SocketImplFactory;
 import java.net.UnknownHostException;
 import java.util.Date;
 import java.util.Properties;
 
+import org.apache.harmony.luni.net.SocketImplProvider;
+
 import tests.support.Support_Configuration;
 import tests.support.Support_Exec;
 
@@ -306,11 +309,32 @@
     /**
      * @tests java.net.ServerSocket#setSocketFactory(java.net.SocketImplFactory)
      */
-    public void test_setSocketFactoryLjava_net_SocketImplFactory() {
-        // Test for method void
-        // java.net.ServerSocket.setSocketFactory(java.net.SocketImplFactory)
+    public void test_setSocketFactoryLjava_net_SocketImplFactory()
+            throws IOException {
+        SocketImplFactory factory = new MockSocketImplFactory();
+        // Should not throw SocketException when set DatagramSocketImplFactory
+        // for the first time.
+        ServerSocket.setSocketFactory(factory);
+
+        try {
+            ServerSocket.setSocketFactory(null);
+            fail("Should throw SocketException");
+        } catch (SocketException e) {
+            // Expected
+        }
 
-        // TODO : Implementation
+        try {
+            ServerSocket.setSocketFactory(factory);
+            fail("Should throw SocketException");
+        } catch (SocketException e) {
+            // Expected
+        }
+    }
+
+    private static class MockSocketImplFactory implements SocketImplFactory {
+        public SocketImpl createSocketImpl() {
+            return SocketImplProvider.getServerSocketImpl();
+        }
     }
 
     /**

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketImplTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketImplTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketImplTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketImplTest.java Wed Apr 30 20:14:31 2008
@@ -57,9 +57,22 @@
             // expected
         }
     }
+    
+    /**
+     * @tests java.net.SocketImpl#shutdownInput()
+     */
+    public void test_shutdownInput() {
+        MockSocketImpl s = new MockSocketImpl();
+        try {
+            s.shutdownInput();
+            fail("This method is still not implemented yet,It should throw IOException.");
+        } catch (IOException e) {
+            // Expected
+        }
+    }
 
     /**
-     * @tests java.net.SocketImpl#shutdownOutput()
+     * @tests java.net.SocketImpl#supportsUrgentData()
      */
     public void test_supportsUrgentData() {
         MockSocketImpl s = new MockSocketImpl();
@@ -129,6 +142,10 @@
         public void shutdownOutput() throws IOException {
             super.shutdownOutput();
         }
+        
+        public void shutdownInput() throws IOException{
+            super.shutdownInput();
+        }
 
         public boolean testSupportsUrgentData() {
             return super.supportsUrgentData();

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketPermissionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketPermissionTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketPermissionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketPermissionTest.java Wed Apr 30 20:14:31 2008
@@ -22,6 +22,8 @@
 import java.net.UnknownHostException;
 import java.security.PermissionCollection;
 
+import org.apache.harmony.testframework.serialization.SerializationTest;
+
 import tests.support.Support_Configuration;
 
 public class SocketPermissionTest extends junit.framework.TestCase {
@@ -193,4 +195,13 @@
         assertTrue("A different host should not imply resolve", !pc
                 .implies(star_Resolve));
     }
+    
+    /**
+     * @tests serialization/deserialization.
+     */
+    public void testSerializationSelf() throws Exception {
+        SocketPermission permission = new SocketPermission("harmony.apache.org", "connect");;
+
+        SerializationTest.verifySelf(permission);
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/SocketTest.java Wed Apr 30 20:14:31 2008
@@ -31,10 +31,13 @@
 import java.net.SocketAddress;
 import java.net.SocketException;
 import java.net.SocketImpl;
+import java.net.SocketImplFactory;
 import java.net.SocketTimeoutException;
 import java.net.UnknownHostException;
 import java.security.Permission;
 
+import org.apache.harmony.luni.net.SocketImplProvider;
+
 import tests.support.Support_Configuration;
 
 public class SocketTest extends SocketTestCase {
@@ -2061,4 +2064,36 @@
         client.close();
         server.close();
     }
+    
+    /**
+     * @tests {@link java.net.Socket#setSocketImplFactory(SocketImplFactory)}
+     */
+    public void test_setSocketFactoryLjava_net_SocketImplFactory()
+            throws IOException {
+        SocketImplFactory factory = new MockSocketImplFactory();
+        // Should not throw SocketException when set DatagramSocketImplFactory
+        // for the first time.
+        Socket.setSocketImplFactory(factory);
+
+        try {
+            Socket.setSocketImplFactory(null);
+            fail("Should throw SocketException");
+        } catch (SocketException e) {
+            // Expected
+        }
+
+        try {
+            Socket.setSocketImplFactory(factory);
+            fail("Should throw SocketException");
+        } catch (SocketException e) {
+            // Expected
+        }
+    }
+
+    private class MockSocketImplFactory implements SocketImplFactory {
+
+        public SocketImpl createSocketImpl() {
+            return SocketImplProvider.getServerSocketImpl();
+        }
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URITest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URITest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URITest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/URITest.java Wed Apr 30 20:14:31 2008
@@ -23,6 +23,8 @@
 
 import junit.framework.TestCase;
 
+import org.apache.harmony.testframework.serialization.SerializationTest;
+
 public class URITest extends TestCase {
 
     private URI[] uris;
@@ -1834,4 +1836,13 @@
             }
         }
     }
+    
+    /**
+     * @tests serialization/deserialization.
+     */
+    public void testSerializationSelf() throws Exception {
+        URI uri = new URI("http://harmony.apache.org/");
+
+        SerializationTest.verifySelf(uri);
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/AbstractMapTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/AbstractMapTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/AbstractMapTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/AbstractMapTest.java Wed Apr 30 20:14:31 2008
@@ -35,168 +35,256 @@
 
 public class AbstractMapTest extends junit.framework.TestCase {
 
-	static final String specialKey = "specialKey".intern();
+    static final String specialKey = "specialKey".intern();
 
-	static final String specialValue = "specialValue".intern();
+    static final String specialValue = "specialValue".intern();
 
-	// The impl of MyMap is not realistic, but serves to create a type
-	// that uses the default remove behavior.
-	class MyMap extends AbstractMap {
-		final Set mySet = new HashSet(1);
-
-		MyMap() {
-			mySet.add(new Map.Entry() {
-				public Object getKey() {
-					return specialKey;
-				}
-
-				public Object getValue() {
-					return specialValue;
-				}
-
-				public Object setValue(Object object) {
-					return null;
-				}
-			});
-		}
-
-		public Object put(Object key, Object value) {
-			return null;
-		}
-
-		public Set entrySet() {
-			return mySet;
-		}
-	}
-
-	/**
-	 * @tests java.util.AbstractMap#keySet()
-	 */
-	public void test_keySet() {
-		AbstractMap map1 = new HashMap(0);
-		assertSame("HashMap(0)", map1.keySet(), map1.keySet());
-
-		AbstractMap map2 = new HashMap(10);
-		assertSame("HashMap(10)", map2.keySet(), map2.keySet());
-
-		Map map3 = Collections.EMPTY_MAP;
-		assertSame("EMPTY_MAP", map3.keySet(), map3.keySet());
-
-		AbstractMap map4 = new IdentityHashMap(1);
-		assertSame("IdentityHashMap", map4.keySet(), map4.keySet());
-
-		AbstractMap map5 = new LinkedHashMap(122);
-		assertSame("LinkedHashMap", map5.keySet(), map5.keySet());
-
-		AbstractMap map6 = new TreeMap();
-		assertSame("TreeMap", map6.keySet(), map6.keySet());
-
-		AbstractMap map7 = new WeakHashMap();
-		assertSame("WeakHashMap", map7.keySet(), map7.keySet());
-	}
-
-	/**
-	 * @tests java.util.AbstractMap#remove(java.lang.Object)
-	 */
-	public void test_removeLjava_lang_Object() {
-		Object key = new Object();
-		Object value = new Object();
-
-		AbstractMap map1 = new HashMap(0);
-		map1.put("key", value);
-		assertSame("HashMap(0)", map1.remove("key"), value);
-
-		AbstractMap map4 = new IdentityHashMap(1);
-		map4.put(key, value);
-		assertSame("IdentityHashMap", map4.remove(key), value);
-
-		AbstractMap map5 = new LinkedHashMap(122);
-		map5.put(key, value);
-		assertSame("LinkedHashMap", map5.remove(key), value);
-
-		AbstractMap map6 = new TreeMap(new Comparator() {
-			// Bogus comparator
-			public int compare(Object object1, Object object2) {
-				return 0;
-			}
-		});
-		map6.put(key, value);
-		assertSame("TreeMap", map6.remove(key), value);
-
-		AbstractMap map7 = new WeakHashMap();
-		map7.put(key, value);
-		assertSame("WeakHashMap", map7.remove(key), value);
-
-		AbstractMap aSpecialMap = new MyMap();
-		aSpecialMap.put(specialKey, specialValue);
-		Object valueOut = aSpecialMap.remove(specialKey);
-		assertSame("MyMap", valueOut, specialValue);
-	}
-
-	/**
-	 * @tests java.util.AbstractMap#values()
-	 */
-	public void test_values() {
-		AbstractMap map1 = new HashMap(0);
-		assertSame("HashMap(0)", map1.values(), map1.values());
-
-		AbstractMap map2 = new HashMap(10);
-		assertSame("HashMap(10)", map2.values(), map2.values());
-
-		Map map3 = Collections.EMPTY_MAP;
-		assertSame("EMPTY_MAP", map3.values(), map3.values());
-
-		AbstractMap map4 = new IdentityHashMap(1);
-		assertSame("IdentityHashMap", map4.values(), map4.values());
-
-		AbstractMap map5 = new LinkedHashMap(122);
-		assertSame("IdentityHashMap", map5.values(), map5.values());
-
-		AbstractMap map6 = new TreeMap();
-		assertSame("TreeMap", map6.values(), map6.values());
-
-		AbstractMap map7 = new WeakHashMap();
-		assertSame("WeakHashMap", map7.values(), map7.values());
-	}
-
-	/**
-	 * @tests java.util.AbstractMap#clone()
-	 */
-	public void test_clone() {
-		class MyMap extends AbstractMap implements Cloneable {
-			private Map map = new HashMap();
-
-			public Set entrySet() {
-				return map.entrySet();
-			}
-
-			public Object put(Object key, Object value) {
-				return map.put(key, value);
-			}
-
-			public Map getMap() {
-				return map;
-			}
-
-			public Object clone() {
-				try {
-					return super.clone();
-				} catch (CloneNotSupportedException e) {
-					return null;
-				}
-			}
-		}
-		;
-		MyMap map = new MyMap();
-		map.put("one", "1");
-		Map.Entry entry = (Map.Entry) map.entrySet().iterator().next();
-		assertTrue("entry not added", entry.getKey() == "one"
-				&& entry.getValue() == "1");
-		MyMap mapClone = (MyMap) map.clone();
-		assertTrue("clone not shallow", map.getMap() == mapClone.getMap());
-	}
-	
-	public class AMT extends AbstractMap {
+    // The impl of MyMap is not realistic, but serves to create a type
+    // that uses the default remove behavior.
+    class MyMap extends AbstractMap {
+        final Set mySet = new HashSet(1);
+
+        MyMap() {
+            mySet.add(new Map.Entry() {
+                public Object getKey() {
+                    return specialKey;
+                }
+
+                public Object getValue() {
+                    return specialValue;
+                }
+
+                public Object setValue(Object object) {
+                    return null;
+                }
+            });
+        }
+
+        public Object put(Object key, Object value) {
+            return null;
+        }
+
+        public Set entrySet() {
+            return mySet;
+        }
+    }
+
+    /**
+     * @tests java.util.AbstractMap#keySet()
+     */
+    public void test_keySet() {
+        AbstractMap map1 = new HashMap(0);
+        assertSame("HashMap(0)", map1.keySet(), map1.keySet());
+
+        AbstractMap map2 = new HashMap(10);
+        assertSame("HashMap(10)", map2.keySet(), map2.keySet());
+
+        Map map3 = Collections.EMPTY_MAP;
+        assertSame("EMPTY_MAP", map3.keySet(), map3.keySet());
+
+        AbstractMap map4 = new IdentityHashMap(1);
+        assertSame("IdentityHashMap", map4.keySet(), map4.keySet());
+
+        AbstractMap map5 = new LinkedHashMap(122);
+        assertSame("LinkedHashMap", map5.keySet(), map5.keySet());
+
+        AbstractMap map6 = new TreeMap();
+        assertSame("TreeMap", map6.keySet(), map6.keySet());
+
+        AbstractMap map7 = new WeakHashMap();
+        assertSame("WeakHashMap", map7.keySet(), map7.keySet());
+    }
+
+    /**
+     * @tests java.util.AbstractMap#remove(java.lang.Object)
+     */
+    public void test_removeLjava_lang_Object() {
+        Object key = new Object();
+        Object value = new Object();
+
+        AbstractMap map1 = new HashMap(0);
+        map1.put("key", value);
+        assertSame("HashMap(0)", map1.remove("key"), value);
+
+        AbstractMap map4 = new IdentityHashMap(1);
+        map4.put(key, value);
+        assertSame("IdentityHashMap", map4.remove(key), value);
+
+        AbstractMap map5 = new LinkedHashMap(122);
+        map5.put(key, value);
+        assertSame("LinkedHashMap", map5.remove(key), value);
+
+        AbstractMap map6 = new TreeMap(new Comparator() {
+            // Bogus comparator
+            public int compare(Object object1, Object object2) {
+                return 0;
+            }
+        });
+        map6.put(key, value);
+        assertSame("TreeMap", map6.remove(key), value);
+
+        AbstractMap map7 = new WeakHashMap();
+        map7.put(key, value);
+        assertSame("WeakHashMap", map7.remove(key), value);
+
+        AbstractMap aSpecialMap = new MyMap();
+        aSpecialMap.put(specialKey, specialValue);
+        Object valueOut = aSpecialMap.remove(specialKey);
+        assertSame("MyMap", valueOut, specialValue);
+    }
+
+    /**
+     * @tests java.util.AbstractMap#clear()
+     */
+    public void test_clear() {
+        // normal clear()
+        AbstractMap map = new HashMap();
+        map.put(1, 1);
+        map.clear();
+        assertTrue(map.isEmpty());
+
+        // Special entrySet return a Set with no clear method.
+        AbstractMap myMap = new MocAbstractMap();
+        try {
+            myMap.clear();
+            fail("Should throw UnsupportedOprationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+    }
+
+    class MocAbstractMap<K, V> extends AbstractMap {
+
+        public Set entrySet() {
+            Set set = new MySet();
+            return set;
+        }
+
+        class MySet extends HashSet {
+            public void clear() {
+                throw new UnsupportedOperationException();
+            }
+        }
+    }
+
+    /**
+     * @tests java.util.AbstractMap#containsKey(Object)
+     */
+    public void test_containsKey() {
+        AbstractMap map = new AMT();
+
+        assertFalse(map.containsKey("k"));
+        assertFalse(map.containsKey(null));
+
+        map.put("k", "v");
+        map.put("key", null);
+        map.put(null, "value");
+        map.put(null, null);
+
+        assertTrue(map.containsKey("k"));
+        assertTrue(map.containsKey("key"));
+        assertTrue(map.containsKey(null));
+    }
+
+    /**
+     * @tests java.util.AbstractMap#containsValue(Object)
+     */
+    public void test_containValue() {
+        AbstractMap map = new AMT();
+
+        assertFalse(map.containsValue("v"));
+        assertFalse(map.containsValue(null));
+
+        map.put("k", "v");
+        map.put("key", null);
+        map.put(null, "value");
+
+        assertTrue(map.containsValue("v"));
+        assertTrue(map.containsValue("value"));
+        assertTrue(map.containsValue(null));
+    }
+
+    /**
+     * @tests java.util.AbstractMap#get(Object)
+     */
+    public void test_get() {
+        AbstractMap map = new AMT();
+        assertNull(map.get("key"));
+        assertNull(map.get(null));
+
+        map.put("k", "v");
+        map.put("key", null);
+        map.put(null, "value");
+
+        assertEquals("v", map.get("k"));
+        assertNull(map.get("key"));
+        assertEquals("value", map.get(null));
+    }
+
+    /**
+     * @tests java.util.AbstractMap#values()
+     */
+    public void test_values() {
+        AbstractMap map1 = new HashMap(0);
+        assertSame("HashMap(0)", map1.values(), map1.values());
+
+        AbstractMap map2 = new HashMap(10);
+        assertSame("HashMap(10)", map2.values(), map2.values());
+
+        Map map3 = Collections.EMPTY_MAP;
+        assertSame("EMPTY_MAP", map3.values(), map3.values());
+
+        AbstractMap map4 = new IdentityHashMap(1);
+        assertSame("IdentityHashMap", map4.values(), map4.values());
+
+        AbstractMap map5 = new LinkedHashMap(122);
+        assertSame("IdentityHashMap", map5.values(), map5.values());
+
+        AbstractMap map6 = new TreeMap();
+        assertSame("TreeMap", map6.values(), map6.values());
+
+        AbstractMap map7 = new WeakHashMap();
+        assertSame("WeakHashMap", map7.values(), map7.values());
+    }
+
+    /**
+     * @tests java.util.AbstractMap#clone()
+     */
+    public void test_clone() {
+        class MyMap extends AbstractMap implements Cloneable {
+            private Map map = new HashMap();
+
+            public Set entrySet() {
+                return map.entrySet();
+            }
+
+            public Object put(Object key, Object value) {
+                return map.put(key, value);
+            }
+
+            public Map getMap() {
+                return map;
+            }
+
+            public Object clone() {
+                try {
+                    return super.clone();
+                } catch (CloneNotSupportedException e) {
+                    return null;
+                }
+            }
+        }
+        ;
+        MyMap map = new MyMap();
+        map.put("one", "1");
+        Map.Entry entry = (Map.Entry) map.entrySet().iterator().next();
+        assertTrue("entry not added", entry.getKey() == "one"
+                && entry.getValue() == "1");
+        MyMap mapClone = (MyMap) map.clone();
+        assertTrue("clone not shallow", map.getMap() == mapClone.getMap());
+    }
+
+    public class AMT extends AbstractMap {
 
         // Very crude AbstractMap implementation
         Vector values = new Vector();
@@ -267,9 +355,9 @@
         assertEquals("Should be equal", amt, ht);
     }
 
-	protected void setUp() {
-	}
+    protected void setUp() {
+    }
 
-	protected void tearDown() {
-	}
+    protected void tearDown() {
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/AbstractSequentialListTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/AbstractSequentialListTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/AbstractSequentialListTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/AbstractSequentialListTest.java Wed Apr 30 20:14:31 2008
@@ -52,7 +52,7 @@
     }
     
     /**
-     * @tests {@link java.util.AbstractSequentialList#addAll(int, java.util.Collection)}
+     * @tests java.util.AbstractSequentialList#addAll(int, java.util.Collection)
      */
     public void test_addAll_ILCollection() {
         AbstractSequentialList<String> al = new ASLT<String>();
@@ -65,6 +65,70 @@
         assertTrue("Should return true", al.addAll(2, c)); //$NON-NLS-1$
     }
     
+
+    /**
+     * @tests java.util.AbstractSequentialList#get(int)
+     */
+    public void test_get() {
+        AbstractSequentialList list = new MyAbstractSequentialList();
+        list.add(1);
+        list.add("value");
+        assertEquals(1, list.get(0));
+        assertEquals("value", list.get(1));
+
+        // get value by index which is out of bounds
+        try {
+            list.get(list.size());
+            fail("Should throw IndexOutOfBoundsException.");
+        } catch (IndexOutOfBoundsException e) {
+            // expected
+        }
+        try {
+            list.get(-1);
+            fail("Should throw IndexOutOfBoundsException.");
+        } catch (IndexOutOfBoundsException e) {
+            // expected
+        }
+
+    }
+
+    /**
+     * @tests java.util.AbstractSequentialList#remove(int)
+     */
+    public void test_remove() {
+        AbstractSequentialList list = new MyAbstractSequentialList();
+        list.add(1);
+
+        // normal test
+        assertEquals(1, list.remove(0));
+
+        list.add("value");
+        assertEquals("value", list.remove(0));
+
+        // remove index is out of bounds
+        try {
+            list.remove(list.size());
+            fail("Should throw IndexOutOfBoundsException.");
+        } catch (IndexOutOfBoundsException e) {
+            // expected
+        }
+        try {
+            list.remove(-1);
+            fail("Should throw IndexOutOfBoundsException.");
+        } catch (IndexOutOfBoundsException e) {
+            // expected
+        }
+
+        // list dont't support remove operation
+        try {
+            AbstractSequentialList mylist = new MockAbstractSequentialList();
+            mylist.remove(0);
+            fail("Should throw UnsupportedOperationException.");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+    }
+    
     public void test_set() throws Exception {
 		MyAbstractSequentialList list = new MyAbstractSequentialList();
 		try {
@@ -75,15 +139,12 @@
 		}
 	}
 
-	public static class MyAbstractSequentialList extends AbstractSequentialList {
+	static class MyAbstractSequentialList extends AbstractSequentialList {
 
 		private LinkedList list = new LinkedList();
 
 		public ListIterator listIterator(int index) {
-			ListIterator iter = list.listIterator();
-			for (int i = 0; i < index; i++) {
-				iter.next();
-			}
+			ListIterator iter = list.listIterator(index);
 			return iter;
 		}
 
@@ -92,4 +153,56 @@
 			return list.size();
 		}
 	}
+    
+    static class MockAbstractSequentialList<E> extends AbstractSequentialList {
+
+        public ListIterator listIterator(int index) {
+            return new MockListIterator();
+        }
+
+        @Override
+        public int size() {
+            return 0;
+        }
+    }
+    
+    static class MockListIterator implements ListIterator{
+
+        public void add(Object object) {
+            throw new UnsupportedOperationException();
+        }
+
+        public boolean hasNext() {
+            throw new UnsupportedOperationException();
+        }
+
+        public boolean hasPrevious() {
+            throw new UnsupportedOperationException();
+        }
+
+        public Object next() {
+            throw new UnsupportedOperationException();
+        }
+
+        public int nextIndex() {
+            throw new UnsupportedOperationException();
+        }
+
+        public Object previous() {
+            throw new UnsupportedOperationException();
+        }
+
+        public int previousIndex() {
+            throw new UnsupportedOperationException();
+        }
+
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+
+        public void set(Object object) {
+            throw new UnsupportedOperationException();
+        }
+        
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ArrayListTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ArrayListTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ArrayListTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ArrayListTest.java Wed Apr 30 20:14:31 2008
@@ -154,6 +154,31 @@
             fail("IndexOutOfBoundsException expected");
         } catch (IndexOutOfBoundsException e) {
         }
+        
+        // Regression for HARMONY-5705
+        String[] data = new String[] { "1", "2", "3", "4", "5", "6", "7", "8" };
+        ArrayList list1 = new ArrayList();
+        ArrayList list2 = new ArrayList();
+        for (String d : data) {
+            list1.add(d);
+            list2.add(d);
+            list2.add(d);
+        }
+        while (list1.size() > 0)
+            list1.remove(0);
+        list1.addAll(list2);
+        assertTrue("The object list is not the same as orginal list", list1
+                .containsAll(list2) && list2.containsAll(list1));
+
+        obj = new ArrayList();
+        for (int i = 0; i < 100; i++) {
+            if (list1.size() > 0) {
+                obj.removeAll(list1);
+                obj.addAll(list1);
+            }
+        }
+        assertTrue("The object list is not the same as orginal list", obj
+                .containsAll(list1) && list1.containsAll(obj));
     }
 
     public void test_addAllCollectionOfQextendsE() {

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/CalendarTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/CalendarTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/CalendarTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/CalendarTest.java Wed Apr 30 20:14:31 2008
@@ -27,6 +27,8 @@
 import java.util.Map;
 import java.util.TimeZone;
 
+import org.apache.harmony.testframework.serialization.SerializationTest;
+
 public class CalendarTest extends junit.framework.TestCase {
 	
 	Locale defaultLocale;
@@ -480,6 +482,268 @@
 			Locale.JAPAN, Locale.ITALIAN, Locale.GERMAN, Locale.ENGLISH,
 			Locale.CHINA, Locale.CANADA, Locale.FRANCE };
 
+    /**
+     * @tests java.util.Calendar#before(Object)
+     * @tests java.util.Calendar#after(Object)
+     */
+    public void test_before_after() {
+        Calendar early = Calendar.getInstance();
+        Calendar late = Calendar.getInstance();
+        // test by second
+        early.set(2008, 3, 20, 17, 28, 12);
+        late.set(2008, 3, 20, 17, 28, 22);
+        // test before()
+        assertTrue(early.before(late));
+        assertFalse(early.before(early));
+        assertFalse(late.before(early));
+        // test after();
+        assertTrue(late.after(early));
+        assertFalse(late.after(late));
+        assertFalse(early.after(late));
+
+        // test by minute
+        early.set(2008, 3, 20, 17, 18, 12);
+        late.set(2008, 3, 20, 17, 28, 12);
+        // test before()
+        assertTrue(early.before(late));
+        assertFalse(early.before(early));
+        assertFalse(late.before(early));
+        // test after();
+        assertTrue(late.after(early));
+        assertFalse(late.after(late));
+        assertFalse(early.after(late));
+
+        // test by hour
+        early.set(2008, 3, 20, 17, 28, 12);
+        late.set(2008, 3, 20, 27, 28, 12);
+        // test before()
+        assertTrue(early.before(late));
+        assertFalse(early.before(early));
+        assertFalse(late.before(early));
+        // test after();
+        assertTrue(late.after(early));
+        assertFalse(late.after(late));
+        assertFalse(early.after(late));
+
+        // test by day
+        early.set(2008, 3, 10, 17, 28, 12);
+        late.set(2008, 3, 20, 17, 28, 12);
+        // test before()
+        assertTrue(early.before(late));
+        assertFalse(early.before(early));
+        assertFalse(late.before(early));
+        // test after();
+        assertTrue(late.after(early));
+        assertFalse(late.after(late));
+        assertFalse(early.after(late));
+
+        // test by month
+        early.set(2008, 2, 20, 17, 28, 12);
+        late.set(2008, 3, 20, 17, 28, 12);
+        // test before()
+        assertTrue(early.before(late));
+        assertFalse(early.before(early));
+        assertFalse(late.before(early));
+        // test after();
+        assertTrue(late.after(early));
+        assertFalse(late.after(late));
+        assertFalse(early.after(late));
+
+        // test by year
+        early.set(2007, 3, 20, 17, 28, 12);
+        late.set(2008, 3, 20, 17, 28, 12);
+        // test before()
+        assertTrue(early.before(late));
+        assertFalse(early.before(early));
+        assertFalse(late.before(early));
+        // test after();
+        assertTrue(late.after(early));
+        assertFalse(late.after(late));
+        assertFalse(early.after(late));
+    }
+
+    /**
+     * @tests java.util.Calendar#clear()
+     * @tests java.util.Calendar#clear(int)
+     */
+    public void test_clear() {
+        Calendar calendar = Calendar.getInstance();
+
+        int count = 6;
+        int[] fields = new int[count];
+        int[] defaults = new int[count];
+
+        fields[0] = Calendar.YEAR;
+        fields[1] = Calendar.MONTH;
+        fields[2] = Calendar.DATE;
+        fields[3] = Calendar.HOUR_OF_DAY;
+        fields[4] = Calendar.MINUTE;
+        fields[5] = Calendar.SECOND;
+
+        defaults[0] = 1970;
+        defaults[1] = 0;
+        defaults[2] = 1;
+        defaults[3] = 0;
+        defaults[4] = 0;
+        defaults[5] = 0;
+
+        calendar.set(2008, 3, 20, 17, 28, 12);
+
+        // test clear(int)
+        for (int i = 0; i < fields.length; i++) {
+            int index = fields[i];
+            calendar.clear(index);
+            if (5 == index) {
+                // RI also doesn't change the value of DATE
+                assertEquals("Field " + index + " Should equal to 20.", 20,
+                        calendar.get(index));
+            } else if (11 == index) {
+                // RI also doesn't change the value of HOUR
+                assertEquals("Field " + index + " Should equal to 17.", 17,
+                        calendar.get(index));
+            } else {
+                // Other have been set to default values
+                assertEquals("Field " + index + " Should equal to "
+                        + defaults[i] + ".", defaults[i], calendar.get(index));
+            }
+        }
+
+        // test clear()
+        calendar.set(2008, 3, 20, 17, 28, 12);
+
+        calendar.clear();
+
+        for (int i = 0; i < fields.length; i++) {
+            int index = fields[i];
+            assertEquals("Field " + index + " Should equal to "
+                    + defaults[i] + ".", defaults[i], calendar.get(index));
+        }
+    }
+
+    /**
+     * @tests java.util.Calendar#isSet(int)
+     */
+    public void test_isSet() {
+        Calendar calendar = Calendar.getInstance();
+        calendar.clear();
+        for (int i = 0; i < Calendar.FIELD_COUNT; i++) {
+            assertFalse(calendar.isSet(i));
+        }
+    }
+
+    /**
+     * @tests java.util.Calendar#getAvailableLocales()
+     */
+    public void test_getAvailableLocales() {
+        Locale[] locales = Calendar.getAvailableLocales();
+        boolean exist = false;
+        for (int i = 0; i < locales.length; i++) {
+            Locale l = locales[i];
+            if (Locale.US.equals(l)) {
+                exist = true;
+                break;
+            }
+        }
+        assertTrue(exist);
+    }
+
+    /**
+     * @tests java.util.Calendar#getInstance(Locale)
+     * @tests java.util.Calendar#getInstance(TimeZone, Locale)
+     */
+    public void test_getInstance() {
+        // test getInstance(Locale)
+        Calendar us_calendar = Calendar.getInstance(Locale.US);
+        Calendar ch_calendar = Calendar.getInstance(Locale.CHINESE);
+        assertEquals(Calendar.SUNDAY, us_calendar
+                .getFirstDayOfWeek());
+        assertEquals(Calendar.MONDAY, ch_calendar
+                .getFirstDayOfWeek());
+
+        // test getInstance(Locale, TimeZone)
+        Calendar gmt_calendar = Calendar.getInstance(TimeZone
+                .getTimeZone("GMT"), Locale.US);
+        assertEquals(TimeZone.getTimeZone("GMT"),
+                gmt_calendar.getTimeZone());
+        Calendar est_calendar = Calendar.getInstance(TimeZone
+                .getTimeZone("EST"), Locale.US);
+        assertEquals(TimeZone.getTimeZone("EST")
+                .getID(), est_calendar.getTimeZone().getID());
+    }
+
+    /**
+     * @tests java.util.Calendar#internalGet(int)
+     */
+    public void test_internalGet() {
+        MockGregorianCalendar c = new MockGregorianCalendar();
+        c.clear(Calendar.YEAR);
+        assertEquals(0, c.internal_get(Calendar.YEAR));
+    }
+
+    /**
+     * @tests java.util.Calendar#hashCode()
+     */
+    public void test_hashcode() {
+        Calendar calendar = Calendar.getInstance(Locale.JAPAN);
+        assertTrue(calendar.hashCode() == calendar.hashCode());
+    }
+
+    /**
+     * @tests java.util.Calendar#roll(int, int)
+     */
+    public void test_roll() {
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(2008, 3, 20, 17, 28, 12);
+
+        // roll up
+        calendar.roll(Calendar.DATE, 5);
+        assertEquals(25, calendar.get(Calendar.DATE));
+
+        // roll down
+        calendar.roll(Calendar.DATE, -5);
+        assertEquals(20, calendar.get(Calendar.DATE));
+
+        // roll 0
+        calendar.roll(Calendar.DATE, 0);
+        assertEquals(20, calendar.get(Calendar.DATE));
+
+        // roll overweight
+        calendar.set(2008, 1, 31, 17, 28, 12);
+        calendar.roll(Calendar.MONTH, 1);
+        assertEquals(2, calendar.get(Calendar.DATE));
+
+    }
+
+    /**
+     * @tests java.util.Calendar#toString()
+     */
+    public void test_toString() {
+        Calendar calendar = Calendar.getInstance();
+        //Should be the current time with no interrogation in the string.
+        assertTrue(calendar.toString() instanceof String);
+        assertEquals(-1, calendar.toString().indexOf("?"));
+        calendar.clear();
+        assertTrue(calendar.toString() instanceof String);
+        assertTrue(0 <= calendar.toString().indexOf("?"));
+    }
+
+    /**
+     * @tests serialization/deserialization.
+     */
+    public void testSerializationSelf() throws Exception {
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(2008, 3, 20, 17, 28, 12);
+
+        SerializationTest.verifySelf(calendar);
+    }
+
+
+    private class MockGregorianCalendar extends GregorianCalendar {
+        public int internal_get(int field) {
+            return super.internalGet(field);
+        }
+    }
+
     private class MockCalendar extends Calendar {
 
 		public MockCalendar() {

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/GregorianCalendarTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/GregorianCalendarTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/GregorianCalendarTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/GregorianCalendarTest.java Wed Apr 30 20:14:31 2008
@@ -753,6 +753,15 @@
         assertEquals(0, gc.get(Calendar.SECOND));
         gc.set(1582, Calendar.OCTOBER, 14, 0, 0, 0);
         assertEquals(24, gc.get(Calendar.DAY_OF_MONTH));
+        
+        // Regression test for HARMONY-2422
+        gc = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
+        gc.set(GregorianCalendar.ZONE_OFFSET, -1);
+        assertEquals(-1, gc.get(GregorianCalendar.ZONE_OFFSET));
+        gc.set(GregorianCalendar.ZONE_OFFSET, 1);
+        assertEquals(1, gc.get(GregorianCalendar.ZONE_OFFSET));
+        gc.set(GregorianCalendar.ZONE_OFFSET, 0);
+        assertEquals(0, gc.get(GregorianCalendar.ZONE_OFFSET));
     }
 
 	/**

Modified: harmony/enhanced/classlib/branches/java6/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ObjectAccessorImpl.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ObjectAccessorImpl.c?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ObjectAccessorImpl.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/misc/src/main/native/accessors/shared/org_apache_harmony_misc_accessors_ObjectAccessorImpl.c Wed Apr 30 20:14:31 2008
@@ -307,8 +307,13 @@
  */
 JNIEXPORT jobject JNICALL Java_org_apache_harmony_misc_accessors_ObjectAccessor_newInstance__Ljava_lang_Class_2J_3Ljava_lang_Object_2
 (JNIEnv *env, jobject accessorObj, jclass clss, jlong ctorID, jobjectArray args) {
-    jvalue* pargs = jarrayToValues(env, args);
-    jobject res = (*env)->NewObjectA(env, clss, (jmethodID)(intptr_t)ctorID, pargs);
+    jvalue *pargs = NULL;
+    jobject res;
+
+    if (args != NULL) {
+        pargs = jarrayToValues(env, args);
+    }
+    res = (*env)->NewObjectA(env, clss, (jmethodID)(intptr_t)ctorID, pargs);
     free(pargs);
     return res;
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/BufferOverflowExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/BufferOverflowExceptionTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/BufferOverflowExceptionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/BufferOverflowExceptionTest.java Wed Apr 30 20:14:31 2008
@@ -39,4 +39,14 @@
 
         SerializationTest.verifyGolden(this, new BufferOverflowException());
     }
+    
+    /**
+     *@tests {@link java.nio.BufferOverflowException#BufferOverflowException()}
+     */
+    public void test_Constructor() {
+        BufferOverflowException exception = new BufferOverflowException();
+        assertNull(exception.getMessage());
+        assertNull(exception.getLocalizedMessage());
+        assertNull(exception.getCause());
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/BufferUnderflowExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/BufferUnderflowExceptionTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/BufferUnderflowExceptionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/BufferUnderflowExceptionTest.java Wed Apr 30 20:14:31 2008
@@ -42,4 +42,14 @@
 
         SerializationTest.verifyGolden(this, new BufferUnderflowException());
     }
+    
+    /**
+     *@tests {@link java.nio.BufferUnderflowException#BufferUnderflowException()}
+     */
+    public void test_Constructor() {
+        BufferUnderflowException exception = new BufferUnderflowException();
+        assertNull(exception.getMessage());
+        assertNull(exception.getLocalizedMessage());
+        assertNull(exception.getCause());
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/InvalidMarkExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/InvalidMarkExceptionTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/InvalidMarkExceptionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/InvalidMarkExceptionTest.java Wed Apr 30 20:14:31 2008
@@ -38,4 +38,14 @@
 
         SerializationTest.verifyGolden(this, new InvalidMarkException());
     }
+    
+    /**
+     *@tests {@link java.nio.InvalidMarkException#InvalidMarkException()}
+     */
+    public void test_Constructor() {
+        InvalidMarkException exception = new InvalidMarkException();
+        assertNull(exception.getMessage());
+        assertNull(exception.getLocalizedMessage());
+        assertNull(exception.getCause());
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/MappedByteBufferTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/MappedByteBufferTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/MappedByteBufferTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/MappedByteBufferTest.java Wed Apr 30 20:14:31 2008
@@ -21,37 +21,24 @@
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.RandomAccessFile;
 import java.nio.ByteBuffer;
 import java.nio.IntBuffer;
 import java.nio.MappedByteBuffer;
 import java.nio.channels.FileChannel;
+import java.nio.channels.FileChannel.MapMode;
 
 import junit.framework.TestCase;
 
 public class MappedByteBufferTest extends TestCase {
 
+    File tmpFile;
+    
     /**
      * A regression test for failing to correctly set capacity of underlying
      * wrapped buffer from a mapped byte buffer.
      */
     public void testasIntBuffer() throws IOException {
-        // Create temp file with 26 bytes and 5 ints
-        File tmpFile = File.createTempFile("harmony", "test");  //$NON-NLS-1$//$NON-NLS-2$
-        tmpFile.deleteOnExit();
-        FileOutputStream fileOutputStream = new FileOutputStream(tmpFile);
-        FileChannel fileChannel = fileOutputStream.getChannel();
-        ByteBuffer byteBuffer = ByteBuffer.allocateDirect(26 + 20);
-        for (int i = 0; i < 26; i++) {
-            byteBuffer.put((byte) ('A' + i));
-        }
-        for (int i = 0; i < 5; i++) {
-            byteBuffer.putInt(i + 1);
-        }
-        byteBuffer.rewind();
-        fileChannel.write(byteBuffer);
-        fileChannel.close();
-        fileOutputStream.close();
-
         // Map file
         FileInputStream fis = new FileInputStream(tmpFile);
         FileChannel fc = fis.getChannel();
@@ -73,4 +60,101 @@
             assertEquals("Got wrong int value", i + 1, val); //$NON-NLS-1$
         }
     }
+    
+    /**
+     * @tests {@link java.nio.MappedByteBuffer#force()}
+     */
+    public void test_force() throws IOException {
+        // buffer was not mapped in read/write mode
+        FileInputStream fileInputStream = new FileInputStream(tmpFile);
+        FileChannel fileChannelRead = fileInputStream.getChannel();
+        MappedByteBuffer mmbRead = fileChannelRead.map(MapMode.READ_ONLY, 0,
+                fileChannelRead.size());
+
+        mmbRead.force();
+
+        FileInputStream inputStream = new FileInputStream(tmpFile);
+        FileChannel fileChannelR = inputStream.getChannel();
+        MappedByteBuffer resultRead = fileChannelR.map(MapMode.READ_ONLY, 0,
+                fileChannelR.size());
+
+        //If this buffer was not mapped in read/write mode, then invoking this method has no effect.
+        assertEquals(
+                "Invoking force() should have no effect when this buffer was not mapped in read/write mode",
+                mmbRead, resultRead);
+
+        // Buffer was mapped in read/write mode
+        RandomAccessFile randomFile = new RandomAccessFile(tmpFile, "rw");
+        FileChannel fileChannelReadWrite = randomFile.getChannel();
+        MappedByteBuffer mmbReadWrite = fileChannelReadWrite.map(
+                FileChannel.MapMode.READ_WRITE, 0, fileChannelReadWrite.size());
+
+        mmbReadWrite.put((byte) 'o');
+        mmbReadWrite.force();
+
+        RandomAccessFile random = new RandomAccessFile(tmpFile, "rw");
+        FileChannel fileChannelRW = random.getChannel();
+        MappedByteBuffer resultReadWrite = fileChannelRW.map(
+                FileChannel.MapMode.READ_WRITE, 0, fileChannelRW.size());
+
+        // Invoking force() will change the buffer
+        assertFalse(mmbReadWrite.equals(resultReadWrite));
+    }
+
+    /**
+     * @tests {@link java.nio.MappedByteBuffer#isLoaded()}
+     */
+    public void test_isload() throws IOException {
+        FileInputStream fileInputStream = new FileInputStream(tmpFile);
+        FileChannel fileChannelRead = fileInputStream.getChannel();
+        MappedByteBuffer mmbRead = fileChannelRead.map(MapMode.READ_ONLY, 0,
+                fileChannelRead.size());
+
+        assertFalse(mmbRead.isLoaded());
+
+        RandomAccessFile randomFile = new RandomAccessFile(tmpFile, "rw");
+        FileChannel fileChannelReadWrite = randomFile.getChannel();
+        MappedByteBuffer mmbReadWrite = fileChannelReadWrite.map(
+                FileChannel.MapMode.READ_WRITE, 0, fileChannelReadWrite.size());
+
+        assertFalse(mmbReadWrite.isLoaded());
+    }
+
+    /**
+     * @tests {@link java.nio.MappedByteBuffer#load()}
+     */
+    public void test_load() throws IOException {
+        FileInputStream fileInputStream = new FileInputStream(tmpFile);
+        FileChannel fileChannelRead = fileInputStream.getChannel();
+        MappedByteBuffer mmbRead = fileChannelRead.map(MapMode.READ_ONLY, 0,
+                fileChannelRead.size());
+        
+        assertEquals(mmbRead, mmbRead.load());
+
+        RandomAccessFile randomFile = new RandomAccessFile(tmpFile, "rw");
+        FileChannel fileChannelReadWrite = randomFile.getChannel();
+        MappedByteBuffer mmbReadWrite = fileChannelReadWrite.map(
+                FileChannel.MapMode.READ_WRITE, 0, fileChannelReadWrite.size());
+
+        assertEquals(mmbReadWrite, mmbReadWrite.load());
+    }
+
+    protected void setUp() throws IOException {
+        // Create temp file with 26 bytes and 5 ints
+        tmpFile = File.createTempFile("harmony", "test");  //$NON-NLS-1$//$NON-NLS-2$
+        tmpFile.deleteOnExit();
+        FileOutputStream fileOutputStream = new FileOutputStream(tmpFile);
+        FileChannel fileChannel = fileOutputStream.getChannel();
+        ByteBuffer byteBuffer = ByteBuffer.allocateDirect(26 + 20);
+        for (int i = 0; i < 26; i++) {
+            byteBuffer.put((byte) ('A' + i));
+        }
+        for (int i = 0; i < 5; i++) {
+            byteBuffer.putInt(i + 1);
+        }
+        byteBuffer.rewind();
+        fileChannel.write(byteBuffer);
+        fileChannel.close();
+        fileOutputStream.close();
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/ReadOnlyBufferExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/ReadOnlyBufferExceptionTest.java?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/ReadOnlyBufferExceptionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio/src/test/java/common/org/apache/harmony/nio/tests/java/nio/ReadOnlyBufferExceptionTest.java Wed Apr 30 20:14:31 2008
@@ -38,4 +38,14 @@
 
         SerializationTest.verifyGolden(this, new ReadOnlyBufferException());
     }
+    
+    /**
+     *@tests {@link java.nio.ReadOnlyBufferException#ReadOnlyBufferException()}
+     */
+    public void test_Constructor() {
+        ReadOnlyBufferException exception = new ReadOnlyBufferException();
+        assertNull(exception.getMessage());
+        assertNull(exception.getLocalizedMessage());
+        assertNull(exception.getCause());
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties?rev=652421&r1=652420&r2=652421&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties Wed Apr 30 20:14:31 2008
@@ -98,3 +98,5 @@
 rowset.35=Not a valid match olumn index
 rowset.36=Number of elements of two arrays don't equal
 rowset.37=The RowSet doesn't set the table name
+rowset.38=This type of join is not supported
+rowset.39=The table name is null