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 `mkdirs()` return value is silently ignored here. The existing pattern 
in `DefaultStreamCachingStrategy.doStart()` (lines 432-439) checks the return 
value and logs a warning on failure. Without this, a permissions or disk-full 
failure will surface as an opaque `IOException` from 
`FileUtil.createTempFile()` on the next line, with no hint about the directory 
creation being the root cause.
   
   ```suggestion
               File spoolDir = strategy.resolveSpoolDirectory(exchange);
               if (spoolDir != null && !spoolDir.exists()) {
                   if (!spoolDir.mkdirs()) {
                       LOG.warn("Cannot create spool directory: {}."
                                + " This may cause problems spooling to disk 
for the stream caching!", 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