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 2016/09/25 20:07:20 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=15521342#comment-15521342 ] 

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

GitHub user MengshiZhang opened a pull request:

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

    fixed IO-447

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/MengshiZhang/commons-io master

Alternatively you can review and apply these changes as the patch at:

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

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #21
    
----
commit 752b0f0290a4d81a503e4e1be3e324c331c1f9d7
Author: mengshi.zhang <me...@utexas.edu>
Date:   2016-09-25T19:39:08Z

    fixed IO-447

----


> 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.4#6332)