[jira] Created: (VFS-327) UriParser.canonicalizePath possible NPE for filenameParser

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (VFS-327) UriParser.canonicalizePath possible NPE for filenameParser

Gary D. Gregory (Jira)
UriParser.canonicalizePath possible NPE for filenameParser
----------------------------------------------------------

                 Key: VFS-327
                 URL: https://issues.apache.org/jira/browse/VFS-327
             Project: Commons VFS
          Issue Type: Bug
            Reporter: Sebb


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

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

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.


--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] [Resolved] (VFS-327) UriParser.canonicalizePath possible NPE for filenameParser

Gary D. Gregory (Jira)

     [ https://issues.apache.org/jira/browse/VFS-327?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory resolved VFS-327.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1

Committed revision 1339277.
               

> UriParser.canonicalizePath possible NPE for filenameParser
> ----------------------------------------------------------
>
>                 Key: VFS-327
>                 URL: https://issues.apache.org/jira/browse/VFS-327
>             Project: Commons VFS
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 2.1
>
>
> The UriParser.canonicalizePath method has a possible NPE for filenameParser:
> {code}
> [495]   boolean match = value == '%'
> [496]          || (fileNameParser != null && fileNameParser.encodeCharacter(value));
> ...
> [511]    else if (fileNameParser.encodeCharacter(ch))
> {code}
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira