google / java-photoslibrary

Java client library for the Google Photos Library API
http://developers.google.com/photos
Apache License 2.0
107 stars 64 forks source link

Process upload still hold file after upload success #8

Closed hoangdangduy closed 5 years ago

hoangdangduy commented 5 years ago

I create application run 24/24. Then file was uploaded success, I want to delete file but it still was holded by process upload lead to an exception was throw. So, how the way to delete file when upload success and java application still run ?

My code upload is below.

qa google photo client java 3

jfschmakeit commented 5 years ago

You will need to explicitly call close() on the RandomAccessFile that you have created for the upload request. The best place to do this would be the UploadMediaItemResponse has been returned. This library does not handle the opening or closing of files, that's up to the developer to handle correctly. (For example, you may wish to retry the call with the same file, without closing it first.)

It looks like the code sample in the documentation isn't quite showing this - I have filed a bug internally to improve this.