我有一个简单的方法来检查路径是否是包含某些文件的目录。尽管该文件夹中有许多文件,但检查失败。public boolean check() throws FileNotFoundException { LOG.info("getPath, prefix set to : {}", prefix); File templatesFolder = new File(prefix); if (!templatesFolder.isDirectory() || templatesFolder.list() == null || templatesFolder.list().length == 0) { LOG.error("Templates cannot be found in absolute path {}", templatesFolder.getAbsolutePath()); LOG.error("templatesFolder.isDirectory() {}", templatesFolder.isDirectory()); return false; } return true; }这是输出:prefix set to : file:///tmp/templates/Templates cannot be found in absolute path /home/oozen/workspace/pdfGenerator/file:/tmp/templatesisDirectory false 我应该如何设置路径以便检查不会失败?
添加回答
举报
0/150
提交
取消