-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8363720: Follow up to JDK-8360411 with post review comments #26445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cc34a0a
8363720: Follow up to JDK-8360411 with post review comments
061dc64
Fix indentation issues
7468b4b
Fix remaining indentation errors (From my first commit on this branch)
0b55f24
Implemented Brian's suggestion
67c73d1
removed blank lines at end of file
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,18 +36,19 @@ public class MaxPathLength { | |
| private static String pathComponent = sep + | ||
| "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; | ||
| private static String fileName = | ||
| "areallylongfilenamethatsforsur"; | ||
| "areallylongfilenamethatsforsur"; | ||
| private static boolean isWindows = false; | ||
|
|
||
| private static final int MAX_LENGTH = 256; | ||
|
|
||
| private static final int FILE_EXISTS_SLEEP = 100; | ||
|
|
||
| private static final int MAX_PATH_COMPONENTS_WINDOWS = 20; | ||
|
|
||
| private static int counter = 0; | ||
|
|
||
| public static void main(String[] args) throws Exception { | ||
| String osName = System.getProperty("os.name"); | ||
| if (osName.startsWith("Windows")) { | ||
| isWindows = true; | ||
| } | ||
| setIsWindows(); | ||
|
|
||
| for (int i = 4; i < 7; i++) { | ||
| String name = fileName; | ||
|
|
@@ -59,8 +60,17 @@ public static void main(String[] args) throws Exception { | |
| } | ||
|
|
||
| // test long paths on windows | ||
| // And these long pathes cannot be handled on Solaris and Mac platforms | ||
| testLongPathOnWindows(); | ||
| // And these long paths cannot be handled on Linux and Mac platforms | ||
| if (isWindows) { | ||
| testLongPath(); | ||
| } | ||
| } | ||
|
|
||
| private static void setIsWindows() { | ||
| String osName = System.getProperty("os.name"); | ||
| if (osName.startsWith("Windows")) { | ||
| isWindows = true; | ||
| } | ||
| } | ||
|
|
||
| private static String getNextName(String fName) { | ||
|
|
@@ -155,7 +165,7 @@ static void testLongPath(int max, String fn, | |
| String abPath = f.getAbsolutePath(); | ||
| if (!abPath.startsWith("\\\\") || | ||
| abPath.length() < 1093) { | ||
| throw new RuntimeException ("File.renameTo() failed for lenth=" | ||
| throw new RuntimeException ("File.renameTo() failed for length=" | ||
| + abPath.length()); | ||
| } | ||
| } else { | ||
|
|
@@ -182,7 +192,7 @@ static void testLongPath(int max, String fn, | |
| Files.deleteIfExists(p); | ||
| // Test if the file is really deleted and wait for 1 second at most | ||
| for (int j = 0; j < 10 && Files.exists(p); j++) { | ||
| Thread.sleep(100); | ||
| Thread.sleep(FILE_EXISTS_SLEEP); | ||
| } | ||
| } catch (DirectoryNotEmptyException ex) { | ||
| // Give up the clean-up, let jtreg handle it. | ||
|
|
@@ -193,14 +203,14 @@ static void testLongPath(int max, String fn, | |
| } | ||
| } | ||
|
|
||
| private static void testLongPathOnWindows () throws Exception { | ||
| if (isWindows) { | ||
| String name = fileName; | ||
| while (name.length() < MAX_LENGTH) { | ||
| testLongPath (20, name, false); | ||
| testLongPath (20, name, true); | ||
| name = getNextName(name); | ||
| } | ||
| private static void testLongPath () throws Exception { | ||
| String name = fileName; | ||
| while (name.length() < MAX_LENGTH) { | ||
| testLongPath(MAX_PATH_COMPONENTS_WINDOWS, name, false); | ||
| testLongPath(MAX_PATH_COMPONENTS_WINDOWS, name, true); | ||
| name = getNextName(name); | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.