artifactory-client-java icon indicating copy to clipboard operation
artifactory-client-java copied to clipboard

Close content InputStream after uploaded to Artifactory

Open qlan2 opened this issue 6 years ago • 3 comments

We use doUpload() to upload artifacts to Artifactory, but when we want to delete those artifacts, they can't be deleted since they have not been closed.

https://github.com/jfrog/artifactory-client-java/blob/master/services/src/main/groovy/org/jfrog/artifactory/client/impl/UploadableArtifactImpl.groovy#L78

I think we need to invoke close() on content after uploaded.

qlan2 avatar Jul 10 '18 23:07 qlan2

I'm using the upload method which takes the targetPath as string and the content as File object. After calling doUpload() the file can't be deleted. It seems nobody is closing the input stream.

dbogdoll avatar Mar 19 '19 10:03 dbogdoll

I've just run into this issue as well... I solved it in my own code by passing my own InputStream rather than a File to the UploadableArtifact constructor... but really this should be done properly in this package.

valenvb avatar Sep 10 '20 18:09 valenvb

Thanks for sharing this @valenvb! Would you like to contribute the fix through a pull request?

eyalbe4 avatar Sep 11 '20 04:09 eyalbe4