classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Initialization and ProtectionDomains.


From: C. Scott Ananian
Subject: Initialization and ProtectionDomains.
Date: Tue, 24 Sep 2002 12:00:21 -0400 (EDT)

The recent change to java.lang.String (aug 13, v1.50) add a call to
Character.zeroBasedStringValue() which (inadvertently?) makes
java.lang.Character part of the "CORE CLASS" initializers (because String
is a core class, and the static initializer of String invokes a method in
Character, causing the initialization of Character).  Character should
be either marked as a CORE CLASS or the shared method should be moved
to java.lang.String.

If Character remains a core class, it invokes
VMClassLoader.getPrimitiveClass() which will initialize java.lang.Class,
whose static initializer references java.security.ProtectionDomain.
The static initializer for ProtectionDomain inexplicably invokes
System.getProperty(), which will lead to a null pointer exception, because
the properties have not yet been initialized.  (String needs to be
initialized before Runtime.insertSystemProperties can be run, and we've
gotten to ProtectionDomain by *trying* to initialize String).

The appended patch removes the unnecessary static initializer of
ProtectionDomain, which helps somewhat.  IMO, the other fix should be to
move the zeroBasedStringValue() method to java.lang.String.
 --scott

WTO Seattle Nader anthrax jihad Leitrim MI6 Shoal Bay IDEA Japan BATF 
Sigint $400 million in gold bullion RUCKUS Khaddafi Bejing counter-intelligence 
                         ( http://cscott.net/ )

Index: java/security/ProtectionDomain.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/security/ProtectionDomain.java,v
retrieving revision 1.6
diff -u -p -r1.6 ProtectionDomain.java
--- java/security/ProtectionDomain.java 25 Mar 2002 05:12:19 -0000      1.6
+++ java/security/ProtectionDomain.java 24 Sep 2002 15:59:07 -0000
@@ -53,8 +53,6 @@ package java.security;
  */
 public class ProtectionDomain
 {
-  private static final String linesep = System.getProperty("line.separator");
-
   /**
    * This is the <code>CodeSource</code> for this protection domain
    */
@@ -131,6 +129,7 @@ public class ProtectionDomain
    */
   public String toString()
   {
+    String linesep = System.getProperty("line.separator");
     StringBuffer sb = new StringBuffer("");
     sb.append("ProtectionDomain (" + linesep);
     if (code_source == null)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]