--- old/src/share/classes/sun/net/InetAddressCachePolicy.java 2014-04-17 18:00:11.461437474 -0700 +++ new/src/share/classes/sun/net/InetAddressCachePolicy.java 2014-04-17 18:00:11.277437465 -0700 @@ -84,19 +84,31 @@ * Initialize */ static { - Integer tmp = null; - try { - tmp = new Integer( - java.security.AccessController.doPrivileged ( - new PrivilegedAction() { - public String run() { - return Security.getProperty(cachePolicyProp); - } - })); - } catch (NumberFormatException e) { - // ignore - } + Integer tmp = java.security.AccessController.doPrivileged( + new PrivilegedAction() { + public Integer run() { + try { + String tmpString = Security.getProperty(cachePolicyProp); + if (tmpString != null) { + return Integer.valueOf(tmpString); + } + } catch (NumberFormatException ignored) { + // Ignore + } + + try { + String tmpString = Security.getProperty(cachePolicyPropFallback); + if (tmpString != null) { + return Integer.decode(tmpString); + } + } catch (NumberFormatException ignored) { + // Ignore + } + return null; + } + }); + if (tmp != null) { cachePolicy = tmp.intValue(); if (cachePolicy < 0) { @@ -104,35 +116,36 @@ } propertySet = true; } else { - tmp = java.security.AccessController.doPrivileged - (new sun.security.action.GetIntegerAction(cachePolicyPropFallback)); - if (tmp != null) { - cachePolicy = tmp.intValue(); - if (cachePolicy < 0) { - cachePolicy = FOREVER; - } - propertySet = true; - } else { - /* No properties defined for positive caching. If there is no - * security manager then use the default positive cache value. - */ - if (System.getSecurityManager() == null) { - cachePolicy = DEFAULT_POSITIVE; - } + /* No properties defined for positive caching. If there is no + * security manager then use the default positive cache value. + */ + if (System.getSecurityManager() == null) { + cachePolicy = DEFAULT_POSITIVE; } } + tmp = java.security.AccessController.doPrivileged ( + new PrivilegedAction() { + public Integer run() { + try { + String tmpString = Security.getProperty(negativeCachePolicyProp); + if (tmpString != null) { + return Integer.valueOf(tmpString); + } + } catch (NumberFormatException ignored) { + // Ignore + } - try { - tmp = new Integer( - java.security.AccessController.doPrivileged ( - new PrivilegedAction() { - public String run() { - return Security.getProperty(negativeCachePolicyProp); - } - })); - } catch (NumberFormatException e) { - // ignore - } + try { + String tmpString = Security.getProperty(negativeCachePolicyPropFallback); + if (tmpString != null) { + return Integer.decode(tmpString); + } + } catch (NumberFormatException ignored) { + // Ignore + } + return null; + } + }); if (tmp != null) { negativeCachePolicy = tmp.intValue(); @@ -140,16 +153,6 @@ negativeCachePolicy = FOREVER; } propertyNegativeSet = true; - } else { - tmp = java.security.AccessController.doPrivileged - (new sun.security.action.GetIntegerAction(negativeCachePolicyPropFallback)); - if (tmp != null) { - negativeCachePolicy = tmp.intValue(); - if (negativeCachePolicy < 0) { - negativeCachePolicy = FOREVER; - } - propertyNegativeSet = true; - } } }