List of usage examples for java.net ProtocolException getLocalizedMessage
public String getLocalizedMessage()
From source file:com.salesmanBuddy.dao.JDBCSalesmanBuddyDAO.java
public GoogleUserInfo getGoogleUserInfo(String token) throws GoogleUserInfoException { URL url;// w w w .ja v a 2 s .c o m byte[] body = null; JSONObject json = null; String whatItHas = ""; try { url = new URL(GoogleUserEndpoint); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setRequestMethod("GET"); conn.setRequestProperty("Authorization", token); whatItHas = conn.getRequestProperty("Authorization"); body = IOUtils.toByteArray(conn.getInputStream()); json = new JSONObject(new String(body)); } catch (ProtocolException pe) { throw new RuntimeException("protocolExceptions: " + pe.getLocalizedMessage()); } catch (MalformedURLException e) { throw new RuntimeException("malformedUrlException: " + e.getLocalizedMessage()); } catch (IOException e) { throw new RuntimeException("IOException: " + e.getLocalizedMessage() + ", token:" + token + ", auth:" + whatItHas + ", json: " + json + ", e: " + e); } catch (JSONException jse) { throw new RuntimeException("JSONException: " + jse.getLocalizedMessage()); } GoogleUserInfo gui = new GoogleUserInfo(json); return gui; }