{"action":"created","issue":{"url":"https://api.github.com/repos/google/gdata-java-client/issues/123","labels_url":"https://api.github.com/repos/google/gdata-java-client/issues/123/labels{/name}","comments_url":"https://api.github.com/repos/google/gdata-java-client/issues/123/comments","events_url":"https://api.github.com/repos/google/gdata-java-client/issues/123/events","html_url":"https://github.com/google/gdata-java-client/issues/123","id":66728259,"number":123,"title":"RedirectRequiredException running CalendarTest sample","user":{"login":"GoogleCodeExporter","id":9614759,"avatar_url":"https://avatars.githubusercontent.com/u/9614759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCodeExporter","html_url":"https://github.com/GoogleCodeExporter","followers_url":"https://api.github.com/users/GoogleCodeExporter/followers","following_url":"https://api.github.com/users/GoogleCodeExporter/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCodeExporter/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCodeExporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCodeExporter/subscriptions","organizations_url":"https://api.github.com/users/GoogleCodeExporter/orgs","repos_url":"https://api.github.com/users/GoogleCodeExporter/repos","events_url":"https://api.github.com/users/GoogleCodeExporter/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCodeExporter/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/google/gdata-java-client/labels/auto-migrated","name":"auto-migrated","color":"ededed"},{"url":"https://api.github.com/repos/google/gdata-java-client/labels/Priority-Medium","name":"Priority-Medium","color":"ededed"},{"url":"https://api.github.com/repos/google/gdata-java-client/labels/Type-Defect","name":"Type-Defect","color":"ededed"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-04-06T23:15:41Z","updated_at":"2015-06-17T20:05:58Z","closed_at":"2015-04-06T23:15:41Z","body":"```\nWhat steps will reproduce the problem?\n1. Install gdata (and prereqs) for Java\n2. Run sample calendar test found at\nhttp://code.google.com/apis/gdata/articles/java_client_lib.html#helloworld\n3.\n\nWhat is the expected output? What do you see instead?\nExpect a list of Calendar names.  Get an exception of the form:\n\nException in thread \"main\" com.google.gdata.util.RedirectRequiredException:\nMoved Temporarily\n<HTML>\n<HEAD>\n<TITLE>Moved Temporarily</TITLE>\n</HEAD>\n<BODY BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\">\n<H1>Moved Temporarily</H1>\nThe document has moved <A\nHREF=\"http://www.google.com/calendar/feeds/default/allcalendars/full?gsessionid=\nxxxxsessionidxxxx\">here</A>.\n</BODY>\n</HTML>\n\n\tat\ncom.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataR\nequest.java:560)\n\tat\ncom.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.jav\na:481)\n\tat\ncom.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:460)\n\tat\ncom.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:\n534)\n\tat com.google.gdata.client.Service.getFeed(Service.java:962)\n\tat com.google.gdata.client.Service.getFeed(Service.java:819)\n\tat com.google.gdata.client.GoogleService.getFeed(GoogleService.java:600)\n\tat com.google.gdata.client.Service.getFeed(Service.java:838)\n\tat CalTest.main(CalTest.java:23)\n\n\nWhat version of the product are you using? On what operating system?\nGData v1.30.0\nMac OS X 10.5.6\n\nPlease provide any additional information below.\nWhile it is true that the example mentions it has no exception handling it\nis a bit of an obstacle for first-timers to have to hunt down how to deal\nwith a redirect.  Other than this wart, the getting started section got me\nup and running very smoothly.  Something like the following worked for me:\n\n    public static void main(String[] args) throws IOException, ServiceException\n    {\n        CalendarService cs = new CalendarService(\"sample\");\n        cs.setUserCredentials(\"username@gmail.com\", \"password\");\n        \n        URL feedUrl = new\nURL(\"http://google.com/calendar/feeds/default/allcalendars/full\");\n\n        CalendarFeed feed = null;\n        try\n        {\n            feed = cs.getFeed(feedUrl, CalendarFeed.class);\n        }\n        catch (RedirectRequiredException re)\n        {\n            feedUrl = new URL(re.getRedirectLocation());\n            feed = cs.getFeed(feedUrl, CalendarFeed.class);\n        }\n        \n        for (CalendarEntry entry : feed.getEntries())\n        {\n            System.out.println(entry.getTitle().getPlainText());\n        }\n    }\n\n\n\n```\n\nOriginal issue reported on code.google.com by `michael....@gmail.com` on 13 Apr 2009 at 2:49"},"comment":{"url":"https://api.github.com/repos/google/gdata-java-client/issues/comments/112930968","html_url":"https://github.com/google/gdata-java-client/issues/123#issuecomment-112930968","issue_url":"https://api.github.com/repos/google/gdata-java-client/issues/123","id":112930968,"user":{"login":"er1c","id":64685,"avatar_url":"https://avatars.githubusercontent.com/u/64685?v=3","gravatar_id":"","url":"https://api.github.com/users/er1c","html_url":"https://github.com/er1c","followers_url":"https://api.github.com/users/er1c/followers","following_url":"https://api.github.com/users/er1c/following{/other_user}","gists_url":"https://api.github.com/users/er1c/gists{/gist_id}","starred_url":"https://api.github.com/users/er1c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/er1c/subscriptions","organizations_url":"https://api.github.com/users/er1c/orgs","repos_url":"https://api.github.com/users/er1c/repos","events_url":"https://api.github.com/users/er1c/events{/privacy}","received_events_url":"https://api.github.com/users/er1c/received_events","type":"User","site_admin":false},"created_at":"2015-06-17T20:05:58Z","updated_at":"2015-06-17T20:05:58Z","body":"I'm now getting a similar error:\r\n\r\n    fm.util.GoogleDocs  -  Calling GoogleDocs API...\r\n    fm.util.GoogleDocs  -  Google Docs Export: https://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=0Ai7IYcrzwmCMdFloak50NGN5cmZlWkVqbXRYMmR2aXc&gid=0&exportFormat=tsv\r\n    fm.util.GoogleDocs  -  Caught unhandled exception: com.google.gdata.util.RedirectRequiredException: Moved Temporarily\r\n    <HTML>\r\n    <HEAD>\r\n    <TITLE>Moved Temporarily</TITLE>\r\n    </HEAD>\r\n    <BODY BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\">\r\n    <H1>Moved Temporarily</H1>\r\n    The document has moved <A HREF=\"https://docs.google.com/a/frugalmechanic.com/spreadsheets/d/1HJ-wP0oEPMP9Kz1f17wOabbfXhsqkgk0hHGoBEVmrX8/export?gid=0&amp;exportFormat=tsv\">here</A>.\r\n    </BODY>\r\n    </HTML>\r\n\r\nIf I try/catch the RedirectRequiredException I get a cookie error:\r\n\r\n    fm.util.GoogleDocs  -  Calling GoogleDocs API...\r\n    fm.util.GoogleDocs  -  Google Docs Export: https://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=0Ai7IYcrzwmCMdFloak50NGN5cmZlWkVqbXRYMmR2aXc&gid=0&exportFormat=tsv\r\n    fm.util.GoogleDocs  -  Google Docs Export: https://docs.google.com/a/frugalmechanic.com/spreadsheets/d/1HJ-wP0oEPMP9Kz1f17wOabbfXhsqkgk0hHGoBEVmrX8/export?gid=0&exportFormat=tsv\r\n    fm.util.GoogleDocs  -  Caught unhandled exception: java.lang.IllegalArgumentException: Trying to set foreign cookie\r\n    fm.util.GoogleDocs  -  Retrying: Calling GoogleDocs API\r\n\r\n\r\n    def makeRequest(url: URL): String = {\r\n      val request = service.createEntryRequest(url)\r\n\r\n      try {\r\n        logger.info(\"Google Docs Export: \"+url)\r\n        request.execute()\r\n        InputStreamResource(request.getResponseStream()).readToString(\"UTF-8\")\r\n      } catch {\r\n        case e: com.google.gdata.util.RedirectRequiredException => makeRequest(new URL(e.getRedirectLocation))\r\n      } finally {\r\n        request.end()\r\n      }\r\n    }\r\n\r\n\r\nThoughts?"}}