harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From regi...@apache.org
Subject svn commit: r833022 - in /harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net: InetAddress.java SocketPermission.java
Date Thu, 05 Nov 2009 08:50:29 GMT
Author: regisxu
Date: Thu Nov  5 08:50:16 2009
New Revision: 833022

URL: http://svn.apache.org/viewvc?rev=833022&view=rev
Log:
quick fix for test errors in SecurityManagerTest

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

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/InetAddress.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/InetAddress.java?rev=833022&r1=833021&r2=833022&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/InetAddress.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/InetAddress.java Thu
Nov  5 08:50:16 2009
@@ -507,14 +507,16 @@
      */
     static native String getHostNameImpl();
 
-    static String getHostNameInternal(String host) throws UnknownHostException {
+    static String getHostNameInternal(String host, boolean isCheck) throws UnknownHostException
{
         if (host == null || 0 == host.length()) {
             return InetAddress.LOOPBACK.getHostAddress();
         }
         if (isHostName(host)) {
-            SecurityManager sm = System.getSecurityManager();
-            if (sm != null) {
-                sm.checkConnect(host, -1);
+            if (isCheck) {
+                SecurityManager sm = System.getSecurityManager();
+                if (sm != null) {
+                    sm.checkConnect(host, -1);
+                }
             }
             return lookupHostByName(host).getHostAddress();
         }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketPermission.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketPermission.java?rev=833022&r1=833021&r2=833022&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketPermission.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/SocketPermission.java
Thu Nov  5 08:50:16 2009
@@ -159,7 +159,7 @@
         }
         SocketPermission sp = (SocketPermission) other;
         if (!hostName.equalsIgnoreCase(sp.hostName)) {
-            if (getIPString() == null || !ipString.equalsIgnoreCase(sp.getIPString())) {
+            if (getIPString(true) == null || !ipString.equalsIgnoreCase(sp.getIPString(true)))
{
                 return false;
             }
         }
@@ -379,10 +379,10 @@
         return actions = sb.substring(1, sb.length());
     }
 
-    private String getIPString() {
+    private String getIPString(boolean isCheck) {
         if (!resolved) {
             try {
-                ipString = InetAddress.getHostNameInternal(hostName);
+                ipString = InetAddress.getHostNameInternal(hostName, isCheck);
             } catch (UnknownHostException e) {
                 // ignore
             }
@@ -483,7 +483,7 @@
         }
         // The ipString may not be the same, some hosts resolve to
         // multiple ips
-        return (getIPString() != null && ipString.equals(sp.getIPString()))
+        return (getIPString(false) != null && ipString.equals(sp.getIPString(false)))
                 || hostName.equals(sp.hostName);
     }
 



Mime
View raw message