Java Google Drive SDK SocketTimeoutException on File.insert.execute -
i have been using google drive sdk in both java , objective-c months , today (jul 10, 2013) inserting new files using java api (google-api-client-1.15.0-rc.jar & version 1.14) failing execute on fileinsert.execute(). here static helper method i've been using (basically copy dredit tutorials):
public static file insertfile(drive driveservice, string title, string description, string parentid, string mimetype, java.io.file content) { system.out.println("<gdrive insertfile> start"); file body = new file(); body.settitle(title); body.setdescription(description); body.setmimetype(mimetype); if (parentid != null && parentid.length() > 0) { body.setparents( arrays.aslist(new parentreference().setid(parentid)) ); } insert fileinsert = null; system.out.println("<gdrive insertfile> before content attache"); if (content != null && content.length() > 0) { filecontent mediacontent = new filecontent(mimetype, content); try { fileinsert = driveservice.files().insert(body, mediacontent); } catch (ioexception e) { e.printstacktrace(); } } else { try { fileinsert = driveservice.files().insert(body); } catch (ioexception e) { e.printstacktrace(); } } try { if (fileinsert != null) { system.out.println("<gdrive insertfile> before execute"); file file = fileinsert.execute(); system.out.println("<gdrive insertfile> file posted " + file.getid()); return file; } else return null; } catch (ioexception e) { system.out.println("an error occured: " + e); return null; } }
obviously system.out used locate issue, hangs on "before execute". haven't been able find posts google server issues or changes in how api used. here error message logged when app fails time after 20 - 180 seconds:
an error occured: java.net.sockettimeoutexception: read timed out exception in thread "main" java.lang.nullpointerexception
thanks.
Comments
Post a Comment