Uploaded image for project: 'Commons VFS'
  1. Commons VFS
  2. VFS-327

UriParser.canonicalizePath possible NPE for filenameParser

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.1
    • Labels:
      None

      Description

      The UriParser.canonicalizePath method has a possible NPE for filenameParser:

      [495]   boolean match = value == '%'
      [496]          || (fileNameParser != null && fileNameParser.encodeCharacter(value));
      ...
      [511]    else if (fileNameParser.encodeCharacter(ch))
      

      Line 496 allows for fileNameParser being null, but line 511 does not.

      As far as I can tell, the method is never called with a null parser, so it should be safe to omit the null check in line 496.
      If the code can ever be called with a null parser, then the code at line 511 needs to be fixed.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              sebb Sebb
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: