mirror of
https://github.com/openjdk/jdk15u.git
synced 2025-12-11 20:53:20 -06:00
8261183: Follow on to Make lists of normal filenames
Reviewed-by: alanb, rriggs, rhalade
This commit is contained in:
parent
d0951b13f8
commit
e6c6caa84a
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -1135,14 +1135,7 @@ public class File
|
||||
* the directory
|
||||
*/
|
||||
public String[] list() {
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkRead(path);
|
||||
}
|
||||
if (isInvalid()) {
|
||||
return null;
|
||||
}
|
||||
return fs.list(this);
|
||||
return normalizedList();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1162,8 +1155,15 @@ public class File
|
||||
* the directory
|
||||
*/
|
||||
private final String[] normalizedList() {
|
||||
String[] s = list();
|
||||
if (getClass() != File.class) {
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkRead(path);
|
||||
}
|
||||
if (isInvalid()) {
|
||||
return null;
|
||||
}
|
||||
String[] s = fs.list(this);
|
||||
if (s != null && getClass() != File.class) {
|
||||
String[] normalized = new String[s.length];
|
||||
for (int i = 0; i < s.length; i++) {
|
||||
normalized[i] = fs.normalize(s[i]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user