System.java (properties): Use Properties.clone.
authorTom Tromey <tromey@redhat.com>
Fri, 14 Feb 2003 17:43:34 +0000 (17:43 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Fri, 14 Feb 2003 17:43:34 +0000 (17:43 +0000)
* java/lang/System.java (properties): Use Properties.clone.
(setProperties): Likewise.

From-SVN: r62903

libjava/ChangeLog
libjava/java/lang/System.java

index 484b5fccd5eb35083acfc4013af552ce83f99bc8..33a95eb29cabee984bfa7bf08cd361b457469cd6 100644 (file)
@@ -1,3 +1,8 @@
+2003-02-14  Tom Tromey  <tromey@redhat.com>
+
+       * java/lang/System.java (properties): Use Properties.clone.
+       (setProperties): Likewise.
+
 2003-02-14  Michael Koch  <konqueror@gmx.de>
 
        * gnu/java/nio/natServerSocketChannelImpl.cc: Removed.
index ab584250749e916cd51b8f51eb8a5aeebed1aaa5..2e7c031b16c77373e4fdae7f3a97a039d4a23df4 100644 (file)
@@ -1,5 +1,5 @@
 /* System.java -- useful methods to interface with the system
-   Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -104,8 +104,10 @@ public final class System
    * {@link #setProperties(Properties)}, but will never be null, because
    * setProperties(null) sucks in the default properties.
    */
+  // Note that we use clone here and not new.  Some programs assume
+  // that the system properties do not have a parent.
   private static Properties properties
-    = new Properties(Runtime.defaultProperties);
+    = (Properties) Runtime.defaultProperties.clone();
 
   /**
    * The standard InputStream. This is assigned at startup and starts its
@@ -369,7 +371,11 @@ public final class System
     if (sm != null)
       sm.checkPropertiesAccess();
     if (properties == null)
-      properties = new Properties(Runtime.defaultProperties);
+      {
+       // Note that we use clone here and not new.  Some programs
+       // assume that the system properties do not have a parent.
+       properties = (Properties) Runtime.defaultProperties.clone();
+      }
     System.properties = properties;
   }