Skip to content

Commit dbb4327

Browse files
committed
8360411: [TEST] open/test/jdk/java/io/File/MaxPathLength.java Refactor extract method to encapsulate Windows specific test logic
Backport-of: 016694bf74f6920f850330e353df9fd03458cca1
1 parent ce9e6fe commit dbb4327

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

test/jdk/java/io/File/MaxPathLength.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -60,14 +60,7 @@ public static void main(String[] args) throws Exception {
6060

6161
// test long paths on windows
6262
// And these long pathes cannot be handled on Solaris and Mac platforms
63-
if (isWindows) {
64-
String name = fileName;
65-
while (name.length() < MAX_LENGTH) {
66-
testLongPath (20, name, false);
67-
testLongPath (20, name, true);
68-
name = getNextName(name);
69-
}
70-
}
63+
testLongPathOnWindows();
7164
}
7265

7366
private static String getNextName(String fName) {
@@ -199,4 +192,15 @@ static void testLongPath(int max, String fn,
199192
}
200193
}
201194
}
195+
196+
private static void testLongPathOnWindows () throws Exception {
197+
if (isWindows) {
198+
String name = fileName;
199+
while (name.length() < MAX_LENGTH) {
200+
testLongPath (20, name, false);
201+
testLongPath (20, name, true);
202+
name = getNextName(name);
203+
}
204+
}
205+
}
202206
}

0 commit comments

Comments
 (0)