package awesomefb;

import com.mongodb.BasicDBObject;
import org.json.JSONObject;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;


/**
 * Created by earl on 5/25/2015.
 */
public class Post {
    private String mMessage;
    private User mCreator;
    private Date mCreatedTime;
    private CommentsList mCommentsList;

    public Post(JSONObject post) {
        mMessage = post.getString("message");
        mCreator = new User(post.getJSONObject("from"));
        DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
        try {
            mCreatedTime = format.parse(post.getString("created_time"));
        } catch (ParseException e) {
            System.out.println(e.toString());
        }
        mCommentsList = new CommentsList(post.getJSONObject("comments").getJSONArray("data"));
    }

    public BasicDBObject toDBObject() {
        BasicDBObject doc = new BasicDBObject("message", mMessage)
                .append("creator", mCreator.toDBObject())
                .append("time", mCreatedTime)
                .append("comments", mCommentsList.toDBObject());
        return doc;
    }
}

@@ -521,24 +521,240 @@
 t(%22from%22));%0A
+        mCreatedTime = parseTime(post.getString(%22created_time%22));%0A        mCommentsList = new CommentsList(post.getJSONObject(%22comments%22).getJSONArray(%22data%22));%0A    %7D%0A%0A    private Date parseTime(String dateString) %7B%0A
         Date
@@ -839,33 +839,30 @@
             
-mCreatedT
+Date t
 ime = format
@@ -872,39 +872,44 @@
 rse(
-post.getString(%22created_
+dateString);%0A            return 
 time
-%22))
 ;%0A  
@@ -1011,93 +1011,19 @@
     
-mCommentsList = new CommentsList(post.getJSONObject(%22comments%22).getJSONArray(%22data%22))
+return null
 ;%0A  

Move statements to parseTime method