diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-04-09 11:56:14 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2010-04-09 11:56:14 +0000 |
commit | 551f6edf58b574ab5e12207b7c44433514415354 (patch) | |
tree | 07fd2c0be445648ea0d57bfec4aecf2bc6586fd5 /sca-java-2.x/trunk/modules/databinding-jaxb/src/main/java | |
parent | 7965f1a7601a080e06b845f7411a9753c0b2c2a0 (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
Diffstat (limited to 'sca-java-2.x/trunk/modules/databinding-jaxb/src/main/java')
-rw-r--r-- | sca-java-2.x/trunk/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java | 12 |
1 files changed, 11 insertions, 1 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; } |