Skip to content

Commit 2db6b5f

Browse files
committed
fix: date format parser
1 parent f278c8f commit 2db6b5f

File tree

2 files changed

+6
-2
lines changed
  • operator-framework-core

2 files changed

+6
-2
lines changed

operator-framework-core/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<version>${surefire.version}</version>
3030
</plugin>
3131
<plugin>
32+
<!-- Used to generate the version / commit information -->
3233
<groupId>pl.project13.maven</groupId>
3334
<artifactId>git-commit-id-plugin</artifactId>
3435
<version>4.0.3</version>

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/Utils.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package io.javaoperatorsdk.operator.api.config;
22

33
import java.io.IOException;
4-
import java.text.DateFormat;
54
import java.text.ParseException;
5+
import java.text.SimpleDateFormat;
66
import java.time.Instant;
77
import java.util.Date;
88
import java.util.Properties;
@@ -21,7 +21,10 @@ public static Version loadFromProperties() {
2121

2222
Date builtTime;
2323
try {
24-
builtTime = DateFormat.getDateTimeInstance().parse(properties.getProperty("git.build.time"));
24+
builtTime =
25+
// RFC 822 date is the default format used by git-commit-id-plugin
26+
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
27+
.parse(properties.getProperty("git.build.time"));
2528
} catch (ParseException e) {
2629
builtTime = Date.from(Instant.EPOCH);
2730
}

0 commit comments

Comments
 (0)