You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2017/09/07 19:34:00 UTC

[jira] [Resolved] (IO-547) Throw a IllegalArgumentException instead of NullPointerException in FileSystemUtils.freeSpaceWindows()

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

Gary Gregory resolved IO-547.
-----------------------------
       Resolution: Fixed
    Fix Version/s: 2.6

> Throw a IllegalArgumentException  instead of NullPointerException in FileSystemUtils.freeSpaceWindows()
> -------------------------------------------------------------------------------------------------------
>
>                 Key: IO-547
>                 URL: https://issues.apache.org/jira/browse/IO-547
>             Project: Commons IO
>          Issue Type: Bug
>    Affects Versions: 2.5
>         Environment: Windows OS
>            Reporter: Nikhil Shinde
>            Priority: Minor
>              Labels: beginner
>             Fix For: 2.6
>
>
> In FileSystemutils.freeSpaceWindows(String path,long timeout) , path cannot be null. In this function for following assignment
>           path = FilenameUtils.normalize(path,bool), path is assigned null value when 
>           (1) path argument is null.
>           (2) path argument is illegal/invalid path as per windows system.
> {code:java}
> public class FileSystemutilTest {
> 	public static void main(String args[]){
> 		FileSystemUtils fsuobj = new FileSystemUtils();
>                 String path = ":\\Users\\nikhil\\Desktop\\tests";  /* Invalid path, causes Nullpointer Exception*/
> 		try {
> 			long space = fsuobj.freeSpace(path);
> 		} catch (IOException e) {
> 			e.printStackTrace();
> 		}
> 	}
> }
> {code}
> For above test case, as path is illegal for windows system, Nullpointer exception occurs. A check for validity of path as per windows file system, will resolve this bug.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)