Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMykola Nikishov2018-12-20 18:27:34 +0000
committerAlexander Kurtakov2018-12-21 13:31:59 +0000
commit3f4541ab3218cb89725fcb2a9cb32e6784fb814c (patch)
tree553b596eb5926e6b5145a5fac42ccbe8b1b25de8
parent690ce3ff002f277a7d29ff58f82ca463fca15277 (diff)
downloadrt.equinox.p2-3f4541ab3218cb89725fcb2a9cb32e6784fb814c.tar.gz
rt.equinox.p2-3f4541ab3218cb89725fcb2a9cb32e6784fb814c.tar.xz
rt.equinox.p2-3f4541ab3218cb89725fcb2a9cb32e6784fb814c.zip
Bug 542960 - NPE in InitialSharedInstall's cleanupDotEclipseFolder() when '~/.eclipse/' doesn't existI20181222-1800I20181221-1800
InitialSharedInstall's cleanupDotEclipseFolder() ensures that '${user.home}/.eclipse/' doesn't have directories/files which names start with 'p2.automated.test'. But it will throw NPE when the folder doesn't exist in the first place: setupRun(org.eclipse.equinox.p2.tests.sharedinstall.InitialSharedInstall) Time elapsed: 0.002 s <<< ERROR! java.lang.NullPointerException at org.eclipse.equinox.p2.tests.sharedinstall.InitialSharedInstall.cleanupDotEclipseFolder(InitialSharedInstall.java:72) at org.eclipse.equinox.p2.tests.sharedinstall.InitialSharedInstall.setupRun(InitialSharedInstall.java:49) In this case, make InitialSharedInstall's cleanupDotEclipseFolder() a noop. Change-Id: I4165609c644a6dde69c1d8ffe88138bf7ce16705 Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/InitialSharedInstall.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/InitialSharedInstall.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/InitialSharedInstall.java
index d8b3be153..eb144c92b 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/InitialSharedInstall.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/InitialSharedInstall.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013, 2017 Ericsson AB and others.
+ * Copyright (c) 2013, 2018 Ericsson AB and others.
*
* This
* program and the accompanying materials are made available under the terms of
@@ -64,13 +64,17 @@ public class InitialSharedInstall extends AbstractSharedInstallTest {
private void cleanupDotEclipseFolder() {
File userHome = new File(System.getProperty("user.home"));
File dotEclipse = new File(userHome, ".eclipse");
+ if (!dotEclipse.exists())
+ // nothing to clean up
+ return;
+
File[] toDelete = dotEclipse.listFiles((FilenameFilter) (dir, name) -> {
if (name.startsWith("p2.automated.test"))
return true;
return false;
});
- for (int i = 0; i < toDelete.length; i++) {
- delete(toDelete[i]);
+ for (File file : toDelete) {
+ delete(file);
}
}
}

Back to the top