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 2021/11/24 22:10:44 UTC

[GitHub] [camel] klease opened a new pull request #6473: CAMEL-17229: optimisation to create files from a String

klease opened a new pull request #6473:
URL: https://github.com/apache/camel/pull/6473


   This change reduces the risk of a file being consumed before being completely
   written which frequently happens during parallel unit tests.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] davsclaus merged pull request #6473: CAMEL-17229: optimisation to create files from a String

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


   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] davsclaus commented on pull request #6473: CAMEL-17229: optimisation to create files from a String

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


   Ah we need to wait till after 3.14 LTS has been released because Files.wrireString is not part of Java 8.
   Camel 3.15 will drop Java 8 so we can do this PR in about 1 month when 3.14 is released


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] davsclaus commented on pull request #6473: CAMEL-17229: optimisation to create files from a String

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


   The main branch has been upgraded to java 11, so we can go ahead with this PR


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] davsclaus commented on a change in pull request #6473: CAMEL-17229: optimisation to create files from a String

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



##########
File path: components/camel-file/src/main/java/org/apache/camel/component/file/FileOperations.java
##########
@@ -408,6 +411,16 @@ public boolean storeFile(String fileName, Exchange exchange, long size) throws G
         }
     }
 
+    private void writeFileFromString(String body, File target) throws IOException {

Review comment:
       Can you rename to `writeFileByString` and move the method down to where the others are

##########
File path: components/camel-file/src/main/java/org/apache/camel/component/file/FileOperations.java
##########
@@ -381,6 +381,9 @@ public boolean storeFile(String fileName, Exchange exchange, long size) throws G
                 // buffer the reader
                 in = IOHelper.buffered(in);
                 writeFileByReaderWithCharset(in, file, charset);
+            } else if (exchange.getIn().getBody() instanceof String &&
+                    ((String) exchange.getIn().getBody()).length() < endpoint.getBufferSize()) {

Review comment:
       Maybe put the body into a String str = (String) ... so you avoid the ugly type casts




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org