cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1241416 - in /cxf/branches/2.3.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java
Date Tue, 07 Feb 2012 10:35:17 GMT
Author: sergeyb
Date: Tue Feb  7 10:35:16 2012
New Revision: 1241416

URL: http://svn.apache.org/viewvc?rev=1241416&view=rev
Log:
Merged revisions 1241413 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.4.x-fixes

................
  r1241413 | sergeyb | 2012-02-07 10:27:37 +0000 (Tue, 07 Feb 2012) | 16 lines
  
  Merged revisions 1241412 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/branches/2.5.x-fixes
  
  ................
    r1241412 | sergeyb | 2012-02-07 10:24:34 +0000 (Tue, 07 Feb 2012) | 9 lines
    
    Merged revisions 1241195 via svnmerge from 
    https://svn.apache.org/repos/asf/cxf/trunk
    
    ........
      r1241195 | sergeyb | 2012-02-06 21:40:21 +0000 (Mon, 06 Feb 2012) | 1 line
      
      [CXF-4088] Checking getGenericSuperclass when selecting providers
    ........
  ................
................

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
    cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Feb  7 10:35:16 2012
@@ -1,3 +1,3 @@
-/cxf/branches/2.4.x-fixes:1235732,1236170,1236646,1239371,1240148,1240260,1240347
-/cxf/branches/2.5.x-fixes:1235731,1236169,1236643,1239368,1240147,1240255
-/cxf/trunk:1235730,1236166,1236624,1239365,1240136,1240252
+/cxf/branches/2.4.x-fixes:1235732,1236170,1236646,1239371,1240148,1240260,1240347,1241413
+/cxf/branches/2.5.x-fixes:1235731,1236169,1236643,1239368,1240147,1240255,1241412
+/cxf/trunk:1235730,1236166,1236624,1239365,1240136,1240252,1241195

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java?rev=1241416&r1=1241415&r2=1241416&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
Tue Feb  7 10:35:16 2012
@@ -813,6 +813,10 @@ public final class ProviderFactory {
         if (Object.class == cls) {
             return new Type[]{};
         }
+        Type genericSuperCls = cls.getGenericSuperclass();
+        if (genericSuperCls instanceof ParameterizedType) {
+            return new Type[]{genericSuperCls};
+        }
         Type[] types = cls.getGenericInterfaces();
         if (types.length > 0) {
             return types;

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java?rev=1241416&r1=1241415&r2=1241416&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java
Tue Feb  7 10:35:16 2012
@@ -213,6 +213,16 @@ public class ProviderFactoryTest extends
     }
     
     @Test
+    public void testExceptionMappersHierarchyWithGenerics() throws Exception {
+        ProviderFactory pf = ProviderFactory.getInstance();
+        RuntimeExceptionMapper1 exMapper1 = new RuntimeExceptionMapper1(); 
+        pf.registerUserProvider(exMapper1);
+        RuntimeExceptionMapper2 exMapper2 = new RuntimeExceptionMapper2(); 
+        pf.registerUserProvider(exMapper2);
+        assertSame(exMapper1, pf.createExceptionMapper(RuntimeException.class, new MessageImpl()));
+        assertSame(exMapper2, pf.createExceptionMapper(WebApplicationException.class, new
MessageImpl()));
+    }
+    
     public void testMessageBodyHandlerHierarchy() throws Exception {
         ProviderFactory pf = ProviderFactory.getInstance();
         List<Object> providers = new ArrayList<Object>();
@@ -731,4 +741,24 @@ public class ProviderFactoryTest extends
         }
         
     }
+
+    private static class RuntimeExceptionMapper1 
+        extends AbstractTestExceptionMapper<RuntimeException> {
+        
+    }
+    
+    private static class RuntimeExceptionMapper2 
+        extends AbstractTestExceptionMapper<WebApplicationException> {
+        
+    }
+    
+    private static class AbstractTestExceptionMapper<T extends RuntimeException> 
+        implements ExceptionMapper<T> {
+
+        public Response toResponse(T arg0) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+        
+    }
 }



Mime
View raw message