You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2021/07/27 20:54:27 UTC

[tomcat] branch 9.0.x updated: Simplify code - no functional change

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new d873f31  Simplify code - no functional change
d873f31 is described below

commit d873f31ca0f64ba1f8c757b6e123196c3bc3de77
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Jul 27 21:53:08 2021 +0100

    Simplify code - no functional change
---
 .../catalina/loader/WebappClassLoaderBase.java     | 69 ++++++++++------------
 1 file changed, 31 insertions(+), 38 deletions(-)

diff --git a/java/org/apache/catalina/loader/WebappClassLoaderBase.java b/java/org/apache/catalina/loader/WebappClassLoaderBase.java
index 4137fcf..0d2bb7c 100644
--- a/java/org/apache/catalina/loader/WebappClassLoaderBase.java
+++ b/java/org/apache/catalina/loader/WebappClassLoaderBase.java
@@ -2430,49 +2430,42 @@ public abstract class WebappClassLoaderBase extends URLClassLoader
                 }
             }
 
-            // Looking up the package
-            String packageName = null;
-            int pos = name.lastIndexOf('.');
-            if (pos != -1) {
-                packageName = name.substring(0, pos);
-            }
-
-            Package pkg = null;
-
-            if (packageName != null) {
-                pkg = getPackage(packageName);
-                // Define the package (if null)
-                if (pkg == null) {
-                    try {
-                        if (manifest == null) {
-                            definePackage(packageName, null, null, null, null, null, null, null);
-                        } else {
-                            definePackage(packageName, manifest, codeBase);
+            if (securityManager != null) {
+                // Looking up the package
+                int pos = name.lastIndexOf('.');
+                if (pos != -1) {
+                    String packageName = name.substring(0, pos);
+                    Package pkg = getPackage(packageName);
+
+                    // Define the package (if null)
+                    if (pkg == null) {
+                        try {
+                            if (manifest == null) {
+                                definePackage(packageName, null, null, null, null, null, null, null);
+                            } else {
+                                definePackage(packageName, manifest, codeBase);
+                            }
+                        } catch (IllegalArgumentException e) {
+                            // Ignore: normal error due to dual definition of package
                         }
-                    } catch (IllegalArgumentException e) {
-                        // Ignore: normal error due to dual definition of package
+                        pkg = getPackage(packageName);
                     }
-                    pkg = getPackage(packageName);
-                }
-            }
-
-            if (securityManager != null) {
 
-                // Checking sealing
-                if (pkg != null) {
-                    boolean sealCheck = true;
-                    if (pkg.isSealed()) {
-                        sealCheck = pkg.isSealed(codeBase);
-                    } else {
-                        sealCheck = (manifest == null) || !isPackageSealed(packageName, manifest);
-                    }
-                    if (!sealCheck) {
-                        throw new SecurityException
-                            ("Sealing violation loading " + name + " : Package "
-                             + packageName + " is sealed.");
+                    // Checking sealing
+                    if (pkg != null) {
+                        boolean sealCheck = true;
+                        if (pkg.isSealed()) {
+                            sealCheck = pkg.isSealed(codeBase);
+                        } else {
+                            sealCheck = (manifest == null) || !isPackageSealed(packageName, manifest);
+                        }
+                        if (!sealCheck) {
+                            throw new SecurityException
+                                ("Sealing violation loading " + name + " : Package "
+                                 + packageName + " is sealed.");
+                        }
                     }
                 }
-
             }
 
             try {

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org