Skip to content

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

Closed
@felixz7

Description

@felixz7
  • I have searched the issues of this repository and believe that this is not a duplicate.
  • 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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions