Author: rfeng
Date: Mon Apr 27 15:56:52 2009
New Revision: 769035

URL: http://svn.apache.org/viewvc?rev=769035&view=rev
Log:
Fix the ArrayOutofBoundException that causes the hang of itest/helloworld-bpel

Modified:
    
tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java
    
tuscany/branches/sca-java-1.x/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java

Modified: 
tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java?rev=769035&r1=769034&r2=769035&view=diff
==============================================================================
--- 
tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java
 (original)
+++ 
tuscany/branches/sca-java-1.x/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java
 Mon Apr 27 15:56:52 2009
@@ -124,7 +124,7 @@
             Method imethod = method;
             if (imethod == null || 
!imethod.getDeclaringClass().isInstance(instance)) {
                 try {
-                    imethod = 
JavaInterfaceUtil.findMethod(instance.getClass(), operation);
+                    imethod = 
JavaInterfaceUtil.findMethod(instance.getClass(), op);
                 } catch (NoSuchMethodException e) {
                     throw new IllegalArgumentException("Callback object does 
not provide method " + e.getMessage());
                 }
@@ -134,10 +134,10 @@
 
             // Holder pattern. Any payload parameters <T> which are should be 
in holders are placed in Holder<T>.
             // Only check Holder for remotable interfaces
-            if (imethod != null && op.getInterface().isRemotable()) {
-                List<DataType> inputTypes = op.getInputType().getLogical();
+            if (imethod != null && operation.getInterface().isRemotable()) {
+                List<DataType> inputTypes = 
operation.getInputType().getLogical();
                 for (int i = 0, size = inputTypes.size(); i < size; i++) {
-                    if (ParameterMode.IN != op.getParameterModes().get(i)) {
+                    if (ParameterMode.IN != 
operation.getParameterModes().get(i)) {
                         // Promote array params from [<T>] to [Holder<T>]
                         Object[] payloadArray = (Object[])payload;
                         for (int j = 0; payloadArray != null && j < 
payloadArray.length; j++) {
@@ -169,9 +169,9 @@
                 // Holder pattern. Any payload Holder<T> types are returned as 
the message body.
                 List returnArgs = new ArrayList<Object>();
                 if (imethod != null) {
-                    for (int i = 0, size = op.getParameterModes().size(); i < 
size; i++) {
+                    for (int i = 0, size = 
operation.getParameterModes().size(); i < size; i++) {
                         // System.out.println( 
"JavaImplementationInvoker.invoke return parameter " + i + " type=" + 
parameter.getClass().getName() );
-                        if (ParameterMode.IN != op.getParameterModes().get(i)) 
{
+                        if (ParameterMode.IN != 
operation.getParameterModes().get(i)) {
                             // Demote array params from Holder<T> to <T>.
                             Object[] payloadArray = (Object[])payload;
                             for (int j = 0; j < payloadArray.length; j++) {
@@ -195,7 +195,7 @@
         } catch (InvocationTargetException e) {
             Throwable cause = e.getTargetException();
             boolean isChecked = false;
-            for (DataType<?> d : operation.getFaultTypes()) {
+            for (DataType<?> d : op.getFaultTypes()) {
                 if (d.getPhysical().isInstance(cause)) {
                     isChecked = true;
                     msg.setFaultBody(cause);

Modified: 
tuscany/branches/sca-java-1.x/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java?rev=769035&r1=769034&r2=769035&view=diff
==============================================================================
--- 
tuscany/branches/sca-java-1.x/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java
 (original)
+++ 
tuscany/branches/sca-java-1.x/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java
 Mon Apr 27 15:56:52 2009
@@ -6,15 +6,15 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
- * under the License.    
+ * under the License.
  */
 
 package org.apache.tuscany.sca.interfacedef.wsdl.impl;
@@ -38,6 +38,7 @@
 import org.apache.tuscany.sca.interfacedef.ConversationSequence;
 import org.apache.tuscany.sca.interfacedef.DataType;
 import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.ParameterMode;
 import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
 import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
 import org.apache.tuscany.sca.interfacedef.util.FaultException;
@@ -46,9 +47,8 @@
 import org.apache.tuscany.sca.interfacedef.util.XMLType;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation;
-import org.apache.tuscany.sca.xsd.XSDefinition;
 import org.apache.tuscany.sca.xsd.XSDFactory;
-
+import org.apache.tuscany.sca.xsd.XSDefinition;
 import org.apache.ws.commons.schema.XmlSchemaComplexType;
 import org.apache.ws.commons.schema.XmlSchemaElement;
 import org.apache.ws.commons.schema.XmlSchemaObject;
@@ -60,7 +60,7 @@
 
 /**
  * Metadata for a WSDL operation
- * 
+ *
  * @version $Rev$ $Date$
  */
 public class WSDLOperationIntrospectorImpl {
@@ -105,7 +105,7 @@
     /**
      * Test if the operation qualifies wrapper style as defined by the JAX-WS
      * 2.0 Specification
-     * 
+     *
      * @return true if the operation qualifies wrapper style, otherwise false
      */
     public boolean isWrapperStyle() throws InvalidWSDLException {
@@ -220,6 +220,11 @@
             operationModel.setInputType(getInputType());
             operationModel.setOutputType(getOutputType());
 
+            // FIXME: [rfeng] How to determine the parameter mode?
+            for (DataType d : operationModel.getInputType().getLogical()) {
+                operationModel.getParameterModes().add(ParameterMode.IN);
+            }
+
             operationModel.setInputWrapperStyle(isWrapperStyle());
             operationModel.setOutputWrapperStyle(isWrapperStyle());
             if (isWrapperStyle()) {
@@ -429,7 +434,7 @@
 
         /**
          * Return a list of child XSD elements under the wrapped request 
element
-         * 
+         *
          * @return a list of child XSD elements or null if if the request
          *         element is not wrapped
          */
@@ -471,7 +476,7 @@
         /**
          * Return a list of child XSD elements under the wrapped response
          * element
-         * 
+         *
          * @return a list of child XSD elements or null if if the response
          *         element is not wrapped
          */


Reply via email to