Author: rfeng
Date: Thu Jul 31 11:36:40 2008
New Revision: 681435
URL: http://svn.apache.org/viewvc?rev=681435&view=rev
Log:
Fix for TUSCANY-2519
Added:
tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/BusinessExceptionMinimal.java
(with props)
tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClientMinimalImpl.java
(with props)
tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceMinimal.java
(with props)
tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceMinimalImpl.java
(with props)
tuscany/java/sca/itest/exceptions-simple-ws/src/test/java/com/example/ExampleMinimalTestCase.java
(with props)
Modified:
tuscany/java/sca/itest/exceptions-simple-ws/src/main/resources/example.composite
tuscany/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java
Added:
tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/BusinessExceptionMinimal.java
URL:
http://svn.apache.org/viewvc/tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/BusinessExceptionMinimal.java?rev=681435&view=auto
==============================================================================
---
tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/BusinessExceptionMinimal.java
(added)
+++
tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/BusinessExceptionMinimal.java
Thu Jul 31 11:36:40 2008
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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.
+ */
+package com.example;
+
+public class BusinessExceptionMinimal extends Exception {
+
+ public BusinessExceptionMinimal(String message) {
+ super(message);
+ }
+
+}
+
Propchange:
tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/BusinessExceptionMinimal.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/BusinessExceptionMinimal.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClientMinimalImpl.java
URL:
http://svn.apache.org/viewvc/tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClientMinimalImpl.java?rev=681435&view=auto
==============================================================================
---
tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClientMinimalImpl.java
(added)
+++
tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClientMinimalImpl.java
Thu Jul 31 11:36:40 2008
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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.
+ */
+package com.example;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+//@Service(ExampleClient.class)
[EMAIL PROTECTED]("COMPOSITE")
+//public class ExampleClientMinimalImpl implements ExampleClient {
+public class ExampleClientMinimalImpl {
+ @Reference
+ protected ExampleServiceMinimal myService;
+
+ public void runTest() {
+ try {
+ //Object result = myService.hello("John");
+ myService.throwException("John");
+ //System.out.println("myService returned " +
result.getClass().getName());
+ } catch (BusinessExceptionMinimal e) {
+ System.out.println("caught exception from hello(): " +
e.getMessage() );
+ }
+ }
+
+ public String hello(String name) throws BusinessExceptionMinimal{
+ throw new BusinessExceptionMinimal("bad news");
+ }
+ public void throwException(String name) throws BusinessExceptionMinimal{
+ throw new BusinessExceptionMinimal("bad news");
+ }
+
+
+ public static void main(String[] args) {
+
+ }
+
+}
Propchange:
tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClientMinimalImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/ExampleClientMinimalImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceMinimal.java
URL:
http://svn.apache.org/viewvc/tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceMinimal.java?rev=681435&view=auto
==============================================================================
---
tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceMinimal.java
(added)
+++
tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceMinimal.java
Thu Jul 31 11:36:40 2008
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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.
+ */
+package com.example;
+
+import org.osoa.sca.annotations.Remotable;
+
[EMAIL PROTECTED]
+public interface ExampleServiceMinimal {
+
+ public String hello(String name) throws Exception;
+ public void throwException(String name) throws BusinessExceptionMinimal;
+}
Propchange:
tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceMinimal.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceMinimal.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceMinimalImpl.java
URL:
http://svn.apache.org/viewvc/tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceMinimalImpl.java?rev=681435&view=auto
==============================================================================
---
tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceMinimalImpl.java
(added)
+++
tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceMinimalImpl.java
Thu Jul 31 11:36:40 2008
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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.
+ */
+package com.example;
+
+public class ExampleServiceMinimalImpl implements ExampleServiceMinimal {
+ public String hello(String name) throws Exception {
+ throw new BusinessExceptionMinimal("minimal bad news" + name);
+ // return "Hello, " + name;
+ }
+
+ public void throwException(String name) throws BusinessExceptionMinimal {
+ throw new BusinessExceptionMinimal("minimal bad news" + name);
+ }
+}
Propchange:
tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceMinimalImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tuscany/java/sca/itest/exceptions-simple-ws/src/main/java/com/example/ExampleServiceMinimalImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified:
tuscany/java/sca/itest/exceptions-simple-ws/src/main/resources/example.composite
URL:
http://svn.apache.org/viewvc/tuscany/java/sca/itest/exceptions-simple-ws/src/main/resources/example.composite?rev=681435&r1=681434&r2=681435&view=diff
==============================================================================
---
tuscany/java/sca/itest/exceptions-simple-ws/src/main/resources/example.composite
(original)
+++
tuscany/java/sca/itest/exceptions-simple-ws/src/main/resources/example.composite
Thu Jul 31 11:36:40 2008
@@ -37,4 +37,20 @@
<binding.ws
wsdlElement="http://example.com/#wsdl.port(ExampleService/ExampleServiceSOAP11port_http)"
/>
</service>
</component>
+
+ <component name="ExampleClientMinimalComponent">
+ <implementation.java class="com.example.ExampleClientMinimalImpl" />
+ <reference name="myService">
+ <interface.java
interface="com.example.ExampleServiceMinimal"/>
+ <binding.ws
uri="http://localhost:8085/ExampleMinimalComponent" />
+ </reference>
+ </component>
+
+ <component name="ExampleMinimalComponent">
+ <implementation.java
class="com.example.ExampleServiceMinimalImpl" />
+ <service name="ExampleServiceMinimal">
+ <interface.java
interface="com.example.ExampleServiceMinimal"/>
+ <binding.ws
uri="http://localhost:8085/ExampleMinimalComponent" />
+ </service>
+ </component>
</composite>
Added:
tuscany/java/sca/itest/exceptions-simple-ws/src/test/java/com/example/ExampleMinimalTestCase.java
URL:
http://svn.apache.org/viewvc/tuscany/java/sca/itest/exceptions-simple-ws/src/test/java/com/example/ExampleMinimalTestCase.java?rev=681435&view=auto
==============================================================================
---
tuscany/java/sca/itest/exceptions-simple-ws/src/test/java/com/example/ExampleMinimalTestCase.java
(added)
+++
tuscany/java/sca/itest/exceptions-simple-ws/src/test/java/com/example/ExampleMinimalTestCase.java
Thu Jul 31 11:36:40 2008
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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.
+ */
+package com.example;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class ExampleMinimalTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private ExampleClientMinimalImpl client;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("example.composite");
+ client = scaDomain.getService(ExampleClientMinimalImpl.class,
"ExampleClientMinimalComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void test() throws Exception {
+ client.runTest();
+ }
+}
Propchange:
tuscany/java/sca/itest/exceptions-simple-ws/src/test/java/com/example/ExampleMinimalTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tuscany/java/sca/itest/exceptions-simple-ws/src/test/java/com/example/ExampleMinimalTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified:
tuscany/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java
URL:
http://svn.apache.org/viewvc/tuscany/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java?rev=681435&r1=681434&r2=681435&view=diff
==============================================================================
---
tuscany/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java
(original)
+++
tuscany/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java
Thu Jul 31 11:36:40 2008
@@ -36,6 +36,7 @@
import org.apache.tuscany.sca.interfacedef.FaultExceptionMapper;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
import org.apache.tuscany.sca.interfacedef.util.FaultException;
import org.apache.tuscany.sca.interfacedef.util.XMLType;
import org.osoa.sca.ServiceRuntimeException;
@@ -250,7 +251,7 @@
}
@SuppressWarnings("unchecked")
- public boolean introspectFaultDataType(DataType<DataType> exceptionType,
Operation operation, final boolean generatingFaultBean) {
+ public boolean introspectFaultDataType(DataType<DataType> exceptionType,
final Operation operation, final boolean generatingFaultBean) {
QName faultName = null;
boolean result = false;
@@ -303,7 +304,10 @@
} catch (ClassNotFoundException e) {
if (generatingFaultBean) {
Class<? extends Throwable> t = (Class<? extends
Throwable>)cls;
- GeneratedClassLoader cl = new
GeneratedClassLoader(t.getClassLoader());
+ ClassLoader parent =
+ operation == null ? t.getClassLoader() :
((JavaInterface)operation.getInterface())
+ .getJavaClass().getClassLoader();
+ GeneratedClassLoader cl = new
GeneratedClassLoader(parent);
GeneratedDataTypeImpl dt = new
GeneratedDataTypeImpl(xmlAdapterExtensionPoint, t, cl);
return dt;
} else {