SilverHoodCorp / gdata-java-client

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

Service.updateMedia does not take ETag into account #250

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Call DocsService.updateMedia() and set the ETag in the MediaStream:
  MediaStreamSource ms = new MediaStreamSource(in,mimeType);
  ms.setEtag(etag);
  service.updateMedia(new URL(mediaEditLink), DocumentListEntry.class, ms);

workaround:
  MediaStreamSource ms = new MediaStreamSource(in,mimeType);
  ms.setEtag(etag);
  service.getRequestFactory().setHeader("If-Match", etag);
  service.updateMedia(new URL(mediaEditLink), DocumentListEntry.class, ms);
  service.setHeader("If-Match", null);

What is the expected output? What do you see instead?
If the ETag matches the server version, the content should be updated.
But I see instead:
com.google.gdata.util.ServiceForbiddenException: If-Match or If-None-Match
header required

What version of the product are you using? On what operating system?
GData 1.41.0. WindowsXP.

Please provide any additional information below.
There is a signature of the DocsService.update() method that takes an ETag
as parameter. The DocsService.updateMedia() method has no such signature
since the ETag is set at the MediaStream. But while assembling the HTTP
request, the DocsService does not take the ETag set at the MediaStream into
account.

Original issue reported on code.google.com by s.k...@xaldon.de on 25 Mar 2010 at 7:45