cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1296276 - in /cxf/branches/2.4.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/search/Beanspector.java rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/search/FiqlParserTest.java
Date Fri, 02 Mar 2012 16:15:02 GMT
Author: sergeyb
Date: Fri Mar  2 16:15:01 2012
New Revision: 1296276

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

................
  r1296273 | sergeyb | 2012-03-02 16:10:28 +0000 (Fri, 02 Mar 2012) | 9 lines
  
  Merged revisions 1296270 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1296270 | sergeyb | 2012-03-02 16:06:19 +0000 (Fri, 02 Mar 2012) | 1 line
    
    [CXF-4153] Fixing Beanspector wrongly getting the property names in case of 'is'
  ........
................

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/ext/search/Beanspector.java
    cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/search/FiqlParserTest.java

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Fri Mar  2 16:15:01 2012
@@ -0,0 +1,2 @@
+/cxf/branches/2.5.x-fixes:1296273
+/cxf/trunk:1296270

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/ext/search/Beanspector.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/search/Beanspector.java?rev=1296276&r1=1296275&r2=1296276&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/search/Beanspector.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/search/Beanspector.java
Fri Mar  2 16:15:01 2012
@@ -60,9 +60,9 @@ class Beanspector<T> {
         }
         for (Method m : tclass.getMethods()) {
             if (isGetter(m)) {
-                getters.put(getterName(m), m);
+                getters.put(getPropertyName(m), m);
             } else if (isSetter(m)) {
-                setters.put(setterName(m), m);
+                setters.put(getPropertyName(m), m);
             }
         }
         // check type equality for getter-setter pairs
@@ -171,8 +171,17 @@ class Beanspector<T> {
                && (m.getName().startsWith("get") || m.getName().startsWith("is"));
     }
 
-    private String getterName(Method m) {
-        return m.getName().replace("is", "").replace("get", "").toLowerCase();
+    private String getPropertyName(Method m) {
+        // at this point the method is either getter or setter
+        String result = m.getName().toLowerCase();
+
+        if (result.startsWith("is")) {
+            result = result.substring(2, result.length());
+        } else {
+            result = result.substring(3, result.length());
+        }
+        return result;
+
     }
 
     private boolean isSetter(Method m) {
@@ -180,8 +189,6 @@ class Beanspector<T> {
                && (m.getName().startsWith("set") || m.getName().startsWith("is"));
     }
 
-    private String setterName(Method m) {
-        return m.getName().replace("is", "").replace("set", "").toLowerCase();
-    }
+    
 
 }

Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/search/FiqlParserTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/search/FiqlParserTest.java?rev=1296276&r1=1296275&r2=1296276&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/search/FiqlParserTest.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/search/FiqlParserTest.java
Fri Mar  2 16:15:01 2012
@@ -120,11 +120,6 @@ public class FiqlParserTest extends Asse
         parser.parse("name==10");
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void testMismatchedAccessorTypes() throws FiqlParseException {
-        new FiqlParser<MismatchedTypes>(MismatchedTypes.class);
-    }
-
     @Test
     public void testParseName() throws FiqlParseException {
         SearchCondition<Condition> filter = parser.parse("name==king");
@@ -329,14 +324,4 @@ public class FiqlParserTest extends Asse
 
     }
 
-    // TODO refactor to Beanspector unit tests
-    @Ignore
-    static class MismatchedTypes {
-        public Date getFoo() {
-            return null;
-        }
-
-        public void setFoo(String val) {
-        }
-    }
 }



Mime
View raw message