Skip to content

Commit

Permalink
8260520: Avoid getting permissions in JarFileFactory when no Security…
Browse files Browse the repository at this point in the history
…Manager installed

Reviewed-by: alanb, dfuchs, michaelm, mullan
  • Loading branch information
cl4es committed Jan 28, 2021
1 parent ecde52e commit 8fe1323
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -123,10 +123,10 @@ private JarFile getCachedJarFile(URL url) {

/* if the JAR file is cached, the permission will always be there */
if (result != null) {
Permission perm = getPermission(result);
if (perm != null) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
Permission perm = getPermission(result);
if (perm != null) {
try {
sm.checkPermission(perm);
} catch (SecurityException se) {
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -133,10 +133,10 @@ private JarFile getCachedJarFile(URL url) {

/* if the JAR file is cached, the permission will always be there */
if (result != null) {
Permission perm = getPermission(result);
if (perm != null) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
Permission perm = getPermission(result);
if (perm != null) {
try {
sm.checkPermission(perm);
} catch (SecurityException se) {
Expand Down

1 comment on commit 8fe1323

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.