SilverHoodCorp / gdata-java-client

Automatically exported from code.google.com/p/gdata-java-client
Apache License 2.0
0 stars 0 forks source link

DocumentListEntry.updateMedia() exception: Media cannot be updated #170

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use code from "Replacing a document's content" guide at
http://code.google.com/apis/documents/docs/2.0/developers_guide_java.html#Updati
ngReplaceContent

What is the expected output? What do you see instead?
java.lang.UnsupportedOperationException: Media cannot be updated
at com.google.gdata.data.media.MediaEntry.updateMedia(MediaEntry.java:151)

What version of the product are you using? On what operating system?
GDocs-Java/2.0.1 GData-Java/1.35.1(gzip)

Please provide any additional information below.
The code worked 2 days ago, now throwing exception, I tried several
document types - .doc, .xls all of them throwing exception.
I noticed that gdata-java-client version 1.35.1 just came out 2 days ago -
was server codebase broken in this release? I tried the code with 1.35.1 as
well (originally code was working with 1.35 up to 2 days ago) and exception
is still there.

Original issue reported on code.google.com by blpha...@gmail.com on 13 Aug 2009 at 2:22

GoogleCodeExporter commented 9 years ago
I have same problem, here is my code:

DocsService myService = new DocsService("my-id-here");
myService.setUserCredentials("my-email", "my-password");
System.out.println("Logged in google: "+myService.getServiceVersion());
URL docsFeedURL = new
URL("http://docs.google.com/feeds/folders/private/full/folder:my-folder-id-here"
);
DocumentListEntry documentEntry = new DocumentListEntry();
documentEntry.setFile(new File("test.txt"), "text/plain");
documentEntry.setTitle(new PlainTextConstruct("test.txt"));
documentEntry = myService.insert(docsFeedURL, documentEntry);
System.out.println("File uploaded: "+documentEntry.getResourceId());
myService.getRequestFactory().setHeader("If-Match", "*");
documentEntry.setMediaSource(new MediaByteArraySource("updated 
content".getBytes(),
"text/plain"));
documentEntry.updateMedia(false);
System.out.println("File updated: "+documentEntry.getResourceId());

Here is output:

Logged in google: GDocs-Java/2.0.1 GData-Java/1.35.1(gzip)
File uploaded: document:0AS15q5biv9gkZGdqcms2d3FfMmdwYnpmc2R2
java.lang.UnsupportedOperationException: Media cannot be updated
at com.google.gdata.data.media.MediaEntry.updateMedia(MediaEntry.java:151)
.....

Original comment by ka3a...@gmail.com on 13 Aug 2009 at 7:01

GoogleCodeExporter commented 9 years ago
I'm checking with the Eng team on this.  Will get back to you as soon as we 
confirm
this issue.  

FYI: This forum issue tracker is not monitored actively (with respect to server 
side
issues).  Please check 
http://groups.google.com/group/Google-Docs-Data-APIs?pli=1 for
any known issues, or use that forum for any Documents Data API issues.

Original comment by vbarat...@gmail.com on 24 Aug 2009 at 5:58

GoogleCodeExporter commented 9 years ago
I couldnt reproduce on our end.  Can you confirm if this still an issue?

Original comment by vbarat...@gmail.com on 26 Aug 2009 at 2:18

GoogleCodeExporter commented 9 years ago
I'm using the google calendar api and I'm getting the same exception:
java.lang.UnsupportedOperationException: Entry cannot be updated

Is there any update on this?

Original comment by boven....@gmail.com on 24 Sep 2009 at 5:41

GoogleCodeExporter commented 9 years ago
i have similar problem about updating the position of a media in a playlist, 
using 
gdata-core-1.0: 

my code:
String videoEntryUrl = "http://gdata.youtube.com/feeds/api/videos/AWpsOqh8q0M";
VideoEntry videoEntry = service.getEntry(new URL(videoEntryUrl), 
VideoEntry.class);

PlaylistEntry playlistEntry = new PlaylistEntry(videoEntry);
service.insert(new URL(playlistUrl), playlistEntry);    

playlistEntry.setPosition(0);
playlistEntry.update();

Exception:
Exception in thread "main" java.lang.UnsupportedOperationException: Entry 
cannot 
be updated
    at com.google.gdata.data.BaseEntry.update(BaseEntry.java:613)

Original comment by babulous...@gmail.com on 12 Mar 2010 at 5:47