summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-04-09 11:56:14 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2010-04-09 11:56:14 +0000
commit551f6edf58b574ab5e12207b7c44433514415354 (patch)
tree07fd2c0be445648ea0d57bfec4aecf2bc6586fd5
parent7965f1a7601a080e06b845f7411a9753c0b2c2a0 (diff)
TUSCANY-3530 - not a solution for property type validation but display more info at runtime when a simple type conversion fails. We need to validate the property types at read or build time.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@932370 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--sca-java-2.x/trunk/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java12
-rw-r--r--sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java2
-rw-r--r--sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java3
3 files changed, 15 insertions, 2 deletions
diff --git a/sca-java-2.x/trunk/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java b/sca-java-2.x/trunk/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java
index 81f4475f4b..50fc346270 100644
--- a/sca-java-2.x/trunk/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java
+++ b/sca-java-2.x/trunk/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java
@@ -182,7 +182,17 @@ public final class JAXBContextHelper {
return createJAXBElement(context, dataType, value);
} else {
if (value instanceof JAXBElement) {
- return ((JAXBElement)value).getValue();
+ Object returnValue = ((JAXBElement)value).getValue();
+
+ if (returnValue == null){
+ // TUSCANY-3530
+ // something went wrong in the transformation that
+ // generated the JAXBElement. Have seen this when trying
+ // to convert a value to a simple type with an incompatible
+ // value.
+ throw new TransformationException("Null returned when trying to convert value to: " + cls.getName());
+ }
+ return returnValue;
} else {
return value;
}
diff --git a/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java b/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java
index 8189271ed5..209546ce2f 100644
--- a/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java
+++ b/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java
@@ -83,7 +83,7 @@ public class ReflectiveInstanceFactory<T> implements InstanceFactory<T> {
if (destroyInvoker != null) {
destroyInvoker.invokeEvent(instance);
}
- throw new ObjectCreationException("Exception invoking injector", e);
+ throw new ObjectCreationException("Exception invoking injector - " + e.getMessage(), e);
}
}
}
diff --git a/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java b/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java
index 26e1e56845..4d54fbd46c 100644
--- a/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java
+++ b/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java
@@ -23,6 +23,7 @@ import java.lang.reflect.Method;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.core.factory.InstanceWrapper;
+import org.apache.tuscany.sca.core.factory.ObjectCreationException;
import org.apache.tuscany.sca.core.scope.ScopeContainer;
import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
import org.apache.tuscany.sca.implementation.java.JavaImplementation;
@@ -137,6 +138,8 @@ public class JavaImplementationInvoker implements Invoker {
}
}
+ } catch (ObjectCreationException e) {
+ throw new ServiceRuntimeException(e.getMessage(), e);
} catch (Exception e) {
msg.setFaultBody(e);
} finally {