FileSystemView方法抛出异常

时间:2017-07-03 16:14:04

标签: java grails

        CHECKDISK = "Local Disk"
        File[] paths
        FileSystemView fsv = FileSystemView.getFileSystemView() 
        paths = File.listRoots()
        List<String> drives = new ArrayList<String>()
        for(File path:paths)
        {  
            String drivePath = path.toString().replace('\\', '/'); 
            log.info("get system description : "+fsv.getSystemTypeDescription(path)) 
            if(fsv.getSystemTypeDescription(path).equals(CHECKDISK)){ 
                drives.add(drivePath)
            }
        }

当我在本地系统中执行此代码时,正在获取正确的驱动器列表。但是在战争部署之后,它在log.info()行中抛出了NullPointerException。 请指导我解决这个问题。谢谢。

0 个答案:

没有答案