java.util/280: Properties not working with load
Tom Tromey
tromey@cygnus.com
Fri Jul 7 14:40:00 GMT 2000
The following reply was made to PR java.util/280; it has been noted by GNATS.
From: Tom Tromey <tromey@cygnus.com>
To: "Magnus Persson" <magnus.persson@thephonepages.com>
Cc: "Tom Tromey" <tromey@cygnus.com>,
Java Gnats Server <java-gnats@sourceware.cygnus.com>
Subject: RE: java.util/280: Properties not working with load
Date: Fri, 7 Jul 2000 14:32:42 -0700 (PDT)
Magnus> here it is:
Thanks. Please CC java-gnats so this ends up in the PR.
(That's why I'm quoting the whole program in this reply...)
I looked at this a bit. It looks like a recently introduced bug in
libgcc. If the local Java exception expert doesn't know the problem
offhand, I'll forward this to the appropriate gcc hackers.
Note that your program won't work. You don't flush or close the
FileOutputStream before trying to read the input stream. In essence
you're relying on a GC between the store and the load -- unadvisable.
Magnus> import java.util.*;
Magnus> import java.io.*;
Magnus> public class P {
Magnus> public static void main(String[] a) {
Magnus> System.out.println("start");
Magnus> Properties p=new Properties();
Magnus> p.put("hej","hejsan");
Magnus> try {
Magnus> p.store(new FileOutputStream("out"),"test");
Magnus> p.load(new FileInputStream("out"));
Magnus> } catch(Exception e) {
Magnus> System.out.println(e);
Magnus> }
Magnus> }
Magnus> }
Tom
More information about the Java-prs
mailing list