< prev index next >

src/java.base/share/classes/java/lang/StackStreamFactory.java

Print this page
rev 14210 : 8154231: Simplify access to System properties from JDK code
Reviewed-by: rriggs

*** 28,48 **** import java.lang.StackWalker.Option; import java.lang.StackWalker.StackFrame; import java.lang.annotation.Native; import java.lang.reflect.Method; - import java.security.AccessController; - import java.security.PrivilegedAction; import java.util.HashSet; import java.util.NoSuchElementException; import java.util.Objects; import java.util.Set; import java.util.Spliterator; import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.Stream; import java.util.stream.StreamSupport; import static java.lang.StackStreamFactory.WalkerState.*; /** * StackStreamFactory class provides static factory methods --- 28,47 ---- import java.lang.StackWalker.Option; import java.lang.StackWalker.StackFrame; import java.lang.annotation.Native; import java.lang.reflect.Method; import java.util.HashSet; import java.util.NoSuchElementException; import java.util.Objects; import java.util.Set; import java.util.Spliterator; import java.util.function.Consumer; import java.util.function.Function; import java.util.stream.Stream; import java.util.stream.StreamSupport; + import sun.security.action.GetPropertyAction; import static java.lang.StackStreamFactory.WalkerState.*; /** * StackStreamFactory class provides static factory methods
*** 988,1004 **** MethodAccessor.class.isAssignableFrom(c) || c.getName().startsWith("java.lang.invoke.LambdaForm"); } private static boolean getProperty(String key, boolean value) { ! String s = AccessController.doPrivileged(new PrivilegedAction<>() { ! @Override ! public String run() { ! return System.getProperty(key); ! } ! }); if (s != null) { ! return Boolean.valueOf(s); } return value; } } --- 987,998 ---- MethodAccessor.class.isAssignableFrom(c) || c.getName().startsWith("java.lang.invoke.LambdaForm"); } private static boolean getProperty(String key, boolean value) { ! String s = GetPropertyAction.getProperty(key); if (s != null) { ! return Boolean.parseBoolean(s); } return value; } }
< prev index next >