davsclaus commented on code in PR #25360:
URL: https://github.com/apache/camel/pull/25360#discussion_r3731403623


##########
core/camel-support/src/main/java/org/apache/camel/converter/stream/FileInputStreamCache.java:
##########
@@ -320,7 +320,11 @@ OutputStream createOutputStream(StreamCachingStrategy 
strategy) throws IOExcepti
                 LOG.error(error);
                 throw new IOException(error);
             }
-            tempFile = FileUtil.createTempFile("cos", ".tmp", 
strategy.getSpoolDirectory());
+            File spoolDir = strategy.resolveSpoolDirectory(exchange);
+            if (spoolDir != null && !spoolDir.exists()) {
+                spoolDir.mkdirs();

Review Comment:
   The explicit `mkdirs()` here is redundant — `FileUtil.createTempFile()` 
(line 328 below) already calls `parentDir.mkdirs()` internally before creating 
the temp file. This block can be removed and simplified to just:
   
   ```suggestion
               File spoolDir = strategy.resolveSpoolDirectory(exchange);
               tempFile = FileUtil.createTempFile("cos", ".tmp", spoolDir);
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to