8211860: Avoid reading security properties eagerly on Manifest class initialization
Reviewed-by: mullan, alanb
--- 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