Skip to content

Commit 3e39b02

Browse files
committed
Merge branch '3.3.x'
Closes gh-43617
2 parents 682d6e5 + 12e753c commit 3e39b02

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/MavenBuildOutputTimestamp.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.time.OffsetDateTime;
2222
import java.time.ZoneOffset;
2323
import java.time.format.DateTimeParseException;
24-
import java.time.temporal.ChronoUnit;
2524

2625
import org.springframework.util.StringUtils;
2726

@@ -86,10 +85,7 @@ Instant toInstant() {
8685
return null;
8786
}
8887
try {
89-
Instant instant = OffsetDateTime.parse(this.timestamp)
90-
.withOffsetSameInstant(ZoneOffset.UTC)
91-
.truncatedTo(ChronoUnit.SECONDS)
92-
.toInstant();
88+
Instant instant = OffsetDateTime.parse(this.timestamp).withOffsetSameInstant(ZoneOffset.UTC).toInstant();
9389
if (instant.isBefore(DATE_MIN) || instant.isAfter(DATE_MAX)) {
9490
throw new IllegalArgumentException(
9591
String.format("'%s' is not within the valid range %s to %s", instant, DATE_MIN, DATE_MAX));

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/test/java/org/springframework/boot/maven/MavenBuildOutputTimestampTests.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -48,12 +48,17 @@ void shouldNotParseSingleCharacter() {
4848

4949
@Test
5050
void shouldParseIso8601() {
51-
assertThat(parse("2011-12-03T10:15:30Z")).isEqualTo(Instant.parse("2011-12-03T10:15:30Z"));
51+
assertThat(parse("2011-12-03T10:15:30Z")).isEqualTo(Instant.parse("2011-12-03T10:15:30.000Z"));
5252
}
5353

5454
@Test
5555
void shouldParseIso8601WithMilliseconds() {
56-
assertThat(parse("2011-12-03T10:15:30.12345Z")).isEqualTo(Instant.parse("2011-12-03T10:15:30Z"));
56+
assertThat(parse("2011-12-03T10:15:30.123Z")).isEqualTo(Instant.parse("2011-12-03T10:15:30.123Z"));
57+
}
58+
59+
@Test
60+
void shouldParseIso8601WithSeconds() {
61+
assertThat(parse("2011-12-03T10:15:30Z")).isEqualTo(Instant.parse("2011-12-03T10:15:30.000Z"));
5762
}
5863

5964
@Test

0 commit comments

Comments
 (0)