Author: sergeyb
Date: Fri Dec 16 22:26:48 2011
New Revision: 1215321
URL: http://svn.apache.org/viewvc?rev=1215321&view=rev
Log:
[DOSGI-102] Fixing exception mapping on the client side with AndrĂ¡s Liter
finding the fix
Modified:
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandler.java
cxf/dosgi/trunk/systests/common/pom.xml
cxf/dosgi/trunk/systests/common_rest/pom.xml
cxf/dosgi/trunk/systests/multi_bundle_distro/pom.xml
cxf/dosgi/trunk/systests/multi_bundle_distro_rest/pom.xml
cxf/dosgi/trunk/systests/pom.xml
cxf/dosgi/trunk/systests/single_bundle_distro/pom.xml
cxf/dosgi/trunk/systests/single_bundle_distro_rest/pom.xml
cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/AbstractTestImportService.java
cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test1/MyServiceTracker.java
Modified:
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandler.java
URL:
http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandler.java?rev=1215321&r1=1215320&r2=1215321&view=diff
==============================================================================
---
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandler.java
(original)
+++
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandler.java
Fri Dec 16 22:26:48 2011
@@ -19,11 +19,9 @@
package org.apache.cxf.dosgi.dsw.handlers;
import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.security.AccessController;
-import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.Arrays;
@@ -67,18 +65,21 @@ public class ServiceInvocationHandler im
});
} catch (Throwable ex) {
Throwable theCause = ex.getCause() == null ? ex : ex.getCause();
-
+ Throwable theCauseCause = theCause.getCause() == null ? theCause :
theCause.getCause();
List<Class<?>> excTypes = exceptionsMap.get(m);
if (excTypes != null) {
for (Class<?> type : excTypes) {
if (type.isAssignableFrom(theCause.getClass())) {
throw theCause;
}
+ if (type.isAssignableFrom(theCauseCause.getClass())) {
+ throw theCauseCause;
+ }
}
+
}
- throw new InvocationTargetException(
- new ServiceException(REMOTE_EXCEPTION_TYPE, theCause));
+ throw new ServiceException(REMOTE_EXCEPTION_TYPE, theCause);
} finally {
Thread.currentThread().setContextClassLoader(oldCl);
}
Modified: cxf/dosgi/trunk/systests/common/pom.xml
URL:
http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests/common/pom.xml?rev=1215321&r1=1215320&r2=1215321&view=diff
==============================================================================
--- cxf/dosgi/trunk/systests/common/pom.xml (original)
+++ cxf/dosgi/trunk/systests/common/pom.xml Fri Dec 16 22:26:48 2011
@@ -21,14 +21,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.cxf.dosgi.systests</groupId>
<artifactId>cxf-dosgi-ri-systests-common</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.3-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Distributed OSGI RI System Test Common Classes</name>
<parent>
<groupId>org.apache.cxf.dosgi</groupId>
<artifactId>cxf-dosgi-ri-parent</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.3-SNAPSHOT</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
Modified: cxf/dosgi/trunk/systests/common_rest/pom.xml
URL:
http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests/common_rest/pom.xml?rev=1215321&r1=1215320&r2=1215321&view=diff
==============================================================================
--- cxf/dosgi/trunk/systests/common_rest/pom.xml (original)
+++ cxf/dosgi/trunk/systests/common_rest/pom.xml Fri Dec 16 22:26:48 2011
@@ -21,14 +21,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.cxf.dosgi.systests</groupId>
<artifactId>cxf-dosgi-ri-systests-common-rest</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.3-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Distributed OSGI RI System Test Rest Common Classes</name>
<parent>
<groupId>org.apache.cxf.dosgi</groupId>
<artifactId>cxf-dosgi-ri-parent</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.3-SNAPSHOT</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
Modified: cxf/dosgi/trunk/systests/multi_bundle_distro/pom.xml
URL:
http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests/multi_bundle_distro/pom.xml?rev=1215321&r1=1215320&r2=1215321&view=diff
==============================================================================
--- cxf/dosgi/trunk/systests/multi_bundle_distro/pom.xml (original)
+++ cxf/dosgi/trunk/systests/multi_bundle_distro/pom.xml Fri Dec 16 22:26:48
2011
@@ -21,14 +21,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.cxf.dosgi.systests</groupId>
<artifactId>cxf-dosgi-ri-systests-multibundle-distro</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.3-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Distributed OSGI RI System Test using Multi Bundle Distro</name>
<parent>
<groupId>org.apache.cxf.dosgi.systests</groupId>
<artifactId>cxf-dosgi-ri-systests</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
Modified: cxf/dosgi/trunk/systests/multi_bundle_distro_rest/pom.xml
URL:
http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests/multi_bundle_distro_rest/pom.xml?rev=1215321&r1=1215320&r2=1215321&view=diff
==============================================================================
--- cxf/dosgi/trunk/systests/multi_bundle_distro_rest/pom.xml (original)
+++ cxf/dosgi/trunk/systests/multi_bundle_distro_rest/pom.xml Fri Dec 16
22:26:48 2011
@@ -21,14 +21,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.cxf.dosgi.systests</groupId>
<artifactId>cxf-dosgi-ri-systests-multibundle-distro</artifactId>
- <version>1.1-SNAPSHOT</version>
+ <version>1.3-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Distributed OSGI RI Rest System Test using Multi Bundle Distro</name>
<parent>
<groupId>org.apache.cxf.dosgi.systests</groupId>
<artifactId>cxf-dosgi-ri-systests</artifactId>
- <version>1.1-SNAPSHOT</version>
+ <version>1.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
Modified: cxf/dosgi/trunk/systests/pom.xml
URL:
http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests/pom.xml?rev=1215321&r1=1215320&r2=1215321&view=diff
==============================================================================
--- cxf/dosgi/trunk/systests/pom.xml (original)
+++ cxf/dosgi/trunk/systests/pom.xml Fri Dec 16 22:26:48 2011
@@ -22,14 +22,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.cxf.dosgi.systests</groupId>
<artifactId>cxf-dosgi-ri-systests</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.3-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Distributed OSGI RI System Tests</name>
<parent>
<groupId>org.apache.cxf.dosgi</groupId>
<artifactId>cxf-dosgi-ri-parent</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.3-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: cxf/dosgi/trunk/systests/single_bundle_distro/pom.xml
URL:
http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests/single_bundle_distro/pom.xml?rev=1215321&r1=1215320&r2=1215321&view=diff
==============================================================================
--- cxf/dosgi/trunk/systests/single_bundle_distro/pom.xml (original)
+++ cxf/dosgi/trunk/systests/single_bundle_distro/pom.xml Fri Dec 16 22:26:48
2011
@@ -21,14 +21,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.cxf.dosgi.systests</groupId>
<artifactId>cxf-dosgi-ri-systests-singlebundle-distro</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.3-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Distributed OSGI RI System Test using Single Bundle Distro</name>
<parent>
<groupId>org.apache.cxf.dosgi.systests</groupId>
<artifactId>cxf-dosgi-ri-systests</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
Modified: cxf/dosgi/trunk/systests/single_bundle_distro_rest/pom.xml
URL:
http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests/single_bundle_distro_rest/pom.xml?rev=1215321&r1=1215320&r2=1215321&view=diff
==============================================================================
--- cxf/dosgi/trunk/systests/single_bundle_distro_rest/pom.xml (original)
+++ cxf/dosgi/trunk/systests/single_bundle_distro_rest/pom.xml Fri Dec 16
22:26:48 2011
@@ -21,14 +21,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.cxf.dosgi.systests</groupId>
<artifactId>cxf-dosgi-ri-systests-singlebundle-distro-rest</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.3-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Distributed OSGI RI REST System Test using Single Bundle Distro</name>
<parent>
<groupId>org.apache.cxf.dosgi.systests</groupId>
<artifactId>cxf-dosgi-ri-systests</artifactId>
- <version>1.2-SNAPSHOT</version>
+ <version>1.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@@ -112,23 +112,15 @@
<artifactId>org.apache.servicemix.specs.jsr311-api-1.0</artifactId>
<version>${servicemix.specs.version}</version>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>com.springsource.slf4j.api</artifactId>
- <version>${slf4j.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>com.springsource.slf4j.log4j</artifactId>
- <version>${slf4j.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
-
<artifactId>com.springsource.slf4j.org.apache.commons.logging</artifactId>
- <version>${slf4j.version}</version>
- <scope>test</scope>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>com.springsource.slf4j.api</artifactId>
+ <version>1.5.10</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>com.springsource.slf4j.jcl</artifactId>
+ <version>1.5.10</version>
</dependency>
<dependency>
<groupId>org.apache.log4j</groupId>
Modified:
cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/AbstractTestImportService.java
URL:
http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/AbstractTestImportService.java?rev=1215321&r1=1215320&r2=1215321&view=diff
==============================================================================
---
cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/AbstractTestImportService.java
(original)
+++
cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/AbstractTestImportService.java
Fri Dec 16 22:26:48 2011
@@ -95,7 +95,7 @@ public abstract class AbstractTestImport
// Wait for the service tracker in the test bundle to register a
service with the test result
ServiceReference ref = waitService(String.class.getName(),
"(testResult=test1)");
- Assert.assertEquals("HiOSGi", ref.getProperty("result"));
+ Assert.assertEquals("HiOSGi;exception", ref.getProperty("result"));
} finally {
if(server != null) {
server.stop();
Modified:
cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test1/MyServiceTracker.java
URL:
http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test1/MyServiceTracker.java?rev=1215321&r1=1215320&r2=1215321&view=diff
==============================================================================
---
cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test1/MyServiceTracker.java
(original)
+++
cxf/dosgi/trunk/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test1/MyServiceTracker.java
Fri Dec 16 22:26:48 2011
@@ -21,9 +21,12 @@ package org.apache.cxf.dosgi.systests2.c
import java.util.Hashtable;
import java.util.Map;
+import org.apache.cxf.dosgi.samples.greeter.GreeterData;
+import org.apache.cxf.dosgi.samples.greeter.GreeterException;
import org.apache.cxf.dosgi.samples.greeter.GreeterService;
import org.apache.cxf.dosgi.samples.greeter.GreetingPhrase;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceException;
import org.osgi.framework.ServiceReference;
import org.osgi.util.tracker.ServiceTracker;
@@ -49,13 +52,17 @@ public class MyServiceTracker extends Se
private void invokeGreeter(GreeterService svc) {
try {
- Map<GreetingPhrase, String> result = svc.greetMe("OSGi");
+ Map<GreetingPhrase, String> result = svc.greetMe("OSGi");
for (Map.Entry<GreetingPhrase, String> e : result.entrySet()) {
GreetingPhrase key = e.getKey();
invocationResult.append(key.getPhrase());
invocationResult.append(e.getValue());
}
-
+ try {
+ svc.greetMe(new GreeterDataImpl() {});
+ } catch (GreeterException ex) {
+ invocationResult.append(";exception");
+ }
Hashtable<String, Object> props = new Hashtable<String, Object>();
props.put("result", invocationResult.toString());
props.put("testResult", "test1");
@@ -67,4 +74,23 @@ public class MyServiceTracker extends Se
x.printStackTrace(System.err);
}
}
+
+ private static class GreeterDataImpl implements GreeterData {
+
+ public int getAge() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public String getName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean isException() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ }
}
\ No newline at end of file