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

sergeyb pushed a commit to branch 3.1.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git


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

commit 19402004d61d3fb7c71e7e971528e897966c8956
Author: Sergey Beryozkin <[email protected]>
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
---
 .../apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java   | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 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 150857e..abf34ff 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
@@ -721,7 +721,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);
@@ -797,7 +799,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) {
@@ -845,16 +847,8 @@ public class SourceGenerator {
         finalizeMethodDocs(doCreateJavaDocs, sbCode, sbMethodDocs, 
sbMethodRespDocs, sbMethodCode);
         
     }
-    
-    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, 
+    private void finalizeMethodDocs(boolean doCreateJavaDocs, StringBuilder 
sbCode, StringBuilder sbJavaDocs,
                                     StringBuilder sbRespDocs, StringBuilder 
sbMethodCode) {
         if (doCreateJavaDocs) {
             sbJavaDocs.append(sbRespDocs);

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to