You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by GitBox <gi...@apache.org> on 2018/05/24 10:45:54 UTC

[GitHub] coheigea commented on a change in pull request #419: [CXF-7743] wadl2java: generate throws declaration for fault response

coheigea commented on a change in pull request #419: [CXF-7743] wadl2java: generate throws declaration for fault response
URL: https://github.com/apache/cxf/pull/419#discussion_r190542528
 
 

 ##########
 File path: tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
 ##########
 @@ -1203,20 +1211,26 @@ private void writeJaxrResponse(StringBuilder sbCode, Set<String> imports) {
         sbCode.append(Response.class.getSimpleName()).append(" ");
     }
 
-    private Element getOKResponse(List<Element> responseEls) {
-        for (int i = 0; i < responseEls.size(); i++) {
-            String statusValue = responseEls.get(i).getAttribute("status");
-            if (statusValue.length() == 0) {
-                return responseEls.get(i);
-            }
-            String[] statuses = statusValue.split("\\s");
-            for (String status : statuses) {
-                if (HTTP_OK_STATUSES.contains(status)) {
-                    return responseEls.get(i);
+    private static Element getOKResponse(List<Element> responseEls) {
+        final List<Element> result = getResponses(responseEls, HTTP_OK_STATUSES);
 
 Review comment:
   One problem with sharing the getResponses() method is that we are creating a list for the OK case which is not really required, as we are only ever returning the first element.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services