[ 
https://issues.apache.org/jira/browse/CAMEL-17702?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-17702.
---------------------------------
    Resolution: Fixed

> [camel-google-storage] Payload type File causes NPE on consumer
> ---------------------------------------------------------------
>
>                 Key: CAMEL-17702
>                 URL: https://issues.apache.org/jira/browse/CAMEL-17702
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-google-drive
>    Affects Versions: 3.11.0
>            Reporter: Radovan Bičiště
>            Assignee: Karen Lease
>            Priority: Minor
>             Fix For: 3.14.2, 3.16.0
>
>
> When sending a file payload to google-storage consumer it causes Null Pointer 
> Exception in GoogleCloudStorageProducer.processFile method.  
>         if (obj instanceof File) {
>             filePayload = (File) obj;
>             is = new FileInputStream(filePayload);
>         } else {
>             is = exchange.getIn().getMandatoryBody(InputStream.class);
>             baos = determineLengthInputStream(is);
>  
> baos is not initialized and causing NPE later on.
> Test Case:
> {code:java}
> <route id="CopyToGoogleCloudStorage" streamCache="true">
>   <from uri="{{file-fromUri}}"/>
>   <log message="Found file: '${header[CamelFileNameOnly]}'"/>
>       <log message="Uploading to GCS file ${header.CamelFileNameOnly}"/>
>       <!-- google-storage does not know File payload type and throws NPE -->
>       <convertBodyTo type="String"/> <-- comment this out to create NPE
>       <toD 
> uri="google-storage://test?objectName=test.txt&amp;serviceAccountKey=classpath:keys/test.json"/>
>   <log message="Moved file: '${header.CamelFileNameOnly}'"/>
> </route> {code}
>  
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to