Buggy code:
public class ForrstAPIClient implements ForrstAPI { private static HttpRequest http ; public ForrstAPIClient ( ) { } public Stat stats ( ) { } public JSONObject notifications ( String accessToken , Map < String , String > options ) { } public Auth usersAuth ( String emailOrUsername , String password ) throws ForrstAuthenticationException { } public User usersInfo ( Map < String , String > userInfo ) { } public List < Post > userPosts ( Map < String , String > userInfo , Map < String , String > options ) { List < Post > posts = new ArrayList < Post > ( ) ; Map < String , String > params = new HashMap < String , String > ( ) ; if ( userInfo . containsKey ( "id" ) ) params . put ( "id" , userInfo . get ( "id" ) ) ; if ( userInfo . containsKey ( "username" ) ) params . put ( "username" , userInfo . get ( "username" ) ) ; if ( options != null ) { if ( options . containsKey ( "type" ) ) params . put ( "type" , options . get ( "type" ) ) ; if ( options . containsKey ( "limit" ) ) params . put ( "limit" , options . get ( "limit" ) ) ; if ( options . containsKey ( "after" ) ) params . put ( "after" , options . get ( "after" ) ) ; } try { JSONObject json = ForrstAPIClient . http . get ( Endpoint . getInstance ( ) . USER_POSTS_URI , params ) ; JSONArray postsJsonArray = ( ( JSONArray ) ( json . get ( "posts" ) ) ) ; for ( int i = 0 ; i < ( postsJsonArray . length ( ) ) ; i ++ ) { Post post = new Post ( ) ; Photo photo = new Photo ( ) ; User user = new User ( ) ; Snap snap = new Snap ( ) ; JSONObject postJson = ( ( JSONObject ) ( postsJsonArray . get ( i ) ) ) ; JSONObject userJson = postJson . getJSONObject ( "user" ) ; JSONObject photoJson = userJson . getJSONObject ( "photos" ) ; photo . setXlUrl ( photoJson . getString ( "xl_url" ) ) ; photo . setLargeUrl ( photoJson . getString ( "large_url" ) ) ; photo . setMediumUrl ( photoJson . getString ( "medium_url" ) ) ; photo . setSmallUrl ( photoJson . getString ( "small_url" ) ) ; photo . setThumbUrl ( photoJson . getString ( "thumb_url" ) ) ; user . setId ( userJson . getInt ( "id" ) ) ; user . setName ( userJson . getString ( "name" ) ) ; user . setUsername ( userJson . getString ( "username" ) ) ; user . setUrl ( userJson . getString ( "url" ) ) ; user . setPosts ( userJson . getInt ( "posts" ) ) ; user . setLikes ( userJson . getInt ( "likes" ) ) ; user . setComments ( userJson . getInt ( "comments" ) ) ; user . setFollowers ( userJson . getInt ( "followers" ) ) ; user . setFollowing ( userJson . getInt ( "following" ) ) ; user . setPhoto ( photo ) ; user . setBio ( userJson . getString ( "bio" ) ) ; user . setIsA ( userJson . getString ( "is_a" ) ) ; user . setHomepageUrl ( userJson . getString ( "homepage_url" ) ) ; user . setTwitter ( userJson . getString ( "twitter" ) ) ; user . setInDirectory ( userJson . getBoolean ( "in_directory" ) ) ; user . setTagString ( userJson . getString ( "tag_string" ) ) ; <START_BUG> if ( json . has ( "snaps" ) ) { <END_BUG> JSONObject snapJson = postJson . getJSONObject ( "snaps" ) ; snap . setKeithUrl ( snapJson . getString ( "keith_url" ) ) ; snap . setLargeUrl ( snapJson . getString ( "large_url" ) ) ; snap . setMediumUrl ( snapJson . getString ( "medium_url" ) ) ; snap . setMegaUrl ( snapJson . getString ( "mega_url" ) ) ; snap . setOriginalUrl ( snapJson . getString ( "original_url" ) ) ; snap . setSmallUrl ( snapJson . getString ( "small_url" ) ) ; snap . setThumbUrl ( snapJson . getString ( "thumb_url" ) ) ; post . setSnap ( snap ) ; } post . setId ( postJson . getInt ( "id" ) ) ; post . setTinyId ( postJson . getString ( "tiny_id" ) ) ; post . setPostType ( postJson . getString ( "post_type" ) ) ; post . setPostUrl ( postJson . getString ( "post_url" ) ) ; post . setCreatedAt ( postJson . getString ( "created_at" ) ) ; post . setUpdatedAt ( postJson . getString ( "updated_at" ) ) ; post . setUser ( user ) ; post . setPublished ( postJson . getBoolean ( "published" ) ) ; post . setPublic ( postJson . getBoolean ( "public" ) ) ; post . setTitle ( postJson . getString ( "title" ) ) ; post . setUrl ( postJson . getString ( "url" ) ) ; post . setContent ( postJson . getString ( "content" ) ) ; post . setDescription ( postJson . getString ( "description" ) ) ; post . setViewCount ( postJson . getInt ( "view_count" ) ) ; post . setLikeCount ( postJson . getInt ( "like_count" ) ) ; post . setCommentCount ( postJson . getInt ( "comment_count" ) ) ; post . setTagString ( postJson . getString ( "tag_string" ) ) ; posts . add ( post ) ; } } catch ( JSONException e ) { throw new RuntimeException ( "Error<seq2seq4repair_space>fetching<seq2seq4repair_space>users<seq2seq4repair_space>posts" , e ) ; } return posts ; } public Post postsShow ( int id ) { } public JSONObject postsAll ( Map < String , String > options ) { }

Fix:
if ( postJson . has ( "snaps" ) ) {