List of usage examples for java.net MalformedURLException toString
public String toString()
From source file:com.easy.facebook.android.apicall.GraphApi.java
public Comment getComment(String commentId) throws EasyFacebookError { Bundle params = new Bundle(); params.putString("format", "json"); params.putString("access_token", facebook.getAccessToken()); String jsonResponse;/*w w w . ja va 2s .c om*/ try { jsonResponse = Util.openUrl("https://graph.facebook.com/" + commentId, "GET", params); JSONObject objectJSONErrorCheck = new JSONObject(jsonResponse); if (!objectJSONErrorCheck.isNull("error")) { throw new EasyFacebookError(jsonResponse); } JSONSingleObjectDecode objectjson = new JSONSingleObjectDecode(); return objectjson.getComment(jsonResponse); } catch (MalformedURLException e) { throw new EasyFacebookError(e.toString(), "MalformedURLException"); } catch (IOException e) { throw new EasyFacebookError(e.toString(), "IOException"); } catch (JSONException e) { throw new EasyFacebookError(e.toString(), "JSONException"); } }
From source file:com.easy.facebook.android.apicall.GraphApi.java
public Events getEvent(String eventId) throws EasyFacebookError { Bundle params = new Bundle(); params.putString("format", "json"); params.putString("access_token", facebook.getAccessToken()); try {/*from www . j a va 2s.co m*/ String jsonResponse = Util.openUrl("https://graph.facebook.com/" + eventId, "GET", params); JSONSingleObjectDecode objectjson = new JSONSingleObjectDecode(); JSONObject objectJSONErrorCheck = new JSONObject(jsonResponse); if (!objectJSONErrorCheck.isNull("error")) { throw new EasyFacebookError(jsonResponse); } return objectjson.getEvent(jsonResponse); } catch (MalformedURLException e) { throw new EasyFacebookError(e.toString(), "MalformedURLException"); } catch (IOException e) { throw new EasyFacebookError(e.toString(), "IOException"); } catch (JSONException e) { throw new EasyFacebookError(e.toString(), "JSONException"); } }
From source file:com.easy.facebook.android.apicall.GraphApi.java
public Group getGroup(String groupId) throws EasyFacebookError { Bundle params = new Bundle(); params.putString("format", "json"); params.putString("access_token", facebook.getAccessToken()); String jsonResponse;/*from w w w.j av a2 s . com*/ try { jsonResponse = Util.openUrl("https://graph.facebook.com/" + groupId, "GET", params); JSONObject objectJSONErrorCheck = new JSONObject(jsonResponse); if (!objectJSONErrorCheck.isNull("error")) { throw new EasyFacebookError(jsonResponse); } JSONSingleObjectDecode objectjson = new JSONSingleObjectDecode(); return objectjson.getGroup(jsonResponse); } catch (MalformedURLException e) { throw new EasyFacebookError(e.toString(), "MalformedURLException"); } catch (IOException e) { throw new EasyFacebookError(e.toString(), "IOException"); } catch (JSONException e) { throw new EasyFacebookError(e.toString(), "JSONException"); } }
From source file:com.easy.facebook.android.apicall.GraphApi.java
public Message getMessage(String messageID) throws EasyFacebookError { Bundle params = new Bundle(); params.putString("format", "json"); params.putString("access_token", facebook.getAccessToken()); String jsonResponse;/* ww w .java2s . c o m*/ try { jsonResponse = Util.openUrl("https://graph.facebook.com/" + messageID, "GET", params); JSONSingleObjectDecode objectjson = new JSONSingleObjectDecode(); JSONObject objectJSONErrorCheck = new JSONObject(jsonResponse); if (!objectJSONErrorCheck.isNull("error")) { throw new EasyFacebookError(jsonResponse); } return objectjson.getMessage(jsonResponse); } catch (MalformedURLException e) { throw new EasyFacebookError(e.toString(), "MalformedURLException"); } catch (IOException e) { throw new EasyFacebookError(e.toString(), "IOException"); } catch (JSONException e) { throw new EasyFacebookError(e.toString(), "JSONException"); } }
From source file:com.easy.facebook.android.apicall.GraphApi.java
public Page getPage(String pageId) throws EasyFacebookError { Bundle params = new Bundle(); params.putString("format", "json"); params.putString("access_token", facebook.getAccessToken()); String jsonResponse;/*from w w w . j a va2 s . c o m*/ try { jsonResponse = Util.openUrl("https://graph.facebook.com/" + pageId, "GET", params); JSONSingleObjectDecode objectjson = new JSONSingleObjectDecode(); JSONObject objectJSONErrorCheck = new JSONObject(jsonResponse); if (!objectJSONErrorCheck.isNull("error")) { throw new EasyFacebookError(jsonResponse); } return objectjson.getPage(jsonResponse); } catch (MalformedURLException e) { throw new EasyFacebookError(e.toString(), "MalformedURLException"); } catch (IOException e) { throw new EasyFacebookError(e.toString(), "IOException"); } catch (JSONException e) { throw new EasyFacebookError(e.toString(), "JSONException"); } }
From source file:com.easy.facebook.android.apicall.GraphApi.java
private User getUserCall(String friendID) throws EasyFacebookError { Bundle params = new Bundle(); params.putString("format", "json"); params.putString("access_token", facebook.getAccessToken()); if (friendID == null) friendID = "me"; String jsonResponse;/*from ww w . ja va 2s . co m*/ try { jsonResponse = Util.openUrl("https://graph.facebook.com/" + friendID, "GET", params); JSONObject objectJSONErrorCheck = new JSONObject(jsonResponse); if (!objectJSONErrorCheck.isNull("error")) { throw new EasyFacebookError(jsonResponse); } JSONSingleObjectDecode objectjson = new JSONSingleObjectDecode(); return objectjson.getUser(jsonResponse); } catch (MalformedURLException e) { throw new EasyFacebookError(e.toString(), "MalformedURLException"); } catch (IOException e) { throw new EasyFacebookError(e.toString(), "IOException"); } catch (JSONException e) { throw new EasyFacebookError(e.toString(), "JSONException"); } }
From source file:com.easy.facebook.android.apicall.GraphApi.java
private String createAlbumCall(String albumName, String description, String location) throws EasyFacebookError { String albumID = ""; Bundle params = new Bundle(); params.putString("format", "json"); params.putString("access_token", facebook.getAccessToken()); params.putString("name", albumName); params.putString("message", description); params.putString("location", location); String jsonResponse;/*from w w w. j a v a 2 s. co m*/ try { jsonResponse = Util.openUrl("https://graph.facebook.com/me/albums", "POST", params); JSONObject objectJSONErrorCheck = new JSONObject(jsonResponse); if (!objectJSONErrorCheck.isNull("error")) { throw new EasyFacebookError(jsonResponse); } JSONObject json = new JSONObject(jsonResponse); if (json.has("id")) albumID = json.get("id").toString(); } catch (MalformedURLException e) { throw new EasyFacebookError(e.toString(), "MalformedURLException"); } catch (IOException e) { throw new EasyFacebookError(e.toString(), "IOException"); } catch (JSONException e) { throw new EasyFacebookError(e.toString(), "JSONException"); } return albumID; }
From source file:com.easy.facebook.android.apicall.GraphApi.java
public String commetReply(String message, String commentID) throws EasyFacebookError { String postID = null;/*from www . j a va 2 s. c om*/ Bundle params = new Bundle(); params.putString("format", "json"); params.putString("access_token", facebook.getAccessToken()); params.putString("message", message); try { String jsonResponse = Util.openUrl("https://graph.facebook.com/" + commentID + "/comments", "POST", params); JSONObject objectJSONErrorCheck = new JSONObject(jsonResponse); if (!objectJSONErrorCheck.isNull("error")) { throw new EasyFacebookError(jsonResponse); } JSONObject json = new JSONObject(jsonResponse); if (json.has("id")) postID = json.get("id").toString(); } catch (MalformedURLException e) { throw new EasyFacebookError(e.toString(), "MalformedURLException"); } catch (IOException e) { throw new EasyFacebookError(e.toString(), "IOException"); } catch (JSONException e) { throw new EasyFacebookError(e.toString(), "JSONException"); } return postID; }
From source file:com.easy.facebook.android.apicall.GraphApi.java
private String noteCall(String message, String subject, String friendID) throws EasyFacebookError { String postID = null;// ww w. j a v a 2 s .c o m Bundle params = new Bundle(); params.putString("format", "json"); params.putString("access_token", facebook.getAccessToken()); params.putString("message", message); params.putString("subject", subject); if (friendID == null) friendID = "me"; try { String jsonResponse = Util.openUrl("https://graph.facebook.com/" + friendID + "/notes", "POST", params); JSONObject objectJSONErrorCheck = new JSONObject(jsonResponse); if (!objectJSONErrorCheck.isNull("error")) { throw new EasyFacebookError(jsonResponse); } JSONObject json = new JSONObject(jsonResponse); if (json.has("id")) postID = json.get("id").toString(); } catch (MalformedURLException e) { throw new EasyFacebookError(e.toString(), "MalformedURLException"); } catch (IOException e) { throw new EasyFacebookError(e.toString(), "IOException"); } catch (JSONException e) { throw new EasyFacebookError(e.toString(), "JSONException"); } return postID; }
From source file:com.easy.facebook.android.apicall.GraphApi.java
private String uploadPhotoCall(String message, String friendIDorAlbumID, String urlPicture) throws EasyFacebookError { String postID = null;/*w w w . j a v a2 s .c o m*/ Bundle params = new Bundle(); params.putString("format", "json"); params.putString("access_token", facebook.getAccessToken()); params.putString("message", message); if (urlPicture != null) { String pictureName = urlPicture.substring(urlPicture.lastIndexOf('/'), urlPicture.length()); params.putByteArray(pictureName, Util.loadPicture(urlPicture)); } if (friendIDorAlbumID == null) friendIDorAlbumID = "me"; try { String jsonResponse = Util.openUrl("https://graph.facebook.com/" + friendIDorAlbumID + "/photos", "POST", params); JSONObject objectJSONErrorCheck = new JSONObject(jsonResponse); if (!objectJSONErrorCheck.isNull("error")) { throw new EasyFacebookError(jsonResponse); } JSONObject json = new JSONObject(jsonResponse); if (json.has("id")) postID = json.get("id").toString(); } catch (MalformedURLException e) { throw new EasyFacebookError(e.toString(), "MalformedURLException"); } catch (IOException e) { throw new EasyFacebookError(e.toString(), "IOException"); } catch (JSONException e) { throw new EasyFacebookError(e.toString(), "JSONException"); } return postID; }