You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2010/11/17 23:34:29 UTC

svn commit: r1036260 - in /cxf/branches/2.3.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/ systests/jaxrs...

Author: sergeyb
Date: Wed Nov 17 22:34:29 2010
New Revision: 1036260

URL: http://svn.apache.org/viewvc?rev=1036260&view=rev
Log:
Merged revisions 1036258 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1036258 | sergeyb | 2010-11-17 22:25:44 +0000 (Wed, 17 Nov 2010) | 1 line
  
  [CXF-3022] Fixing more generics-related issues
........

Added:
    cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/GenericRestServiceImpl.java
      - copied unchanged from r1036258, cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/GenericRestServiceImpl.java
    cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/IRestService.java
      - copied unchanged from r1036258, cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/IRestService.java
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/AbstractJAXBProvider.java
    cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
    cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
    cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
    svn:mergeinfo = /cxf/trunk:1036258

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/AbstractJAXBProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java?rev=1036260&r1=1036259&r2=1036260&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java (original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java Wed Nov 17 22:34:29 2010
@@ -334,10 +334,7 @@ public abstract class AbstractJAXBProvid
         }
         
         JAXBContext context = getPackageContext(type);
-        if (context == null && type != genericType) {
-            context = getPackageContext(InjectionUtils.getActualType(genericType));
-        }
-        
+                
         return context != null ? context : getClassContext(type);
     }
     

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java?rev=1036260&r1=1036259&r2=1036260&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java (original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java Wed Nov 17 22:34:29 2010
@@ -115,8 +115,9 @@ public final class InjectionUtils {
         }
         
         Type[] bounds = var.getBounds();
-        if (bounds.length > pos && bounds[pos] != Object.class) {
-            return bounds[pos];
+        int boundPos = bounds.length > pos ? pos : 0; 
+        if (bounds.length > boundPos && bounds[boundPos] != Object.class) {
+            return bounds[boundPos];
         }
                 
         Type genericSubtype = serviceClass.getGenericSuperclass();

Modified: cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java?rev=1036260&r1=1036259&r2=1036260&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java (original)
+++ cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java Wed Nov 17 22:34:29 2010
@@ -55,7 +55,17 @@ public class JAXRSClientServerSpringBook
     @BeforeClass
     public static void startServers() throws Exception {
         assertTrue("server did not launch correctly", 
-                   launchServer(BookServerSpring.class));
+                   launchServer(BookServerSpring.class, true));
+    }
+    
+    @Test
+    public void testGetGenericBook() throws Exception {
+        String baseAddress = "http://localhost:" + PORT + "/the/thebooks8/books"; 
+        WebClient wc = WebClient.create(baseAddress);
+        Long id = wc.type("application/xml").accept("text/plain").post(new Book("CXF", 1L), Long.class);
+        assertEquals(new Long(1), id);
+        Book book = wc.accept("application/xml").query("id", 1L).get(Book.class);
+        assertEquals("CXF", book.getName());
     }
     
     @Test

Modified: cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml?rev=1036260&r1=1036259&r2=1036260&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml (original)
+++ cxf/branches/2.3.x-fixes/systests/jaxrs/src/test/resources/jaxrs/WEB-INF/beans.xml Wed Nov 17 22:34:29 2010
@@ -152,6 +152,12 @@ http://cxf.apache.org/schemas/core.xsd">
     </jaxrs:model>
   </jaxrs:server>  
 
+  <jaxrs:server id="bookservice8" address="/thebooks8">
+    <jaxrs:serviceBeans>
+      <bean class="org.apache.cxf.systest.jaxrs.GenericRestServiceImpl"/>
+    </jaxrs:serviceBeans>
+  </jaxrs:server>
+
   <bean id="jaxbProvider" class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
       <property name="schemaHandler" ref="schemaHolder"/>
   </bean>