Skip to content

Commit

Permalink
Fixed parsing of build timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
buchen committed Dec 1, 2019
1 parent c152866 commit a9d3cdb
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package name.abuchen.portfolio.util;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeParseException;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

import name.abuchen.portfolio.PortfolioLog;

public enum BuildInfo
{
INSTANCE;
Expand All @@ -27,10 +31,11 @@ private LocalDateTime readBuildTime()
{
// timestamp is written into build-info.properties by Maven
ResourceBundle bundle = ResourceBundle.getBundle("build-info"); //$NON-NLS-1$
return LocalDateTime.parse(bundle.getString("build.timestamp")); //$NON-NLS-1$
return Instant.parse(bundle.getString("build.timestamp")).atZone(ZoneId.systemDefault()).toLocalDateTime(); //$NON-NLS-1$
}
catch (MissingResourceException | DateTimeParseException e)
{
PortfolioLog.error(e);
return LocalDateTime.now();
}
}
Expand Down

0 comments on commit a9d3cdb

Please sign in to comment.