From c7f7df1aea6e58d51f62884a46494f1e171c96f0 Mon Sep 17 00:00:00 2001 From: gsd Date: Sun, 19 Mar 2023 11:47:03 +0300 Subject: [PATCH] fix --- Dockerfile | 2 ++ src/main/java/app/updates/PreviewUpdater.java | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0fa052f..30668c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,4 +8,6 @@ mvn -f pom.xml clean package FROM eclipse-temurin:18 COPY --from=builder /tmp/Facti13.Web.Backend.Java.V2/target/*.jar /app/backend.jar WORKDIR /app +ARG BUILDDATE +ENV BUILDDATE $BUILDDATE ENTRYPOINT ["java"] \ No newline at end of file diff --git a/src/main/java/app/updates/PreviewUpdater.java b/src/main/java/app/updates/PreviewUpdater.java index d14460b..fa5a451 100644 --- a/src/main/java/app/updates/PreviewUpdater.java +++ b/src/main/java/app/updates/PreviewUpdater.java @@ -69,17 +69,26 @@ public class PreviewUpdater extends BaseUpdater{ public String getPreview(String map) { String url; + //Check jpg + url = preview.formatted(domain, map, "jpg"); try { - url = preview.formatted(domain, map, "jpg"); + logger.info("Request: {}", url); restTemplate.headForHeaders(url); return url; - } catch (RestClientException err) {} + } catch (RestClientException err) { + logger.warn("Not found: {}, err: {}", url, err); + } + //Check txt contained url + url = preview.formatted(domain, map, "url"); try { - url = preview.formatted(domain, map, "url"); + logger.info("Request: {}", url); return restTemplate.getForEntity(url, String.class).getBody().replace("\n", ""); - } catch (RestClientException err) {} + } catch (RestClientException err) { + logger.warn("Not found: {}, err: {}", url, err); + } + return null; }