[jira] [Commented] (IO-547) Nullpointer Exception in FileSystemUtils.freeSpaceWindows
[ https://issues.apache.org/jira/browse/IO-547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16157413#comment-16157413 ] Michael Ernst commented on IO-547: -- I agree with you that IllegalArgumentException is appropriate. The documentation of freeSpaceWindows says that the `path` parameter should be a (Windows) path, and if it's not then the arguments were illegal. IOException would also be OK according to the Javadoc. > Nullpointer Exception 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 > > 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)
[jira] [Commented] (IO-547) Nullpointer Exception in FileSystemUtils.freeSpaceWindows
[ https://issues.apache.org/jira/browse/IO-547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16144815#comment-16144815 ] Gary Gregory commented on IO-547: - Do you have a proposal? > Nullpointer Exception 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 > > 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)
[jira] [Commented] (IO-547) Nullpointer Exception in FileSystemUtils.freeSpaceWindows
[ https://issues.apache.org/jira/browse/IO-547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16144806#comment-16144806 ] Nikhil Shinde commented on IO-547: -- Invalid path cause NullPointerException, refer entire exception stack below Exception in thread "main" java.lang.NullPointerException at org.apache.commons.io.FileSystemUtils.freeSpaceWindows(FileSystemUtils.java:290) at org.apache.commons.io.FileSystemUtils.freeSpaceOS(FileSystemUtils.java:265) at org.apache.commons.io.FileSystemUtils.freeSpace(FileSystemUtils.java:143) at com.example.playground.Foo.main(Foo.java:13) > Nullpointer Exception 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 > > 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)
[jira] [Commented] (IO-547) Nullpointer Exception in FileSystemUtils.freeSpaceWindows
[ https://issues.apache.org/jira/browse/IO-547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16125020#comment-16125020 ] Gary Gregory commented on IO-547: - What would you have happen on illegal input? An IllegalArgumentException? > Nullpointer Exception 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 > > 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)