I have a service that runs daily, and uploads an image via a url to a
Picasa Web Album. This process has run fine, daily, for over a year. The
code has not changed. Last successful image upload was Friday 1/27/2017,
2:30 AM CST. Saturday, 1/28/2017, at 2:30 AM CST, I began receiving errors
on uploading the images.
The stack trace, after leaving my code, is the following:
java.io.IOException: Error writing request body to server
at
sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:3518)
at
sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3501)
at
java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:126)
at
com.google.gdata.data.media.MediaSource$Output.writeTo(MediaSource.java:88)
at
com.google.gdata.data.media.MediaBodyPart$MediaSourceDataHandler.writeTo(MediaBodyPart.java:74)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1485)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:865)
at javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:462)
at
com.google.gdata.wireformats.output.media.MediaMultipartGenerator.generate(MediaMultipartGenerator.java:58)
at
com.google.gdata.wireformats.output.media.MediaMultipartGenerator.generate(MediaMultipartGenerator.java:37)
at com.google.gdata.client.Service.writeRequestData(Service.java:2071)
at
com.google.gdata.client.media.MediaService.insert(MediaService.java:397)
Next, I took the code same as soon in the Java portion of the Picasa
Developers Guide for uploading a file from the file system, like:
URL albumPostUrl = new
URL("https://picasaweb.google.com/data/feed/api/user/*username*/albumid/*albumid*");
PhotoEntry myPhoto = new PhotoEntry();
myPhoto.setTitle(new PlainTextConstruct("Puppies FTW"));
myPhoto.setDescription(new PlainTextConstruct("Puppies are the greatest."));
myPhoto.setClient("myClientName");
MediaFileSource myMedia = new MediaFileSource(new
File("/home/liz/puppies.jpg"), "image/jpeg");
myPhoto.setMediaSource(myMedia);
PhotoEntry returnedPhoto = myService.insert(albumPostUrl, myPhoto);
But altered to reflect an album id in my account. When it ran, I received a
similar error to above:
A fatal error occurred, abnormal exit
com.google.gdata.util.InvalidEntryException: Bad Request
<HTML>
<HEAD>
<TITLE>Bad Request</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Bad Request</H1>
<H2>Error 400</H2>
</BODY>
</HTML>
at
com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:602)
at
com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:564)
at
com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:560)
at
com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:538)
at
com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:536)
at
com.google.gdata.client.media.MediaService.insert(MediaService.java:399)
I have reproduced this error on two different Google Photo Accounts. On both
Google Photo Accounts, I can programmatically create an album with success, and
get the album id of the new album. So I don't believe I am experiencing an
OAuth Authentication issue.
The version of google libraries I am using related to Google Photos are:
<dependency>
<groupId>com.google.gdata</groupId>
<artifactId>core</artifactId>
<version>1.47.1</version>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-jackson2</artifactId>
<version>1.22.0</version>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-oauth2</artifactId>
<version>v2-rev123-1.20.0</version>
</dependency>
What might have changed between 1/27/2017 2:30 AM CST and 1/28/2017 2:30 AM CST
preventing the uploading of images to Google Photos, even with Java code that
exactly replicates sample code from your Developers Guide?
Thanks,
Christian
--
You received this message because you are subscribed to the Google Groups
"Google Picasa Web Albums API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-picasa-data-api.
For more options, visit https://groups.google.com/d/optout.