How to check the validy of a properties file while loading

Hello,

I used my own Settings class extends from the Properties class for loading and saving my Programms settings. So everything works, but if i load a garbage file as settings file, I do not get a exception ore something notification. Is this a Bug or a feature of the Proprties class? How can I implement a validy check while loading without parsing the whole stuff?

Anyone can help here?

thanks in advance

alex

[455 byte] By [bytonix] at [2007-9-26 1:25:21]
# 1

1. you can't check something without reading it.

-> if you want to make sure that the file in total conforms to some standard you have to read the whole file

2. The Propertie class reads the whole file anyway (I'd guess)

3. what kind of check do you want to perform?

you could get all the available keys and compare them with what you expect ... same is true for the values ...

Spieler

spieler at 2007-6-29 1:06:45 > top of Java-index,Archived Forums,Java Programming...
# 2
you can override the load/store methods and implement a checksum, which you write to the file. When you load the file, calculate the checksum over the keys/values again and compare it against the checksum that was stored in the file.
esmo at 2007-6-29 1:06:45 > top of Java-index,Archived Forums,Java Programming...