harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r832453 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URL.java
Date Tue, 03 Nov 2009 15:22:29 GMT
Author: tellison
Date: Tue Nov  3 15:22:29 2009
New Revision: 832453

URL: http://svn.apache.org/viewvc?rev=832453&view=rev
Log:
Part of HARMONY-6367 ([classlib] Some Methods doesn't have security Permissions check as compared
to SUN JDK)
Perform a checkConnect test for URL.openConnection(Proxy).

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URL.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URL.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URL.java?rev=832453&r1=832452&r2=832453&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URL.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/URL.java Tue Nov 
3 15:22:29 2009
@@ -697,9 +697,17 @@
      *             through proxies.
      */
     public URLConnection openConnection(Proxy proxy) throws IOException {
-        if (null == proxy) {
+        if (proxy == null) {
+            // K034c=proxy should not be null
             throw new IllegalArgumentException(Msg.getString("K034c")); //$NON-NLS-1$
         }
+
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null && proxy.type() != Proxy.Type.DIRECT) {
+            InetSocketAddress pAddress = (InetSocketAddress) proxy.address();
+            sm.checkConnect(pAddress.getHostName(), pAddress.getPort());
+        }
+
         return strmHandler.openConnection(this, proxy);
     }
 



Mime
View raw message