Details
-
Type:
Bug
-
Status: Resolved
-
Priority:
P4
-
Resolution: Fixed
-
Affects Version/s: 17
-
Fix Version/s: 17
-
Component/s: client-libs
-
Labels:
-
Subcomponent:
-
Resolved In Build:b16
Description
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;
}