Copilot commented on code in PR #2735:
URL: https://github.com/apache/tika/pull/2735#discussion_r3037175283
##########
tika-server/tika-server-standard/src/test/java/org/apache/tika/server/standard/UnpackerResourceTest.java:
##########
@@ -602,4 +604,13 @@ public void testShallowExtraction() throws Exception {
assertEquals(200, response.getStatus());
// Just verify it succeeds - actual depth limiting behavior depends on
document structure
}
+
Review Comment:
There’s trailing whitespace on the blank line before the new tearDown()
method. This can cause style/formatting checks to fail; please remove the
spaces so the line is truly empty.
```suggestion
```
##########
tika-server/tika-server-standard/src/test/java/org/apache/tika/server/standard/UnpackerResourceTest.java:
##########
@@ -602,4 +604,13 @@ public void testShallowExtraction() throws Exception {
assertEquals(200, response.getStatus());
// Just verify it succeeds - actual depth limiting behavior depends on
document structure
}
+
+ @Override
+ @AfterAll
+ public void tearDown() throws Exception {
+ super.tearDown();
+ if (unpackTempDir != null && Files.exists(unpackTempDir)) {
+ FileUtils.deleteDirectory(unpackTempDir.toFile());
+ }
+ }
Review Comment:
This cleanup logic is duplicated across multiple tests and requires an extra
commons-io dependency/import. Consider switching unpackTempDir to JUnit’s
`@TempDir` (as done in tika-server-core StackTraceTest) so the temp directory
lifecycle is managed automatically and you can drop the manual
FileUtils.deleteDirectory() tearDown code.
##########
tika-server/tika-server-standard/src/test/java/org/apache/tika/server/standard/UnpackerResourceWithConfigTest.java:
##########
@@ -260,4 +262,13 @@ public void testPDFPerPageRenderGray() throws Exception {
assertTrue(averageColor.getBlue() < 100 && averageColor.getBlue()
> 90);
}
}
+
+ @AfterAll
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ if (unpackTempDir != null && Files.exists(unpackTempDir)) {
+ FileUtils.deleteDirectory(unpackTempDir.toFile());
+ }
+ }
Review Comment:
This manual temp-dir cleanup is duplicated with UnpackerResourceTest and
pulls in commons-io FileUtils. Consider using JUnit’s `@TempDir` for
unpackTempDir (see tika-server-core StackTraceTest) so the temp directory is
cleaned up automatically and you can remove the custom tearDown() deletion
logic.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]