I’m trying to read an object from a XML file using XMLDecoder.
The construction seems to be OK, but when I call the readObject() method i get null instead of the object I expected.
The file exists and the created BufferedInputStream reads the file correctly.
This code works OK on the original Vista laptop it was written on, but fails on my Win Xp machine.
try {
XMLDecoder decoder = new XMLDecoder(new BufferedInputStream(
new FileInputStream("Params.xml")));
Params = (Parameters)decoder.readObject();
decoder.close();
} catch (FileNotFoundException e) {
System.out.println(e.toString());
}
Is the same version of Java being used on the Vista and XP boxes?
Also check the version of Java used to create the xml originally.
Another test would be to encode an object on the XP box and try and read it back.