summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarsten Thoms2011-03-27 03:56:25 (EDT)
committer Karsten Thoms2011-03-27 03:56:25 (EDT)
commit71da4a5bd1ce0c911093189dd711b7061f444fbd (patch)
tree059e5ea54db1731eab61552d9183d445e78783bf
parent401154532889e8e86daa87a2ee2cf5ca27ee44d1 (diff)
downloadorg.eclipse.mwe-71da4a5bd1ce0c911093189dd711b7061f444fbd.zip
org.eclipse.mwe-71da4a5bd1ce0c911093189dd711b7061f444fbd.tar.gz
org.eclipse.mwe-71da4a5bd1ce0c911093189dd711b7061f444fbd.tar.bz2
fix for bug#341054: Avoiding NPE for calling the result of File#listFiles(), which can be null
-rw-r--r--plugins/org.eclipse.emf.mwe.utils/src/org/eclipse/emf/mwe/utils/DirectoryCleaner.java2
-rw-r--r--plugins/org.eclipse.emf.mwe.utils/src/org/eclipse/emf/mwe/utils/StandaloneSetup.java16
2 files changed, 10 insertions, 8 deletions
diff --git a/plugins/org.eclipse.emf.mwe.utils/src/org/eclipse/emf/mwe/utils/DirectoryCleaner.java b/plugins/org.eclipse.emf.mwe.utils/src/org/eclipse/emf/mwe/utils/DirectoryCleaner.java
index e4a8fa4..85012b3 100644
--- a/plugins/org.eclipse.emf.mwe.utils/src/org/eclipse/emf/mwe/utils/DirectoryCleaner.java
+++ b/plugins/org.eclipse.emf.mwe.utils/src/org/eclipse/emf/mwe/utils/DirectoryCleaner.java
@@ -125,7 +125,7 @@ public class DirectoryCleaner extends AbstractWorkflowComponent2 {
}
LOG.debug("Cleaning folder " + parentFolder.toString());
final File[] contents = parentFolder.listFiles(myFilter);
- for (int j = 0; j < contents.length; j++) {
+ for (int j = 0; contents!=null && j < contents.length; j++) {
final File file = contents[j];
if (file.isDirectory()) {
if (!cleanFolder(file, myFilter, continueOnError, false) && !continueOnError)
diff --git a/plugins/org.eclipse.emf.mwe.utils/src/org/eclipse/emf/mwe/utils/StandaloneSetup.java b/plugins/org.eclipse.emf.mwe.utils/src/org/eclipse/emf/mwe/utils/StandaloneSetup.java
index 18ea2fe..f94a2d3 100644
--- a/plugins/org.eclipse.emf.mwe.utils/src/org/eclipse/emf/mwe/utils/StandaloneSetup.java
+++ b/plugins/org.eclipse.emf.mwe.utils/src/org/eclipse/emf/mwe/utils/StandaloneSetup.java
@@ -146,13 +146,15 @@ public class StandaloneSetup {
File[] files = f.listFiles();
boolean containsProject = false;
File dotProject = null;
- for (File file : files) {
- if (file.exists() && file.isDirectory() && !file.getName().startsWith(".")) {
- containsProject |= scanFolder(file, visitedPathes);
- } else if (".project".equals(file.getName())) {
- dotProject = file;
- } else if (file.getName().endsWith(".jar")) {
- registerBundle(file);
+ if (files != null) {
+ for (File file : files) {
+ if (file.exists() && file.isDirectory() && !file.getName().startsWith(".")) {
+ containsProject |= scanFolder(file, visitedPathes);
+ } else if (".project".equals(file.getName())) {
+ dotProject = file;
+ } else if (file.getName().endsWith(".jar")) {
+ registerBundle(file);
+ }
}
}
if(!containsProject && dotProject != null)