From 99f99b4ab86f3c8852ab19ce70f4e726e8fdb8be Mon Sep 17 00:00:00 2001 From: Dennis Huebner Date: Tue, 5 May 2015 11:02:04 +0200 Subject: [PATCH] [fb] findbugs 3.0.1. Added filter for InMemoryJavaCompiler. Fixed some fb markers Signed-off-by: Dennis Huebner --- plugins/org.eclipse.xtext.util/.classpath | 2 +- .../src/org/eclipse/xtext/util/Files.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/org.eclipse.xtext.util/.classpath b/plugins/org.eclipse.xtext.util/.classpath index ad32c83a7..c72d35a04 100644 --- a/plugins/org.eclipse.xtext.util/.classpath +++ b/plugins/org.eclipse.xtext.util/.classpath @@ -3,5 +3,5 @@ - + diff --git a/plugins/org.eclipse.xtext.util/src/org/eclipse/xtext/util/Files.java b/plugins/org.eclipse.xtext.util/src/org/eclipse/xtext/util/Files.java index 8ffe0998c..6b9e3b78d 100644 --- a/plugins/org.eclipse.xtext.util/src/org/eclipse/xtext/util/Files.java +++ b/plugins/org.eclipse.xtext.util/src/org/eclipse/xtext/util/Files.java @@ -68,7 +68,7 @@ public class Files { } } - public static boolean cleanFolder(File parentFolder, final FileFilter filter, boolean continueOnError, + public static boolean cleanFolder(final File parentFolder, final FileFilter filter, boolean continueOnError, boolean deleteParentFolder) throws FileNotFoundException { if (!parentFolder.exists()) { throw new FileNotFoundException(parentFolder.getAbsolutePath()); @@ -83,6 +83,9 @@ public class Files { }; log.debug("Cleaning folder " + parentFolder.toString()); final File[] contents = parentFolder.listFiles(myFilter); + if (contents == null) { + return true; + } for (int j = 0; j < contents.length; j++) { final File file = contents[j]; if (file.isDirectory()) { @@ -97,7 +100,7 @@ public class Files { } } if (deleteParentFolder) { - if (parentFolder.list().length==0 && !parentFolder.delete()) { + if (parentFolder.list() != null && parentFolder.list().length == 0 && !parentFolder.delete()) { log.error("Couldn't delete " + parentFolder.getAbsolutePath()); return false; }