commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nikhil Shinde (JIRA)" <>
Subject [jira] [Created] (IO-547) Nullpointer Exception in FileSystemUtils.freeSpaceWindows
Date Sun, 13 Aug 2017 15:19:00 GMT
Nikhil Shinde created IO-547:

             Summary: Nullpointer Exception in FileSystemUtils.freeSpaceWindows 
                 Key: IO-547
             Project: Commons IO
          Issue Type: Bug
    Affects Versions: 2.5
         Environment: Windows OS
            Reporter: Nikhil Shinde
            Priority: Minor

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.

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 = obj.freeSpace(path);
		} catch (IOException e) {

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

View raw message