Skip to content

Commit

Permalink
Merge pull request #67 from Keysight/release/2.2.6
Browse files Browse the repository at this point in the history
Release/2.2.6
  • Loading branch information
Siebje authored Dec 5, 2024
2 parents f65ac11 + 3c58111 commit 4f110eb
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This library is available on Maven Central. Use the following information to inc
<dependency>
<groupId>com.riscure</groupId>
<artifactId>trsfile</artifactId>
<version>2.2.5</version>
<version>2.2.6</version>
</dependency>

#### Basic
Expand Down
15 changes: 8 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@

<groupId>com.riscure</groupId>
<artifactId>trsfile</artifactId>
<version>2.2.5</version>
<version>2.2.6</version>
<packaging>jar</packaging>

<name>${project.groupId}:${project.artifactId}</name>
<description>Inspector Trace Set `.trs` file support for Java.
Riscure Inspector uses the `.trs` file format to save and read traces from disk. To better assist reading and
writing trace set files from third parties, Riscure published this Java library.
Keysight Inspector uses the `.trs` file format to save and read traces from disk. To better assist reading and
writing trace set files from third parties, Keysight manages this Java library. Note that the library was
originally published by Riscure, which was acquired by Keysight in 2024.
</description>
<url>https://github.com/Riscure/java-trsfile</url>
<url>https://github.com/Keysight/java-trsfile</url>
<licenses>
<license>
<name>BSD 3-Clause Clear License</name>
Expand All @@ -23,9 +24,9 @@
</licenses>
<developers>
<developer>
<name>Riscure Team</name>
<organization>Riscure</organization>
<organizationUrl>https://www.riscure.com</organizationUrl>
<name>Riscure Security Solutions</name>
<organization>Keysight Technologies</organization>
<organizationUrl>https://www.keysight.com</organizationUrl>
</developer>
</developers>
<scm>
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/riscure/trs/TraceSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ private void checkValid(Trace trace) {
}

private void closeReader() throws IOException {
buffer = null;
readStream.close();
}

Expand Down
21 changes: 21 additions & 0 deletions src/test/java/TestTraceSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -663,4 +663,25 @@ void test61ReadLegacyTraceWithoutData() throws IOException, TRSFormatException {
assertDoesNotThrow(() -> ts.get(0));
}
}

/**
* Test to reproduce Github issue #65: TRS files remain 'in use' after they have been closed
* Test this issue by opening and closing a file, and then checking whether the file can be deleted.
*/
@Test
void testFileReleasing() throws IOException, TRSFormatException, InterruptedException {
String filePath = tempDir.toAbsolutePath() + File.separator + BYTES_TRS;
// Open the file, and let the try-with-resources statement close it
try (TraceSet traceSet = TraceSet.open(filePath)) {
traceSet.getMetaData().getTraceSetParameters();
}
// Unfortunately, the current solution requires a garbage collect to have been performed before the issue is resolved.
// Other fixes required either a Java 8 Cleaner.clean() call not accessible from Java 21, or a Java 20 Arena.close(),
// which is not been finalized in Java 21.
System.gc();
Thread.sleep(1000);
// Assert that the opened file has been closed again, by deleting it.
File file = new File(filePath);
assert(file.delete());
}
}

0 comments on commit 4f110eb

Please sign in to comment.