aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Alexander Zvegintsev <azvegint@openjdk.org> 2021-03-25 13:49:57 +0000
committerGravatar Alexander Zvegintsev <azvegint@openjdk.org> 2021-03-25 13:49:57 +0000
commitc037e1edaf7f628b3e6a0b57a1029e0cdd134dc8 (patch)
treebf830e6b0cd3689aff463817a28d65302a8c3d25
parenta1e717f13ec040e4e1490f70ba465b405471e4ff (diff)
downloadjdk-c037e1edaf7f628b3e6a0b57a1029e0cdd134dc8.tar.gz
jdk-c037e1edaf7f628b3e6a0b57a1029e0cdd134dc8.zip
8263454: com.apple.laf.AquaFileChooserUI ignores the result of String.trim()
Reviewed-by: serb, pbansal, kizune, trebari, psadhukhan
-rw-r--r--src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java b/src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java
index b95ba9bfbf9..67929fcf0db 100644
--- a/src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java
+++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -2037,11 +2037,9 @@ public class AquaFileChooserUI extends FileChooserUI {
// Try to get the custom text. If none, use the fallback
String getApproveButtonText(final JFileChooser fc, final String fallbackText) {
final String buttonText = fc.getApproveButtonText();
- if (buttonText != null) {
- buttonText.trim();
- if (!buttonText.isEmpty()) return buttonText;
- }
- return fallbackText;
+ return buttonText != null
+ ? buttonText
+ : fallbackText;
}
int getApproveButtonMnemonic(final JFileChooser fc) {
@@ -2056,11 +2054,9 @@ public class AquaFileChooserUI extends FileChooserUI {
String getApproveButtonToolTipText(final JFileChooser fc, final String fallbackText) {
final String tooltipText = fc.getApproveButtonToolTipText();
- if (tooltipText != null) {
- tooltipText.trim();
- if (!tooltipText.isEmpty()) return tooltipText;
- }
- return fallbackText;
+ return tooltipText != null
+ ? tooltipText
+ : fallbackText;
}
String getCancelButtonToolTipText(final JFileChooser fc) {