Use String.isBlank to simplify code in sun.net.www.protocol.mailto.Handler

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P5
    • 19
    • Affects Version/s: None
    • Component/s: core-libs
    • None
    • b08

      Code in sun.net.www.protocol.mailto.Handler#parseURL can be simplified.
      Manual cycle could be replaced with String.isBlank

              boolean nogood = false;
              if (file == null || file.isEmpty())
                  nogood = true;
              else {
                  boolean allwhites = true;
                  for (int i = 0; i < file.length(); i++)
                      if (!Character.isWhitespace(file.charAt(i)))
                          allwhites = false;
                  if (allwhites)
                      nogood = true;
              }
              if (nogood)
                  throw new RuntimeException("No email address");

            Assignee:
            Andrey Turbanov
            Reporter:
            Andrey Turbanov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: