You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2020/08/11 13:35:14 UTC

[GitHub] [camel] zbendhiba opened a new pull request #4085: CAMEL-15390: CollectionStringBuilder - Use JDK util methods instead

zbendhiba opened a new pull request #4085:
URL: https://github.com/apache/camel/pull/4085


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



[GitHub] [camel] davsclaus merged pull request #4085: CAMEL-15390: CollectionStringBuilder - Use JDK util methods instead

Posted by GitBox <gi...@apache.org>.
davsclaus merged pull request #4085:
URL: https://github.com/apache/camel/pull/4085


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



[GitHub] [camel] davsclaus commented on a change in pull request #4085: CAMEL-15390: CollectionStringBuilder - Use JDK util methods instead

Posted by GitBox <gi...@apache.org>.
davsclaus commented on a change in pull request #4085:
URL: https://github.com/apache/camel/pull/4085#discussion_r468595827



##########
File path: components/camel-openapi-java/src/main/java/org/apache/camel/openapi/OpenApiRestProducerFactory.java
##########
@@ -176,13 +176,13 @@ private Producer createHttpProducer(CamelContext camelContext, OasDocument openA
                 }
                 if (list != null) {
                     for (String s : list) {
-                        csb.append(s);
+                        producesBuilder.add(s);
                     }
                 }
-                produces = csb.isEmpty() ? null : csb.toString();
+                produces = producesBuilder.toString().isEmpty() ? null : producesBuilder.toString();

Review comment:
       I think we can avoid the 2 x toString as that is a costly operation. We can use length method to know if its empty or not. For example if length > 1 (as delimiter is 1) I think. There is a few other places where toString would be called twice like this.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



[GitHub] [camel] zbendhiba commented on a change in pull request #4085: CAMEL-15390: CollectionStringBuilder - Use JDK util methods instead

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on a change in pull request #4085:
URL: https://github.com/apache/camel/pull/4085#discussion_r469113053



##########
File path: components/camel-openapi-java/src/main/java/org/apache/camel/openapi/OpenApiRestProducerFactory.java
##########
@@ -176,13 +176,13 @@ private Producer createHttpProducer(CamelContext camelContext, OasDocument openA
                 }
                 if (list != null) {
                     for (String s : list) {
-                        csb.append(s);
+                        producesBuilder.add(s);
                     }
                 }
-                produces = csb.isEmpty() ? null : csb.toString();
+                produces = producesBuilder.toString().isEmpty() ? null : producesBuilder.toString();

Review comment:
       The length is 0 by the way, the delimiter is not added. If the value is null, the length gets prefix + suffix, which in this case is empty.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



[GitHub] [camel] zbendhiba commented on pull request #4085: CAMEL-15390: CollectionStringBuilder - Use JDK util methods instead

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on pull request #4085:
URL: https://github.com/apache/camel/pull/4085#issuecomment-672666649


   Ok 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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