4 messages in com.googlegroups.google-picasa-data-apiRe: How to delete source image file a...
FromSent OnAttachments
Freezie18 Feb 2008 17:46 
Jeff Fisher (Google)19 Feb 2008 14:20 
Freezie19 Feb 2008 18:04 
Jeff Fisher (Google)20 Feb 2008 14:31 
Subject:Re: How to delete source image file after calling picasaWebService.insert()?
From:Jeff Fisher (Google) (api.@google.com)
Date:02/20/2008 02:31:59 PM
List:com.googlegroups.google-picasa-data-api

Cool! I'm glad you got it to work. I'll make sure that fix gets included in a future release of the client library.

My first instinct was to call "bos.close()" as well, but since you're passing in the underlying OutputStream object as an argument, I think it would be wrong to close it in that scope. If you look at the insert() method of the MediaService class, you find out that the OutputStream belongs to a GDataRequest object. I think when execute() is called on the GDataRequest it automatically closes the stream.

Cheers, -Jeff

On Feb 19, 6:04 pm, Freezie <ods7@gmail.com> wrote:

Jeff,

Thank you for quick reply. Your solution has helped to resolve the problem. I use Windows XP, NTFS.

BTW, why not to call also bos.close() after line 82 of the file src/ com/google/gdata/data/media/ MediaSource.java?

On Feb 20, 7:21 am, "Jeff Fisher (Google)" <api.@google.com> wrote:

Hi Freezie,

It looks like you're using the Java client library from the code sample you provided. If you're compiling it yourself and not just linking against the JAR files, I think the fix might be the following:

After line 82 of the file src/com/google/gdata/data/media/ MediaSource.java add the following:

bis.close();

It seems that the InputStream is never getting closed after the file is sent to the server. However, I think the behavior might vary in different Java VM implementations. I wasn't able to reproduce this issue on OS X. What underlying OS and filesystem are you using?

Cheers, -Jeff

On Feb 18, 5:47 pm, Freezie <ods7@gmail.com> wrote:

Hello,

This is the part of my code to upload the photo to the web album:

File imgFile = new File(pathName); // pathName points to the existing image file MediaFileSource mediaSrc= new MediaFileSource(imgFile, "image/jpeg"); picasaWebService.insert(albumFeedURL, PhotoEntry.class, mediaSrc); imgFile.delete();

The photo is successfully uploaded to the web album. But deletion of the source image file is failed. It looks like picaseWebService object continues to keep source image file.