From 1146a38fcac065398ce63c48f269398932bd7d4d Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 7 Jan 2019 21:47:57 +0100 Subject: [PATCH] * Fixed a problem with exception by getting the build time for version. --- Mage/src/main/java/mage/util/JarVersion.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Mage/src/main/java/mage/util/JarVersion.java b/Mage/src/main/java/mage/util/JarVersion.java index e79adbbc2f..d88439c0a2 100644 --- a/Mage/src/main/java/mage/util/JarVersion.java +++ b/Mage/src/main/java/mage/util/JarVersion.java @@ -1,13 +1,12 @@ package mage.util; -import org.apache.log4j.Logger; - import java.net.URL; -import java.time.Instant; import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; +import java.time.temporal.TemporalAccessor; import java.util.jar.Attributes; import java.util.jar.Manifest; +import org.apache.log4j.Logger; /** * @author JayDi85 @@ -39,9 +38,10 @@ public class JarVersion { Manifest manifest = new Manifest(new URL(manifestPath).openStream()); Attributes attr = manifest.getMainAttributes(); String buildTime = attr.getValue("Build-Time"); - Instant instant = Instant.parse(buildTime); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm").withZone(ZoneOffset.UTC); - return formatter.format(instant); + DateTimeFormatter sourceFormatter = DateTimeFormatter.ofPattern("uuuuMMdd-HHmm").withZone(ZoneOffset.UTC); + TemporalAccessor ta = sourceFormatter.parse(buildTime); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("uuuu-MM-dd HH:mm").withZone(ZoneOffset.UTC); + return formatter.format(ta); } catch (Throwable e) { logger.error("Can't read build time in jar manifest for class " + clazz.getName() + " and path " + manifestPath, e); return JAR_BUILD_TIME_ERROR;