File tree Expand file tree Collapse file tree 6 files changed +21
-33
lines changed Expand file tree Collapse file tree 6 files changed +21
-33
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2008, 2017 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2008, 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
+ /*
25
+ * This test is launched via a ProcessBuilder in the main test MacPath which
26
+ * includes a @requires (os.family == "mac") tag so no operating system
27
+ * conditional is applied here.
28
+ */
24
29
import java .io .File ;
25
30
import java .io .FileInputStream ;
26
31
import java .io .FileOutputStream ;
29
34
public class MacPathTest {
30
35
31
36
public static void main (String args []) throws Throwable {
32
- String osname = System .getProperty ("os.name" );
33
- if (!osname .contains ("OS X" ) && !osname .contains ("Darwin" ))
34
- return ;
35
-
36
37
// English
37
38
test ("TestDir_apple" , // test dir
38
39
"dir_macosx" , // dir
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2008, 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
24
24
/* @test
25
25
@bug 6481955
26
26
@summary Path length less than MAX_PATH (260) works on Windows
27
+ @library /test/lib
27
28
*/
28
29
29
- import java .io .*;
30
+ import java .io .File ;
31
+ import java .io .IOException ;
32
+
33
+ import jtreg .SkippedException ;
30
34
31
35
public class MaxPath {
32
36
public static void main (String [] args ) throws Exception {
33
37
String osName = System .getProperty ("os.name" );
34
38
if (!osName .startsWith ("Windows" )) {
35
- return ;
39
+ throw new SkippedException ( "This test is run only on Windows" ) ;
36
40
}
41
+
37
42
int MAX_PATH = 260 ;
38
43
String dir = new File ("." ).getAbsolutePath () + "\\ " ;
39
44
String padding = "1234567890123456789012345678901234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890" ;
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2006, 2013 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2006, 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
24
24
/* @test
25
25
@bug 6176051 4858457
26
26
@summary Check whether reserved names are handled correctly on Windows
27
+ @requires (os.family == "windows")
27
28
*/
28
29
29
30
import java .io .File ;
@@ -38,10 +39,6 @@ public class WinDeviceName {
38
39
};
39
40
public static void main (String [] args ) {
40
41
String osName = System .getProperty ("os.name" );
41
- if (!osName .startsWith ("Windows" )) {
42
- return ;
43
- }
44
-
45
42
for (int i = 0 ; i < devnames .length ; i ++) {
46
43
String names [] = { devnames [i ], devnames [i ] + ".TXT" ,
47
44
devnames [i ].toLowerCase (),
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2006, 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
25
25
@bug 6384833
26
26
@summary Check if appropriate exception FileNotFoundException gets
27
27
thrown when the pathlengh exceeds the limit.
28
+ @requires (os.family == "windows")
28
29
*/
29
30
30
31
import java .io .*;
31
32
public class WinMaxPath {
32
33
public static void main (String [] args ) throws Exception {
33
- String osName = System .getProperty ("os.name" );
34
- if (!osName .startsWith ("Windows" )) {
35
- return ;
36
- }
37
34
try {
38
35
char [] as = new char [65000 ];
39
36
java .util .Arrays .fill (as , 'a' );
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2006, 2018 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2006, 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
25
25
@bug 6192331 6348207 8202076
26
26
@summary Check if File.exists()/length() works correctly on Windows
27
27
special files hiberfil.sys and pagefile.sys
28
+ @requires (os.family == "windows")
28
29
*/
29
30
30
31
import java .io .File ;
31
32
public class WinSpecialFiles {
32
33
public static void main (String [] args ) throws Exception {
33
- String osName = System .getProperty ("os.name" );
34
- if (!osName .startsWith ("Windows" )) {
35
- return ;
36
- }
37
34
File root = new File ("C:\\ " );
38
35
File [] dir = root .listFiles ();
39
36
for (int i = 0 ; i < dir .length ; i ++) {
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2003, 2020 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2003, 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
@@ -37,15 +37,6 @@ public class ManyFiles {
37
37
static int NUM_FILES = 2050 ;
38
38
39
39
public static void main (String args []) throws Exception {
40
- // Linux does not yet allow opening this many files; Solaris
41
- // 8 requires an explicit allocation of more file descriptors
42
- // to succeed. Since this test is written to check for a
43
- // Windows capability it is much simpler to only run it
44
- // on that platform.
45
- String osName = System .getProperty ("os.name" );
46
- if (osName .startsWith ("Linux" ))
47
- return ;
48
-
49
40
for (int n = 0 ; n < NUM_FILES ; n ++) {
50
41
File f = new File ("file" + count ++);
51
42
files .add (f );
You can’t perform that action at this time.
0 commit comments