XStream
  1. XStream
  2. XSTR-708

Marshall and unmarshall of a java.sql.Timestamp object ignores timezone

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.4.3
    • Fix Version/s: 1.4.4
    • Component/s: Converters
    • Labels:
      None
    • JDK version and platform:
      1.6.0_23 for linux

      Description

      Test case:

      java.util.TimeZone.setDefault(java.util.TimeZone.getTimeZone("GMT+0:00"));
      final XStream instance = new XStream();
      final java.sql.Timestamp expected = new java.sql.Timestamp(0);
      final String marshalled = instance.toXML(expected);
      java.util.TimeZone.setDefault(java.util.TimeZone.getTimeZone("GMT-8:00"));
      final java.sql.Timestamp got = (java.sql.Timestamp) instance.fromXML(marshalled);
      Assert.assertEquals(expected, got);

      Test result:
      shouldHandleTimezoneForSqlTimestamp(com.thoughtworks.xstream.XStreamTest) Time elapsed: 0.148 sec <<< FAILURE!
      java.lang.AssertionError: expected:<1969-12-31 16:00:00.0> but was:<1970-01-01 00:00:00.0>

      Proposal patch in attachment.

        People

        • Assignee:
          Jörg Schaible
          Reporter:
          Andrea Zorzin
        • Votes:
          0 Vote for this issue
          Watchers:
          2 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: