You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by il...@apache.org on 2019/11/14 15:25:51 UTC

[cxf] branch 3.3.x-fixes updated: [CXF-8158] Fixing checkstyle (take 2)

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

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


The following commit(s) were added to refs/heads/3.3.x-fixes by this push:
     new 95b1484  [CXF-8158] Fixing checkstyle (take 2)
95b1484 is described below

commit 95b148441611fe337150f5dab1672086f78c0e8a
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Thu Nov 14 16:18:35 2019 +0100

    [CXF-8158] Fixing checkstyle (take 2)
---
 .../cxf/jaxrs/openapi/OpenApiCustomizer.java       | 32 ++++++++++++----------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java
index 8ed43b5..ea0dff3 100644
--- a/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java
+++ b/rt/rs/description-openapi-v3/src/main/java/org/apache/cxf/jaxrs/openapi/OpenApiCustomizer.java
@@ -86,6 +86,23 @@ public class OpenApiCustomizer {
         return configuration;
     }
 
+    protected String extractJavadoc(final Operation operation, final OperationResourceInfo ori, final int paramIdx) {
+        String javadoc = null;
+        if (operation.getParameters().size() == ori.getParameters().size()) {
+            javadoc = javadocProvider.getMethodParameterDoc(ori, paramIdx);
+        } else {
+            for (int j = 0; j < ori.getParameters().size(); j++) {
+                if (Objects.equals(
+                        operation.getParameters().get(paramIdx).getName(),
+                        ori.getParameters().get(j).getName())) {
+
+                    javadoc = javadocProvider.getMethodParameterDoc(ori, j);
+                }
+            }
+        }
+        return javadoc;
+    }
+
     public void customize(final OpenAPI oas) {
         if (replaceTags || javadocProvider != null) {
             Map<String, ClassResourceInfo> operations = new HashMap<>();
@@ -140,20 +157,7 @@ public class OpenApiCustomizer {
 
                         for (int i = 0; i < operation.getParameters().size(); i++) {
                             if (StringUtils.isBlank(operation.getParameters().get(i).getDescription())) {
-                                String javadoc = null;
-                                if (operation.getParameters().size() == ori.getParameters().size()) {
-                                    javadoc = javadocProvider.getMethodParameterDoc(ori, i);
-                                } else {
-                                    for (int j = 0; j < ori.getParameters().size(); j++) {
-                                        if (Objects.equals(
-                                                operation.getParameters().get(i).getName(),
-                                                ori.getParameters().get(j).getName())) {
-
-                                            javadoc = javadocProvider.getMethodParameterDoc(ori, j);
-                                        }
-                                    }
-                                }
-                                operation.getParameters().get(i).setDescription(javadoc);
+                                operation.getParameters().get(i).setDescription(extractJavadoc(operation, ori, i));
                             }
                         }