package com.holmsted.gerrit;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

import com.holmsted.json.JsonUtils;

public class GerritStatParser {

    public List<Commit> parseCommits(String jsonCommitData) {
        List<Commit> commits = new ArrayList<>();
        String[] lines = jsonCommitData.split("\n");
        for (String line : lines) {
            try {
                JSONObject lineJson = JsonUtils.readJsonString(line);
                if (Commit.isCommit(lineJson)) {
                    commits.add(Commit.fromJson(lineJson));
                } else {
                    // TODO ignore for now
                    System.err.println("Ignored line " + line);
                }
            } catch (JSONException ex) {
                System.err.println(String.format("Not JsonObject: '%s'", line));
            }
        }

        return commits;
    }
}

@@ -623,59 +623,136 @@
     
-%7D else %7B%0A                    // TODO ignore for now
+// ignore the stats, log the rest in case the format changes%0A                %7D else if (!lineJson.get(%22type%22).equals(%22stats%22)) %7B
 %0A   

Remove the noisy "Ignored line" messages for stats that are not used