Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8263454

com.apple.laf.AquaFileChooserUI ignores the result of String.trim()

XMLWordPrintable

    • 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;
              }

            azvegint Alexander Zvegintsev
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: