Claus Ibsen created CAMEL-25974:
-----------------------------------

             Summary: camel-stream - stream:file with a file name without a 
directory, and stream:header without the stream header, fail with a 
NullPointerException
                 Key: CAMEL-25974
                 URL: https://issues.apache.org/jira/browse/CAMEL-25974
             Project: Camel
          Issue Type: Bug
          Components: camel-stream
    Affects Versions: 4.18.0, 4.22.0, 4.23.0
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Two producers of camel-stream fail with a NullPointerException instead of an 
error that says what is wrong:
* {{stream:file?fileName=out.txt}}, a file name without a directory: 
{{f.getParentFile().mkdirs()}} ({{StreamProducer}}, main e6885df7894d, line 
100) fails because the parent is null;
* {{stream:header}} without a {{stream}} header, or with one that is not an 
OutputStream: the stream is null, and the {{OutputStreamWriter}} at line 141 
fails.

Checked on 4.24.0-SNAPSHOT with {{camel run}}:
* {{NullPointerException: Cannot invoke "java.io.File.mkdirs()" because the 
return value of "java.io.File.getParentFile()" is null}};
* {{NullPointerException}} from {{java.io.Writer.<init>}}.

*Proposed change*: create the parent directories only when there is a parent, 
and fail with a clear error when the stream header is missing.

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to