Claes tidied things up to produce a workable patch: > Here is the updated webrev: > > http://cr.openjdk.java.net/~mduigou/JDK-8040837/0/webrev/ > > I will push it to jdk9/dev/jdk on Friday before COB for Claes unless I hear > objections. > > Cheers, > > Mike
On Apr 18 2014, at 09:27 , Michael McMahon <michael.x.mcma...@oracle.com> wrote: > I think it would be an improvement to combine these doPrivileged() blocks > as suggested, though your patch needs work Bernd. For instance, > the multi-catch doesn't work. Also the PrivilegedAction<> type is wrong. > > If someone wants to update it, then we can use that. Otherwise, we'll > go with the original suggested change. > > Thanks > Michael > > On 17/04/14 21:28, Bernd Eckenfels wrote: >> Am Thu, 17 Apr 2014 21:50:23 +0200 >> schrieb Bernd Eckenfels <bernd-2...@eckenfels.net>: >> >>> Hello, >>> >>> I would propose to use Integer.valueOf(tmp) instead, but looking at >>> the context I think it is even better to skip this and the following >>> null check with Integer.parseInt(). >> This is even shorter and it reduces the privileged actions invocations: >> >> Integer tmp = java.security.AccessController.doPrivileged ( >> new PrivilegedAction<String>() { >> public String run() { >> try { >> String tmpString = Security.getProperty(cachePolicyProp); >> if (tmpString != null) return Integer.valueOf(tmpString); >> } catch (NumberFormatException | IllegalArgumentException >> ignored) { } >> >> try { >> return Integer.getInteger(cachePolicyPropFallback); >> } catch (NumberFormatException | IllegalArgumentException >> ignored) { } >> >> return null; >> } >> }); >> >> 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; >> } >> } >> >> NB: this will >