From 733784537aa9a652a3dcd2bbb047850b16168dc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Bj=C3=B6rk?= Date: Wed, 24 Aug 2022 08:49:28 +0200 Subject: [PATCH] Upgrade H2 version since it could cause a ConcurrentModificationException. Prevent memory leak by unlocking a lock in the finally clause. Upgrade Hibernate and Spring versions. --- core-bc/composites/svc/pom.xml | 68 +------------------ .../service/ArticleService.java | 26 ++++--- core-bc/composites/types/pom.xml | 36 +--------- .../vgregion/vatskenutrition/model/Child.java | 4 +- .../vgregion/vatskenutrition/model/Field.java | 13 +--- .../src/main/resources/log4j.properties | 4 +- pom.xml | 4 +- 7 files changed, 33 insertions(+), 122 deletions(-) rename core-bc/{composites/svc => modules/intsvc}/src/main/resources/log4j.properties (90%) diff --git a/core-bc/composites/svc/pom.xml b/core-bc/composites/svc/pom.xml index abaa754..e0cf658 100644 --- a/core-bc/composites/svc/pom.xml +++ b/core-bc/composites/svc/pom.xml @@ -73,18 +73,6 @@ ${spring.security.version} - - org.springframework.security - spring-security-jwt - 1.0.9.RELEASE - - - - org.springframework.security.oauth - spring-security-oauth2 - 2.2.5.RELEASE - - org.springframework.data spring-data-jpa @@ -94,65 +82,15 @@ org.postgresql postgresql - 9.4-1203-jdbc42 - - com.h2database h2 - 1.4.197 + 2.1.214 - - org.apache.poi - poi - 3.9 - - - - org.apache.poi - poi-ooxml - 3.9 - - - javax.xml.bind jaxb-api @@ -168,7 +106,7 @@ org.mock-server mockserver-netty - 5.11.1 + 5.14.0 test diff --git a/core-bc/composites/svc/src/main/java/se/vgregion/vatskenutrition/service/ArticleService.java b/core-bc/composites/svc/src/main/java/se/vgregion/vatskenutrition/service/ArticleService.java index 394d9bb..2e3c457 100644 --- a/core-bc/composites/svc/src/main/java/se/vgregion/vatskenutrition/service/ArticleService.java +++ b/core-bc/composites/svc/src/main/java/se/vgregion/vatskenutrition/service/ArticleService.java @@ -76,14 +76,20 @@ public void onFailure(Throwable throwable) { @Override public void onSuccess(ResponseEntity responseEntity) { - List
articles = Arrays.asList(responseEntity.getBody()); + try { + List
articles = Arrays.asList(responseEntity.getBody()); - dbLock.lock(); - articleRepository.deleteAll(); - articleRepository.save(articles); - dbLock.unlock(); + dbLock.lock(); - completableFuture1.complete(null); + articleRepository.deleteAll(); + articleRepository.save(articles); + + completableFuture1.complete(null); + } catch (Exception e) { + LOGGER.error(e.getMessage(), e); + } finally { + dbLock.unlock(); + } } }); @@ -97,8 +103,12 @@ public void onFailure(Throwable throwable) { @Override public void onSuccess(ResponseEntity responseEntity) { - startPageArticles = Arrays.asList(responseEntity.getBody()); - completableFuture2.complete(new Object()); + try { + startPageArticles = Arrays.asList(responseEntity.getBody()); + completableFuture2.complete(new Object()); + } catch (Exception e) { + LOGGER.error(e.getMessage(), e); + } } }); diff --git a/core-bc/composites/types/pom.xml b/core-bc/composites/types/pom.xml index 4c4f987..1981501 100644 --- a/core-bc/composites/types/pom.xml +++ b/core-bc/composites/types/pom.xml @@ -20,36 +20,6 @@ Generation time : 2015-01-14 09:02:50 CET jar ${project.artifactId} - - - - - - -