harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r546880 - in /harmony/enhanced/classlib/branches/java6/modules/luni/src: main/java/java/net/Proxy.java test/java/tests/api/java/net/ProxyTest.java
Date Wed, 13 Jun 2007 14:03:45 GMT
Author: tellison
Date: Wed Jun 13 07:03:44 2007
New Revision: 546880

URL: http://svn.apache.org/viewvc?view=rev&rev=546880
Log:
Apply patch HARMONY-4140 ([classlib][luni][java6] Proxy.toString() changes according to Java6
spec)

Modified:
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/Proxy.java
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/net/ProxyTest.java

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/Proxy.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/Proxy.java?view=diff&rev=546880&r1=546879&r2=546880
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/Proxy.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/net/Proxy.java
Wed Jun 13 07:03:44 2007
@@ -107,11 +107,15 @@
      */
     @Override
     public String toString() {
-        String proxyString = String.valueOf(type);
-        if (null != address) {
-            proxyString += "/" + address.toString(); //$NON-NLS-1$
+        StringBuilder builder = new StringBuilder();
+        if (type != null) {
+            builder.append(type.toString());
         }
-        return proxyString;
+        builder.append("@"); //$NON-NLS-1$
+        if (type != Proxy.Type.DIRECT && address != null) {
+            builder.append(address.toString());
+        }
+        return builder.toString();
     }
 
     /**

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/net/ProxyTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/net/ProxyTest.java?view=diff&rev=546880&r1=546879&r2=546880
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/net/ProxyTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/java/tests/api/java/net/ProxyTest.java
Wed Jun 13 07:03:44 2007
@@ -128,6 +128,11 @@
 		// ensure no NPE is thrown
 		proxy.toString();
 
+		// Regression test for Java 6 spec change
+		proxy = new Proxy(Proxy.Type.HTTP, address);
+		assertTrue(proxy.toString().contains("@"));
+		proxy = new Proxy(Proxy.Type.SOCKS, address);
+		assertTrue(proxy.toString().contains(address.toString()));
 	}
 
 	/**



Mime
View raw message