cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1357519 - in /cxf/branches/2.4.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/codegen/CodeGeneratorProviderTest.java
Date Thu, 05 Jul 2012 09:24:57 GMT
Author: ningjiang
Date: Thu Jul  5 09:24:56 2012
New Revision: 1357519

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

........
  r1357502 | ningjiang | 2012-07-05 16:59:41 +0800 (Thu, 05 Jul 2012) | 1 line
  
  Fixed the test failures in cxf jaxrs
........

Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
    cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/codegen/CodeGeneratorProviderTest.java

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/branches/2.5.x-fixes:r1357502

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

Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java?rev=1357519&r1=1357518&r2=1357519&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
Thu Jul  5 09:24:56 2012
@@ -322,26 +322,27 @@ public final class InjectionUtils {
         }
         
         boolean adapterHasToBeUsed = false;
+        Class<?> cls = pClass;        
         Class<?> valueType = JAXBUtils.getValueTypeFromAdapter(pClass, pClass, paramAnns);
-        if (valueType != pClass) {
-            pClass = valueType;
+        if (valueType != cls) {
+            cls = valueType;
             adapterHasToBeUsed = true;
         }
         
-        Object result = instantiateFromParameterHandler(value, pClass, message);
+        Object result = instantiateFromParameterHandler(value, cls, message);
         if (result != null) {
             return result;
         }
         // check constructors accepting a single String value
         try {
-            Constructor<?> c = pClass.getConstructor(new Class<?>[]{String.class});
+            Constructor<?> c = cls.getConstructor(new Class<?>[]{String.class});
             result = c.newInstance(new Object[]{value});
         } catch (NoSuchMethodException ex) {
             // try valueOf
         } catch (WebApplicationException ex) {
             throw ex;
         } catch (Exception ex) {
-            result = createFromParameterHandler(value, pClass, message);
+            result = createFromParameterHandler(value, cls, message);
             if (result == null) {
                 LOG.severe(new org.apache.cxf.common.i18n.Message("CLASS_CONSTRUCTOR_FAILURE",

                                                                    BUNDLE, 
@@ -351,11 +352,11 @@ public final class InjectionUtils {
         }
         if (result == null) {
             // check for valueOf(String) static methods
-            String[] methodNames = pClass.isEnum() 
+            String[] methodNames = cls.isEnum() 
                 ? new String[] {"fromString", "fromValue", "valueOf"} 
                 : new String[] {"valueOf", "fromString"};
             for (String mName : methodNames) {   
-                result = evaluateFactoryMethod(value, pClass, pType, mName);
+                result = evaluateFactoryMethod(value, cls, pType, mName);
                 if (result != null) {
                     break;
                 }
@@ -363,7 +364,7 @@ public final class InjectionUtils {
         }
         
         if (result == null) {
-            result = createFromParameterHandler(value, pClass, message);
+            result = createFromParameterHandler(value, cls, message);
         }
         
         if (adapterHasToBeUsed) {
@@ -380,7 +381,7 @@ public final class InjectionUtils {
             reportServerError("WRONG_PARAMETER_TYPE", pClass.getName());
         }
         
-        return result;
+        return pClass.cast(result);
     }
 
     private static Object instantiateFromParameterHandler(String value, 

Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/codegen/CodeGeneratorProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/codegen/CodeGeneratorProviderTest.java?rev=1357519&r1=1357518&r2=1357519&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/codegen/CodeGeneratorProviderTest.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/codegen/CodeGeneratorProviderTest.java
Thu Jul  5 09:24:56 2012
@@ -123,8 +123,9 @@ public class CodeGeneratorProviderTest e
     
     private void verifyClasses(File classesDir, boolean typesOnly) {
         List<File> clsFiles = FileUtils.getFilesRecurse(classesDir, ".+\\.class$");
-        assertEquals(typesOnly ? 5 : 7, clsFiles.size());
+        assertEquals(typesOnly ? 6 : 8, clsFiles.size());
         assertTrue(checkContains(clsFiles, "superbooks.Book.class"));
+        assertTrue(checkContains(clsFiles, "superbooks.Books.class"));
         assertTrue(checkContains(clsFiles, "superbooks.Book2.class"));
         assertTrue(checkContains(clsFiles, "superbooks.Chapter.class"));
         assertTrue(checkContains(clsFiles, "superbooks.ObjectFactory.class"));



Mime
View raw message