aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2004-09-26 17:11:14 +0000
committerMark Wielaard <mark@gcc.gnu.org>2004-09-26 17:11:14 +0000
commit3bd2680ed5ffc1442ece7ea37ea0439b8358ac6d (patch)
tree8216ff17334ba7edd9f96ffe031f73711711acc6 /libjava
parent54df0e3ead94d938c820faddb4f0bd18d764dce1 (diff)
downloadgcc-3bd2680ed5ffc1442ece7ea37ea0439b8358ac6d.zip
gcc-3bd2680ed5ffc1442ece7ea37ea0439b8358ac6d.tar.gz
gcc-3bd2680ed5ffc1442ece7ea37ea0439b8358ac6d.tar.bz2
System.java (properties): Make package private.
2004-09-26 Mark Wielaard <mark@klomp.org> * java/lang/System.java (properties): Make package private. * java/lang/Throwable.java (StaticData.nl): Initialize through directly accessing System.properties.getProperty(). * java/lang/Throwable.java (nl): Remove static field. (StaticData): New private static inner class. (stackTraceStringBuffer): Use StaticData.nl. From-SVN: r88133
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog10
-rw-r--r--libjava/java/lang/System.java2
-rw-r--r--libjava/java/lang/Throwable.java19
3 files changed, 28 insertions, 3 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index b2c70bc..3bf4f1d 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,13 @@
+2004-09-26 Mark Wielaard <mark@klomp.org>
+
+ * java/lang/System.java (properties): Make package private.
+ * java/lang/Throwable.java (StaticData.nl): Initialize through
+ directly accessing System.properties.getProperty().
+
+ * java/lang/Throwable.java (nl): Remove static field.
+ (StaticData): New private static inner class.
+ (stackTraceStringBuffer): Use StaticData.nl.
+
2004-09-26 Casey Marshall <csm@gnu.org>
* java/security/ProtectionDomain.java
diff --git a/libjava/java/lang/System.java b/libjava/java/lang/System.java
index 13926b1..68add34 100644
--- a/libjava/java/lang/System.java
+++ b/libjava/java/lang/System.java
@@ -133,7 +133,7 @@ public final class System
*/
// 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
+ static Properties properties
= (Properties) Runtime.defaultProperties.clone();
/**
diff --git a/libjava/java/lang/Throwable.java b/libjava/java/lang/Throwable.java
index 1f236b0..5d29684 100644
--- a/libjava/java/lang/Throwable.java
+++ b/libjava/java/lang/Throwable.java
@@ -1,5 +1,5 @@
/* java.lang.Throwable -- Root class for all Exceptions and Errors
- Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -396,7 +396,21 @@ public class Throwable implements Serializable
pw.print(stackTraceString());
}
- private static final String nl = System.getProperty("line.separator");
+ /*
+ * We use inner class to avoid a static initializer in this basic class.
+ */
+ private static class StaticData
+ {
+
+ final static String nl;
+
+ static
+ {
+ // Access package private properties field to prevent Security check.
+ nl = System.properties.getProperty("line.separator");
+ }
+ }
+
// Create whole stack trace in a stringbuffer so we don't have to print
// it line by line. This prevents printing multiple stack traces from
// different threads to get mixed up when written to the same PrintWriter.
@@ -449,6 +463,7 @@ public class Throwable implements Serializable
private static void stackTraceStringBuffer(StringBuffer sb, String name,
StackTraceElement[] stack, int equal)
{
+ String nl = StaticData.nl;
// (finish) first line
sb.append(name);
sb.append(nl);