nus-yam/ex-repair huggingface dataset:
Program: 99165
Project: 99165
Buggy source:
public void onRoundChanged(int round,int maxRound){
  if (round > maxRound) {
    if (scoreManager.getLeftScore() > scoreManager.getRightScore())     JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),namesManager.getLeftName() + "String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE);
 else     if (scoreManager.getLeftScore() < scoreManager.getRightScore())     JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),namesManager.getRightName() + "String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE);
 else     JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),"String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE);
    ScoreManagerSingleton.getInstance().newGame();
  }
}

Fixed version (ground truth):
public void onRoundChanged(int round,int maxRound){
  if (round > maxRound) {
    String leftName=namesManager.getLeftName();
    if (leftName == null || leftName.equals("String_Node_Str"))     leftName="String_Node_Str";
    String rightName=namesManager.getRightName();
    if (rightName == null || rightName.equals("String_Node_Str"))     rightName="String_Node_Str";
    if (scoreManager.getLeftScore() > scoreManager.getRightScore())     JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),leftName + "String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE);
 else     if (scoreManager.getLeftScore() < scoreManager.getRightScore())     JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),rightName + "String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE);
 else     JOptionPane.showMessageDialog(JOptionPane.getRootFrame(),"String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE);
    ScoreManagerSingleton.getInstance().newGame();
  }
}
Program: 99166
Project: 99166
Buggy source:
public void update(Observable o,Object arg){
  if (arg != null) {
    if (arg instanceof AnswerSide) {
switch ((AnswerSide)arg) {
case LEFT:
        selectSingleScorePanel(true);
      break;
case RIGHT:
    selectSingleScorePanel(false);
  break;
}
}
 else if (arg instanceof GameState) {
if (arg == GameState.FINISHED || arg == GameState.RUNNING) removeSelection();
}
 else if (arg instanceof NamesChangedEvent) {
setNames(((NamesChangedEvent)arg).getLeftName(),((NamesChangedEvent)arg).getRightName());
}
}
 else {
switch (ScoreManagerSingleton.getInstance().getAnswerSide()) {
case LEFT:
leftScorePanel.setScore(ScoreManagerSingleton.getInstance().getLeftScore());
break;
case RIGHT:
rightScorePanel.setScore(ScoreManagerSingleton.getInstance().getRightScore());
break;
}
}
}

Fixed version (ground truth):
public void update(Observable o,Object arg){
  if (arg != null) {
    if (arg instanceof AnswerSide) {
switch ((AnswerSide)arg) {
case LEFT:
        selectSingleScorePanel(true);
      break;
case RIGHT:
    selectSingleScorePanel(false);
  break;
}
}
 else if (arg instanceof GameState) {
if (arg == GameState.FINISHED || arg == GameState.RUNNING) removeSelection();
}
 else if (arg instanceof NamesChangedEvent) {
setNames(((NamesChangedEvent)arg).getLeftName(),((NamesChangedEvent)arg).getRightName());
}
}
 else {
leftScorePanel.setScore(ScoreManagerSingleton.getInstance().getLeftScore());
rightScorePanel.setScore(ScoreManagerSingleton.getInstance().getRightScore());
}
}
Program: 99168
Project: 99168
Buggy source:
public void newGame(){
  GameStateSingleton.getInstance().setGameState(GameState.INIT);
  GameStateSingleton.getInstance().resetRoundsCount();
  leftScore=rightScore=0;
  setChanged();
  notifyObservers();
}

Fixed version (ground truth):
public void newGame(){
  GameStateSingleton.getInstance().setGameState(GameState.INIT);
  GameStateSingleton.getInstance().resetRoundsCount();
  leftScore=rightScore=0;
  price=1;
  setChanged();
  notifyObservers();
}
Program: 99169
Project: 99169
Buggy source:
private void calculateShortestPaths(){
  for (  V j : this.vertices) {
    for (    V i : this.vertices) {
      if (!i.equals(j)) {
        for (        V k : this.vertices) {
          if (!k.equals(j)) {
            Double new_value=this.d.get(i).get(j) + this.d.get(j).get(k);
            if (new_value < this.d.get(i).get(k)) {
              this.d.get(i).put(k,new_value);
              this.t.get(i).put(k,j);
            }
          }
        }
        if (this.d.get(i).get(j) < 0)         throw new NegativeCircleFoundException();
      }
    }
  }
}

Fixed version (ground truth):
private void calculateShortestPaths(){
  for (  V j : this.vertices) {
    for (    V i : this.vertices) {
      if (!i.equals(j)) {
        for (        V k : this.vertices) {
          if (!k.equals(j)) {
            Double new_value=this.d.get(i).get(j) + this.d.get(j).get(k);
            if (new_value < this.d.get(i).get(k)) {
              this.d.get(i).put(k,new_value);
              this.t.get(i).put(k,j);
            }
          }
        }
        if (this.d.get(i).get(i) < 0) {
          throw new NegativeCircleFoundException();
        }
      }
    }
  }
}
Program: 99170
Project: 99170
Buggy source:
public static void main(String[] args){
  DataReader reader=new DataReader();
  Graph graph=new Graph();
  reader.fill(graph);
  System.out.println("String_Node_Str" + graph.nodes.size());
  System.out.println("String_Node_Str" + graph.edges.size());
  ClusteringPhase cp=new ClusteringPhase();
  ArrayList<ArrayList<Integer>> results=cp.doCluster(graph,1);
  System.out.print(results.size());
}

Fixed version (ground truth):
public static void main(String[] args){
  DataReader reader=new DataReader();
  Graph graph=new Graph();
  reader.fill(graph);
  System.out.println("String_Node_Str" + graph.nodes.size());
  System.out.println("String_Node_Str" + graph.edges.size());
  ClusteringPhase cp=new ClusteringPhase();
  ArrayList<ArrayList<Integer>> results=cp.doCluster(graph,1);
  System.out.println(results.size());
  System.out.println("String_Node_Str" + graph.nodes.size());
  System.out.println("String_Node_Str" + graph.edges.size());
  MiningPhase.doMining(graph,results);
  System.out.println("String_Node_Str" + graph.nodes.size());
  System.out.println("String_Node_Str" + graph.edges.size());
}
Program: 99171
Project: 99171
Buggy source:
public void fill(Graph graph){
  Map<Integer,Edge> edges=new HashMap<Integer,Edge>();
  Map<Integer,Node> nodes=new HashMap<Integer,Node>();
  try {
    FileInputStream fstream=new FileInputStream("String_Node_Str");
    DataInputStream in=new DataInputStream(fstream);
    BufferedReader br=new BufferedReader(new InputStreamReader(in));
    String strLine;
    br.readLine();
    br.readLine();
    br.readLine();
    br.readLine();
    while ((strLine=br.readLine()) != null) {
      int id1=Integer.parseInt(strLine.split("String_Node_Str")[0]);
      int id2=Integer.parseInt(strLine.split("String_Node_Str")[1]);
      int edgeId=edges.size();
      Edge e=new Edge(id1,id2,edgeId);
      edges.put(edgeId,e);
      if (!nodes.containsKey(id1)) {
        Node n=new Node(id1);
        n.addEdge(edgeId);
        nodes.put(id1,n);
      }
 else {
        if (!nodes.get(id1).containsEdge(edgeId))         nodes.get(id1).addEdge(edgeId);
      }
      if (!nodes.containsKey(id2)) {
        Node n=new Node(id2);
        n.addEdge(edgeId);
        nodes.put(id2,n);
      }
 else {
        if (!nodes.get(id2).containsEdge(edgeId))         nodes.get(id2).addEdge(edgeId);
      }
    }
    in.close();
  }
 catch (  Exception e) {
    System.err.println("String_Node_Str" + e.getMessage());
  }
  graph.edges=edges;
  graph.nodes=nodes;
}

Fixed version (ground truth):
public void fill(Graph graph){
  Map<Integer,Edge> edges=new HashMap<Integer,Edge>();
  Map<Integer,Node> nodes=new HashMap<Integer,Node>();
  try {
    FileInputStream fstream=new FileInputStream("String_Node_Str");
    DataInputStream in=new DataInputStream(fstream);
    BufferedReader br=new BufferedReader(new InputStreamReader(in));
    String strLine;
    br.readLine();
    br.readLine();
    br.readLine();
    br.readLine();
    while ((strLine=br.readLine()) != null) {
      int id1=Integer.parseInt(strLine.split("String_Node_Str")[0]);
      int id2=Integer.parseInt(strLine.split("String_Node_Str")[1]);
      int edgeId=edges.size();
      Edge e=new Edge(id1,id2,edgeId);
      edges.put(edgeId,e);
      if (!nodes.containsKey(id1)) {
        Node n=new Node(id1);
        n.addEdge(edgeId);
        nodes.put(id1,n);
      }
 else {
        if (!nodes.get(id1).containsEdge(edgeId))         nodes.get(id1).addEdge(edgeId);
      }
      if (!nodes.containsKey(id2)) {
        Node n=new Node(id2);
        nodes.put(id2,n);
      }
 else {
      }
    }
    in.close();
  }
 catch (  Exception e) {
    System.err.println("String_Node_Str" + e.getMessage());
  }
  graph.edges=edges;
  graph.nodes=nodes;
}
Program: 99173
Project: 99173
Buggy source:
public Pattern(AbstractSet<Integer> ls,int leng){
  outlinkList=new ArrayList<Integer>();
  vertexList=new ArrayList<Integer>();
  for (  int x : ls) {
    vertexList.add(x);
  }
  length=leng;
}

Fixed version (ground truth):
Pattern(AbstractSet<Integer> ls,int leng){
  outlinkList=new ArrayList<Integer>();
  vertexList=new ArrayList<Integer>();
  for (  int x : ls) {
    vertexList.add(x);
  }
  length=leng;
}
Program: 99174
Project: 99174
Buggy source:
public int getSavings(){
  return (length - 1) * (getFrequency() - 1) - 1;
}

Fixed version (ground truth):
int getSavings(){
  return (length - 1) * (getFrequency() - 1) - 1;
}
Program: 99175
Project: 99175
Buggy source:
public int getFrequency(){
  return vertexList.size();
}

Fixed version (ground truth):
int getFrequency(){
  return vertexList.size();
}
Program: 99177
Project: 99177
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.home);
  p=(Player)getIntent().getExtras().getSerializable(StartScreenController.SELF);
  c=(Character)getIntent().getExtras().getSerializable("String_Node_Str");
  ((Button)findViewById(R.id.character_button)).setOnClickListener(this);
  ((Button)findViewById(R.id.items_button)).setOnClickListener(this);
  ((Button)findViewById(R.id.battle_button)).setOnClickListener(this);
  ((Button)findViewById(R.id.logout_button)).setOnClickListener(this);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.home);
  p=(Player)getIntent().getExtras().getSerializable(StartScreenController.SELF);
  character=(Character)getIntent().getExtras().getSerializable("String_Node_Str");
  ((Button)findViewById(R.id.character_button)).setOnClickListener(this);
  ((Button)findViewById(R.id.items_button)).setOnClickListener(this);
  ((Button)findViewById(R.id.battle_button)).setOnClickListener(this);
  ((Button)findViewById(R.id.logout_button)).setOnClickListener(this);
}
Program: 99178
Project: 99178
Buggy source:
public void onClick(View v){
  if (v.getId() == R.id.character_button) {
    Intent c=new Intent(HomeScreenController.this,CharacterController.class);
    c.putExtra("String_Node_Str",p);
    c.putExtra("String_Node_Str",c);
    startActivity(c);
  }
 else   if (v.getId() == R.id.items_button) {
    Intent b=new Intent(HomeScreenController.this,ItemController.class);
    b.putExtra("String_Node_Str",p);
    b.putExtra("String_Node_Str",c);
    startActivity(b);
  }
 else   if (v.getId() == R.id.battle_button) {
    Intent a=new Intent(HomeScreenController.this,PreBattleController.class);
    a.putExtra("String_Node_Str",p);
    a.putExtra("String_Node_Str",c);
    startActivity(a);
  }
 else   if (v.getId() == R.id.logout_button) {
    Intent d=new Intent(HomeScreenController.this,StartScreenController.class);
    startActivity(d);
  }
}

Fixed version (ground truth):
public void onClick(View v){
  if (v.getId() == R.id.character_button) {
    Intent c=new Intent(HomeScreenController.this,CharacterController.class);
    c.putExtra("String_Node_Str",p);
    c.putExtra("String_Node_Str",character);
    startActivity(c);
  }
 else   if (v.getId() == R.id.items_button) {
    Intent b=new Intent(HomeScreenController.this,ItemController.class);
    b.putExtra("String_Node_Str",p);
    b.putExtra("String_Node_Str",character);
    startActivity(b);
  }
 else   if (v.getId() == R.id.battle_button) {
    Intent a=new Intent(HomeScreenController.this,PreBattleController.class);
    a.putExtra("String_Node_Str",p);
    a.putExtra("String_Node_Str",character);
    startActivity(a);
  }
 else   if (v.getId() == R.id.logout_button) {
    Intent d=new Intent(HomeScreenController.this,StartScreenController.class);
    startActivity(d);
  }
}
Program: 99180
Project: 99180
Buggy source:
private void setUpListView(final ListView v,final HashMap<String,Number> map,final String what){
  ArrayAdapter<String> adapter;
  adapter=new ArrayAdapter<String>(this,R.layout.itemrow,new ArrayList<String>());
  v.setAdapter(adapter);
  v.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      Toast.makeText(ItemController.this,"String_Node_Str",Toast.LENGTH_LONG).show();
      Object[] keys=map.keySet().toArray();
      itemDialog(v,(String)keys[position],what);
    }
  }
);
  if (map.size() > 0) {
    Object[] keys=map.keySet().toArray();
    Toast.makeText(this,keys.length + "String_Node_Str" + map.size(),Toast.LENGTH_LONG).show();
    for (int i=0; i < map.size(); i++) {
      adapter.add("String_Node_Str" + map.get((String)keys[i]) + "String_Node_Str"+ (String)keys[i]);
    }
    v.invalidate();
  }
}

Fixed version (ground truth):
private void setUpListView(final ListView v,final HashMap<String,Number> map,final String what){
  ArrayAdapter<String> adapter;
  adapter=new ArrayAdapter<String>(this,R.layout.itemrow,new ArrayList<String>());
  v.setAdapter(adapter);
  v.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      Object[] keys=map.keySet().toArray();
      itemDialog(v,(String)keys[position],what);
    }
  }
);
  if (map.size() > 0) {
    Object[] keys=map.keySet().toArray();
    for (int i=0; i < map.size(); i++) {
      adapter.add("String_Node_Str" + map.get((String)keys[i]) + "String_Node_Str"+ (String)keys[i]);
    }
    v.invalidate();
  }
}
Program: 99181
Project: 99181
Buggy source:
public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  Toast.makeText(ItemController.this,"String_Node_Str",Toast.LENGTH_LONG).show();
  Object[] keys=map.keySet().toArray();
  itemDialog(v,(String)keys[position],what);
}

Fixed version (ground truth):
public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  Object[] keys=map.keySet().toArray();
  itemDialog(v,(String)keys[position],what);
}
Program: 99182
Project: 99182
Buggy source:
public static EnchantmentSet getPossibleSet(int mel,Item item){
  Enchantment[] se=getPossible(mel,item);
  EnchantmentPower[] sp=getPower(se,mel);
  EnchantmentSet output=new EnchantmentSet(se,sp);
  return output;
}

Fixed version (ground truth):
public static EnchantmentSet getPossibleSet(int mel,Item item){
  Enchantment[] se=getPossible(mel,item);
  EnchantmentPower[] sp=getPower(se,mel);
  EnchantmentSet output=new EnchantmentSet(mel,0,se,sp);
  return output;
}
Program: 99183
Project: 99183
Buggy source:
public static boolean isConflicting(Enchantment enca,Enchantment encb){
  if (enca == encb) {
    return true;
  }
  if (enca.getType() == encb.getType()) {
    if (enca.getType() == EnchantmentType.GENERAL) {
      return false;
    }
 else {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks if 2 enchantments conflict with each other
 * @param enca The first Enchantment
 * @param encb The second Enchantment
 * @return TRUE if the enchantments conflict
 */
public static boolean isConflicting(Enchantment enca,Enchantment encb){
  if (enca == encb) {
    return true;
  }
  if (enca.getType() == encb.getType()) {
    if (enca.getType() == EnchantmentType.GENERAL) {
      return false;
    }
 else {
      return true;
    }
  }
  return false;
}
Program: 99184
Project: 99184
Buggy source:
public static EnchantmentSet removeConflict(EnchantmentSet possible,Enchantment enchantment){
  int length=possible.enchantments.length;
  boolean[] valid=new boolean[length];
  int inh=0;
  for (int c=0; c < length; c++) {
    if (isConflicting(possible.enchantments[c],enchantment)) {
      valid[c]=false;
    }
 else {
      valid[c]=true;
      inh++;
    }
  }
  Enchantment[] oute=new Enchantment[inh];
  EnchantmentPower[] outp=new EnchantmentPower[inh];
  int outh=0;
  for (int c=0; c < length; c++) {
    if (valid[c]) {
      oute[outh]=possible.enchantments[c];
      outp[outh]=possible.power[c];
      outh++;
    }
  }
  EnchantmentSet output=new EnchantmentSet(oute,outp);
  return output;
}

Fixed version (ground truth):
/** 
 * Removes enchantments that conflict with a enchantment from a array.
 * @param possible The array of enchantments
 * @param enchantment The enchantment to check against
 * @return A array that contains the non-conflicting enchantments
 */
public static Enchantment[] removeConflict(Enchantment[] possible,Enchantment enchantment){
  int length=possible.length;
  boolean[] valid=new boolean[length];
  int inh=0;
  for (int c=0; c < length; c++) {
    if (isConflicting(possible[c],enchantment)) {
      valid[c]=false;
    }
 else {
      valid[c]=true;
      inh++;
    }
  }
  Enchantment[] oute=new Enchantment[inh];
  int outh=0;
  for (int c=0; c < length; c++) {
    if (valid[c]) {
      oute[outh]=possible[c];
      outh++;
    }
  }
  return oute;
}
Program: 99185
Project: 99185
Buggy source:
/** 
 * Shows login page.
 * @param context the specified context
 * @throws Exception exception
 */
@RequestProcessing(value="String_Node_Str",method=HTTPRequestMethod.GET) public void showLogin(final HTTPRequestContext context) throws Exception {
  final HttpServletRequest request=context.getRequest();
  String destinationURL=request.getParameter(Common.GOTO);
  if (Strings.isEmptyOrNull(destinationURL)) {
    destinationURL=Latkes.getServePath() + Common.ADMIN_INDEX_URI;
  }
  final HttpServletResponse response=context.getResponse();
  userMgmtService.tryLogInWithCookie(request,response);
  if (null != userService.getCurrentUser(request)) {
    response.sendRedirect(destinationURL);
    return;
  }
  renderPage(context,"String_Node_Str",destinationURL);
}

Fixed version (ground truth):
/** 
 * Shows login page.
 * @param context the specified context
 * @throws Exception exception
 */
@RequestProcessing(value="String_Node_Str",method=HTTPRequestMethod.GET) public void showLogin(final HTTPRequestContext context) throws Exception {
  final HttpServletRequest request=context.getRequest();
  String destinationURL=request.getParameter(Common.GOTO);
  if (Strings.isEmptyOrNull(destinationURL)) {
    destinationURL=Latkes.getServePath() + Common.ADMIN_INDEX_URI;
  }
  final HttpServletResponse response=context.getResponse();
  userMgmtService.tryLogInWithCookie(request,response);
  if (null != userService.getCurrentUser(request)) {
    response.sendRedirect(destinationURL);
    return;
  }
  renderPage(context,"String_Node_Str",destinationURL,request);
}
Program: 99186
Project: 99186
Buggy source:
/** 
 * Shows forgotten password page.
 * @param context the specified context
 * @throws Exception exception
 */
@RequestProcessing(value="String_Node_Str",method=HTTPRequestMethod.GET) public void showForgot(final HTTPRequestContext context) throws Exception {
  final HttpServletRequest request=context.getRequest();
  String destinationURL=request.getParameter(Common.GOTO);
  if (Strings.isEmptyOrNull(destinationURL)) {
    destinationURL=Latkes.getServePath() + Common.ADMIN_INDEX_URI;
  }
  renderPage(context,"String_Node_Str",destinationURL);
}

Fixed version (ground truth):
/** 
 * Shows forgotten password page.
 * @param context the specified context
 * @throws Exception exception
 */
@RequestProcessing(value="String_Node_Str",method=HTTPRequestMethod.GET) public void showForgot(final HTTPRequestContext context) throws Exception {
  final HttpServletRequest request=context.getRequest();
  String destinationURL=request.getParameter(Common.GOTO);
  if (Strings.isEmptyOrNull(destinationURL)) {
    destinationURL=Latkes.getServePath() + Common.ADMIN_INDEX_URI;
  }
  renderPage(context,"String_Node_Str",destinationURL,request);
}
Program: 99187
Project: 99187
Buggy source:
/** 
 * Send the random password to the given address and update the ever one.
 * @param user the user relative to the given email below
 * @param userEmail the given email
 * @param jsonObject return code and message object
 * @throws JSONException the JSONException
 * @throws ServiceException the ServiceException
 * @throws IOException the IOException
 */
private void sendRandomPwd(final JSONObject user,final String userEmail,final JSONObject jsonObject) throws JSONException, ServiceException, IOException {
  final JSONObject preference=preferenceQueryService.getPreference();
  final String randomPwd=new Randoms().nextString();
  final String blogTitle=preference.getString(Preference.BLOG_TITLE);
  final String adminEmail=preference.getString(Preference.ADMIN_EMAIL);
  final String mailSubject=langPropsService.get("String_Node_Str");
  final String mailBody=langPropsService.get("String_Node_Str") + randomPwd;
  final MailService.Message message=new MailService.Message();
  user.put(User.USER_PASSWORD,randomPwd);
  userMgmtService.updateUser(user);
  message.setFrom(adminEmail);
  message.addRecipient(userEmail);
  message.setSubject(mailSubject);
  message.setHtmlBody(mailBody);
  mailService.send(message);
  jsonObject.put("String_Node_Str",true);
  jsonObject.put("String_Node_Str",Latkes.getServePath() + "String_Node_Str");
  jsonObject.put(Keys.MSG,langPropsService.get("String_Node_Str"));
  LOGGER.log(Level.DEBUG,"String_Node_Str",new Object[]{mailSubject,mailBody,userEmail});
}

Fixed version (ground truth):
/** 
 * Send the random password to the given address and update the ever one.
 * @param user       the user relative to the given email below
 * @param userEmail  the given email
 * @param jsonObject return code and message object
 * @throws JSONException    the JSONException
 * @throws ServiceException the ServiceException
 * @throws IOException      the IOException
 */
private void sendRandomPwd(final JSONObject user,final String userEmail,final JSONObject jsonObject) throws JSONException, ServiceException, IOException {
  final JSONObject preference=preferenceQueryService.getPreference();
  final String randomPwd=new Randoms().nextString();
  final String blogTitle=preference.getString(Preference.BLOG_TITLE);
  final String adminEmail=preference.getString(Preference.ADMIN_EMAIL);
  final String mailSubject=langPropsService.get("String_Node_Str");
  final String mailBody=langPropsService.get("String_Node_Str") + randomPwd;
  final MailService.Message message=new MailService.Message();
  user.put(User.USER_PASSWORD,randomPwd);
  userMgmtService.updateUser(user);
  message.setFrom(adminEmail);
  message.addRecipient(userEmail);
  message.setSubject(mailSubject);
  message.setHtmlBody(mailBody);
  mailService.send(message);
  jsonObject.put("String_Node_Str",true);
  jsonObject.put("String_Node_Str",Latkes.getServePath() + "String_Node_Str");
  jsonObject.put(Keys.MSG,langPropsService.get("String_Node_Str"));
  LOGGER.log(Level.DEBUG,"String_Node_Str",new Object[]{mailSubject,mailBody,userEmail});
}
Program: 99189
Project: 99189
Buggy source:
/** 
 * reset forgotten password. <p> Renders the response with a json object, for example, <pre> { "isLoggedIn": boolean, "msg": "" // optional, exists if isLoggedIn equals to false } </pre> </p>
 * @param context the specified context
 */
@RequestProcessing(value={"String_Node_Str"},method=HTTPRequestMethod.POST) public void forgot(final HTTPRequestContext context){
  final HttpServletRequest request=context.getRequest();
  final JSONRenderer renderer=new JSONRenderer();
  context.setRenderer(renderer);
  final JSONObject jsonObject=new JSONObject();
  renderer.setJSONObject(jsonObject);
  try {
    jsonObject.put("String_Node_Str",false);
    jsonObject.put(Keys.MSG,langPropsService.get("String_Node_Str"));
    final JSONObject requestJSONObject=Requests.parseRequestJSONObject(request,context.getResponse());
    final String userEmail=requestJSONObject.getString(User.USER_EMAIL);
    if (Strings.isEmptyOrNull(userEmail)) {
      LOGGER.log(Level.WARN,"String_Node_Str");
      return;
    }
    LOGGER.log(Level.INFO,"String_Node_Str",userEmail);
    final JSONObject user=userQueryService.getUserByEmail(userEmail);
    if (null == user) {
      LOGGER.log(Level.WARN,"String_Node_Str",userEmail);
      jsonObject.put(Keys.MSG,langPropsService.get("String_Node_Str"));
      return;
    }
    if (isPwdExpired()) {
      LOGGER.log(Level.WARN,"String_Node_Str",userEmail);
      jsonObject.put(Keys.MSG,langPropsService.get("String_Node_Str"));
      return;
    }
    sendRandomPwd(user,userEmail,jsonObject);
  }
 catch (  final Exception e) {
    LOGGER.log(Level.ERROR,e.getMessage(),e);
  }
}

Fixed version (ground truth):
/** 
 * reset forgotten password. <p/> <p> Renders the response with a json object, for example, <pre> { "isLoggedIn": boolean, "msg": "" // optional, exists if isLoggedIn equals to false } </pre> </p>
 * @param context the specified context
 */
@RequestProcessing(value={"String_Node_Str"},method=HTTPRequestMethod.POST) public void forgot(final HTTPRequestContext context){
  final HttpServletRequest request=context.getRequest();
  final JSONRenderer renderer=new JSONRenderer();
  context.setRenderer(renderer);
  final JSONObject jsonObject=new JSONObject();
  renderer.setJSONObject(jsonObject);
  try {
    jsonObject.put("String_Node_Str",false);
    jsonObject.put(Keys.MSG,langPropsService.get("String_Node_Str"));
    final JSONObject requestJSONObject=Requests.parseRequestJSONObject(request,context.getResponse());
    final String userEmail=requestJSONObject.getString(User.USER_EMAIL);
    if (Strings.isEmptyOrNull(userEmail)) {
      LOGGER.log(Level.WARN,"String_Node_Str");
      return;
    }
    LOGGER.log(Level.INFO,"String_Node_Str",userEmail);
    final JSONObject user=userQueryService.getUserByEmail(userEmail);
    if (null == user) {
      LOGGER.log(Level.WARN,"String_Node_Str",userEmail);
      jsonObject.put(Keys.MSG,langPropsService.get("String_Node_Str"));
      return;
    }
    sendResetUrl(userEmail,jsonObject);
  }
 catch (  final Exception e) {
    LOGGER.log(Level.ERROR,e.getMessage(),e);
  }
}
Program: 99191
Project: 99191
Buggy source:
/** 
 * Checks upgrade.
 * @param context the specified context
 */
@RequestProcessing(value="String_Node_Str",method=HTTPRequestMethod.GET) public void upgrade(final HTTPRequestContext context){
  final TextHTMLRenderer renderer=new TextHTMLRenderer();
  context.setRenderer(renderer);
  try {
    final JSONObject preference=preferenceRepository.get(Preference.PREFERENCE);
    if (null == preference) {
      LOGGER.log(Level.INFO,"String_Node_Str");
      renderer.setContent("String_Node_Str");
      return;
    }
    renderer.setContent("String_Node_Str");
    final String version=preference.getString(Preference.VERSION);
    if (SoloServletListener.VERSION.equals(version)) {
      return;
    }
    if ("String_Node_Str".equals(version)) {
      v046ToV050();
    }
 else {
      final String msg="String_Node_Str";
      LOGGER.warning(msg);
      notifyUserByEmail();
      responseConflict();
    }
  }
 catch (  final Exception e) {
    LOGGER.log(Level.SEVERE,e.getMessage(),e);
    renderer.setContent("String_Node_Str" + e.getMessage() + "String_Node_Str"+ "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Checks upgrade.
 * @param context the specified context
 */
@RequestProcessing(value="String_Node_Str",method=HTTPRequestMethod.GET) public void upgrade(final HTTPRequestContext context){
  final TextHTMLRenderer renderer=new TextHTMLRenderer();
  context.setRenderer(renderer);
  try {
    final JSONObject preference=preferenceRepository.get(Preference.PREFERENCE);
    if (null == preference) {
      LOGGER.log(Level.INFO,"String_Node_Str");
      renderer.setContent("String_Node_Str");
      return;
    }
    renderer.setContent("String_Node_Str");
    final String version=preference.getString(Preference.VERSION);
    if (SoloServletListener.VERSION.equals(version)) {
      return;
    }
    if ("String_Node_Str".equals(version)) {
      v046ToV050();
    }
 else {
      LOGGER.log(Level.WARNING,"String_Node_Str",version);
      if (!sent) {
        notifyUserByEmail();
        sent=true;
      }
      renderer.setContent(langPropsService.get("String_Node_Str"));
    }
  }
 catch (  final Exception e) {
    LOGGER.log(Level.SEVERE,e.getMessage(),e);
    renderer.setContent("String_Node_Str" + e.getMessage() + "String_Node_Str"+ "String_Node_Str");
  }
}
Program: 99192
Project: 99192
Buggy source:
/** 
 * Send an email to the user who upgrades B3log Solo with a discontinuous version.
 * @throws ServiceException ServiceException
 * @throws JSONException JSONException
 * @throws IOException IOException
 */
private void notifyUserByEmail() throws ServiceException, JSONException, IOException {
  final String adminEmail=preferenceQueryService.getPreference().getString(Preference.ADMIN_EMAIL);
  final MailService.Message message=new MailService.Message();
  message.setFrom(adminEmail);
  message.addRecipient(adminEmail);
  message.setSubject("String_Node_Str");
  message.setHtmlBody("String_Node_Str" + "String_Node_Str");
  MAIL_SVC.send(message);
  LOGGER.warning("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Send an email to the user who upgrades B3log Solo with a discontinuous version.
 * @throws ServiceException ServiceException
 * @throws JSONException JSONException
 * @throws IOException IOException
 */
private void notifyUserByEmail() throws ServiceException, JSONException, IOException {
  final String adminEmail=preferenceQueryService.getPreference().getString(Preference.ADMIN_EMAIL);
  final MailService.Message message=new MailService.Message();
  message.setFrom(adminEmail);
  message.addRecipient(adminEmail);
  message.setSubject(langPropsService.get("String_Node_Str"));
  message.setHtmlBody(langPropsService.get("String_Node_Str"));
  MAIL_SVC.send(message);
  LOGGER.info("String_Node_Str");
}
Program: 99194
Project: 99194
Buggy source:
public void setSuspend(boolean suspend){
synchronized (cache) {
    if (suspend)     cache.state=CacheState.SUSPEND;
 else     cache.state=CacheState.INITIALIZED;
  }
}

Fixed version (ground truth):
public void setSuspend(boolean suspend){
synchronized (cache) {
    if (suspend)     cache.state=CacheState.SUSPEND;
 else     if (cache.state == CacheState.SUSPEND)     cache.state=CacheState.INITIALIZED;
  }
}
Program: 99195
Project: 99195
Buggy source:
@Override public void run(){
  Rect viewportRect=new Rect(0,0,0,0);
  while (true) {
    while (cache.state != CacheState.START_UPDATE)     try {
      Thread.sleep(10);
    }
 catch (    InterruptedException e) {
    }
    boolean cont=false;
synchronized (cache) {
      if (cache.state == CacheState.START_UPDATE) {
        cache.state=CacheState.IN_UPDATE;
        cache.bitmapRef=null;
        cont=true;
      }
    }
    if (cont) {
synchronized (viewport) {
        viewportRect.set(viewport.origin);
      }
      cache.setOriginRect(viewportRect);
      Bitmap bitmap=cache.decoder.decodeRegion(cache.origin,cache.options);
      cache.bitmapRef=new WeakReference<Bitmap>(bitmap);
      cache.state=CacheState.READY;
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  running=true;
  Rect viewportRect=new Rect(0,0,0,0);
  while (running) {
    while (cache.state != CacheState.START_UPDATE)     try {
      Thread.sleep(5);
      if (!running)       return;
    }
 catch (    InterruptedException e) {
    }
    long start=System.currentTimeMillis();
    boolean cont=false;
synchronized (cache) {
      if (cache.state == CacheState.START_UPDATE) {
        cache.state=CacheState.IN_UPDATE;
        cache.bitmapRef=null;
        cont=true;
      }
    }
    if (cont) {
synchronized (viewport) {
        viewportRect.set(viewport.origin);
      }
      cache.setOriginRect(viewportRect);
      try {
        Bitmap bitmap=cache.decoder.decodeRegion(cache.origin,cache.options);
        cache.bitmapRef=new NotWeakReference<Bitmap>(bitmap);
        cache.state=CacheState.READY;
        long done=System.currentTimeMillis();
        if (DEBUG)         Log.d(TAG,String.format("String_Node_Str",done - start));
      }
 catch (      OutOfMemoryError e) {
        if (cache.percent > 0)         cache.percent-=1;
        cache.state=CacheState.START_UPDATE;
        Log.e(TAG,String.format("String_Node_Str",cache.percent));
      }
    }
  }
}
Program: 99196
Project: 99196
Buggy source:
@Override public void surfaceDestroyed(SurfaceHolder holder){
  boolean retry=true;
  drawThread.setRunning(false);
  while (retry) {
    try {
      drawThread.join();
      retry=false;
    }
 catch (    InterruptedException e) {
    }
  }
}

Fixed version (ground truth):
@Override public void surfaceDestroyed(SurfaceHolder holder){
  scene.stop();
  drawThread.setRunning(false);
  boolean retry=true;
  while (retry) {
    try {
      drawThread.join();
      retry=false;
    }
 catch (    InterruptedException e) {
    }
  }
}
Program: 99197
Project: 99197
Buggy source:
@Override protected void onDraw(Canvas canvas){
  super.onDraw(canvas);
  scene.update();
  scene.draw(canvas);
  if (DEBUG) {
    long now=System.currentTimeMillis();
    double n=((double)now) / 1000L;
    double s=((double)startTime) / 1000L;
    double fps=1L / (n - s);
    startTime=System.currentTimeMillis();
  }
}

Fixed version (ground truth):
@Override protected void onDraw(Canvas canvas){
  super.onDraw(canvas);
  scene.update();
  scene.draw(canvas);
}
Program: 99198
Project: 99198
Buggy source:
@Override public void surfaceCreated(SurfaceHolder holder){
  drawThread=new DrawThread(holder);
  drawThread.setRunning(true);
  drawThread.start();
}

Fixed version (ground truth):
@Override public void surfaceCreated(SurfaceHolder holder){
  drawThread=new DrawThread(holder);
  drawThread.setName("String_Node_Str");
  drawThread.setRunning(true);
  drawThread.start();
  scene.start();
}
Program: 99199
Project: 99199
Buggy source:
/** 
 * Figure out the originRect based on the viewportRect 
 */
private void setOriginRect(Rect viewportRect){
  int vw=viewportRect.width();
  int vh=viewportRect.height();
  calcMargin(viewportRect.width(),viewportRect.height());
  int mw=margin.x;
  int mh=margin.y;
  if (vw + mw > width)   mw=Math.max(0,width - vw);
  if (vh + mh > height)   mh=Math.max(0,height - vh);
  int left=viewportRect.left - (mw >> 1);
  int right=viewportRect.right + (mw >> 1);
  if (left < 0) {
    right=right - left;
    left=0;
  }
  if (right > width) {
    left=left - (right - width);
    right=width;
  }
  int top=viewportRect.top - (mh >> 1);
  int bottom=viewportRect.bottom + (mh >> 1);
  if (top < 0) {
    bottom=bottom - top;
    top=0;
  }
  if (bottom > height) {
    top=top - (bottom - height);
    bottom=height;
  }
  originRect.set(left,top,right,bottom);
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + originRect.toShortString());
}

Fixed version (ground truth):
/** 
 * Figure out the originRect based on the viewportRect 
 */
private void setOriginRect(Rect viewportRect){
  int vw=viewportRect.width();
  int vh=viewportRect.height();
  calcMargin(vw,vh);
  int mw=margin.x;
  int mh=margin.y;
  if (vw + mw > width)   mw=Math.max(0,width - vw);
  if (vh + mh > height)   mh=Math.max(0,height - vh);
  int left=viewportRect.left - (mw >> 1);
  int right=viewportRect.right + (mw >> 1);
  if (left < 0) {
    right=right - left;
    left=0;
  }
  if (right > width) {
    left=left - (right - width);
    right=width;
  }
  int top=viewportRect.top - (mh >> 1);
  int bottom=viewportRect.bottom + (mh >> 1);
  if (top < 0) {
    bottom=bottom - top;
    top=0;
  }
  if (bottom > height) {
    top=top - (bottom - height);
    bottom=height;
  }
  originRect.set(left,top,right,bottom);
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + originRect.toShortString());
}
Program: 99201
Project: 99201
Buggy source:
public void setup(){
  size(600,400,GLConstants.GLGRAPHICS);
  map=new UnfoldingMap(this,0,0,400,400,new StamenMapProvider.WaterColor());
  map.zoomAndPanTo(new Location(52.5f,13.4f),10);
  MapUtils.createDefaultEventDispatcher(this,map);
}

Fixed version (ground truth):
public void setup(){
  size(600,400,GLConstants.GLGRAPHICS);
  map=new UnfoldingMap(this,0,0,400,400,new StamenMapProvider.WaterColor());
  map.zoomAndPanTo(new Location(51.507222,-0.1275),10);
  MapUtils.createDefaultEventDispatcher(this,map);
}
Program: 99202
Project: 99202
Buggy source:
public void draw(){
  background(0);
  map.draw();
  int x=415;
  int y=20;
  for (  MapSnapshot mapSnapshot : mapSnapshots) {
    mapSnapshot.draw(x,y,80,80);
    x+=90;
    if (x > width - 90) {
      x=410;
      y+=90;
    }
  }
}

Fixed version (ground truth):
public void draw(){
  background(0);
  map.draw();
  int x=415;
  int y=20;
  for (  MapSnapshot mapSnapshot : mapSnapshots) {
    mapSnapshot.draw(x,y,80,80);
    x+=90;
    if (x > width - 90) {
      x=415;
      y+=90;
    }
  }
}
Program: 99203
Project: 99203
Buggy source:
public void setup(){
  size(800,600,GLConstants.GLGRAPHICS);
  smooth();
  font=createFont("String_Node_Str",14);
  map=new UnfoldingMap(this,"String_Node_Str",0,0,600,600);
  map.zoomToLevel(3);
  MapUtils.createDefaultEventDispatcher(this,map);
}

Fixed version (ground truth):
public void setup(){
  size(800,600,GLConstants.GLGRAPHICS);
  smooth();
  font=createFont("String_Node_Str",14);
  map=new UnfoldingMap(this,"String_Node_Str",0,0,600,600);
  map.setTweening(true);
  map.zoomToLevel(3);
  MapUtils.createDefaultEventDispatcher(this,map);
}
Program: 99204
Project: 99204
Buggy source:
/** 
 * Updates the integrators for tweening. Must be called before   {@link AbstractMapDisplay#draw()} .
 */
public void updateMap(){
  if (tweening) {
    scaleIntegrator.update();
    mapDisplay.innerScale=scaleIntegrator.value;
    mapDisplay.calculateInnerMatrix();
  }
}

Fixed version (ground truth):
/** 
 * Updates the integrators for tweening. Must be called before   {@link AbstractMapDisplay#draw()} .
 */
public void updateMap(){
  if (tweening) {
    scaleIntegrator.update();
    mapDisplay.innerScale=scaleIntegrator.value;
    txIntegrator.update();
    mapDisplay.innerOffsetX=txIntegrator.value;
    tyIntegrator.update();
    mapDisplay.innerOffsetY=tyIntegrator.value;
    mapDisplay.calculateInnerMatrix();
  }
}
Program: 99205
Project: 99205
Buggy source:
public void setTweening(boolean tweening){
  this.tweening=tweening;
}

Fixed version (ground truth):
public void setTweening(boolean tweening){
  if (tweening == this.tweening)   return;
  this.tweening=tweening;
  if (tweening) {
    scaleIntegrator.set(mapDisplay.innerScale);
    scaleIntegrator.target(mapDisplay.innerScale);
    txIntegrator.set(mapDisplay.innerOffsetX);
    txIntegrator.target(mapDisplay.innerOffsetX);
    tyIntegrator.set(mapDisplay.innerOffsetY);
    tyIntegrator.target(mapDisplay.innerOffsetY);
  }
 else {
    mapDisplay.innerScale=scaleIntegrator.target;
    mapDisplay.innerOffsetX=txIntegrator.target;
    mapDisplay.innerOffsetY=tyIntegrator.target;
  }
}
Program: 99206
Project: 99206
Buggy source:
protected void setInnerOffset(float x,float y){
  mapDisplay.innerOffsetX=x;
  mapDisplay.innerOffsetY=y;
  mapDisplay.calculateInnerMatrix();
}

Fixed version (ground truth):
protected void setInnerOffset(float x,float y){
  if (tweening) {
    txIntegrator.target(x);
    tyIntegrator.target(y);
  }
 else {
    mapDisplay.innerOffsetX=x;
    mapDisplay.innerOffsetY=y;
    mapDisplay.calculateInnerMatrix();
  }
}
Program: 99207
Project: 99207
Buggy source:
/** 
 * Switches the tweening.
 */
public void switchTweening(){
  this.tweening=!this.tweening;
}

Fixed version (ground truth):
/** 
 * Switches the tweening flag.
 */
public void switchTweening(){
  setTweening(!tweening);
}
Program: 99208
Project: 99208
Buggy source:
protected void setInnerScale(float scale){
  mapDisplay.innerScale=scale;
  mapDisplay.innerScale=PApplet.constrain(mapDisplay.innerScale,minScale,maxScale);
  scaleIntegrator.target(scale);
  mapDisplay.calculateInnerMatrix();
}

Fixed version (ground truth):
protected void setInnerScale(float scale){
  scale=PApplet.constrain(scale,minScale,maxScale);
  if (tweening) {
    scaleIntegrator.target(scale);
  }
 else {
    mapDisplay.innerScale=scale;
    mapDisplay.calculateInnerMatrix();
  }
}
Program: 99209
Project: 99209
Buggy source:
protected void addInnerOffset(float dx,float dy){
  mapDisplay.innerOffsetX+=dx;
  mapDisplay.innerOffsetY+=dy;
  mapDisplay.calculateInnerMatrix();
}

Fixed version (ground truth):
protected void addInnerOffset(float dx,float dy){
  if (tweening) {
    txIntegrator.target(txIntegrator.target + dx);
    tyIntegrator.target(tyIntegrator.target + dy);
  }
 else {
    mapDisplay.innerOffsetX+=dx;
    mapDisplay.innerOffsetY+=dy;
    mapDisplay.calculateInnerMatrix();
  }
}
Program: 99210
Project: 99210
Buggy source:
protected void innerScale(float scale){
  mapDisplay.innerScale*=scale;
  mapDisplay.innerScale=PApplet.constrain(mapDisplay.innerScale,minScale,maxScale);
  mapDisplay.calculateInnerMatrix();
}

Fixed version (ground truth):
protected void innerScale(float scale){
  scale=PApplet.constrain(mapDisplay.innerScale * scale,minScale,maxScale);
  if (tweening) {
    scaleIntegrator.target(scale);
  }
 else {
    mapDisplay.innerScale=scale;
    mapDisplay.calculateInnerMatrix();
  }
}
Program: 99211
Project: 99211
Buggy source:
public void set(float v){
  value=v;
}

Fixed version (ground truth):
public void set(double v){
  value=(float)v;
}
Program: 99212
Project: 99212
Buggy source:
public void target(float t){
  targeting=true;
  target=t;
}

Fixed version (ground truth):
public void target(double d){
  target((float)d);
}
Program: 99215
Project: 99215
Buggy source:
public void calculateInnerMatrix(){
  PMatrix3D invMatrix=new PMatrix3D();
  invMatrix.apply(innerMatrix);
  invMatrix.invert();
  float originalCenterX=invMatrix.multX(innerTransformationCenter.x,innerTransformationCenter.y);
  float originalCenterY=invMatrix.multY(innerTransformationCenter.x,innerTransformationCenter.y);
  innerMatrix=new PMatrix3D();
  innerMatrix.translate(innerTransformationCenter.x,innerTransformationCenter.y);
  innerMatrix.scale(innerScale);
  innerMatrix.rotateZ(innerAngle);
  innerMatrix.translate(-originalCenterX,-originalCenterY);
}

Fixed version (ground truth):
public void calculateInnerMatrix(){
synchronized (this) {
    PMatrix3D invMatrix=new PMatrix3D();
    invMatrix.apply(innerMatrix);
    invMatrix.invert();
    float originalCenterX=invMatrix.multX(innerTransformationCenter.x,innerTransformationCenter.y);
    float originalCenterY=invMatrix.multY(innerTransformationCenter.x,innerTransformationCenter.y);
    innerMatrix=new PMatrix3D();
    innerMatrix.translate(innerTransformationCenter.x,innerTransformationCenter.y);
    innerMatrix.scale(innerScale);
    innerMatrix.rotateZ(innerAngle);
    innerMatrix.translate(-originalCenterX,-originalCenterY);
  }
}
Program: 99216
Project: 99216
Buggy source:
public float[] getInnerObjectFromLocation(Location location){
  PMatrix3D m=new PMatrix3D();
  Coordinate coord=provider.locationCoordinate(location).zoomTo(0);
  float[] out=new float[3];
  m.mult(new float[]{coord.column * TILE_WIDTH,coord.row * TILE_HEIGHT,0},out);
  return out;
}

Fixed version (ground truth):
public float[] getInnerObjectFromLocation(Location location){
  Coordinate coord=provider.locationCoordinate(location).zoomTo(0);
  return new float[]{coord.column * TILE_WIDTH,coord.row * TILE_HEIGHT,0};
}
Program: 99217
Project: 99217
Buggy source:
public void keyPressed(){
  if (key == '+') {
    float[] xy=map.mapDisplay.getScreenFromObjectPosition(map.mapDisplay.getWidth() / 2,map.mapDisplay.getHeight() / 2);
    PVector transCenter=new PVector(xy[0],xy[1]);
    map.mapDisplay.setInnerTransformationCenter(transCenter);
    map.zoomLevelIn();
  }
  if (key == '-') {
    map.zoomLevelOut();
  }
  if (key == '*') {
    map.zoomIn();
  }
  if (key == '_') {
    map.zoomOut();
  }
  if (key == 'c') {
    map.panTo(berlinLocation);
  }
  if (key == 'i') {
    PVector m=new PVector(mouseX,mouseY);
    map.mapDisplay.setTransformationCenter(m);
  }
  if (key == 'r') {
    map.rotate(PI / 20);
  }
  if (key == 'l') {
    map.rotate(-PI / 20);
  }
  if (key == 'o') {
    map.move(100,100);
  }
  if (key == CODED) {
    if (keyCode == RIGHT) {
      map.panRight();
    }
    if (keyCode == LEFT) {
      map.panLeft();
    }
    if (keyCode == DOWN) {
      map.panDown();
    }
    if (keyCode == UP) {
      map.panUp();
    }
  }
  if (key == '1') {
    map.zoomToLevel(1);
  }
  if (key == '2') {
    map.zoomToLevel(2);
  }
  if (key == '3') {
    map.zoomToLevel(3);
  }
  if (key == '4') {
    map.zoomToLevel(4);
  }
}

Fixed version (ground truth):
public void keyPressed(){
  if (key == '+') {
    float[] xy=map.mapDisplay.getScreenFromObjectPosition(map.mapDisplay.getWidth() / 2,map.mapDisplay.getHeight() / 2);
    PVector transCenter=new PVector(xy[0],xy[1]);
    map.mapDisplay.setInnerTransformationCenter(transCenter);
    map.zoomLevelIn();
  }
  if (key == '-') {
    map.zoomLevelOut();
  }
  if (key == '*') {
    map.zoomIn();
  }
  if (key == '_') {
    map.zoomOut();
  }
  if (key == 'c') {
    map.panTo(berlinLocation);
  }
  if (key == 'i') {
    PVector m=new PVector(mouseX,mouseY);
    map.mapDisplay.setTransformationCenter(m);
  }
  if (key == 'r') {
    map.rotate(PI / 20);
  }
  if (key == 'l') {
    map.rotate(-PI / 20);
  }
  if (key == 'R') {
    map.innerRotate(PI / 20);
  }
  if (key == 'L') {
    map.innerRotate(-PI / 20);
  }
  if (key == 'o') {
    map.move(100,100);
  }
  if (key == CODED) {
    if (keyCode == RIGHT) {
      map.panRight();
    }
    if (keyCode == LEFT) {
      map.panLeft();
    }
    if (keyCode == DOWN) {
      map.panDown();
    }
    if (keyCode == UP) {
      map.panUp();
    }
  }
  if (key == '1') {
    map.zoomToLevel(1);
  }
  if (key == '2') {
    map.zoomToLevel(2);
  }
  if (key == '3') {
    map.zoomToLevel(3);
  }
  if (key == '4') {
    map.zoomToLevel(4);
  }
}
Program: 99218
Project: 99218
Buggy source:
public void setup(){
  size(800,600,GLConstants.GLGRAPHICS);
  map=new Map(this,"String_Node_Str",0,0,800,600);
  map.setTweening(false);
  debugDisplay=new DebugDisplay(this,map.mapDisplay,0,0,250,200);
  addMouseWheelListener(new java.awt.event.MouseWheelListener(){
    public void mouseWheelMoved(    java.awt.event.MouseWheelEvent evt){
      mouseWheel(evt.getWheelRotation());
    }
  }
);
}

Fixed version (ground truth):
public void setup(){
  size(800,600,GLConstants.GLGRAPHICS);
  map=new Map(this,"String_Node_Str",50,50,700,500);
  map.setTweening(false);
  debugDisplay=new DebugDisplay(this,map.mapDisplay,0,0,250,200);
  addMouseWheelListener(new java.awt.event.MouseWheelListener(){
    public void mouseWheelMoved(    java.awt.event.MouseWheelEvent evt){
      mouseWheel(evt.getWheelRotation());
    }
  }
);
}