Andrea Cosentino created CAMEL-26586:
----------------------------------------
Summary: camel-google-storage - close the upload stream after a
failure
Key: CAMEL-26586
URL: https://issues.apache.org/jira/browse/CAMEL-26586
Project: Camel
Issue Type: Bug
Components: camel-google-storage
Reporter: Andrea Cosentino
`components/camel-google/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageProducer.java:115`
```java
is = new FileInputStream(filePayload);
```
The producer opens the file itself; createFrom runs at 155 and
IOHelper.close(is) only at 160, with no finally block. An upload exception
bypasses closure. Repeated failures leave descriptor release to garbage
collection. Use structured cleanup, including failures during metadata
preparation. Add a failed-upload test that verifies closure of the stream
captured by the storage client.
History: trailing close dates to 2021; CAMEL-25167 changed length handling, not
exceptional cleanup. Existing ProducerStoreFileTest covers successful uploads.
Expected behavior: the operation honors its documented contract, including
exceptional and terminal paths. Add regression tests for the triggering case
described above.
Audited against upstream main 3658e02a7f9d. AI-generated by Codex on behalf of
oscerd (JIRA acosentino).
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)