< prev index next >

src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 2014, 2025, 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
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.  Oracle designates this

@@ -52,21 +52,19 @@
  import java.nio.file.WatchService;
  import java.nio.file.attribute.FileAttribute;
  import java.nio.file.attribute.FileTime;
  import java.nio.file.attribute.UserPrincipalLookupService;
  import java.nio.file.spi.FileSystemProvider;
- import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.Collections;
  import java.util.HashSet;
  import java.util.Iterator;
  import java.util.Map;
  import java.util.Objects;
  import java.util.Set;
  import java.util.regex.Pattern;
  import jdk.internal.jimage.ImageReader.Node;
- import static java.util.stream.Collectors.toList;
  
  /**
   * jrt file system implementation built on System jimage files.
   *
   * @implNote This class needs to maintain JDK 8 source compatibility.

@@ -223,23 +221,23 @@
          Node node = checkNode(path).resolveLink(true);
          if (!node.isDirectory()) {
              throw new NotDirectoryException(path.getName());
          }
          if (filter == null) {
-             return node.getChildren()
-                        .stream()
-                        .map(child -> (Path)(path.resolve(new JrtPath(this, child.getNameString()).getFileName())))
-                        .iterator();
+             return node.getChildNames()
+                     .map(child -> (Path) (path.resolve(new JrtPath(this, child).getFileName())))
+                     .iterator();
          }
-         return node.getChildren()
-                    .stream()
-                    .map(child -> (Path)(path.resolve(new JrtPath(this, child.getNameString()).getFileName())))
-                    .filter(p ->  { try { return filter.accept(p);
-                                    } catch (IOException x) {}
-                                    return false;
-                                   })
-                    .iterator();
+         return node.getChildNames()
+                 .map(child -> (Path) (path.resolve(new JrtPath(this, child).getFileName())))
+                 .filter(p -> {
+                     try {
+                         return filter.accept(p);
+                     } catch (IOException x) {}
+                     return false;
+                 })
+                 .iterator();
      }
  
      // returns the content of the file resource specified by the path
      byte[] getFileContent(JrtPath path) throws IOException {
          Node node = checkNode(path);
< prev index next >