-
Bug
-
Resolution: Fixed
-
P4
-
17
-
b16
SonarCloud complains:
The return value of "trim" must be used.
// 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(); // <--- here
if (!buttonText.isEmpty()) return buttonText;
}
return fallbackText;
}
String getApproveButtonToolTipText(final JFileChooser fc, final String fallbackText) {
final String tooltipText = fc.getApproveButtonToolTipText();
if (tooltipText != null) {
tooltipText.trim(); // <--- here
if (!tooltipText.isEmpty()) return tooltipText;
}
return fallbackText;
}
The return value of "trim" must be used.
// 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(); // <--- here
if (!buttonText.isEmpty()) return buttonText;
}
return fallbackText;
}
String getApproveButtonToolTipText(final JFileChooser fc, final String fallbackText) {
final String tooltipText = fc.getApproveButtonToolTipText();
if (tooltipText != null) {
tooltipText.trim(); // <--- here
if (!tooltipText.isEmpty()) return tooltipText;
}
return fallbackText;
}