JDK-8040837 : Avoid provoking NumberFormatException when initializing InetAddrCachePolicy
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 7u51,8,9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2014-04-17
  • Updated: 2016-05-27
  • Resolved: 2014-04-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u20Fixed 9 b11Fixed
Description
When loading and initializing the class sun.net.InetAddrCachePolicy, NFEs will be thrown and caught when networkaddress.cache.ttl and networkaddress.cache.negative.ttl aren't set (which they typically aren't):

        try {
            tmp = new Integer(
              java.security.AccessController.doPrivileged (
                new PrivilegedAction<String>() {
                  public String run() {
                      return Security.getProperty(cachePolicyProp);
                  }
              }));
        } catch (NumberFormatException e) {
            // ignore
        }
Comments
I have a simple patch and a microbenchmark I'd like to submit for review. Getting a small but measurable (0.045ms) improvement when initializing the class.
17-04-2014

This looks like useful work for JDK 9.
17-04-2014