From ddf65708a71219dd58c243f12ac6533d1db2cbff Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer <stefan@stklcode.de> Date: Wed, 8 Apr 2020 14:30:46 +0200 Subject: [PATCH 1/5] add JDK 14 to automated builds --- .drone.yml | 4 ++-- .travis.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index 7997190..1bccf75 100644 --- a/.drone.yml +++ b/.drone.yml @@ -15,7 +15,7 @@ name: java11 steps: - name: test - image: maven:3-jdk-11-slim + image: maven:3-jdk-11 commands: - mvn clean test @@ -26,6 +26,6 @@ name: java13 steps: - name: test - image: maven:3-jdk-13 + image: maven:3-jdk-14 commands: - mvn clean test diff --git a/.travis.yml b/.travis.yml index 69844cf..95ae926 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: java jdk: - openjdk8 - openjdk11 - - openjdk13 + - openjdk14 install: true addons: sonarcloud: From c314b0c6d4c444de3525f5f2f8f54e633532a31c Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer <stefan@stklcode.de> Date: Wed, 14 Oct 2020 09:40:59 +0200 Subject: [PATCH 2/5] [backport] remove future from trip reader after closing Future was not removed from the reader instance after close() has been called, so re-opening was not possible. Remove the instance after termination allows calling open() again. --- CHANGELOG.md | 5 +++++ .../stklcode/pubtrans/ura/reader/AsyncUraTripReader.java | 2 ++ .../pubtrans/ura/reader/AsyncUraTripReaderTest.java | 9 ++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1379606..4d8d086 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog All notable changes to this project will be documented in this file. +## unreleased +### Fixed +* Allow reopening an `AsyncUraTripReader` without raising an exception (#13) + + ## 1.3.0 - 2019-12-04 ### Security * Updated dependencies diff --git a/src/main/java/de/stklcode/pubtrans/ura/reader/AsyncUraTripReader.java b/src/main/java/de/stklcode/pubtrans/ura/reader/AsyncUraTripReader.java index 1a3bc13..d87cc32 100644 --- a/src/main/java/de/stklcode/pubtrans/ura/reader/AsyncUraTripReader.java +++ b/src/main/java/de/stklcode/pubtrans/ura/reader/AsyncUraTripReader.java @@ -134,6 +134,8 @@ public class AsyncUraTripReader implements AutoCloseable { } catch (TimeoutException e) { // Task failed to finish within 1 second. future.cancel(true); + } finally { + future = null; } } diff --git a/src/test/java/de/stklcode/pubtrans/ura/reader/AsyncUraTripReaderTest.java b/src/test/java/de/stklcode/pubtrans/ura/reader/AsyncUraTripReaderTest.java index 0f62da0..cb709dd 100644 --- a/src/test/java/de/stklcode/pubtrans/ura/reader/AsyncUraTripReaderTest.java +++ b/src/test/java/de/stklcode/pubtrans/ura/reader/AsyncUraTripReaderTest.java @@ -41,6 +41,8 @@ import java.util.concurrent.atomic.AtomicInteger; import static com.github.tomakehurst.wiremock.client.WireMock.*; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assumptions.assumeTrue; /** @@ -122,7 +124,7 @@ public class AsyncUraTripReaderTest { tr = new AsyncUraTripReader( new URL(httpMock.baseUrl() + "/interfaces/ura/stream_V2"), - Collections.singletonList(trips::add) + trips::add ); // Open the reader. @@ -146,6 +148,11 @@ public class AsyncUraTripReaderTest { assertThat("Unexpected number of v2 trips after all lines have been flushed", trips.size(), is(7)); assertThat("Unexpected number of v2 trips in list 2 after all lines have been flushed", trips2.size(), is(5)); assertThat("Same object should have been pushed to both lists", trips.containsAll(trips2)); + + // Opening the reader twice should raise an exception. + assertDoesNotThrow(tr::open, "Opening the reader after closing should not fail"); + assertThrows(IllegalStateException.class, tr::open, "Opening the reader twice should raise an exception"); + tr.close(); } /** From 7b8c81ab21866b528581368089cd28ff599db6d9 Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer <stefan@stklcode.de> Date: Sat, 12 Dec 2020 12:26:03 +0100 Subject: [PATCH 3/5] update dependency Jackson 2.11.3 --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 4f37b90..b5e55da 100644 --- a/pom.xml +++ b/pom.xml @@ -49,12 +49,12 @@ <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> - <version>2.11.0</version> + <version>2.11.3</version> </dependency> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter</artifactId> - <version>5.6.2</version> + <version>5.7.0</version> <scope>test</scope> </dependency> <dependency> @@ -66,7 +66,7 @@ <dependency> <groupId>com.github.tomakehurst</groupId> <artifactId>wiremock</artifactId> - <version>2.26.3</version> + <version>2.27.2</version> <scope>test</scope> </dependency> </dependencies> @@ -120,7 +120,7 @@ <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> - <version>0.8.5</version> + <version>0.8.6</version> <executions> <execution> <id>prepare-agent</id> From 3648d2d653cef108dc964e8c523d79be70ddd741 Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer <stefan@stklcode.de> Date: Sat, 12 Dec 2020 12:26:44 +0100 Subject: [PATCH 4/5] build with JDK 15 --- .drone.yml | 8 ++++---- .travis.yml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index 1bccf75..a5b7ed1 100644 --- a/.drone.yml +++ b/.drone.yml @@ -4,7 +4,7 @@ name: java8 steps: - name: test - image: maven:3-jdk-8-alpine + image: maven:3-openjdk-8 commands: - mvn clean test @@ -15,17 +15,17 @@ name: java11 steps: - name: test - image: maven:3-jdk-11 + image: maven:3-openjdk-11 commands: - mvn clean test --- kind: pipeline type: docker -name: java13 +name: java15 steps: - name: test - image: maven:3-jdk-14 + image: maven:3-openjdk-15 commands: - mvn clean test diff --git a/.travis.yml b/.travis.yml index 113a8df..942425a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: java jdk: - openjdk8 - openjdk11 - - openjdk14 + - openjdk15 install: true addons: sonarcloud: From 24b69a29e2947ed10dbd9ae00ec15e27e1e4e4f7 Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer <stefan@stklcode.de> Date: Sat, 12 Dec 2020 13:50:35 +0100 Subject: [PATCH 5/5] prepare release 1.3.1 --- CHANGELOG.md | 5 ++++- pom.xml | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d8d086..d9509fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,13 @@ # Changelog All notable changes to this project will be documented in this file. -## unreleased +## 1.3.1 - 2020-12-12 ### Fixed * Allow reopening an `AsyncUraTripReader` without raising an exception (#13) +### Improvements +* Dependency updates + ## 1.3.0 - 2019-12-04 ### Security diff --git a/pom.xml b/pom.xml index b5e55da..4af37c4 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ <groupId>de.stklcode.pubtrans</groupId> <artifactId>juraclient</artifactId> - <version>1.3.1-SNAPSHOT</version> + <version>1.3.1</version> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>