Skip to content

Commit

Permalink
Upgrade H2 version since it could cause a ConcurrentModificationExcep…
Browse files Browse the repository at this point in the history
…tion. Prevent memory leak by unlocking a lock in the finally clause. Upgrade Hibernate and Spring versions.
  • Loading branch information
patrikbjork committed Aug 24, 2022
1 parent 4a7d549 commit 7337845
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 122 deletions.
68 changes: 3 additions & 65 deletions core-bc/composites/svc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,6 @@
<version>${spring.security.version}</version>
</dependency>

<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-jwt</artifactId>
<version>1.0.9.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.security.oauth/spring-security-oauth2 -->
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<version>2.2.5.RELEASE</version>
</dependency>

<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
Expand All @@ -94,65 +82,15 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4-1203-jdbc42</version>
</dependency>
<!--
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-webmvc</artifactId>
<version>2.6.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-hal-browser</artifactId>
<version>2.6.1.RELEASE</version>
<version>42.3.5</version>
</dependency>

&lt;!&ndash;<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901-1.jdbc4</version>
</dependency>&ndash;&gt;
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>portal-service</artifactId>
<version>6.2.10.17</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
<scope>test</scope>
</dependency>-->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.197</version>
<version>2.1.214</version>
</dependency>

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.9</version>
</dependency>

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
</dependency>


<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
Expand All @@ -168,7 +106,7 @@
<dependency>
<groupId>org.mock-server</groupId>
<artifactId>mockserver-netty</artifactId>
<version>5.11.1</version>
<version>5.14.0</version>
<scope>test</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,20 @@ public void onFailure(Throwable throwable) {

@Override
public void onSuccess(ResponseEntity<Article[]> responseEntity) {
List<Article> articles = Arrays.asList(responseEntity.getBody());
try {
List<Article> 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();
}
}
});

Expand All @@ -97,8 +103,12 @@ public void onFailure(Throwable throwable) {

@Override
public void onSuccess(ResponseEntity<Article[]> 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);
}
}
});

Expand Down
36 changes: 3 additions & 33 deletions core-bc/composites/types/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,6 @@ Generation time : 2015-01-14 09:02:50 CET
<packaging>jar</packaging>
<name>${project.artifactId}</name>

<build>
<plugins>
<!-- The weaving enables lazy loading in EclipseLink. So without it performance is decreased. -->
<!--<plugin>
<groupId>de.empulse.eclipselink</groupId>
<artifactId>staticweave-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>weave</goal>
</goals>
<configuration>
<persistenceXMLLocation>META-INF/persistence.xml</persistenceXMLLocation>
<logLevel>FINE</logLevel>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa</artifactId>
<version>2.6.0</version>
</dependency>
</dependencies>
</plugin>-->
</plugins>
</build>

<dependencies>

<!--<dependency>
Expand All @@ -64,19 +34,19 @@ Generation time : 2015-01-14 09:02:50 CET
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.0.11.Final</version>
<version>5.3.20.Final</version>
</dependency>

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.0.11.Final</version>
<version>5.3.20.Final</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.10.5</version>
<version>2.13.3</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class Child {
@Column
private String name;

@Column
@Column(name = "value_")
@Lob
private String value;

Expand Down Expand Up @@ -40,4 +40,4 @@ public void setValue(String value) {
public void setChildren(List<Child> children) {
this.children = children;
}*/
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
package se.vgregion.vatskenutrition.model;

import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.OrderColumn;
import javax.persistence.*;
import java.util.List;

@Entity
@Table(name = "field_")
public class Field {

@Id
Expand All @@ -25,7 +18,7 @@ public class Field {
@OrderColumn
private List<Child> children;

@Column
@Column(name = "value_")
@Lob
private String value;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Logging to file...
log4j.rootCategory=INFO, CONSOLE
log4j.rootCategory=INFO, CONSOLE, ROLLINGFILE
# Define rolling file appender
log4j.appender.ROLLINGFILE=org.apache.log4j.RollingFileAppender
log4j.appender.ROLLINGFILE.File=${catalina.base}/logs/vatskenutrition.log
Expand All @@ -16,4 +16,4 @@ log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd@HH:mm:ss:SSS} %-5p [%c] - %m%n

log4j.category.se.vgregion=DEBUG
log4j.category.se.vgregion=DEBUG
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<servlet-api.version>3.0.1</servlet-api.version>
<slf4j.version>1.7.30</slf4j.version>
<spring.fw.version>4.3.12.RELEASE</spring.fw.version>
<spring.security.version>4.2.12.RELEASE</spring.security.version>
<spring.fw.version>5.3.20</spring.fw.version>
<spring.security.version>5.7.1</spring.security.version>

<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
Expand Down

0 comments on commit 7337845

Please sign in to comment.