Skip to content

Commit 170bf57

Browse files
isaacreathsmiklosovic
authored andcommitted
Fix ThreadLocalReadAheadBufferTest to avoid FileNotFoundException when -Djava.io.tmpdir set to /tmp
patch by Isaac Reath; reviewed by Paulo Motta, Stefan Miklosovic for CASSANDRA-20819
1 parent 902ef57 commit 170bf57

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/unit/org/apache/cassandra/io/util/ThreadLocalReadAheadBufferTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,13 @@ public InputData(File file, List<Pair<Long, Integer>> positionsAndLengths)
177177

178178
private static File writeFile(int seed, int length)
179179
{
180-
String fileName = JAVA_IO_TMPDIR.getString() + "data+" + length + ".bin";
180+
String fileName = "data+" + length + ".bin";
181181

182182
byte[] dataChunk = new byte[4096 * 8];
183183
java.util.Random random = new Random(seed);
184184
int writtenData = 0;
185185

186-
File file = new File(fileName);
186+
File file = new File(JAVA_IO_TMPDIR.getString(), fileName);
187187
try (FileOutputStream fos = new FileOutputStream(file.toJavaIOFile()))
188188
{
189189
while (writtenData < length)

0 commit comments

Comments
 (0)