-
Notifications
You must be signed in to change notification settings - Fork 123
Closed
Labels
good first issueIssue that seems easy to resolve and is likely a good candidate for contributors new to projectIssue that seems easy to resolve and is likely a good candidate for contributors new to projectpr-welcomeIssue for which progress most likely if someone submits a Pull RequestIssue for which progress most likely if someone submits a Pull Request
Milestone
Description
jdk-17.0.6,
code:
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import java.time.OffsetDateTime;
public class Main {
public static void main(String[] args) throws JsonProcessingException {
ObjectMapper mapper = new ObjectMapper()
.registerModule(new JavaTimeModule());
String json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(OffsetDateTime.MIN);
System.out.println(json);
OffsetDateTime value = mapper.readValue(json, OffsetDateTime.class);
System.out.println(value);
}
}
pom:
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jackson.version>2.17.0</jackson.version>
</properties>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-parameter-names</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson.version}</version>
</dependency>
</dependencies>
output:
-31557014135661600.000000000
Exception in thread "main" java.time.DateTimeException: Invalid value for EpochDay (valid values -365243219162 - 365241780471): -365243219163
at java.base/java.time.temporal.ValueRange.checkValidValue(ValueRange.java:319)
at java.base/java.time.temporal.ChronoField.checkValidValue(ChronoField.java:718)
at java.base/java.time.LocalDate.ofEpochDay(LocalDate.java:343)
at java.base/java.time.LocalDateTime.ofEpochSecond(LocalDateTime.java:424)
at java.base/java.time.OffsetDateTime.ofInstant(OffsetDateTime.java:330)
at com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer.lambda$static$3(InstantDeserializer.java:84)
at com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer._fromDecimal(InstantDeserializer.java:328)
at com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer.deserialize(InstantDeserializer.java:214)
at com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer.deserialize(InstantDeserializer.java:52)
at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4730)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3677)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3645)
timonback
Metadata
Metadata
Assignees
Labels
good first issueIssue that seems easy to resolve and is likely a good candidate for contributors new to projectIssue that seems easy to resolve and is likely a good candidate for contributors new to projectpr-welcomeIssue for which progress most likely if someone submits a Pull RequestIssue for which progress most likely if someone submits a Pull Request