RFR: 8267485: Remove the dependency on SecurityManager in JceSecurityManager.java [v4]

Daniel Fuchs dfuchs at openjdk.java.net
Fri Jun 4 10:19:03 UTC 2021


On Thu, 3 Jun 2021 22:48:45 GMT, Mandy Chung <mchung at openjdk.org> wrote:

>> Bradford Wetmore has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 14 commits:
>> 
>>  - More Codereview Comments
>>  - Merge branch 'master' into JDK-8267485
>>  - Minor typo
>>  - Reduced SuppressWarnings scope
>>  - Codereview Comments #2
>>  - Merge branch 'master' into JDK-8267485
>>  - Address codereview comments
>>  - Merge branch 'master' into JDK-8267485
>>  - Merge branch 'master' into JDK-8267485
>>  - Merge branch 'master' into JDK-8267485
>>  - ... and 4 more: https://git.openjdk.java.net/jdk/compare/9f05c411...a441778b
>
> src/java.base/share/classes/javax/crypto/JceSecurityManager.java line 109:
> 
>> 107:         @SuppressWarnings("removal")
>> 108:         List<StackFrame> stack =
>> 109:                 AccessController.doPrivileged(pa).walk(Stream::toList);
> 
> You can replace line 108-125 with something like this: 
> 
> StackWalker walker = AccessController.doPrivileged(pa);
> Optional<URL> callerCodeBase = walker.walk(s -> {
>     s.map(f -> JceSecurity.getCodeBase(f.getDeclaringClass()))
>       .findFirst();
> });

@mlchung Maybe there should be a `.filter(cb -> cb != null)` inserted before `.findFirst()`?

-------------

PR: https://git.openjdk.java.net/jdk/pull/4150



More information about the security-dev mailing list