com.google.gdata.util.ResourceNotFoundException:找不到照片

时间:2015-08-17 06:55:45

标签: java google-api google-api-java-client google-api-client google-contacts

JAVA:我正在尝试使用here提供的帮助文档上传联系人图片。我从ContactEntry contact = myService.getEntry(contactURL,ContactEntry.class)获得以下异常;线。显然它表示我们需要在调用方法之前上传照片,但我们正在上传之后。在帮助文档中,没有像这样提及。有没有人遇到过这个问题?

com.google.gdata.util.ResourceNotFoundException: Not Found
Photo not found

[12:10:25:368][17-08-2015][SYSERR][INFO][42]:   at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:591)
[12:10:25:368][17-08-2015][SYSERR][INFO][42]:   at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:563)
[12:10:25:368][17-08-2015][SYSERR][INFO][42]:   at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:552)
[12:10:25:368][17-08-2015][SYSERR][INFO][42]:   at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:530)
[12:10:25:368][17-08-2015][SYSERR][INFO][42]:   at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:535)
[12:10:25:368][17-08-2015][SYSERR][INFO][42]:   at com.google.gdata.client.Service.getEntry(Service.java:1352)
[12:10:25:368][17-08-2015][SYSERR][INFO][42]:   at com.google.gdata.client.GoogleService.getEntry(GoogleService.java:567)
[12:10:25:368][17-08-2015][SYSERR][INFO][42]:   at com.google.gdata.client.Service.getEntry(Service.java:1278)

这是我的java代码..

            ContactEntry contact = myService.getEntry(contactURL, ContactEntry.class);
            Link photoLink = contact.getContactPhotoLink();
            URL photoUrl = new URL(photoLink.getHref());
            GDataRequest request = myService.createRequest(GDataRequest.RequestType.UPDATE, photoUrl, new ContentType("image/jpeg"));
            request.setEtag(photoLink.getEtag());
            OutputStream requestStream = request.getRequestStream();
            requestStream.write(photoData);
            request.execute();

其中photoData是联系人图像的字节数组。

0 个答案:

没有答案