src/java.base/share/classes/java/lang/System.java
changeset 52724 0bdbf854472f
parent 52615 9a899e2c3e64
child 52902 e3398b2e1ab0
equal deleted inserted replaced
52723:f24ae8376e71 52724:0bdbf854472f
    70 import jdk.internal.access.SharedSecrets;
    70 import jdk.internal.access.SharedSecrets;
    71 import jdk.internal.misc.VM;
    71 import jdk.internal.misc.VM;
    72 import jdk.internal.logger.LoggerFinderLoader;
    72 import jdk.internal.logger.LoggerFinderLoader;
    73 import jdk.internal.logger.LazyLoggers;
    73 import jdk.internal.logger.LazyLoggers;
    74 import jdk.internal.logger.LocalizedLoggerWrapper;
    74 import jdk.internal.logger.LocalizedLoggerWrapper;
       
    75 import jdk.internal.util.SystemProps;
    75 import jdk.internal.vm.annotation.Stable;
    76 import jdk.internal.vm.annotation.Stable;
    76 import sun.reflect.annotation.AnnotationType;
    77 import sun.reflect.annotation.AnnotationType;
    77 import sun.nio.ch.Interruptible;
    78 import sun.nio.ch.Interruptible;
    78 import sun.security.util.SecurityConstants;
    79 import sun.security.util.SecurityConstants;
    79 
    80 
   603      * <dt>user.dir             <dd>User's current working directory
   604      * <dt>user.dir             <dd>User's current working directory
   604      * </dl>
   605      * </dl>
   605      */
   606      */
   606 
   607 
   607     private static Properties props;
   608     private static Properties props;
   608     private static native Properties initProperties(Properties props);
       
   609 
   609 
   610     /**
   610     /**
   611      * Determines the current system properties.
   611      * Determines the current system properties.
   612      *
   612      *
   613      * First, if there is a security manager, its
   613      * First, if there is a security manager, its
   797     public static void setProperties(Properties props) {
   797     public static void setProperties(Properties props) {
   798         SecurityManager sm = getSecurityManager();
   798         SecurityManager sm = getSecurityManager();
   799         if (sm != null) {
   799         if (sm != null) {
   800             sm.checkPropertiesAccess();
   800             sm.checkPropertiesAccess();
   801         }
   801         }
       
   802 
   802         if (props == null) {
   803         if (props == null) {
   803             props = new Properties();
   804             props = SystemProps.initProperties();
   804             initProperties(props);
       
   805             VersionProps.init(props);
   805             VersionProps.init(props);
   806         }
   806         }
   807         System.props = props;
   807         System.props = props;
   808     }
   808     }
   809 
   809 
  1964      */
  1964      */
  1965     private static void initPhase1() {
  1965     private static void initPhase1() {
  1966 
  1966 
  1967         // VM might invoke JNU_NewStringPlatform() to set those encoding
  1967         // VM might invoke JNU_NewStringPlatform() to set those encoding
  1968         // sensitive properties (user.home, user.name, boot.class.path, etc.)
  1968         // sensitive properties (user.home, user.name, boot.class.path, etc.)
  1969         // during "props" initialization, in which it may need access, via
  1969         // during "props" initialization.
  1970         // System.getProperty(), to the related system encoding property that
  1970         // The charset is initialized in System.c and does not depend on the Properties.
  1971         // have been initialized (put into "props") at early stage of the
  1971         props = SystemProps.initProperties();
  1972         // initialization. So make sure the "props" is available at the
       
  1973         // very beginning of the initialization and all system properties to
       
  1974         // be put into it directly.
       
  1975         props = new Properties(84);
       
  1976         initProperties(props);  // initialized by the VM
       
  1977         VersionProps.init(props);
  1972         VersionProps.init(props);
       
  1973         StaticProperty.javaHome();          // Load StaticProperty to cache the property values
  1978 
  1974 
  1979         // There are certain system configurations that may be controlled by
  1975         // There are certain system configurations that may be controlled by
  1980         // VM options such as the maximum amount of direct memory and
  1976         // VM options such as the maximum amount of direct memory and
  1981         // Integer cache size used to support the object identity semantics
  1977         // Integer cache size used to support the object identity semantics
  1982         // of autoboxing.  Typically, the library will obtain these values
  1978         // of autoboxing.  Typically, the library will obtain these values
  1991         // can only be accessed by the internal implementation.  Remove
  1987         // can only be accessed by the internal implementation.  Remove
  1992         // certain system properties that are not intended for public access.
  1988         // certain system properties that are not intended for public access.
  1993         VM.saveAndRemoveProperties(props);
  1989         VM.saveAndRemoveProperties(props);
  1994 
  1990 
  1995         lineSeparator = props.getProperty("line.separator");
  1991         lineSeparator = props.getProperty("line.separator");
  1996         StaticProperty.javaHome();          // Load StaticProperty to cache the property values
       
  1997 
  1992 
  1998         FileInputStream fdIn = new FileInputStream(FileDescriptor.in);
  1993         FileInputStream fdIn = new FileInputStream(FileDescriptor.in);
  1999         FileOutputStream fdOut = new FileOutputStream(FileDescriptor.out);
  1994         FileOutputStream fdOut = new FileOutputStream(FileDescriptor.out);
  2000         FileOutputStream fdErr = new FileOutputStream(FileDescriptor.err);
  1995         FileOutputStream fdErr = new FileOutputStream(FileDescriptor.err);
  2001         setIn0(new BufferedInputStream(fdIn));
  1996         setIn0(new BufferedInputStream(fdIn));