Details
-
Type: Bug
-
Status: Closed
-
Priority: Minor
-
Resolution: Won't Fix
-
Affects Version/s: 1.2.2
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
JDK version and platform:JDK 1.4.2_14
Description
I encountered an error when deserializing a date. To simulate this problem, you can run the below sample program:
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
public class QuickTest {
public static void main(String[] args) throws Exception
{ XStream xstream = new XStream(new DomDriver()); String xml1 = "<date>1982-01-01 00:00:00.0 SGT</date>"; String xml2 = "<date>1982-01-02 00:00:00.0 SGT</date>"; System.err.println(xstream.fromXML(xml1)); System.err.println(xstream.fromXML(xml2)); }}
The output I get is:
Thu Dec 31 23:30:00 SGT 1981
Sat Jan 02 00:00:00 SGT 1982
But it should be:
Fri Jan 01 00:00:00 SGT 1982
Sat Jan 02 00:00:00 SGT 1982
This is a pure JDK problem:
There's nothing XStream can do about.