From 551f6edf58b574ab5e12207b7c44433514415354 Mon Sep 17 00:00:00 2001 From: slaws Date: Fri, 9 Apr 2010 11:56:14 +0000 Subject: 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 --- .../tuscany/sca/databinding/jaxb/JAXBContextHelper.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'sca-java-2.x/trunk/modules/databinding-jaxb/src') 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; } -- cgit v1.2.3