summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2013-01-20 20:27:58 (EST)
committerPascal Rapicault2013-01-20 20:27:58 (EST)
commit02137aec58e3f298dd6ccbc7dacf369f3a80e4ed (patch)
treedf18f9cb18c73e7161799583237d74401a52655c
parentcc0191d38cd2e4f100040f41bd182dc7e2590edd (diff)
downloadrt.equinox.p2-02137aec58e3f298dd6ccbc7dacf369f3a80e4ed.zip
rt.equinox.p2-02137aec58e3f298dd6ccbc7dacf369f3a80e4ed.tar.gz
rt.equinox.p2-02137aec58e3f298dd6ccbc7dacf369f3a80e4ed.tar.bz2
Null handling in the return value
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ParameterizedProvisioningAction.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Phase.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/plugin.xml16
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/AllTests.java2
4 files changed, 27 insertions, 7 deletions
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ParameterizedProvisioningAction.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ParameterizedProvisioningAction.java
index eed4c31..2ab4395 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ParameterizedProvisioningAction.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ParameterizedProvisioningAction.java
@@ -75,13 +75,14 @@ public class ParameterizedProvisioningAction extends ProvisioningAction {
actualParameters.put(variableName, value);
if (value instanceof Value) {
- if (allowInfixReplacement == false && variableBeginIndex == 0 && variableEndIndex == parameterValue.length() - 1)
- return value;
+ if (allowInfixReplacement == false && variableBeginIndex == 0 && variableEndIndex == parameterValue.length() - 1) {
+ return ((Value<?>) value).getValue();
+ }
Value<?> result = (Value<?>) value;
- if (result.getClazz() == String.class)
+ if (result.getClazz() == String.class) {
value = result.getValue();
- else
+ } else
throw new RuntimeException("The type of the variable is expected to be a String"); //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Phase.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Phase.java
index ccc05ef..a981318 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Phase.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Phase.java
@@ -17,7 +17,8 @@ import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
import org.eclipse.equinox.p2.engine.IProfile;
import org.eclipse.equinox.p2.engine.ProvisioningContext;
-import org.eclipse.equinox.p2.engine.spi.*;
+import org.eclipse.equinox.p2.engine.spi.ProvisioningAction;
+import org.eclipse.equinox.p2.engine.spi.Touchpoint;
import org.eclipse.osgi.util.NLS;
public abstract class Phase {
@@ -170,7 +171,7 @@ public abstract class Phase {
parameters = touchpointToTouchpointOperandParameters.get(touchpoint);
}
- if (lastResult != null && lastResult != Value.NO_VALUE) {
+ if (lastResult != null) {
parameters = new HashMap<String, Object>(parameters);
parameters.put(LAST_RESULT_INTERNAL_NAME, lastResult);
}
@@ -180,7 +181,7 @@ public abstract class Phase {
try {
session.recordActionExecute(action, parameters);
actionStatus = action.execute(parameters);
- lastResult = action.getResult().getValue();
+ lastResult = action.getResult();
} catch (RuntimeException e) {
if (!forced)
throw e;
diff --git a/bundles/org.eclipse.equinox.p2.tests/plugin.xml b/bundles/org.eclipse.equinox.p2.tests/plugin.xml
index cec9954..70f56fb 100644
--- a/bundles/org.eclipse.equinox.p2.tests/plugin.xml
+++ b/bundles/org.eclipse.equinox.p2.tests/plugin.xml
@@ -53,6 +53,22 @@
version="1.0.0">
</action>
</extension>
+ <extension
+ point="org.eclipse.equinox.p2.engine.actions">
+ <action
+ class="org.eclipse.equinox.p2.tests.engine.VariableTest2$Action"
+ name="test.actionForVariableTesting2"
+ version="1.0.0">
+ </action>
+ </extension>
+ <extension
+ point="org.eclipse.equinox.p2.engine.actions">
+ <action
+ class="org.eclipse.equinox.p2.tests.engine.VariableTest3$Action"
+ name="test.actionForVariableTesting3"
+ version="1.0.0">
+ </action>
+ </extension>
<extension
point="org.eclipse.equinox.p2.engine.actions">
<action
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/AllTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/AllTests.java
index c420ed9..1248def 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/AllTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/AllTests.java
@@ -38,6 +38,8 @@ public class AllTests extends TestCase {
suite.addTestSuite(TouchpointTest.class);
suite.addTestSuite(ProvisioningEventTest.class);
suite.addTestSuite(VariableTest.class);
+ suite.addTestSuite(VariableTest2.class);
+ suite.addTestSuite(VariableTest3.class);
return suite;
}