summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault (Ericsson)2013-03-13 21:21:39 (EDT)
committerPascal Rapicault2013-03-13 22:17:25 (EDT)
commit48bbc74bc2134718d082411c37f741a965d49a29 (patch)
tree698e25a71bedc3e39daacb7ac7d66dc24d679a53
parent43d03cdba58ef6cb0c94b0e5a23ddf101778c7cd (diff)
downloadrt.equinox.p2-48bbc74bc2134718d082411c37f741a965d49a29.zip
rt.equinox.p2-48bbc74bc2134718d082411c37f741a965d49a29.tar.gz
rt.equinox.p2-48bbc74bc2134718d082411c37f741a965d49a29.tar.bz2
Fix NPE when nothing is found
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java
index 68dbf8f..09ae0f1 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java
@@ -10,18 +10,17 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.sdk.scheduler;
-import org.eclipse.equinox.internal.p2.touchpoint.eclipse.AgentFromInstall;
-
import java.io.*;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.equinox.internal.p2.touchpoint.eclipse.AgentFromInstall;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
public class PreviousConfigurationFinder {
- private static final Pattern path = Pattern.compile("(.+?)_{1}?([0-9\\.]+)_{1}?(\\d+)_*?([^_].*)"); //$NON-NLS-1$
+ private static final Pattern path = Pattern.compile("(.+?)_{1}?([0-9\\.]+)_{1}?(\\d+)(_*?([^_].*)|$)"); //$NON-NLS-1$
public static class Identifier {
private static final String DELIM = ". _-"; //$NON-NLS-1$
@@ -139,7 +138,7 @@ public class PreviousConfigurationFinder {
Matcher m = path.matcher(candidate.getName());
if (!m.matches())
return null;
- return new ConfigurationDescriptor(m.group(1), new Identifier(m.group(2)), m.group(3), m.group(4), candidate.getAbsoluteFile());
+ return new ConfigurationDescriptor(m.group(1), new Identifier(m.group(2)), m.group(3), m.group(5), candidate.getAbsoluteFile());
}
public IProvisioningAgent findPreviousInstalls(File searchRoot, File installFolder) {
@@ -180,6 +179,8 @@ public class PreviousConfigurationFinder {
criteriaMet++;
}
+ if (criteriaMet == 0)
+ continue;
if (criteriaMet > numberOfcriteriaMet) {
bestMatch = candidate;
numberOfcriteriaMet = criteriaMet;
@@ -210,6 +211,8 @@ public class PreviousConfigurationFinder {
//We have a match
criteriaMet++;
}
+ if (criteriaMet == 0)
+ continue;
if (criteriaMet > numberOfcriteriaMet) {
bestMatch = candidate;
numberOfcriteriaMet = criteriaMet;