dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

The dubbo protostuff protocol serializes the bug of java.sql.Timestamp

Open feixz opened this issue 7 years ago • 2 comments

  • [x] I have searched the issues of this repository and believe that this is not a duplicate.
  • [x] I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: v2.7.1
  • Operating System version: OSX 10.14.4
  • Java version: 1.8.0_202

Steps to reproduce this issue

    @Test
    public void testSerializeTimestamp() throws IOException, ClassNotFoundException {
        Timestamp originTime = new Timestamp(System.currentTimeMillis());
        this.protostuffObjectOutput.writeObject(originTime);
        this.flushToInput();

        Timestamp serializedTime = protostuffObjectInput.readObject(Timestamp.class);
        assertThat(serializedTime, is(originTime));
    }

// output
java.lang.AssertionError: 
Expected: is <2019-04-23 19:01:37.31>
     but: was <1970-01-01 08:00:00.31>
Expected :is <2019-04-23 19:01:37.31>
Actual   :<1970-01-01 08:00:00.31>

feixz avatar Apr 23 '19 11:04 feixz

#3915

feixz avatar Apr 23 '19 11:04 feixz

@CrazyHZM @kexianjun

feixz avatar Apr 23 '19 11:04 feixz