jfrog / artifactory-client-java

Artifactory REST Client Java API bindings
Apache License 2.0
319 stars 153 forks source link

Close content InputStream after uploaded to Artifactory #205

Open qlan2 opened 6 years ago

qlan2 commented 6 years ago

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.

dbogdoll commented 5 years ago

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.

valenvb commented 4 years ago

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.

eyalbe4 commented 4 years ago

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