Mercurial > hg > icedtea8-forest > jdk
changeset 14979:4eae74c62a51 jdk8u292-b10 jdk8u292-ga
8261183: Follow on to Make lists of normal filenames
Reviewed-by: mbalao, andrew
author | yan |
---|---|
date | Thu, 18 Feb 2021 17:34:20 +0000 |
parents | b138d2995b90 |
children | 28b74705f731 |
files | src/share/classes/java/io/File.java |
diffstat | 1 files changed, 11 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/classes/java/io/File.java Fri Dec 18 17:58:20 2020 +0000 +++ b/src/share/classes/java/io/File.java Thu Feb 18 17:34:20 2021 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2013, 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 @@ -1123,14 +1123,7 @@ * 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(); } /** @@ -1150,8 +1143,15 @@ * 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]);