aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/io
diff options
context:
space:
mode:
authorBryce McKinlay <bryce@gcc.gnu.org>2000-11-26 01:48:04 +0000
committerBryce McKinlay <bryce@gcc.gnu.org>2000-11-26 01:48:04 +0000
commit213858c013438c43989052d3f86fb93b2e9b274a (patch)
tree4eaca964f2a13f025b0393ee000372ef3380e323 /libjava/java/io
parent3645c4dc1cf004887905411ca81590b75c665529 (diff)
downloadgcc-213858c013438c43989052d3f86fb93b2e9b274a.zip
gcc-213858c013438c43989052d3f86fb93b2e9b274a.tar.gz
gcc-213858c013438c43989052d3f86fb93b2e9b274a.tar.bz2
System.java (setProperties): Only call init_properties() if properties is null.
2000-11-24 Bryce McKinlay <bryce@albatross.co.nz> * java/lang/System.java (setProperties): Only call init_properties() if properties is null. (getProperties): Ditto. (getProperty): Ditto. (setProperty): Call init_properties if properties are null. (prop_init): Remove field. * java/lang/natSystem.cc (init_properties): Synchronize the entire method. Check for null properties after synchronizing instead of prop_init flag. Set the properties field last for thread safety. * java/io/ObjectInputStream.java (ObjectInputStream): If DEBUG is set, test for gcj.dumpobjects property and enable object stream dumping if it is set. (dumpElement): No longer native. (dumpElementln): Ditto. (setDump): Do not define. * java/io/natObjectInputStream.cc (dumpElement): Removed. (dumpElementln): Removed. (setDump): Removed. 2000-11-24 Bryce McKinlay <bryce@albatross.co.nz> * configure: Rebuilt. * Makefile.in: Rebuilt. * Makefile.am (built_java_source_files): Add Configuration.java. * configure.in: Add Configuration.java to CONFIG_FILES. Set LIBGCJDEBUG substitution if --enable-libgcj-debug is specified. Create `gnu' directory in the build tree. * gnu/classpath/Configuration.java.in: New file. From-SVN: r37749
Diffstat (limited to 'libjava/java/io')
-rw-r--r--libjava/java/io/ObjectInputStream.java38
-rw-r--r--libjava/java/io/natObjectInputStream.cc37
2 files changed, 25 insertions, 50 deletions
diff --git a/libjava/java/io/ObjectInputStream.java b/libjava/java/io/ObjectInputStream.java
index 2a90ba3..595e9de 100644
--- a/libjava/java/io/ObjectInputStream.java
+++ b/libjava/java/io/ObjectInputStream.java
@@ -27,6 +27,8 @@ executable file might be covered by the GNU General Public License. */
package java.io;
+import gnu.classpath.Configuration;
+
import java.lang.reflect.Array;
import java.lang.reflect.Modifier;
import java.util.Arrays;
@@ -61,6 +63,21 @@ public class ObjectInputStream extends InputStream
public ObjectInputStream (InputStream in)
throws IOException, StreamCorruptedException
{
+ if (Configuration.DEBUG)
+ {
+ String val = System.getProperty("gcj.dumpobjects");
+ if (dump == false && val != null && !val.equals(""))
+ {
+ dump = true;
+ System.out.println ("Serialization debugging enabled");
+ }
+ else if (dump == true && (val == null || val.equals("")))
+ {
+ dump = false;
+ System.out.println ("Serialization debugging disabled");
+ }
+ }
+
this.resolveEnabled = false;
this.isDeserializing = false;
this.blockDataPosition = 0;
@@ -1510,24 +1527,19 @@ public class ObjectInputStream extends InputStream
private boolean fieldsAlreadyRead;
private Vector validators;
- private static boolean dump;
- public native static void setDump (boolean dump);
- private native void dumpElement (String msg);
- private native void dumpElementln (String msg);
-
+ private static boolean dump;
-/* FIXME: These 2 methods cause a build error on i686-pc-linux-gnu.
- private void DEBUG (String msg)
+ private void dumpElement (String msg)
{
- System.out.print (msg);
+ if (Configuration.DEBUG && dump)
+ System.out.print(msg);
}
-
-
- private void DEBUGln (String msg)
+
+ private void dumpElementln (String msg)
{
- System.out.println (msg);
+ if (Configuration.DEBUG && dump)
+ System.out.println(msg);
}
-* end FIXME */
}
diff --git a/libjava/java/io/natObjectInputStream.cc b/libjava/java/io/natObjectInputStream.cc
index ac72ecf..856f6e2 100644
--- a/libjava/java/io/natObjectInputStream.cc
+++ b/libjava/java/io/natObjectInputStream.cc
@@ -78,40 +78,3 @@ java::io::ObjectInputStream::getMethod (jclass klass, jstring name,
{
return klass->getPrivateMethod (name, arg_types);
}
-
-#ifdef DEBUG
-void
-java::io::ObjectInputStream::setDump (jboolean dump)
-{
- java::io::ObjectInputStream::dump = dump;
-}
-
-void
-java::io::ObjectInputStream::dumpElement (jstring msg)
-{
- if (dump)
- java::lang::System::out->print (msg);
-}
-
-void
-java::io::ObjectInputStream::dumpElementln (jstring msg)
-{
- if (dump)
- java::lang::System::out->println (msg);
-}
-#else
-void
-java::io::ObjectInputStream::setDump (jboolean dump)
-{
-}
-
-void
-java::io::ObjectInputStream::dumpElement (jstring msg)
-{
-}
-
-void
-java::io::ObjectInputStream::dumpElementln (jstring msg)
-{
-}
-#endif