Skip to content

Commit

Permalink
bug fix for jsonb skip LocalDate, for issue #2907
Browse files Browse the repository at this point in the history
  • Loading branch information
wenshao committed Sep 1, 2024
1 parent 8572567 commit 6ebb67b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2446,6 +2446,7 @@ public void skipValue() {
case BC_TIMESTAMP_MINUTES:
case BC_FLOAT:
case BC_INT64_INT:
case BC_LOCAL_DATE:
offset += 4;
return;
case BC_FLOAT_INT:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.alibaba.fastjson2.issues_2900;

import com.alibaba.fastjson2.JSONB;
import org.junit.jupiter.api.Test;

import java.time.LocalDate;

import static org.junit.jupiter.api.Assertions.assertNotNull;

public class Issue2907 {
@Test
public void test() {
Bean bean = new Bean();
bean.date = LocalDate.now();
byte[] bytes = JSONB.toBytes(bean);
Bean1 bean1 = JSONB.parseObject(bytes, Bean1.class);
assertNotNull(bean1);
}

public static class Bean {
public LocalDate date;
}

public static class Bean1 {
}
}

0 comments on commit 6ebb67b

Please sign in to comment.