harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r613858 [3/5] - in /harmony/enhanced/classlib/branches/java6: depends/build/ depends/libs/freebsd.x86/ depends/libs/linux.ia64/ depends/libs/linux.ppc32/ depends/libs/linux.ppc64/ depends/libs/linux.x86.libstdc++6/ depends/libs/linux.x86/ d...
Date Mon, 21 Jan 2008 11:55:41 GMT
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.c?rev=613858&r1=613857&r2=613858&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.c Mon Jan 21 03:55:17 2008
@@ -305,8 +305,8 @@
   jmethodID errorCodeExConstructor, socketExConstructor,socketExCauseMethod;
   jobject errorCodeEx,socketEx;
   char *errorMessage = netLookupErrorString (env, errorNumber);
-  jstring errorMessageString = (*env)->NewStringUTF (env,errorMessage);
   if (HYPORT_ERROR_SOCKET_WOULDBLOCK == errorNumber){
+    jstring errorMessageString = (*env)->NewStringUTF (env,errorMessage);
     errorCodeExClass = (*env)->FindClass (env, "org/apache/harmony/luni/util/ErrorCodeException");
     if (!errorCodeExClass){
       return;

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/file/FileURLConnectionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/file/FileURLConnectionTest.java?rev=613858&r1=613857&r2=613858&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/file/FileURLConnectionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/file/FileURLConnectionTest.java Mon Jan 21 03:55:17 2008
@@ -19,10 +19,9 @@
 import java.io.IOException;
 import java.net.URL;
 
-import org.apache.harmony.luni.internal.net.www.protocol.file.FileURLConnection;
-
 import junit.framework.TestCase;
 
+import org.apache.harmony.luni.internal.net.www.protocol.file.FileURLConnection;
 
 /**
  * Tests for <code>FileURLConnection</code> class constructors and methods.
@@ -36,13 +35,14 @@
         return new FileURLConnection(url).getContentType();
     }
 
-    public void testGetContentType() throws Exception {
+    public void testGetContentType() throws IOException  {
         // Regression for HARMONY-4699
-        assertEquals(getContentType("test.rtf"), "application/rtf");
-        assertEquals(getContentType("test.java"), "text/plain");
-        assertEquals(getContentType("test.doc"), "application/msword"); // RI would return "content/unknown"
-        assertEquals(getContentType("test.htx"), "text/html");
-        assertEquals(getContentType("test.xml"), "application/xml");
-        assertEquals(getContentType("."), "text/plain");
+        assertEquals("application/rtf", getContentType("test.rtf"));
+        assertEquals("text/plain", getContentType("test.java"));
+        // RI would return "content/unknown"
+        assertEquals("application/msword", getContentType("test.doc"));
+        assertEquals("text/html", getContentType("test.htx"));
+        assertEquals("application/xml", getContentType("test.xml"));
+        assertEquals("text/plain", getContentType("."));
     }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java?rev=613858&r1=613857&r2=613858&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java Mon Jan 21 03:55:17 2008
@@ -97,8 +97,8 @@
             this(name, persUses, OK_CODE);
         }
 
-        public MockHTTPServer(String name, int persUses,
-                int responseCode) throws IOException {
+        public MockHTTPServer(String name, int persUses, int responseCode)
+                throws IOException {
             super(name);
             this.persUses = persUses;
             this.responseCode = responseCode;
@@ -120,10 +120,10 @@
                 try {
                     client = serverSocket.accept();
                     accepted = true;
-                    for (int i=0; i<persUses; i++) {
+                    for (int i = 0; i < persUses; i++) {
                         if (DEBUG) {
                             System.out.println("*** Using connection for "
-                                    + (i+1) + " time ***");
+                                    + (i + 1) + " time ***");
                         }
                         byte[] buff = new byte[1024];
                         is = client.getInputStream();
@@ -141,38 +141,42 @@
                             wasEOL = (bytik == '\n');
                             buff[num++] = (byte) bytik;
                         }
-                        //int num = is.read(buff);
+                        // int num = is.read(buff);
                         String message = new String(buff, 0, num);
                         if (DEBUG) {
-                            System.out.println("---- Server got request: ----\n"
-                                + message + "-----------------------------");
+                            System.out
+                                    .println("---- Server got request: ----\n"
+                                            + message
+                                            + "-----------------------------");
                         }
-                        
+
                         // Act as Server (not Proxy) side
                         if (message.startsWith("POST")) {
                             // client connection sent some data
                             // if the data was not read with header
                             if (DEBUG) {
-                                System.out.println(
-                                        "---- Server read client's data: ----");
+                                System.out
+                                        .println("---- Server read client's data: ----");
                             }
                             num = is.read(buff);
                             message = new String(buff, 0, num);
                             if (DEBUG) {
                                 System.out.println("'" + message + "'");
-                                System.out.println(
-                                        "------------------------------------");
+                                System.out
+                                        .println("------------------------------------");
                             }
                             // check the received data
                             assertEquals(clientPost, message);
                         }
 
-                        client.getOutputStream().write((
-                            "HTTP/1.1 " + responseCode + " OK\n"
-                            + "Content-type: text/html\n"
-                            + "Content-length: " 
-                            + response.length() + "\n\n"
-                            + response).getBytes());
+                        client
+                                .getOutputStream()
+                                .write(
+                                        ("HTTP/1.1 " + responseCode + " OK\n"
+                                                + "Content-type: text/html\n"
+                                                + "Content-length: "
+                                                + response.length() + "\n\n" + response)
+                                                .getBytes());
 
                         if (responseCode != OK_CODE) {
                             // wait while test case check closed connection
@@ -181,7 +185,8 @@
                                 while (!isInterrupted()) {
                                     Thread.sleep(1000);
                                 }
-                            } catch (Exception ignore) { }
+                            } catch (Exception ignore) {
+                            }
                         }
                     }
                 } catch (SocketTimeoutException ignore) {
@@ -204,7 +209,7 @@
     static class MockProxyServer extends MockServer {
 
         boolean acceptedAuthorizedRequest;
-        
+
         public MockProxyServer(String name) throws Exception {
             super(name);
         }
@@ -216,10 +221,12 @@
                 socket.setSoTimeout(5000);
                 byte[] buff = new byte[1024];
                 int num = socket.getInputStream().read(buff);
-                socket.getOutputStream().write((
-                    "HTTP/1.0 407 Proxy authentication required\n"
-                        + "Proxy-authenticate: Basic realm=\"remotehost\"\n\n")
-                        .getBytes());
+                socket
+                        .getOutputStream()
+                        .write(
+                                ("HTTP/1.0 407 Proxy authentication required\n"
+                                        + "Proxy-authenticate: Basic realm=\"remotehost\"\n\n")
+                                        .getBytes());
                 num = socket.getInputStream().read(buff);
                 if (num == -1) {
                     // this connection was closed, create new one:
@@ -228,11 +235,11 @@
                     num = socket.getInputStream().read(buff);
                 }
                 String request = new String(buff, 0, num);
-                acceptedAuthorizedRequest = 
-                    request.toLowerCase().indexOf("proxy-authorization:") > 0;
+                acceptedAuthorizedRequest = request.toLowerCase().indexOf(
+                        "proxy-authorization:") > 0;
                 if (acceptedAuthorizedRequest) {
-                    socket.getOutputStream().write((
-                            "HTTP/1.1 200 OK\n\n").getBytes());
+                    socket.getOutputStream().write(
+                            ("HTTP/1.1 200 OK\n\n").getBytes());
                 }
             } catch (IOException e) {
             }
@@ -242,7 +249,7 @@
     public void setUp() {
         if (DEBUG) {
             System.out.println("\n==============================");
-            System.out.println("===== Execution: "+getName());
+            System.out.println("===== Execution: " + getName());
             System.out.println("==============================");
         }
     }
@@ -257,11 +264,10 @@
         private int server_port;
 
         /**
-         * Creates proxy selector instance.
-         * Selector will return the proxy, only if the connection
-         * is made to localhost:server_port. Otherwise it will
-         * return NO_PROXY.
-         * Address of the returned proxy will be localhost:proxy_port.
+         * Creates proxy selector instance. Selector will return the proxy, only
+         * if the connection is made to localhost:server_port. Otherwise it will
+         * return NO_PROXY. Address of the returned proxy will be
+         * localhost:proxy_port.
          */
         public TestProxySelector(int server_port, int proxy_port) {
             this.server_port = server_port;
@@ -273,8 +279,8 @@
             Proxy proxy = Proxy.NO_PROXY;
             if (("localhost".equals(uri.getHost()))
                     && (server_port == uri.getPort())) {
-                proxy = new Proxy(Proxy.Type.HTTP,
-                            new InetSocketAddress("localhost", proxy_port));
+                proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(
+                        "localhost", proxy_port));
             }
             ArrayList<Proxy> result = new ArrayList<Proxy>();
             result.add(proxy);
@@ -292,28 +298,27 @@
      */
     public void testGetOutputStream() throws Exception {
         // Regression for HARMONY-482
-        MockServer httpServer =
-            new MockServer("ServerSocket for HttpURLConnectionTest");
+        MockServer httpServer = new MockServer(
+                "ServerSocket for HttpURLConnectionTest");
         httpServer.start();
-        synchronized(bound) {
+        synchronized (bound) {
             if (!httpServer.started) {
                 bound.wait(5000);
             }
         }
-        HttpURLConnection c = (HttpURLConnection)
-            new URL("http://127.0.0.1:" + httpServer.port()).openConnection();
+        HttpURLConnection c = (HttpURLConnection) new URL("http://127.0.0.1:"
+                + httpServer.port()).openConnection();
         c.setDoOutput(true);
-        //use new String("POST") instead of simple "POST" to obtain other
-        //object instances then those that are in HttpURLConnection classes
+        // use new String("POST") instead of simple "POST" to obtain other
+        // object instances then those that are in HttpURLConnection classes
         c.setRequestMethod(new String("POST"));
         c.getOutputStream();
         httpServer.join();
     }
 
-
     /**
-     * Test checks if the proxy specified in openConnection
-     * method will be used for connection to the server
+     * Test checks if the proxy specified in openConnection method will be used
+     * for connection to the server
      */
     public void testUsingProxy() throws Exception {
         // Regression for HARMONY-570
@@ -324,18 +329,19 @@
 
         HttpURLConnection connection = (HttpURLConnection) url
                 .openConnection(new Proxy(Proxy.Type.HTTP,
-                        new InetSocketAddress("localhost",
-                            proxy.port())));
+                        new InetSocketAddress("localhost", proxy.port())));
         connection.setConnectTimeout(2000);
         connection.setReadTimeout(2000);
 
         server.start();
-        synchronized(bound) {
-            if (!server.started) bound.wait(5000);
+        synchronized (bound) {
+            if (!server.started)
+                bound.wait(5000);
         }
         proxy.start();
-        synchronized(bound) {
-            if (!proxy.started) bound.wait(5000);
+        synchronized (bound) {
+            if (!proxy.started)
+                bound.wait(5000);
         }
 
         connection.connect();
@@ -346,14 +352,15 @@
 
         assertTrue("Connection does not use proxy", connection.usingProxy());
         assertTrue("Proxy server was not used", proxy.accepted);
-        
-        HttpURLConnection huc = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY);
+
+        HttpURLConnection huc = (HttpURLConnection) url
+                .openConnection(Proxy.NO_PROXY);
         assertFalse(huc.usingProxy());
     }
 
     /**
-     * Test checks if the proxy provided by proxy selector
-     * will be used for connection to the server
+     * Test checks if the proxy provided by proxy selector will be used for
+     * connection to the server
      */
     public void testUsingProxySelector() throws Exception {
         // Regression for HARMONY-570
@@ -365,22 +372,24 @@
         // keep default proxy selector
         ProxySelector defPS = ProxySelector.getDefault();
         // replace selector
-        ProxySelector.setDefault(
-                new TestProxySelector(server.port(), proxy.port()));
+        ProxySelector.setDefault(new TestProxySelector(server.port(), proxy
+                .port()));
 
         try {
-            HttpURLConnection connection =
-                (HttpURLConnection) url.openConnection();
+            HttpURLConnection connection = (HttpURLConnection) url
+                    .openConnection();
             connection.setConnectTimeout(2000);
             connection.setReadTimeout(2000);
 
             server.start();
-            synchronized(bound) {
-                if (!server.started) bound.wait(5000);
+            synchronized (bound) {
+                if (!server.started)
+                    bound.wait(5000);
             }
             proxy.start();
-            synchronized(bound) {
-                if (!proxy.started) bound.wait(5000);
+            synchronized (bound) {
+                if (!proxy.started)
+                    bound.wait(5000);
             }
             connection.connect();
 
@@ -388,8 +397,7 @@
             server.join();
             proxy.join();
 
-            assertTrue("Connection does not use proxy",
-                                            connection.usingProxy());
+            assertTrue("Connection does not use proxy", connection.usingProxy());
             assertTrue("Proxy server was not used", proxy.accepted);
         } finally {
             // restore default proxy selector
@@ -402,8 +410,8 @@
         Authenticator.setDefault(new Authenticator() {
             @Override
             protected PasswordAuthentication getPasswordAuthentication() {
-                return new PasswordAuthentication(
-                    "user", "password".toCharArray());
+                return new PasswordAuthentication("user", "password"
+                        .toCharArray());
             }
         });
 
@@ -411,9 +419,8 @@
             MockProxyServer proxy = new MockProxyServer("ProxyServer");
 
             URL url = new URL("http://remotehost:55555/requested.data");
-            HttpURLConnection connection =
-                (HttpURLConnection) url.openConnection(
-                        new Proxy(Proxy.Type.HTTP,
+            HttpURLConnection connection = (HttpURLConnection) url
+                    .openConnection(new Proxy(Proxy.Type.HTTP,
                             new InetSocketAddress("localhost", proxy.port())));
             connection.setConnectTimeout(5000);
             connection.setReadTimeout(5000);
@@ -421,8 +428,8 @@
             proxy.start();
 
             connection.connect();
-            assertEquals("unexpected response code", 
-                    200, connection.getResponseCode());
+            assertEquals("unexpected response code", 200, connection
+                    .getResponseCode());
             proxy.join();
             assertTrue("Connection did not send proxy authorization request",
                     proxy.acceptedAuthorizedRequest);
@@ -433,23 +440,23 @@
     }
 
     /**
-     * Test that a connection is not closed if the client reads all the data 
-     * but not closes input stream. read until -1.
+     * Test that a connection is not closed if the client reads all the data but
+     * not closes input stream. read until -1.
      */
     public void testConnectionPersistence() throws Exception {
-        MockHTTPServer httpServer =
-            new MockHTTPServer("HTTP Server for persistence checking", 2);
+        MockHTTPServer httpServer = new MockHTTPServer(
+                "HTTP Server for persistence checking", 2);
         httpServer.start();
-        synchronized(bound) {
+        synchronized (bound) {
             if (!httpServer.started) {
                 bound.wait(5000);
             }
         }
 
-        HttpURLConnection c = (HttpURLConnection)
-            new URL("http://localhost:"+httpServer.port()).openConnection();
+        HttpURLConnection c = (HttpURLConnection) new URL("http://localhost:"
+                + httpServer.port()).openConnection();
         if (DEBUG) {
-            System.out.println("Actual connection class: "+c.getClass());
+            System.out.println("Actual connection class: " + c.getClass());
         }
 
         c.setDoInput(true);
@@ -459,7 +466,7 @@
         byte[] buffer = new byte[128];
         int totalBytes = 0;
         int bytesRead = 0;
-        while((bytesRead = is.read(buffer)) > 0){
+        while ((bytesRead = is.read(buffer)) > 0) {
             if (DEBUG) {
                 System.out.println("Client got response: '"
                         + new String(buffer, 0, bytesRead) + "'");
@@ -467,8 +474,8 @@
             totalBytes += bytesRead;
         }
 
-        HttpURLConnection c2 = (HttpURLConnection)
-            new URL("http://localhost:"+httpServer.port()).openConnection();
+        HttpURLConnection c2 = (HttpURLConnection) new URL("http://localhost:"
+                + httpServer.port()).openConnection();
         c2.setDoInput(true);
         c2.setConnectTimeout(5000);
         c2.setReadTimeout(5000);
@@ -476,7 +483,7 @@
         buffer = new byte[128];
         totalBytes = 0;
         bytesRead = 0;
-        while((bytesRead = is.read(buffer)) > 0){
+        while ((bytesRead = is.read(buffer)) > 0) {
             if (DEBUG) {
                 System.out.println("Client got response: '"
                         + new String(buffer, 0, bytesRead) + "'");
@@ -486,23 +493,23 @@
     }
 
     /**
-     * Test that a connection is not closed if the client reads all the data 
-     * but not closes input stream. read() not receives -1.
+     * Test that a connection is not closed if the client reads all the data but
+     * not closes input stream. read() not receives -1.
      */
     public void testConnectionPersistence2() throws Exception {
-        MockHTTPServer httpServer =
-            new MockHTTPServer("HTTP Server for persistence checking", 2);
+        MockHTTPServer httpServer = new MockHTTPServer(
+                "HTTP Server for persistence checking", 2);
         httpServer.start();
-        synchronized(bound) {
+        synchronized (bound) {
             if (!httpServer.started) {
                 bound.wait(5000);
             }
         }
 
-        HttpURLConnection c = (HttpURLConnection)
-            new URL("http://localhost:"+httpServer.port()).openConnection();
+        HttpURLConnection c = (HttpURLConnection) new URL("http://localhost:"
+                + httpServer.port()).openConnection();
         if (DEBUG) {
-            System.out.println("Actual connection class: "+c.getClass());
+            System.out.println("Actual connection class: " + c.getClass());
         }
 
         c.setDoInput(true);
@@ -511,45 +518,47 @@
         InputStream is = c.getInputStream();
         int bytes2Read = httpServer.response.length();
         byte[] buffer = new byte[httpServer.response.length()];
-        while((bytes2Read -= is.read(buffer)) > 0) { }
+        while ((bytes2Read -= is.read(buffer)) > 0) {
+        }
         if (DEBUG) {
-            System.out.println("Client got response: '"
-                    + new String(buffer) + "'");
+            System.out.println("Client got response: '" + new String(buffer)
+                    + "'");
         }
 
-        HttpURLConnection c2 = (HttpURLConnection)
-            new URL("http://localhost:"+httpServer.port()).openConnection();
+        HttpURLConnection c2 = (HttpURLConnection) new URL("http://localhost:"
+                + httpServer.port()).openConnection();
         c2.setDoInput(true);
         c2.setConnectTimeout(5000);
         c2.setReadTimeout(5000);
         is = c2.getInputStream();
         buffer = new byte[httpServer.response.length()];
         bytes2Read = httpServer.response.length();
-        while((bytes2Read -= is.read(buffer)) > 0) { }
+        while ((bytes2Read -= is.read(buffer)) > 0) {
+        }
         if (DEBUG) {
-            System.out.println("Client got response: '"
-                    + new String(buffer) + "'");
+            System.out.println("Client got response: '" + new String(buffer)
+                    + "'");
         }
     }
 
     /**
-     * Test that a connection is not closed if it firstly does POST, 
-     * and then does GET requests.
+     * Test that a connection is not closed if it firstly does POST, and then
+     * does GET requests.
      */
     public void testConnectionPersistence3() throws Exception {
-        MockHTTPServer httpServer =
-            new MockHTTPServer("HTTP Server for persistence checking", 2);
+        MockHTTPServer httpServer = new MockHTTPServer(
+                "HTTP Server for persistence checking", 2);
         httpServer.start();
-        synchronized(bound) {
+        synchronized (bound) {
             if (!httpServer.started) {
                 bound.wait(5000);
             }
         }
 
-        HttpURLConnection c = (HttpURLConnection)
-            new URL("http://localhost:"+httpServer.port()).openConnection();
+        HttpURLConnection c = (HttpURLConnection) new URL("http://localhost:"
+                + httpServer.port()).openConnection();
         if (DEBUG) {
-            System.out.println("Actual connection class: "+c.getClass());
+            System.out.println("Actual connection class: " + c.getClass());
         }
 
         c.setDoInput(true);
@@ -558,65 +567,68 @@
         c.setReadTimeout(5000);
         c.getOutputStream().write(httpServer.clientPost.getBytes());
 
-        InputStream is = c.getInputStream(); 
+        InputStream is = c.getInputStream();
         int bytes2Read = httpServer.response.length();
         byte[] buffer = new byte[httpServer.response.length()];
-        while((bytes2Read -= is.read(buffer)) > 0) { }
+        while ((bytes2Read -= is.read(buffer)) > 0) {
+        }
         if (DEBUG) {
-            System.out.println("Client got response: '"
-                    + new String(buffer) + "'");
+            System.out.println("Client got response: '" + new String(buffer)
+                    + "'");
         }
 
-        HttpURLConnection c2 = (HttpURLConnection)
-            new URL("http://localhost:"+httpServer.port()).openConnection();
+        HttpURLConnection c2 = (HttpURLConnection) new URL("http://localhost:"
+                + httpServer.port()).openConnection();
         c2.setDoInput(true);
         c2.setConnectTimeout(5000);
         c2.setReadTimeout(5000);
         is = c2.getInputStream();
         buffer = new byte[httpServer.response.length()];
         bytes2Read = httpServer.response.length();
-        while((bytes2Read -= is.read(buffer)) > 0) { }
+        while ((bytes2Read -= is.read(buffer)) > 0) {
+        }
         if (DEBUG) {
-            System.out.println("Client got response: '"
-                    + new String(buffer) + "'");
+            System.out.println("Client got response: '" + new String(buffer)
+                    + "'");
         }
     }
 
     /**
-     * Test that a connection is not closed if it firstly does GET, 
-     * and then does POST requests.
+     * Test that a connection is not closed if it firstly does GET, and then
+     * does POST requests.
      */
     public void testConnectionPersistence4() throws Exception {
-        MockHTTPServer httpServer =
-            new MockHTTPServer("HTTP Server for persistence checking", 2);
+        MockHTTPServer httpServer = new MockHTTPServer(
+                "HTTP Server for persistence checking", 2);
         httpServer.start();
-        synchronized(bound) {
+        synchronized (bound) {
             if (!httpServer.started) {
                 bound.wait(5000);
             }
         }
 
-        HttpURLConnection c = (HttpURLConnection)
-            new URL("http://localhost:"+httpServer.port()).openConnection();
+        HttpURLConnection c = (HttpURLConnection) new URL("http://localhost:"
+                + httpServer.port()).openConnection();
         if (DEBUG) {
-            System.out.println("Actual connection class: "+c.getClass());
+            System.out.println("Actual connection class: " + c.getClass());
         }
 
         c.setDoInput(true);
         c.setConnectTimeout(5000);
         c.setReadTimeout(5000);
 
-        InputStream is = c.getInputStream(); 
+        InputStream is = c.getInputStream();
         int bytes2Read = httpServer.response.length();
         byte[] buffer = new byte[httpServer.response.length()];
-        while((bytes2Read = is.read(buffer)) > 0) { }
+        while ((bytes2Read = is.read(buffer)) > 0) {
+        }
         if (DEBUG) {
-            System.out.println("Client got response: '"
-                    + new String(buffer) + "'");
+            System.out.println("Client got response: '" + new String(buffer)
+                    + "'");
         }
-        
-        HttpURLConnection c2 = (HttpURLConnection)
-            new URL("http://localhost:"+httpServer.port()).openConnection();
+
+        HttpURLConnection c2 = (HttpURLConnection) new URL("http://localhost:"
+                + httpServer.port()).openConnection();
         c2.setDoOutput(true);
         c2.setDoInput(true);
         c2.setConnectTimeout(5000);
@@ -625,10 +637,11 @@
         is = c2.getInputStream();
         buffer = new byte[httpServer.response.length()];
         bytes2Read = httpServer.response.length();
-        while((bytes2Read = is.read(buffer)) > 0) { }
+        while ((bytes2Read = is.read(buffer)) > 0) {
+        }
         if (DEBUG) {
-            System.out.println("Client got response: '"
-                    + new String(buffer) + "'");
+            System.out.println("Client got response: '" + new String(buffer)
+                    + "'");
         }
     }
 
@@ -636,36 +649,37 @@
      * Test that a connection is not closed if it does POST for 2 times.
      */
     public void testConnectionPersistence5() throws Exception {
-        MockHTTPServer httpServer =
-            new MockHTTPServer("HTTP Server for persistence checking", 2);
+        MockHTTPServer httpServer = new MockHTTPServer(
+                "HTTP Server for persistence checking", 2);
         httpServer.start();
-        synchronized(bound) {
+        synchronized (bound) {
             if (!httpServer.started) {
                 bound.wait(5000);
             }
         }
 
-        HttpURLConnection c = (HttpURLConnection)
-            new URL("http://localhost:"+httpServer.port()).openConnection();
+        HttpURLConnection c = (HttpURLConnection) new URL("http://localhost:"
+                + httpServer.port()).openConnection();
         if (DEBUG) {
-            System.out.println("Actual connection class: "+c.getClass());
+            System.out.println("Actual connection class: " + c.getClass());
         }
         c.setDoOutput(true);
         c.setDoInput(true);
         c.setConnectTimeout(5000);
         c.setReadTimeout(5000);
         c.getOutputStream().write(httpServer.clientPost.getBytes());
-        InputStream is = c.getInputStream(); 
+        InputStream is = c.getInputStream();
         int bytes2Read = httpServer.response.length();
         byte[] buffer = new byte[httpServer.response.length()];
-        while((bytes2Read = is.read(buffer)) > 0) { }
+        while ((bytes2Read = is.read(buffer)) > 0) {
+        }
         if (DEBUG) {
-            System.out.println("Client got response: '"
-                    + new String(buffer) + "'");
+            System.out.println("Client got response: '" + new String(buffer)
+                    + "'");
         }
 
-        HttpURLConnection c2 = (HttpURLConnection)
-            new URL("http://localhost:"+httpServer.port()).openConnection();
+        HttpURLConnection c2 = (HttpURLConnection) new URL("http://localhost:"
+                + httpServer.port()).openConnection();
         c2.setDoOutput(true);
         c2.setDoInput(true);
         c2.setConnectTimeout(5000);
@@ -674,72 +688,75 @@
         is = c2.getInputStream();
         buffer = new byte[httpServer.response.length()];
         bytes2Read = httpServer.response.length();
-        while((bytes2Read = is.read(buffer)) > 0) { }
+        while ((bytes2Read = is.read(buffer)) > 0) {
+        }
         if (DEBUG) {
-            System.out.println("Client got response: '"
-                    + new String(buffer) + "'");
+            System.out.println("Client got response: '" + new String(buffer)
+                    + "'");
         }
     }
 
     /**
-     * Test that a connection made through proxy will be reused
-     * for connection establishing without proxy.
+     * Test that a connection made through proxy will be reused for connection
+     * establishing without proxy.
      */
     public void testProxiedConnectionPersistence() throws Exception {
-        MockHTTPServer httpServer =
-            new MockHTTPServer("HTTP Server for persistence checking", 2);
+        MockHTTPServer httpServer = new MockHTTPServer(
+                "HTTP Server for persistence checking", 2);
         httpServer.start();
-        synchronized(bound) {
+        synchronized (bound) {
             if (!httpServer.started) {
                 bound.wait(5000);
             }
         }
 
-        HttpURLConnection c = (HttpURLConnection)
-            new URL("http://some.host:1234")
-                    .openConnection(new Proxy(Proxy.Type.HTTP,
-                            new InetSocketAddress("localhost",
-                                httpServer.port())));
+        HttpURLConnection c = (HttpURLConnection) new URL(
+                "http://some.host:1234").openConnection(new Proxy(
+                Proxy.Type.HTTP, new InetSocketAddress("localhost", httpServer
+                        .port())));
         if (DEBUG) {
-            System.out.println("Actual connection class: "+c.getClass());
+            System.out.println("Actual connection class: " + c.getClass());
         }
         c.setDoOutput(true);
         c.setDoInput(true);
         c.setConnectTimeout(5000);
         c.setReadTimeout(5000);
         c.getOutputStream().write(httpServer.clientPost.getBytes());
-        InputStream is = c.getInputStream(); 
+        InputStream is = c.getInputStream();
         int bytes2Read = httpServer.response.length();
         byte[] buffer = new byte[httpServer.response.length()];
-        while((bytes2Read = is.read(buffer)) > 0) { }
+        while ((bytes2Read = is.read(buffer)) > 0) {
+        }
         if (DEBUG) {
-            System.out.println("Client got response: '"
-                    + new String(buffer) + "'");
+            System.out.println("Client got response: '" + new String(buffer)
+                    + "'");
         }
 
-        HttpURLConnection c2 = (HttpURLConnection)
-            new URL("http://some.host:1234").openConnection();
+        HttpURLConnection c2 = (HttpURLConnection) new URL(
+                "http://some.host:1234").openConnection();
         c2.setDoOutput(true);
         c2.setDoInput(true);
         c2.setConnectTimeout(5000);
         c2.setReadTimeout(5000);
         c2.getOutputStream().write(httpServer.clientPost.getBytes());
-        is = c2.getInputStream(); 
+        is = c2.getInputStream();
         buffer = new byte[httpServer.response.length()];
         bytes2Read = httpServer.response.length();
-        while((bytes2Read = is.read(buffer)) > 0) { }
+        while ((bytes2Read = is.read(buffer)) > 0) {
+        }
         if (DEBUG) {
-            System.out.println("Client got response: '"
-                    + new String(buffer) + "'");
+            System.out.println("Client got response: '" + new String(buffer)
+                    + "'");
         }
     }
 
-    public void testSecurityManager() throws MalformedURLException, IOException, InterruptedException {
+    public void testSecurityManager() throws MalformedURLException,
+            IOException, InterruptedException {
         try {
-            MockHTTPServer httpServer =
-                new MockHTTPServer("HTTP Server for persistence checking", 2);
+            MockHTTPServer httpServer = new MockHTTPServer(
+                    "HTTP Server for persistence checking", 2);
             httpServer.start();
-            synchronized(bound) {
+            synchronized (bound) {
                 if (!httpServer.started) {
                     bound.wait(5000);
                 }
@@ -749,10 +766,12 @@
 
             // Check that a first connection calls checkConnect
             try {
-                HttpURLConnection c = (HttpURLConnection)
-                    new URL("http://localhost:"+httpServer.port()).openConnection();
+                HttpURLConnection c = (HttpURLConnection) new URL(
+                        "http://localhost:" + httpServer.port())
+                        .openConnection();
                 if (DEBUG) {
-                    System.out.println("Actual connection class: "+c.getClass());
+                    System.out.println("Actual connection class: "
+                            + c.getClass());
                 }
                 c.connect();
                 fail("Should have thrown a SecurityException upon connection");
@@ -762,8 +781,8 @@
 
             // Now create a connection properly
             System.setSecurityManager(null);
-            HttpURLConnection c = (HttpURLConnection)
-            new URL("http://localhost:"+httpServer.port()).openConnection();
+            HttpURLConnection c = (HttpURLConnection) new URL(
+                    "http://localhost:" + httpServer.port()).openConnection();
             c.setDoInput(true);
             c.setConnectTimeout(5000);
             c.setReadTimeout(5000);
@@ -771,7 +790,7 @@
             byte[] buffer = new byte[128];
             int totalBytes = 0;
             int bytesRead = 0;
-            while((bytesRead = is.read(buffer)) > 0){
+            while ((bytesRead = is.read(buffer)) > 0) {
                 if (DEBUG) {
                     System.out.println("Client got response: '"
                             + new String(buffer, 0, bytesRead) + "'");
@@ -782,8 +801,9 @@
             // Now check that a second connection also calls checkConnect
             System.setSecurityManager(sm);
             try {
-                HttpURLConnection c2 = (HttpURLConnection)
-                    new URL("http://localhost:"+httpServer.port()).openConnection();
+                HttpURLConnection c2 = (HttpURLConnection) new URL(
+                        "http://localhost:" + httpServer.port())
+                        .openConnection();
                 c2.setDoInput(true);
                 c2.setConnectTimeout(5000);
                 c2.setReadTimeout(5000);
@@ -791,7 +811,7 @@
                 buffer = new byte[128];
                 totalBytes = 0;
                 bytesRead = 0;
-                while((bytesRead = is.read(buffer)) > 0){
+                while ((bytesRead = is.read(buffer)) > 0) {
                     if (DEBUG) {
                         System.out.println("Client got response: '"
                                 + new String(buffer, 0, bytesRead) + "'");
@@ -810,14 +830,14 @@
 
         @Override
         public void checkConnect(String host, int port) {
-           throw new SecurityException();
+            throw new SecurityException();
         }
-        
+
         @Override
         public void checkConnect(String host, int port, Object context) {
             throw new SecurityException();
         }
-        
+
         @Override
         public void checkPermission(Permission permission) {
             // allows a new security manager to be set

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/https/HttpsURLConnectionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/https/HttpsURLConnectionTest.java?rev=613858&r1=613857&r2=613858&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/https/HttpsURLConnectionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/https/HttpsURLConnectionTest.java Mon Jan 21 03:55:17 2008
@@ -36,6 +36,7 @@
 import java.security.KeyStore;
 import java.security.cert.Certificate;
 import java.util.Arrays;
+
 import javax.net.ssl.HostnameVerifier;
 import javax.net.ssl.HttpsURLConnection;
 import javax.net.ssl.KeyManagerFactory;
@@ -46,23 +47,19 @@
 import javax.net.ssl.SSLSocketFactory;
 import javax.net.ssl.TrustManagerFactory;
 
+import junit.framework.AssertionFailedError;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
 /**
- * Implementation independent test for HttpsURLConnection.
- * The test needs certstore file placed in system classpath 
- * and named as "key_store." + the type of the
- * default KeyStore installed in the system in lower case.
- * <br>
- * For example: if default KeyStore type in the system is BKS
- * (i.e. java.security file sets up the property keystore.type=BKS),
- * thus classpath should point to the directory with "key_store.bks"
- * file.
- * <br>
- * This certstore file should contain self-signed certificate
- * generated by keytool utility in a usual way.
- * <br>
+ * Implementation independent test for HttpsURLConnection. The test needs
+ * certstore file placed in system classpath and named as "key_store." + the
+ * type of the default KeyStore installed in the system in lower case. <br>
+ * For example: if default KeyStore type in the system is BKS (i.e.
+ * java.security file sets up the property keystore.type=BKS), thus classpath
+ * should point to the directory with "key_store.bks" file. <br>
+ * This certstore file should contain self-signed certificate generated by
+ * keytool utility in a usual way. <br>
  * The password to the certstore should be "password" (without quotes).
  */
 public class HttpsURLConnectionTest extends TestCase {
@@ -121,11 +118,10 @@
     }
 
     /**
-     * Checks if HTTPS connection performs initial SSL handshake with the
-     * server working over SSL, sends encrypted HTTP request,
-     * and receives expected HTTP response. After HTTPS session if finished
-     * test checks connection state parameters established by
-     * HttpsURLConnection.
+     * Checks if HTTPS connection performs initial SSL handshake with the server
+     * working over SSL, sends encrypted HTTP request, and receives expected
+     * HTTP response. After HTTPS session if finished test checks connection
+     * state parameters established by HttpsURLConnection.
      */
     public void testHttpsConnection() throws Throwable {
         // set up the properties defining the default values needed by SSL stuff
@@ -161,13 +157,11 @@
     }
 
     /**
-     * Checks if HTTPS connection performs initial SSL handshake with the
-     * server working over SSL, sends encrypted HTTP request,
-     * and receives expected HTTP response. After that it checks that the
-     * established connection is persistent.
-     * After HTTPS session if finished
-     * test checks connection state parameters established by
-     * HttpsURLConnection.
+     * Checks if HTTPS connection performs initial SSL handshake with the server
+     * working over SSL, sends encrypted HTTP request, and receives expected
+     * HTTP response. After that it checks that the established connection is
+     * persistent. After HTTPS session if finished test checks connection state
+     * parameters established by HttpsURLConnection.
      */
     public void testHttpsPersistentConnection() throws Throwable {
         // set up the properties defining the default values needed by SSL stuff
@@ -189,7 +183,8 @@
                     .openConnection();
 
             // perform the interaction between the peers
-            SSLSocket peerSocket = (SSLSocket) doPersistentInteraction(connection, ss);
+            SSLSocket peerSocket = (SSLSocket) doPersistentInteraction(
+                    connection, ss);
 
             // check the connection state
             checkConnectionStateParameters(connection, peerSocket);
@@ -203,8 +198,8 @@
     }
 
     /**
-     * Tests the behaviour of HTTPS connection in case of unavailability
-     * of requested resource.
+     * Tests the behaviour of HTTPS connection in case of unavailability of
+     * requested resource.
      */
     public void testHttpsConnection_Not_Found_Response() throws Throwable {
         // set up the properties defining the default values needed by SSL stuff
@@ -244,8 +239,8 @@
     }
 
     /**
-     * Tests possibility to set up the default SSLSocketFactory
-     * to be used by HttpsURLConnection.
+     * Tests possibility to set up the default SSLSocketFactory to be used by
+     * HttpsURLConnection.
      */
     public void testSetDefaultSSLSocketFactory() throws Throwable {
         // create the SSLServerSocket which will be used by server side
@@ -293,8 +288,8 @@
     }
 
     /**
-     * Tests possibility to set up the SSLSocketFactory
-     * to be used by HttpsURLConnection.
+     * Tests possibility to set up the SSLSocketFactory to be used by
+     * HttpsURLConnection.
      */
     public void testSetSSLSocketFactory() throws Throwable {
         // create the SSLServerSocket which will be used by server side
@@ -340,8 +335,8 @@
     }
 
     /**
-     * Tests the behaviour of HttpsURLConnection in case of retrieving
-     * of the connection state parameters before connection has been made.
+     * Tests the behaviour of HttpsURLConnection in case of retrieving of the
+     * connection state parameters before connection has been made.
      */
     public void testUnconnectedStateParameters() throws Throwable {
         // create HttpsURLConnection to be tested
@@ -352,24 +347,29 @@
         try {
             connection.getCipherSuite();
             fail("Expected IllegalStateException was not thrown");
-        } catch (IllegalStateException e) {}
+        } catch (IllegalStateException e) {
+        }
         try {
             connection.getPeerPrincipal();
             fail("Expected IllegalStateException was not thrown");
-        } catch (IllegalStateException e) {}
+        } catch (IllegalStateException e) {
+        }
         try {
             connection.getLocalPrincipal();
             fail("Expected IllegalStateException was not thrown");
-        } catch (IllegalStateException e) {}
+        } catch (IllegalStateException e) {
+        }
 
         try {
             connection.getServerCertificates();
             fail("Expected IllegalStateException was not thrown");
-        } catch (IllegalStateException e) {}
+        } catch (IllegalStateException e) {
+        }
         try {
             connection.getLocalCertificates();
             fail("Expected IllegalStateException was not thrown");
-        } catch (IllegalStateException e) {}
+        } catch (IllegalStateException e) {
+        }
     }
 
     /**
@@ -450,8 +450,8 @@
     }
 
     /**
-     * Tests the behaviour in case of sending the data to the server 
-     * over persistent connection.
+     * Tests the behaviour in case of sending the data to the server over
+     * persistent connection.
      */
     public void testPersistence_doOutput() throws Throwable {
         // setting up the properties pointing to the key/trust stores
@@ -474,8 +474,8 @@
             connection.setDoOutput(true);
 
             // perform the interaction between the peers and check the results
-            SSLSocket peerSocket = (SSLSocket) 
-                doPersistentInteraction(connection, ss);
+            SSLSocket peerSocket = (SSLSocket) doPersistentInteraction(
+                    connection, ss);
             checkConnectionStateParameters(connection, peerSocket);
 
             // should silently exit
@@ -522,9 +522,9 @@
     }
 
     /**
-     * Tests HTTPS connection process made through the proxy server.
-     * Checks that persistent connection to the host exists and can
-     * be used no in spite of explicit Proxy specifying.
+     * Tests HTTPS connection process made through the proxy server. Checks that
+     * persistent connection to the host exists and can be used no in spite of
+     * explicit Proxy specifying.
      */
     public void testPersistentProxyConnection() throws Throwable {
         // setting up the properties pointing to the key/trust stores
@@ -547,7 +547,8 @@
                                     .getLocalPort())));
 
             // perform the interaction between the peers and check the results
-            SSLSocket peerSocket = (SSLSocket) doPersistentInteraction(connection, ss);
+            SSLSocket peerSocket = (SSLSocket) doPersistentInteraction(
+                    connection, ss);
             checkConnectionStateParameters(connection, peerSocket);
 
             // should silently exit
@@ -559,8 +560,8 @@
     }
 
     /**
-     * Tests HTTPS connection process made through the proxy server.
-     * Proxy server needs authentication.
+     * Tests HTTPS connection process made through the proxy server. Proxy
+     * server needs authentication.
      */
     public void testProxyAuthConnection() throws Throwable {
         // setting up the properties pointing to the key/trust stores
@@ -603,10 +604,9 @@
     }
 
     /**
-     * Tests HTTPS connection process made through the proxy server.
-     * 2 HTTPS connections are opened for one URL. For the first time
-     * the connection is opened through one proxy,
-     * for the second time through another.
+     * Tests HTTPS connection process made through the proxy server. 2 HTTPS
+     * connections are opened for one URL. For the first time the connection is
+     * opened through one proxy, for the second time through another.
      */
     public void testConsequentProxyConnection() throws Throwable {
         // setting up the properties pointing to the key/trust stores
@@ -649,9 +649,8 @@
     }
 
     /**
-     * Tests HTTPS connection process made through the proxy server.
-     * Proxy server needs authentication.
-     * Client sends data to the server.
+     * Tests HTTPS connection process made through the proxy server. Proxy
+     * server needs authentication. Client sends data to the server.
      */
     public void testProxyAuthConnection_doOutput() throws Throwable {
         // setting up the properties pointing to the key/trust stores
@@ -693,8 +692,8 @@
     }
 
     /**
-     * Tests HTTPS connection process made through the proxy server.
-     * Proxy server needs authentication but client fails to authenticate
+     * Tests HTTPS connection process made through the proxy server. Proxy
+     * server needs authentication but client fails to authenticate
      * (Authenticator was not set up in the system).
      */
     public void testProxyAuthConnectionFailed() throws Throwable {
@@ -734,8 +733,8 @@
     }
 
     /**
-     * Tests the behaviour of HTTPS connection in case of unavailability
-     * of requested resource.
+     * Tests the behaviour of HTTPS connection in case of unavailability of
+     * requested resource.
      */
     public void testProxyConnection_Not_Found_Response() throws Throwable {
         // setting up the properties pointing to the key/trust stores
@@ -789,8 +788,8 @@
     }
 
     /**
-     * Checks the HttpsURLConnection getter's values and compares
-     * them with actual corresponding values of remote peer.
+     * Checks the HttpsURLConnection getter's values and compares them with
+     * actual corresponding values of remote peer.
      */
     public static void checkConnectionStateParameters(
             HttpsURLConnection clientConnection, SSLSocket serverPeer)
@@ -819,11 +818,12 @@
     }
 
     /**
-     * Returns the file name of the key/trust store. The key store file
-     * (named as "key_store." + extension equals to the default KeyStore
-     * type installed in the system in lower case) is searched in classpath.
-     * @throws AssertionFailedError if property was not set
-     * or file does not exist.
+     * Returns the file name of the key/trust store. The key store file (named
+     * as "key_store." + extension equals to the default KeyStore type installed
+     * in the system in lower case) is searched in classpath.
+     * 
+     * @throws AssertionFailedError
+     *             if property was not set or file does not exist.
      */
     private static String getKeyStoreFileName() throws Exception {
         String ksFileName = "org/apache/harmony/luni/tests/key_store."
@@ -865,9 +865,9 @@
     }
 
     /**
-     * Sets up the properties pointing to the key store and trust store
-     * and used as default values by JSSE staff. This is needed to test
-     * HTTPS behaviour in the case of default SSL Socket Factories.
+     * Sets up the properties pointing to the key store and trust store and used
+     * as default values by JSSE staff. This is needed to test HTTPS behaviour
+     * in the case of default SSL Socket Factories.
      */
     private static void setUpStoreProperties() throws Exception {
         String type = KeyStore.getDefaultType();
@@ -935,19 +935,19 @@
     }
 
     /**
-     * Performs interaction between client's HttpURLConnection and
-     * servers side (ServerSocket).
+     * Performs interaction between client's HttpURLConnection and servers side
+     * (ServerSocket).
      */
     public static Socket doInteraction(
             final HttpURLConnection clientConnection,
             final ServerSocket serverSocket) throws Throwable {
-        return doInteraction(clientConnection, serverSocket, OK_CODE, false, false);
+        return doInteraction(clientConnection, serverSocket, OK_CODE, false,
+                false);
     }
 
     /**
-     * Performs interaction between client's HttpURLConnection and
-     * servers side (ServerSocket). Server will response with specified
-     * response code.
+     * Performs interaction between client's HttpURLConnection and servers side
+     * (ServerSocket). Server will response with specified response code.
      */
     public static Socket doInteraction(
             final HttpURLConnection clientConnection,
@@ -958,20 +958,20 @@
     }
 
     /**
-     * Performs interaction between client's HttpURLConnection and
-     * servers side (ServerSocket) over persistent connection.
+     * Performs interaction between client's HttpURLConnection and servers side
+     * (ServerSocket) over persistent connection.
      */
     public static Socket doPersistentInteraction(
             final HttpURLConnection clientConnection,
             final ServerSocket serverSocket) throws Throwable {
-        return doInteraction(clientConnection, serverSocket, OK_CODE,
-                false, true);
+        return doInteraction(clientConnection, serverSocket, OK_CODE, false,
+                true);
     }
 
     /**
-     * Performs interaction between client's HttpURLConnection and
-     * servers side (ServerSocket) over persistent connection.
-     * Server will response with specified response code.
+     * Performs interaction between client's HttpURLConnection and servers side
+     * (ServerSocket) over persistent connection. Server will response with
+     * specified response code.
      */
     public static Socket doPersistentInteraction(
             final HttpURLConnection clientConnection,
@@ -982,17 +982,17 @@
     }
 
     /**
-     * Performs interaction between client's HttpURLConnection and
-     * servers side (ServerSocket). Server will response with specified
-     * response code.
-     * @param doAuthentication specifies 
-     * if the server needs client authentication.
+     * Performs interaction between client's HttpURLConnection and servers side
+     * (ServerSocket). Server will response with specified response code.
+     * 
+     * @param doAuthentication
+     *            specifies if the server needs client authentication.
      */
     public static Socket doInteraction(
             final HttpURLConnection clientConnection,
             final ServerSocket serverSocket, final int responseCode,
-            final boolean doAuthentication, 
-            final boolean checkPersistence) throws Throwable {
+            final boolean doAuthentication, final boolean checkPersistence)
+            throws Throwable {
 
         // set up the connection
         clientConnection.setDoInput(true);
@@ -1023,9 +1023,9 @@
         }
 
         if (checkPersistence) {
-            ClientConnectionWork client2 =
-                new ClientConnectionWork((HttpURLConnection)
-                        clientConnection.getURL().openConnection());
+            ClientConnectionWork client2 = new ClientConnectionWork(
+                    (HttpURLConnection) clientConnection.getURL()
+                            .openConnection());
             client2.start();
             client2.join();
             if (client2.thrown != null) {
@@ -1128,8 +1128,8 @@
         protected Throwable thrown;
 
         /**
-         * The print stream used for debug log.
-         * If it is null debug info will not be printed.
+         * The print stream used for debug log. If it is null debug info will
+         * not be printed.
          */
         private PrintStream out = new PrintStream(System.out);
 
@@ -1177,10 +1177,13 @@
 
         /**
          * Creates the thread acting as a server side.
-         * @param serverSocket the server socket to be used during connection
-         * @param responseCode the response code to be sent to the client
+         * 
+         * @param serverSocket
+         *            the server socket to be used during connection
+         * @param responseCode
+         *            the response code to be sent to the client
          * @param needProxyAuthentication
-         * indicates if the server needs proxy authentication
+         *            indicates if the server needs proxy authentication
          */
         public ServerWork(ServerSocket serverSocket, int responseCode,
                 boolean needProxyAuthentication, boolean checkPersistence) {
@@ -1208,19 +1211,21 @@
         public void closeSocket(Socket socket) {
             try {
                 socket.getInputStream().close();
-            } catch (IOException e) {}
+            } catch (IOException e) {
+            }
             try {
                 socket.getOutputStream().close();
-            } catch (IOException e) {}
+            } catch (IOException e) {
+            }
             try {
                 socket.close();
-            } catch (IOException e) {}
+            } catch (IOException e) {
+            }
         }
 
         /**
-         * Performs the actual server work.
-         * If some exception occurs during the work it will be
-         * stored in the <code>thrown</code> field.
+         * Performs the actual server work. If some exception occurs during the
+         * work it will be stored in the <code>thrown</code> field.
          */
         public void run() {
             // the buffer used for reading the messages
@@ -1241,10 +1246,11 @@
 
                 // how many times established connection will be used
                 int number_of_uses = checkPersistence ? 2 : 1;
-                for (int it=0; it<number_of_uses; it++) {
+                for (int it = 0; it < number_of_uses; it++) {
                     if (checkPersistence) {
                         log("==========================================");
-                        log("Use established connection for "+(it+1)+" time");
+                        log("Use established connection for " + (it + 1)
+                                + " time");
                     }
 
                     num = is.read(buff);
@@ -1264,8 +1270,9 @@
                             assertEquals(clientsData, message);
                         }
                         // just send the response
-                        os.write(("HTTP/1.1 " + responseCode + "\n" 
-                                    + httpsResponseTail).getBytes());
+                        os
+                                .write(("HTTP/1.1 " + responseCode + "\n" + httpsResponseTail)
+                                        .getBytes());
                         log("Simple NON-Proxy work is DONE");
                         continue;
                     }
@@ -1278,7 +1285,7 @@
                         // read response
                         num = is.read(buff);
                         if (num == -1) {
-                            // this connection was closed, 
+                            // this connection was closed,
                             // do clean up and create new one:
                             closeSocket(peerSocket);
                             peerSocket = serverSocket.accept();
@@ -1293,20 +1300,22 @@
                         log("------------------");
                         // check provided authorization credentials
                         assertTrue("Received message does not contain "
-                                + "authorization credentials", message
-                                .toLowerCase().indexOf("proxy-authorization:") > 0);
+                                + "authorization credentials",
+                                message.toLowerCase().indexOf(
+                                        "proxy-authorization:") > 0);
                     }
 
                     if (peerSocket instanceof SSLSocket) {
-                        // it will be so if we are have second iteration 
+                        // it will be so if we are have second iteration
                         // over persistent connection
-                        os.write(("HTTP/1.1 " + OK_CODE
-                                    + "\n" + httpsResponseTail).getBytes());
+                        os
+                                .write(("HTTP/1.1 " + OK_CODE + "\n" + httpsResponseTail)
+                                        .getBytes());
                         log("Sent OK RESPONSE over SSL");
                     } else {
                         // The content of this response will reach proxied
                         // HTTPUC but will not reach proxied HTTPSUC
-                        // In case of HTTP connection it will be the final 
+                        // In case of HTTP connection it will be the final
                         // message, in case of HTTPS connection this message
                         // will just indicate that connection with remote
                         // host has been done
@@ -1315,12 +1324,15 @@
                         log("Sent OK RESPONSE");
                     }
 
-                    if (message.startsWith("CONNECT")) { // request for SSL tunnel
+                    if (message.startsWith("CONNECT")) { // request for SSL
+                                                            // tunnel
                         log("Perform SSL Handshake...");
                         // create sslSocket acting as a remote server peer
                         SSLSocket sslSocket = (SSLSocket) getContext()
-                                .getSocketFactory().createSocket(peerSocket,
-                                        "localhost", peerSocket.getPort(), true); // do autoclose
+                                .getSocketFactory()
+                                .createSocket(peerSocket, "localhost",
+                                        peerSocket.getPort(), true); // do
+                                                                        // autoclose
                         sslSocket.setUseClientMode(false);
                         // demand client authentication
                         sslSocket.setNeedClientAuth(true);
@@ -1333,7 +1345,8 @@
                         // (HTTPS request)
                         num = is.read(buff);
                         message = new String(buff, 0, num);
-                        log("[Remote Server] Request from SSL tunnel:\n" + message);
+                        log("[Remote Server] Request from SSL tunnel:\n"
+                                + message);
                         log("------------------");
 
                         if (message.startsWith("POST")) {
@@ -1341,18 +1354,21 @@
                             log("[Remote Server] try to read client data");
                             num = is.read(buff);
                             message = new String(buff, 0, num);
-                            log("[Remote Server] client's data: '" + message + "'");
+                            log("[Remote Server] client's data: '" + message
+                                    + "'");
                             // check the received data
                             assertEquals(clientsData, message);
                         }
 
                         log("[Remote Server] Sending the response by SSL tunnel..");
                         // send the response with specified response code
-                        os.write(("HTTP/1.1 " + responseCode 
-                                    + "\n" + httpsResponseTail).getBytes());
+                        os
+                                .write(("HTTP/1.1 " + responseCode + "\n" + httpsResponseTail)
+                                        .getBytes());
                     }
                     log("Work is DONE");
-                };
+                }
+                ;
             } catch (Throwable e) {
                 if (DO_LOG) {
                     e.printStackTrace();
@@ -1362,14 +1378,15 @@
                 closeSocket(peerSocket);
                 try {
                     serverSocket.close();
-                } catch (IOException e) {}
+                } catch (IOException e) {
+                }
             }
         }
     }
 
     /**
-     * The class used for client side works. It could be used to test
-     * both HttpURLConnection and HttpsURLConnection.
+     * The class used for client side works. It could be used to test both
+     * HttpURLConnection and HttpsURLConnection.
      */
     static class ClientConnectionWork extends Work {
 
@@ -1378,7 +1395,9 @@
 
         /**
          * Creates the thread acting as a client side.
-         * @param connection connection to be used to contact the server side
+         * 
+         * @param connection
+         *            connection to be used to contact the server side
          */
         public ClientConnectionWork(HttpURLConnection connection) {
             this.connection = connection;
@@ -1387,9 +1406,8 @@
         }
 
         /**
-         * Performs the actual client work.
-         * If some exception occurs during the work it will be
-         * stored in the <code>thrown<code> field.
+         * Performs the actual client work. If some exception occurs during the
+         * work it will be stored in the <code>thrown<code> field.
          */
         public void run() {
             try {
@@ -1403,7 +1421,7 @@
                 }
                 // read the content of HTTP(s) response
                 InputStream is = connection.getInputStream();
-                log("Input Stream obtained: "+is.getClass());
+                log("Input Stream obtained: " + is.getClass());
                 byte[] buff = new byte[2048];
                 int num = 0;
                 int byt = 0;

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/Process2Test.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/Process2Test.java?rev=613858&r1=613857&r2=613858&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/Process2Test.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/Process2Test.java Mon Jan 21 03:55:17 2008
@@ -19,7 +19,6 @@
 
 import java.io.BufferedInputStream;
 import java.io.BufferedOutputStream;
-import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/EnumMapTest.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/EnumMapTest.java?rev=613858&r1=613857&r2=613858&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/EnumMapTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/EnumMapTest.java Mon Jan 21 03:55:17 2008
@@ -1155,20 +1155,4 @@
         enumColorMap.put(Color.Blue, 3);
         SerializationTest.verifyGolden(this, enumColorMap);
     }
-
-    /**
-     * Sets up the fixture.
-     */
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-    }
-
-    /**
-     * Tears down the fixture.
-     */
-    @Override
-    protected void tearDown() throws Exception{
-        super.tearDown();
-    }
 }

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=613858&r1=613857&r2=613858&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 Mon Jan 21 03:55:17 2008
@@ -212,23 +212,23 @@
 		gc1 = new GregorianCalendar(TimeZone.getTimeZone("EST"));
 		gc1.set(1999, Calendar.APRIL, 3, 16, 0); // day before DST change
 		gc1.add(Calendar.MILLISECOND, 24 * 60 * 60 * 1000);
-		assertEquals("Wrong time after MILLISECOND change", 17, gc1
+		assertEquals("Wrong time after MILLISECOND change", 16, gc1
 				.get(Calendar.HOUR_OF_DAY));
 		gc1.set(1999, Calendar.APRIL, 3, 16, 0); // day before DST change
 		gc1.add(Calendar.SECOND, 24 * 60 * 60);
-		assertEquals("Wrong time after SECOND change", 17, gc1
+		assertEquals("Wrong time after SECOND change", 16, gc1
 				.get(Calendar.HOUR_OF_DAY));
 		gc1.set(1999, Calendar.APRIL, 3, 16, 0); // day before DST change
 		gc1.add(Calendar.MINUTE, 24 * 60);
-		assertEquals("Wrong time after MINUTE change", 17, gc1
+		assertEquals("Wrong time after MINUTE change", 16, gc1
 				.get(Calendar.HOUR_OF_DAY));
 		gc1.set(1999, Calendar.APRIL, 3, 16, 0); // day before DST change
 		gc1.add(Calendar.HOUR, 24);
-		assertEquals("Wrong time after HOUR change", 17, gc1
+		assertEquals("Wrong time after HOUR change", 16, gc1
 				.get(Calendar.HOUR_OF_DAY));
 		gc1.set(1999, Calendar.APRIL, 3, 16, 0); // day before DST change
 		gc1.add(Calendar.HOUR_OF_DAY, 24);
-		assertEquals("Wrong time after HOUR_OF_DAY change", 17, gc1
+		assertEquals("Wrong time after HOUR_OF_DAY change", 16, gc1
 				.get(Calendar.HOUR_OF_DAY));
 
 		gc1.set(1999, Calendar.APRIL, 3, 16, 0); // day before DST change

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/HashtableTest.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/HashtableTest.java?rev=613858&r1=613857&r2=613858&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/HashtableTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/HashtableTest.java Mon Jan 21 03:55:17 2008
@@ -31,8 +31,6 @@
 import java.util.TreeMap;
 import java.util.Vector;
 
-import org.apache.harmony.luni.tests.java.util.HashMapTest.ReusableKey;
-
 import tests.support.Support_MapTest2;
 import tests.support.Support_UnmodifiableCollectionTest;
 
@@ -683,10 +681,25 @@
 			htfull.put("FKey " + i, "FVal " + i);
 	}
 
-	/**
-	 * Tears down the fixture, for example, close a network connection. This
-	 * method is called after a test is executed.
-	 */
-	protected void tearDown() {
-	}
+    static class ReusableKey {
+        private int key = 0;
+
+        public void setKey(int key) {
+            this.key = key;
+        }
+
+        public int hashCode() {
+            return key;
+        }
+
+        public boolean equals(Object o) {
+            if (o == this) {
+                return true;
+            }
+            if (!(o instanceof ReusableKey)) {
+                return false;
+            }
+            return key == ((ReusableKey) o).key;
+        }
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/PropertyPermissionTest.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/PropertyPermissionTest.java?rev=613858&r1=613857&r2=613858&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/PropertyPermissionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/PropertyPermissionTest.java Mon Jan 21 03:55:17 2008
@@ -133,20 +133,6 @@
         SerializationTest.verifySelf(pp, comparator);
         SerializationTest.verifyGolden(this, pp, comparator);
     }
-
-	/**
-	 * Sets up the fixture, for example, open a network connection. This method
-	 * is called before a test is executed.
-	 */
-	protected void setUp() {
-	}
-
-	/**
-	 * Tears down the fixture, for example, close a network connection. This
-	 * method is called after a test is executed.
-	 */
-	protected void tearDown() {
-	}
     
     private static final SerializableAssert comparator = new SerializableAssert() {
 

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ResourceBundleTest.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/ResourceBundleTest.java?rev=613858&r1=613857&r2=613858&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ResourceBundleTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ResourceBundleTest.java Mon Jan 21 03:55:17 2008
@@ -41,7 +41,7 @@
 import org.apache.harmony.luni.tests.java.util.ControlTest.CanSetSM;
 
 import tests.support.resource.Support_Resources;
-import tests.api.java.util.support.B;
+import org.apache.harmony.luni.tests.support.B;
 
 /**
  * Test cases for java.util.ResourceBundle.

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ScannerTest.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/ScannerTest.java?rev=613858&r1=613857&r2=613858&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ScannerTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/ScannerTest.java Mon Jan 21 03:55:17 2008
@@ -5644,24 +5644,6 @@
         assertEquals(1, matchResult.end());
     }
     
-    /**
-	 * @tests {@link java.util.Scanner#reset()}
-	 * @since 1.6
-	 */
-	public void test_reset() {
-		Scanner s = new Scanner("test");
-		s.useRadix(11);
-		assertEquals(11, s.radix());
-		s.useDelimiter("\\w+");
-		assertEquals("\\w+", s.delimiter().toString());
-		s.useLocale(new Locale("test", "test", "test"));
-		assertEquals("test", s.locale().getLanguage());
-		s.reset();
-		assertEquals(10, s.radix());
-		assertEquals("\\p{javaWhitespace}+", s.delimiter().toString());
-		assertEquals(Locale.getDefault(), s.locale());
-	}
-    
     protected void setUp() throws Exception {
         super.setUp();
 

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/SimpleTimeZoneTest.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/SimpleTimeZoneTest.java?rev=613858&r1=613857&r2=613858&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/SimpleTimeZoneTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/SimpleTimeZoneTest.java Mon Jan 21 03:55:17 2008
@@ -189,20 +189,20 @@
 	public void test_getOffsetIIIIII() {
 		// Test for method int java.util.SimpleTimeZone.getOffset(int, int, int,
 		// int, int, int)
-		st1 = (SimpleTimeZone) TimeZone.getTimeZone("EST");
+        TimeZone st1 = TimeZone.getTimeZone("EST");
 		assertTrue("Incorrect offset returned", st1.getOffset(
 				GregorianCalendar.AD, 1998, Calendar.NOVEMBER, 11,
 				Calendar.WEDNESDAY, 0) == -(5 * 60 * 60 * 1000));
 
-		st1 = (SimpleTimeZone) TimeZone.getTimeZone("EST");
-		assertTrue("Incorrect offset returned", st1.getOffset(
-				GregorianCalendar.AD, 1998, Calendar.JUNE, 11,
-				Calendar.THURSDAY, 0) == -(4 * 60 * 60 * 1000));
+        st1 = TimeZone.getTimeZone("EST");
+        assertEquals("Incorrect offset returned", -(5 * 60 * 60 * 1000), st1
+                .getOffset(GregorianCalendar.AD, 1998, Calendar.JUNE, 11,
+                        Calendar.THURSDAY, 0));
 	}
 
 	/**
-	 * @tests java.util.SimpleTimeZone#getRawOffset()
-	 */
+     * @tests java.util.SimpleTimeZone#getRawOffset()
+     */
 	public void test_getRawOffset() {
 		// Test for method int java.util.SimpleTimeZone.getRawOffset()
 		st1 = (SimpleTimeZone) TimeZone.getTimeZone("EST");
@@ -251,32 +251,32 @@
 	public void test_inDaylightTimeLjava_util_Date() {
 		// Test for method boolean
 		// java.util.SimpleTimeZone.inDaylightTime(java.util.Date)
-		SimpleTimeZone zone = (SimpleTimeZone) TimeZone.getTimeZone("EST");
+        TimeZone zone = TimeZone.getTimeZone("EST");
 		GregorianCalendar gc = new GregorianCalendar(1998, Calendar.JUNE, 11);
-		assertTrue("Returned incorrect daylight value1", zone.inDaylightTime(gc
+		assertFalse("Returned incorrect daylight value1", zone.inDaylightTime(gc
 				.getTime()));
 		gc = new GregorianCalendar(1998, Calendar.NOVEMBER, 11);
-		assertTrue("Returned incorrect daylight value2", !(zone
-				.inDaylightTime(gc.getTime())));
+        assertFalse("Returned incorrect daylight value1", zone.inDaylightTime(gc
+                .getTime()));
 		gc = new GregorianCalendar(zone);
 		gc.set(1999, Calendar.APRIL, 4, 1, 59, 59);
 		assertTrue("Returned incorrect daylight value3", !(zone
 				.inDaylightTime(gc.getTime())));
 		Date date = new Date(gc.getTime().getTime() + 1000);
-		assertTrue("Returned incorrect daylight value4", zone
+		assertFalse("Returned incorrect daylight value4", zone
 				.inDaylightTime(date));
 		gc.set(1999, Calendar.OCTOBER, 31, 1, 0, 0);
 		assertTrue("Returned incorrect daylight value5", !(zone
 				.inDaylightTime(gc.getTime())));
 		date = new Date(gc.getTime().getTime() - 1000);
-		assertTrue("Returned incorrect daylight value6", zone
+		assertFalse("Returned incorrect daylight value6", zone
 				.inDaylightTime(date));
 
 		assertTrue("Returned incorrect daylight value7", !zone
 				.inDaylightTime(new Date(891752400000L + 7200000 - 1)));
-		assertTrue("Returned incorrect daylight value8", zone
+		assertFalse("Returned incorrect daylight value8", zone
 				.inDaylightTime(new Date(891752400000L + 7200000)));
-		assertTrue("Returned incorrect daylight value9", zone
+		assertFalse("Returned incorrect daylight value9", zone
 				.inDaylightTime(new Date(909288000000L + 7200000 - 1)));
 		assertTrue("Returned incorrect daylight value10", !zone
 				.inDaylightTime(new Date(909288000000L + 7200000)));
@@ -329,7 +329,7 @@
 	public void test_setEndRuleIIIIZ() {
 		// Test for method void java.util.SimpleTimeZone.setEndRule(int, int,
 		// int, int, boolean)
-		SimpleTimeZone st = (SimpleTimeZone) TimeZone.getDefault().clone();
+        SimpleTimeZone st = new SimpleTimeZone(1000, "Test_TZ");
 		// Spec indicates that both end and start must be set or result is
 		// undefined
 		st.setStartRule(Calendar.NOVEMBER, 8, Calendar.SUNDAY, 1, false);
@@ -410,7 +410,7 @@
 	public void test_setStartRuleIIIIZ() {
 		// Test for method void java.util.SimpleTimeZone.setStartRule(int, int,
 		// int, int, boolean)
-		SimpleTimeZone st = (SimpleTimeZone) TimeZone.getDefault().clone();
+        SimpleTimeZone st = new SimpleTimeZone(0, "Test");
 		// Spec indicates that both end and start must be set or result is
 		// undefined
 		st.setStartRule(Calendar.NOVEMBER, 1, Calendar.SUNDAY, 1, true);

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/TimeZoneTest.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/TimeZoneTest.java?rev=613858&r1=613857&r2=613858&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/TimeZoneTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/TimeZoneTest.java Mon Jan 21 03:55:17 2008
@@ -80,7 +80,7 @@
 				.getTimeInMillis();
 		st1 = TimeZone.getTimeZone("EST");
 		assertEquals("T2. Incorrect offset returned",
-                             -(4 * ONE_HOUR), st1.getOffset(time2));
+                             -(5 * ONE_HOUR), st1.getOffset(time2));
 
 		// test on subclass Support_TimeZone, an instance with daylight savings
 		TimeZone tz1 = new Support_TimeZone(-5 * ONE_HOUR, true);

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/TreeSetTest.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/TreeSetTest.java?rev=613858&r1=613857&r2=613858&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/TreeSetTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/TreeSetTest.java Mon Jan 21 03:55:17 2008
@@ -17,12 +17,10 @@
 
 package org.apache.harmony.luni.tests.java.util;
 
-import java.net.Inet4Address;
 import java.util.Arrays;
 import java.util.Comparator;
 import java.util.HashSet;
 import java.util.Iterator;
-import java.util.NavigableSet;
 import java.util.Set;
 import java.util.SortedSet;
 import java.util.TreeSet;

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java?rev=613858&r1=613857&r2=613858&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java Mon Jan 21 03:55:17 2008
@@ -19,6 +19,7 @@
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.Arrays;
 
 import org.apache.harmony.pack200.bytecode.CPClass;
 import org.apache.harmony.pack200.bytecode.CPDouble;
@@ -359,9 +360,9 @@
         /*
          * Note - this is not in the spec, but seems to be used as an
          * optimization by the RI for bands where the minimum and maximum values
-         * are known (ie reference bands). It will not hurt any encoding that is
-         * following the spec because all the values decoded will be inside the
-         * range anyway.
+         * are known (ie reference bands). It will not hurt any implementation
+         * that is following the spec because all the values decoded will be
+         * inside the range anyway.
          */
         if (codecUsed instanceof BHSDCodec) {
             for (int i = 0; i < returnBand.length; i++) {
@@ -370,6 +371,24 @@
                 }
                 while (returnBand[i] > maxValue) {
                     returnBand[i] -= ((BHSDCodec) codecUsed).cardinality();
+                }
+            }
+        } else if (codecUsed instanceof PopulationCodec) {
+            PopulationCodec popCodec = (PopulationCodec)codecUsed;
+            long[] favoured = (long[]) popCodec.getFavoured().clone();
+            Arrays.sort(favoured);
+            for (int i = 0; i < returnBand.length; i++) {
+                if(returnBand[i] < 0 || returnBand[i] > maxValue) {
+                    boolean favouredValue = Arrays.binarySearch(favoured, returnBand[i]) > -1;
+                    Codec theCodec = favouredValue ? popCodec.getFavouredCodec(): popCodec.getUnvafouredCodec();
+                    if(theCodec instanceof BHSDCodec) {
+                        while (returnBand[i] < 0) {
+                            returnBand[i] +=  ((BHSDCodec) theCodec).cardinality();
+                        }
+                        while (returnBand[i] > maxValue) {
+                            returnBand[i] -= ((BHSDCodec) theCodec).cardinality();
+                        }
+                    }
                 }
             }
         }



Mime
View raw message