diff --git a/src/java.base/share/classes/sun/security/util/Cache.java b/src/java.base/share/classes/sun/security/util/Cache.java index 9a2e2fc29b0..5e1eef17ee4 100644 --- a/src/java.base/share/classes/sun/security/util/Cache.java +++ b/src/java.base/share/classes/sun/security/util/Cache.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2020, 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 @@ -265,8 +265,7 @@ public MemoryCache(boolean soft, int maxSize, int lifetime) { else this.queue = null; - int buckets = (int)(maxSize / LOAD_FACTOR) + 1; - cacheMap = new LinkedHashMap<>(buckets, LOAD_FACTOR, true); + cacheMap = new LinkedHashMap<>(1, LOAD_FACTOR, true); } /** diff --git a/src/java.base/unix/classes/sun/nio/fs/UnixFileSystemProvider.java b/src/java.base/unix/classes/sun/nio/fs/UnixFileSystemProvider.java index 0a927d01d71..5443f8cac63 100644 --- a/src/java.base/unix/classes/sun/nio/fs/UnixFileSystemProvider.java +++ b/src/java.base/unix/classes/sun/nio/fs/UnixFileSystemProvider.java @@ -352,7 +352,14 @@ public boolean isHidden(Path obj) { UnixPath name = file.getFileName(); if (name == null) return false; - return (name.asByteArray()[0] == '.'); + + byte[] path; + if (name.isEmpty()) { // corner case for empty paths + path = name.getFileSystem().defaultDirectory(); + } else { + path = name.asByteArray(); + } + return path[0] == '.'; } /** diff --git a/src/java.base/unix/classes/sun/nio/fs/UnixPath.java b/src/java.base/unix/classes/sun/nio/fs/UnixPath.java index 804b5632846..92d71c53591 100644 --- a/src/java.base/unix/classes/sun/nio/fs/UnixPath.java +++ b/src/java.base/unix/classes/sun/nio/fs/UnixPath.java @@ -243,7 +243,7 @@ private void initOffsets() { } // returns {@code true} if this path is an empty path - private boolean isEmpty() { + boolean isEmpty() { return path.length == 0; } diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 1834ba0925e..f4248995899 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -745,7 +745,6 @@ javax/swing/JTable/4235420/bug4235420.java 8079127 generic-all javax/swing/JSplitPane/4201995/bug4201995.java 8079127 generic-all javax/swing/JTree/DnD/LastNodeLowerHalfDrop.java 8159131 linux-all javax/swing/JTree/4633594/JTreeFocusTest.java 8173125 macosx-all -javax/swing/JFileChooser/8041694/bug8041694.java 8196302 windows-all,macosx-all javax/swing/AbstractButton/6711682/bug6711682.java 8060765 windows-all,macosx-all javax/swing/Action/8133039/bug8133039.java 8196089 windows-all,macosx-all javax/swing/JComboBox/6559152/bug6559152.java 8196090 windows-all,macosx-all @@ -782,7 +781,6 @@ javax/swing/JEditorPane/6917744/bug6917744.java 8213124 macosx-all javax/swing/JTree/6263446/bug6263446.java 8213125 macosx-all javax/swing/text/View/8014863/bug8014863.java 8233561 macosx-all javax/swing/text/StyledEditorKit/4506788/bug4506788.java 8233562 macosx-all -javax/swing/text/JTextComponent/6361367/bug6361367.java 8233569 macosx-all javax/swing/JRootPane/4670486/bug4670486.java 8042381 macosx-all javax/swing/JRadioButton/ButtonGroupFocus/ButtonGroupFocusTest.java 8233555 macosx-all javax/swing/JRadioButton/8075609/bug8075609.java 8233555 macosx-all diff --git a/test/jdk/java/nio/file/Files/Misc.java b/test/jdk/java/nio/file/Files/Misc.java index 553f8910a1d..0bfc0c410dc 100644 --- a/test/jdk/java/nio/file/Files/Misc.java +++ b/test/jdk/java/nio/file/Files/Misc.java @@ -22,7 +22,7 @@ */ /* @test - * @bug 4313887 6838333 8005566 8032220 8215467 + * @bug 4313887 6838333 8005566 8032220 8215467 8255576 * @summary Unit test for miscellenous methods in java.nio.file.Files * @library .. */ @@ -87,6 +87,9 @@ static void testCreateDirectories(Path tmpdir) throws IOException { * Tests isHidden */ static void testIsHidden(Path tmpdir) throws IOException { + // passing an empty path must not throw any runtime exception + assertTrue(!isHidden(Path.of(""))); + assertTrue(!isHidden(tmpdir)); Path file = tmpdir.resolve(".foo"); diff --git a/test/jdk/javax/swing/JFileChooser/8041694/bug8041694.java b/test/jdk/javax/swing/JFileChooser/8041694/bug8041694.java index 311f19a44a1..3e3cb3b9658 100644 --- a/test/jdk/javax/swing/JFileChooser/8041694/bug8041694.java +++ b/test/jdk/javax/swing/JFileChooser/8041694/bug8041694.java @@ -57,6 +57,7 @@ private static void runTest() { // Set Metal L&F to make the test compatible with OS X. UIManager.setLookAndFeel(new MetalLookAndFeel()); Robot robot = new Robot(); + robot.setAutoDelay(100); dir1 = Files.createTempDirectory("bug8041694").toFile(); if (Platform.isWindows()) { @@ -83,15 +84,17 @@ public void run() { } }); - robot.setAutoDelay(50); robot.delay(1000); robot.waitForIdle(); robot.keyPress(KeyEvent.VK_D); robot.keyRelease(KeyEvent.VK_D); + robot.waitForIdle(); robot.keyPress(KeyEvent.VK_SPACE); robot.keyRelease(KeyEvent.VK_SPACE); + robot.waitForIdle(); robot.keyPress(KeyEvent.VK_ENTER); robot.keyRelease(KeyEvent.VK_ENTER); + robot.waitForIdle(); fChooserClosedSignal.await(); if (selectedDir == null) { diff --git a/test/jdk/javax/swing/text/JTextComponent/6361367/bug6361367.java b/test/jdk/javax/swing/text/JTextComponent/6361367/bug6361367.java index 153e6c7d655..0c00e561bcd 100644 --- a/test/jdk/javax/swing/text/JTextComponent/6361367/bug6361367.java +++ b/test/jdk/javax/swing/text/JTextComponent/6361367/bug6361367.java @@ -79,7 +79,7 @@ public JTextComponent call() throws Exception { waitForFocus(textComponent); Robot robot = new Robot(); robot.setAutoWaitForIdle(true); - robot.setAutoDelay(250); + robot.setAutoDelay(100); robot.keyPress(KeyEvent.VK_END); robot.keyRelease(KeyEvent.VK_END); robot.keyPress(KeyEvent.VK_SHIFT);