Permalink
Browse files

TFJ-669 method name refactor

  • Loading branch information...
1 parent bbc525b commit 6a3f7174054845bdc9865035959737d78bc98f2a @yusuke committed Jul 10, 2012
Showing with 6 additions and 5 deletions.
  1. +6 −5 twitter4j-core/src/main/java/twitter4j/internal/json/MediaEntityJSONImpl.java
@@ -80,10 +80,11 @@ public MediaEntityJSONImpl(JSONObject json) throws TwitterException {
}
JSONObject sizes = json.getJSONObject("sizes");
this.sizes = new HashMap<Integer, MediaEntity.Size>(4);
- addSize(this.sizes, sizes, MediaEntity.Size.LARGE, "large");
- addSize(this.sizes, sizes, MediaEntity.Size.MEDIUM, "medium");
- addSize(this.sizes, sizes, MediaEntity.Size.SMALL, "small");
- addSize(this.sizes, sizes, MediaEntity.Size.THUMB, "thumb");
+ // thumbworkarounding API side issue
+ addMediaEntitySizeIfNotNull(this.sizes, sizes, MediaEntity.Size.LARGE, "large");
+ addMediaEntitySizeIfNotNull(this.sizes, sizes, MediaEntity.Size.MEDIUM, "medium");
+ addMediaEntitySizeIfNotNull(this.sizes, sizes, MediaEntity.Size.SMALL, "small");
+ addMediaEntitySizeIfNotNull(this.sizes, sizes, MediaEntity.Size.THUMB, "thumb");
if (!json.isNull("type")) {
this.type = json.getString("type");
}
@@ -92,7 +93,7 @@ public MediaEntityJSONImpl(JSONObject json) throws TwitterException {
}
}
- private void addSize(Map<Integer, MediaEntity.Size> sizes, JSONObject sizes_json, Integer size, String key) throws JSONException {
+ private void addMediaEntitySizeIfNotNull(Map<Integer, MediaEntity.Size> sizes, JSONObject sizes_json, Integer size, String key) throws JSONException {
JSONObject size_json = sizes_json.optJSONObject(key);
if(size_json != null) {
sizes.put(size, new Size(size_json));

0 comments on commit 6a3f717

Please sign in to comment.