1
1
/*
2
- * Copyright (c) 2015, 2018 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2015, 2025 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
21
21
* questions.
22
22
*/
23
23
24
- /**
24
+ /*
25
25
* @test
26
26
* @bug 8137121 8137230
27
27
* @summary (fc) Infinite loop FileChannel.truncate
31
31
*/
32
32
33
33
import java .nio .ByteBuffer ;
34
- import java .nio .channels .FileChannel ;
35
34
import java .nio .channels .ClosedByInterruptException ;
35
+ import java .nio .channels .FileChannel ;
36
36
import java .nio .file .Files ;
37
37
import java .nio .file .Path ;
38
- import static java .nio .file .StandardOpenOption .*;
39
38
import java .util .concurrent .TimeUnit ;
39
+ import static java .nio .file .StandardOpenOption .*;
40
40
import static jdk .test .lib .Utils .adjustTimeout ;
41
41
42
42
public class LoopingTruncate {
@@ -48,7 +48,10 @@ public class LoopingTruncate {
48
48
static long TIMEOUT = adjustTimeout (20_000 );
49
49
50
50
public static void main (String [] args ) throws Throwable {
51
- Path path = Files .createTempFile ("LoopingTruncate.tmp" , null );
51
+ // Intentionally opting out from the default `java.io.tmpdir`.
52
+ // It occasionally lacks the sufficient disk space this test needs.
53
+ Path pathDir = Path .of (System .getProperty ("user.dir" ));
54
+ Path path = Files .createTempFile (pathDir , "LoopingTruncate.tmp" , null );
52
55
try (FileChannel fc = FileChannel .open (path , CREATE , WRITE )) {
53
56
fc .position (FATEFUL_SIZE + 1L );
54
57
System .out .println (" Writing large file..." );
0 commit comments