You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/04/23 15:13:04 UTC

[jira] [Commented] (IO-447) Possible NPE in FileSystemUtils.freeSpaceWindows; FilenameUtils.normalize can return null

    [ https://issues.apache.org/jira/browse/IO-447?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15980427#comment-15980427 ] 

ASF GitHub Bot commented on IO-447:
-----------------------------------

Github user asfgit closed the pull request at:

    https://github.com/apache/commons-io/pull/21


> Possible NPE in FileSystemUtils.freeSpaceWindows; FilenameUtils.normalize can return null
> -----------------------------------------------------------------------------------------
>
>                 Key: IO-447
>                 URL: https://issues.apache.org/jira/browse/IO-447
>             Project: Commons IO
>          Issue Type: Bug
>            Reporter: Sebb
>
> There is a possible NPE in FileSystemUtils.freeSpaceWindows.
> FilenameUtils.normalize can return null so the path.length() will NPE
> For example, ".." returns null.
> I'm not entirely sure why the path needs to be normalised, apart from converting / to \. Even that seems a bit dubious - why should the user want to return the freespace for a Unix-style path on a Windows system?
> And if it does need to be normalised, why not use the File class, which handles / to \ conversion transparently?
> A short term fix would be to return IAE for paths that normalise to null.
> However that would not allow the use of paths such as ".." - though at least that would not cause NPE.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)