Author: slaws
Date: Fri Apr  9 11:56:14 2010
New Revision: 932370

URL: http://svn.apache.org/viewvc?rev=932370&view=rev
Log:
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. 

Modified:
    
tuscany/sca-java-2.x/trunk/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java
    
tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java
    
tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java

Modified: 
tuscany/sca-java-2.x/trunk/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java?rev=932370&r1=932369&r2=932370&view=diff
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java
 (original)
+++ 
tuscany/sca-java-2.x/trunk/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java
 Fri Apr  9 11:56:14 2010
@@ -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;
             }

Modified: 
tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java?rev=932370&r1=932369&r2=932370&view=diff
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java
 (original)
+++ 
tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java
 Fri Apr  9 11:56:14 2010
@@ -83,7 +83,7 @@ public class ReflectiveInstanceFactory<T
                         if (destroyInvoker != null) {
                             destroyInvoker.invokeEvent(instance);
                         }
-                        throw new ObjectCreationException("Exception invoking 
injector", e);
+                        throw new ObjectCreationException("Exception invoking 
injector - " + e.getMessage(), e);
                     }
             }
         }

Modified: 
tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java?rev=932370&r1=932369&r2=932370&view=diff
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java
 (original)
+++ 
tuscany/sca-java-2.x/trunk/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java
 Fri Apr  9 11:56:14 2010
@@ -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 i
                 }
             }            
                 
+        } catch (ObjectCreationException e) {
+            throw new ServiceRuntimeException(e.getMessage(), e);
         } catch (Exception e) {
             msg.setFaultBody(e);           
         } finally {


Reply via email to