This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-net.git
The following commit(s) were added to refs/heads/master by this push:
new 5dd8f927 Bulletproof bills
5dd8f927 is described below
commit 5dd8f92755ec44eb24dbb998961502a99e04dc79
Author: Gary Gregory <[email protected]>
AuthorDate: Wed Jul 19 10:39:16 2023 -0400
Bulletproof bills
---
.../java/org/apache/commons/net/tftp/TFTPServerPathTest.java | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/test/java/org/apache/commons/net/tftp/TFTPServerPathTest.java
b/src/test/java/org/apache/commons/net/tftp/TFTPServerPathTest.java
index f3e377f2..7d92f168 100644
--- a/src/test/java/org/apache/commons/net/tftp/TFTPServerPathTest.java
+++ b/src/test/java/org/apache/commons/net/tftp/TFTPServerPathTest.java
@@ -48,20 +48,24 @@ public class TFTPServerPathTest {
deleteFixture(file);
deleteFixture(out);
}
-
+
@BeforeEach
public void beforeEach() throws IOException {
+ // Fixture 1
file = new File(serverDirectory, filePrefix + "source.txt");
+ deleteFixture(file);
file.createNewFile();
+ // Fixture 2
out = new File(serverDirectory, filePrefix + "out");
+ deleteFixture(out);
}
-
+
private void deleteFixture(final File file) {
- if (!file.delete()) {
+ if (file != null && !file.delete()) {
file.deleteOnExit();
}
}
-
+
@Test
public void testReadOnly() throws IOException {
// Start a read-only server