< prev index next >
test/jdk/javax/swing/JFileChooser/8041694/bug8041694.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, 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.
@@ -97,15 +97,17 @@
if (selectedDir == null) {
throw new RuntimeException("No directory was selected in JFileChooser.");
}
System.out.println(String.format(
"The selected directory is '%s'.", selectedDir.getAbsolutePath()));
- if (selectedDir.getName().equals("d")) {
+ if (selectedDir.getName().equals("d") ||
+ selectedDir.getName().equals("D")) {
throw new RuntimeException(
"JFileChooser removed trailing spaces in the selected directory name.");
- } else if (!selectedDir.getName().equals("d ")) {
- throw new RuntimeException("The selected directory name is not the expected 'd '.");
+ } else if (!(selectedDir.getName().equals("d ") ||
+ selectedDir.getName().equals("D "))) {
+ throw new RuntimeException("The selected directory name is not the expected 'd ' or 'D '.");
}
} catch (UnsupportedLookAndFeelException | AWTException | IOException | InterruptedException e) {
throw new RuntimeException(e);
} finally {
if (dir2 != null) {
< prev index next >