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 2017/11/09 14:48:40 UTC

[cxf] branch master updated: [CXF-7545] Making sure a custom method id always gets the priority, modified patch is applied on behalf of Evaristo Wychoski Benfatti

This is an automated email from the ASF dual-hosted git repository.

sergeyb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new f489ba9  [CXF-7545] Making sure a custom method id always gets the priority, modified patch is applied on behalf of Evaristo Wychoski Benfatti
f489ba9 is described below

commit f489ba9cb3c6bee7c4efd8769f59896f0bfacd31
Author: Sergey Beryozkin <sb...@gmail.com>
AuthorDate: Thu Nov 9 14:48:22 2017 +0000

    [CXF-7545] Making sure a custom method id always gets the priority, modified patch is applied on behalf of Evaristo Wychoski Benfatti
---
 .../org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java b/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
index 3051251..098e3e8 100644
--- a/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
+++ b/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
@@ -717,7 +717,9 @@ public class SourceGenerator {
 
         String methodName = methodEl.getAttribute("name");
         final String methodNameLowerCase = methodName.toLowerCase();
-        String id = getMethodId(methodEl, methodNameLowerCase);
+        String idAttribute = methodEl.getAttribute("id");
+        final String id = idAttribute.isEmpty() ? methodNameLowerCase : idAttribute;
+        
         final boolean responseRequired = isMethodMatched(responseMethods, methodNameLowerCase, id);
         final boolean suspendedAsync = responseRequired ? false
             : isMethodMatched(suspendedAsyncMethods, methodNameLowerCase, id);
@@ -793,7 +795,7 @@ public class SourceGenerator {
                                                           suspendedAsync);
 
                 String genMethodName = id + suffixName;
-                if (methodNameLowerCase.equals(genMethodName)) {
+                if (methodNameLowerCase.equals(genMethodName) && idAttribute.isEmpty()) {
                     List<PathSegment> segments = JAXRSUtils.getPathSegments(currentPath, true, true);
                     StringBuilder sb = new StringBuilder();
                     for (PathSegment ps : segments) {
@@ -842,14 +844,6 @@ public class SourceGenerator {
 
     }
 
-    private String getMethodId(Element methodEl, String methodNameLowerCase) {
-        String id = methodEl.getAttribute("id");
-        if (id.length() == 0) {
-            id = methodNameLowerCase;
-        }
-        return id;
-    }
-
     private void finalizeMethodDocs(boolean doCreateJavaDocs, StringBuilder sbCode, StringBuilder sbJavaDocs,
                                     StringBuilder sbRespDocs, StringBuilder sbMethodCode) {
         if (doCreateJavaDocs) {

-- 
To stop receiving notification emails like this one, please contact
['"commits@cxf.apache.org" <co...@cxf.apache.org>'].