Skip to content

Commit 58b4363

Browse files
committed
8251466: test/java/io/File/GetXSpace.java fails on Windows with mapped network drives.
Backport-of: 178ac7465360729628521a0d555253b9fb2ad7bf
1 parent 96a5e40 commit 58b4363

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

test/jdk/java/io/File/GetXSpace.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2022, 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
@@ -34,7 +34,6 @@
3434

3535
import java.io.BufferedReader;
3636
import java.io.File;
37-
import java.io.FilePermission;
3837
import java.io.InputStreamReader;
3938
import java.io.IOException;
4039
import java.nio.file.Files;
@@ -108,8 +107,8 @@ private static class Space {
108107

109108
Space(String total, String free, String name) {
110109
try {
111-
this.total = Long.valueOf(total) * KSIZE;
112-
this.free = Long.valueOf(free) * KSIZE;
110+
this.total = Long.parseLong(total) * KSIZE;
111+
this.free = Long.parseLong(free) * KSIZE;
113112
} catch (NumberFormatException x) {
114113
throw new RuntimeException("the regex should have caught this", x);
115114
}
@@ -157,7 +156,7 @@ private static ArrayList<Space> space(String f) throws IOException {
157156
}
158157
al.add(new Space(m.group(2), m.group(3), name));;
159158
}
160-
j = m.end() + 1;
159+
j = m.end();
161160
} else {
162161
throw new RuntimeException("unrecognized df output format: "
163162
+ "charAt(" + j + ") = '"
@@ -227,7 +226,7 @@ private static void compare(Space s) {
227226
// On Linux, ignore the NSFE if the path is one of the
228227
// /run/user/$UID mounts created by pam_systemd(8) as it
229228
// might be deleted during the test
230-
if (!Platform.isLinux() || s.name().indexOf("/run/user") == -1)
229+
if (!Platform.isLinux() || !s.name().contains("/run/user"))
231230
throw new RuntimeException(nsfe);
232231
} catch (IOException e) {
233232
throw new RuntimeException(e);

0 commit comments

Comments
 (0)