8211860: Avoid reading security properties eagerly on Manifest class initialization
authorredestad
Mon, 08 Oct 2018 18:16:03 +0200
changeset 52040 d8aebcc2d3ac
parent 52039 15a9f90aa00f
child 52041 54e8e34a7243
8211860: Avoid reading security properties eagerly on Manifest class initialization Reviewed-by: mullan, alanb
src/java.base/share/classes/java/util/jar/Manifest.java
src/java.base/share/classes/sun/security/util/SecurityProperties.java
--- a/src/java.base/share/classes/java/util/jar/Manifest.java	Mon Oct 08 17:41:44 2018 +0200
+++ b/src/java.base/share/classes/java/util/jar/Manifest.java	Mon Oct 08 18:16:03 2018 +0200
@@ -49,9 +49,6 @@
  */
 public class Manifest implements Cloneable {
 
-    private static final boolean jarInfoInExceptionText =
-        SecurityProperties.includedInExceptions("jar");
-
     // manifest main attributes
     private Attributes attr = new Attributes();
 
@@ -203,10 +200,10 @@
     }
 
     static String getErrorPosition(String filename, final int lineNumber) {
-        if (filename == null || !jarInfoInExceptionText) {
+        if (filename == null ||
+                !SecurityProperties.INCLUDE_JAR_NAME_IN_EXCEPTIONS) {
             return "line " + lineNumber;
         }
-
         return "manifest of " + filename + ":" + lineNumber;
     }
 
--- a/src/java.base/share/classes/sun/security/util/SecurityProperties.java	Mon Oct 08 17:41:44 2018 +0200
+++ b/src/java.base/share/classes/sun/security/util/SecurityProperties.java	Mon Oct 08 18:16:03 2018 +0200
@@ -32,6 +32,9 @@
 
 public class SecurityProperties {
 
+    public static final boolean INCLUDE_JAR_NAME_IN_EXCEPTIONS
+        = includedInExceptions("jar");
+
     /**
      * Returns the value of the security property propName, which can be overridden
      * by a system property of the same name