Skip to content

Commit 4f110eb

Browse files
authored
Merge pull request #67 from Keysight/release/2.2.6
Release/2.2.6
2 parents f65ac11 + 3c58111 commit 4f110eb

File tree

4 files changed

+31
-8
lines changed

4 files changed

+31
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This library is available on Maven Central. Use the following information to inc
1212
<dependency>
1313
<groupId>com.riscure</groupId>
1414
<artifactId>trsfile</artifactId>
15-
<version>2.2.5</version>
15+
<version>2.2.6</version>
1616
</dependency>
1717

1818
#### Basic

pom.xml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@
66

77
<groupId>com.riscure</groupId>
88
<artifactId>trsfile</artifactId>
9-
<version>2.2.5</version>
9+
<version>2.2.6</version>
1010
<packaging>jar</packaging>
1111

1212
<name>${project.groupId}:${project.artifactId}</name>
1313
<description>Inspector Trace Set `.trs` file support for Java.
14-
Riscure Inspector uses the `.trs` file format to save and read traces from disk. To better assist reading and
15-
writing trace set files from third parties, Riscure published this Java library.
14+
Keysight Inspector uses the `.trs` file format to save and read traces from disk. To better assist reading and
15+
writing trace set files from third parties, Keysight manages this Java library. Note that the library was
16+
originally published by Riscure, which was acquired by Keysight in 2024.
1617
</description>
17-
<url>https://github.com/Riscure/java-trsfile</url>
18+
<url>https://github.com/Keysight/java-trsfile</url>
1819
<licenses>
1920
<license>
2021
<name>BSD 3-Clause Clear License</name>
@@ -23,9 +24,9 @@
2324
</licenses>
2425
<developers>
2526
<developer>
26-
<name>Riscure Team</name>
27-
<organization>Riscure</organization>
28-
<organizationUrl>https://www.riscure.com</organizationUrl>
27+
<name>Riscure Security Solutions</name>
28+
<organization>Keysight Technologies</organization>
29+
<organizationUrl>https://www.keysight.com</organizationUrl>
2930
</developer>
3031
</developers>
3132
<scm>

src/main/java/com/riscure/trs/TraceSet.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ private void checkValid(Trace trace) {
338338
}
339339

340340
private void closeReader() throws IOException {
341+
buffer = null;
341342
readStream.close();
342343
}
343344

src/test/java/TestTraceSet.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,4 +663,25 @@ void test61ReadLegacyTraceWithoutData() throws IOException, TRSFormatException {
663663
assertDoesNotThrow(() -> ts.get(0));
664664
}
665665
}
666+
667+
/**
668+
* Test to reproduce Github issue #65: TRS files remain 'in use' after they have been closed
669+
* Test this issue by opening and closing a file, and then checking whether the file can be deleted.
670+
*/
671+
@Test
672+
void testFileReleasing() throws IOException, TRSFormatException, InterruptedException {
673+
String filePath = tempDir.toAbsolutePath() + File.separator + BYTES_TRS;
674+
// Open the file, and let the try-with-resources statement close it
675+
try (TraceSet traceSet = TraceSet.open(filePath)) {
676+
traceSet.getMetaData().getTraceSetParameters();
677+
}
678+
// Unfortunately, the current solution requires a garbage collect to have been performed before the issue is resolved.
679+
// Other fixes required either a Java 8 Cleaner.clean() call not accessible from Java 21, or a Java 20 Arena.close(),
680+
// which is not been finalized in Java 21.
681+
System.gc();
682+
Thread.sleep(1000);
683+
// Assert that the opened file has been closed again, by deleting it.
684+
File file = new File(filePath);
685+
assert(file.delete());
686+
}
666687
}

0 commit comments

Comments
 (0)