// Copyright (C) 2012 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.googlesource.gerrit.plugins.branchnetwork.data.json;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;

public class Commit  {

    private String author;
    private List<Parent> parents = new ArrayList<Parent>();
    private int time;
    private String date;
    private String id;
    private int space;
    private String email;
    private String message;
    private String gravatar;

    public String generateGravatar(String email) {
          if (email == null) {
              return null;
          }

          try {
              MessageDigest m = MessageDigest.getInstance("MD5");
              m.update(email.toLowerCase().getBytes());
              BigInteger i = new BigInteger(1, m.digest());
              return String.format("%1$032x", i);
          } catch (NoSuchAlgorithmException e) {
            return null;
          }
    }

    public String getAuthor() {
        return author;
    }

    public List<Parent> getParents() {
        return parents;
    }

    public int getTime() {
        return time;
    }

    public String getDate() {
        return date;
    }

    public String getId() {
        return id;
    }

    public int getSpace() {
        return space;
    }

    public String getEmail() {
        return email;
    }

    public String getMessage() {
        return message;
    }

    public void addParent(Parent parent) {
        this.parents.add(parent);
    }


    public void setAuthor(String author) {
        this.author = author;
    }

    public void setParents(List<Parent> parents) {
        this.parents = parents;
    }

    public void setTime(int time) {
        this.time = time;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public void setId(String id) {
        this.id = id;
    }

    public void setSpace(int space) {
        this.space = space;
    }

    public void setEmail(String email) {
        this.email = email;
        this.gravatar = generateGravatar(email);
    }

    public void setMessage(String message) {
        this.message = message;
    }

    @Override
    public String toString() {
    return id + " (" + date + ")";
    }

}

@@ -671,120 +671,8 @@
 n;%0A%0A
-import java.math.BigInteger;%0Aimport java.security.MessageDigest;%0Aimport java.security.NoSuchAlgorithmException;%0A
 impo
@@ -980,500 +980,8 @@
 age;
-%0A    private String gravatar;%0A%0A    public String generateGravatar(String email) %7B%0A          if (email == null) %7B%0A              return null;%0A          %7D%0A%0A          try %7B%0A              MessageDigest m = MessageDigest.getInstance(%22MD5%22);%0A              m.update(email.toLowerCase().getBytes());%0A              BigInteger i = new BigInteger(1, m.digest());%0A              return String.format(%22%251$032x%22, i);%0A          %7D catch (NoSuchAlgorithmException e) %7B%0A            return null;%0A          %7D%0A    %7D
 %0A%0A  
@@ -2064,57 +2064,8 @@
 il;%0A
-        this.gravatar = generateGravatar(email);%0A
     

Remove unused gravatar member from Commit class