Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Properties - reposted
- From: Marc Palmer" <marc@xxxxxxxxxxxxx (Marc Palmer)
- Subject: Properties - reposted
- Date: Wed, 29 Dec 1999 15:19:24 -0000
> I understand the subject treated here may not be of interest to many,
> but I invite all of you to run the code below to see that the
> Properties' save() method is not saving the list of keys to the file.
>
> After looking into the file I only saw this:
>
> #Here it goes...
> #Tue Dec 28 13:29:47 GMT-02:00 1999
>
> Why this behavior?
You are constructing your Properties object like this:
Properties p1=new Properties(System.getProperties());
Now, AFAIK that simply means that calls to p1.get() will also look in the
System properties if there is no match found in p1.
Calling p1.save() will not save the keys in the "default" Properties set in
the constructor. The properties are not really "inherited" and are not
copied into p1, so they should not be saved when you save p1! That is why
you are getting an "empty" file - there are NO KEYS in p1.
If you were using a lot of Properties objects in a big chain so that the
Properties object at the end of the chain had say 5 Properties objects to
refer to in case a key is not found, you wouldn't necessarily want it to
save all the layers of keys when you call p_layer6.save() - the default
Oroperties may be saved on their own in other areas of code.
Otherwise, when you load up your saved lists, all 6 layers of Properties
object would have many duplications and the "default" mechanism becomes
redundant.
Just a guess, but I think this is your "problem".
Cheers
--------------------------------------------------------------------
Marc Palmer, AnyWare Ltd. Software development / consultancy
www.anyware.co.uk C / C++ / Delphi / Java
CARDIACS are simply amazing - www.cardiacs.com/button.html
All opinions are my own and not necessarily those of my employer
---
To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx
To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx
- References:
- Properties - reposted
- From: esse@xxxxxxxxxxx
- Properties - reposted
- Prev by Date: Properties - reposted
- Next by Date: off topic: Javascript with java plugin
- Previous by thread: Properties - reposted
- Next by thread: Properties - reposted
- Index(es):