Program: 107052
Project: 107052
Buggy source:
public static void main(String[] args){
  String newFile=null;
  String oldFile=null;
  String dirName="String_Node_Str";
  LinkedHashMap<String,Command> commands=new LinkedHashMap<String,Command>();
  LinkedHashMap<String,Command> oldCommands=new LinkedHashMap<String,Command>();
  ArrayList<Command> addedCommands=new ArrayList<Command>();
  ArrayList<Command> removedCommands=new ArrayList<Command>();
  HashMap<String,Command> stableCommands=new HashMap<String,Command>();
  XStream xs=new XStream(new DomDriver());
  xs.alias("String_Node_Str",Command.class);
  xs.alias("String_Node_Str",Argument.class);
  List<String> argsList=Arrays.asList(args);
  Iterator<String> iter=argsList.iterator();
  while (iter.hasNext()) {
    String arg=iter.next();
    if (arg.equals("String_Node_Str")) {
      newFile=iter.next();
    }
    if (arg.equals("String_Node_Str")) {
      oldFile=iter.next();
    }
    if (arg.equals("String_Node_Str")) {
      dirName=iter.next();
    }
  }
  try {
    try {
      ObjectInputStream inOld=xs.createObjectInputStream(new FileReader(oldFile));
      while (true) {
        Command c1=(Command)inOld.readObject();
        oldCommands.put(c1.getName(),c1);
      }
    }
 catch (    EOFException ex) {
    }
    try {
      ObjectInputStream inNew=xs.createObjectInputStream(new FileReader(newFile));
      while (true) {
        Command c=(Command)inNew.readObject();
        commands.put(c.getName(),c);
      }
    }
 catch (    EOFException ex) {
    }
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
  for (  String key : commands.keySet()) {
    if (!oldCommands.containsKey(key)) {
      addedCommands.add(commands.get(key));
    }
 else {
      stableCommands.put(commands.get(key).getName(),commands.get(key));
    }
  }
  for (  String key : oldCommands.keySet()) {
    if (!commands.containsKey(key)) {
      removedCommands.add(oldCommands.get(key));
      if (stableCommands.get(key) != null) {
        stableCommands.remove(key);
      }
    }
  }
  try {
    FileWriter fstream=new FileWriter(dirName + "String_Node_Str");
    BufferedWriter out=new BufferedWriter(fstream);
    out.write("String_Node_Str");
    for (    Command c : addedCommands) {
      if (c.getDescription() != null && !c.getDescription().isEmpty()) {
        out.write("String_Node_Str" + c.getName() + "String_Node_Str"+ c.getDescription()+ "String_Node_Str");
      }
 else {
        out.write("String_Node_Str" + c.getName() + "String_Node_Str");
      }
    }
    out.write("String_Node_Str");
    for (    Command c : removedCommands) {
      if (c.getDescription() != null && !c.getDescription().isEmpty()) {
        out.write("String_Node_Str" + c.getName() + "String_Node_Str"+ c.getDescription()+ "String_Node_Str");
      }
 else {
        out.write("String_Node_Str" + c.getName() + "String_Node_Str");
      }
    }
    out.write("String_Node_Str");
    for (    String key : stableCommands.keySet()) {
      if (commands.get(key).isAsync() != oldCommands.get(key).isAsync()) {
        String type="String_Node_Str";
        if (commands.get(key).isAsync()) {
          type="String_Node_Str";
        }
        out.write("String_Node_Str" + stableCommands.get(key).getName() + "String_Node_Str"+ type);
      }
    }
    out.write("String_Node_Str");
    for (    String key : stableCommands.keySet()) {
      ArrayList<Argument> newReqArgs=new ArrayList<Argument>();
      ArrayList<Argument> removedReqArgs=new ArrayList<Argument>();
      HashMap<String,Argument> stableReqArgs=new HashMap<String,Argument>();
      ArrayList<Argument> newRespArgs=new ArrayList<Argument>();
      ArrayList<Argument> removedRespArgs=new ArrayList<Argument>();
      HashMap<String,Argument> stableRespArgs=new HashMap<String,Argument>();
      Command newCommand=commands.get(key);
      Command oldCommand=oldCommands.get(key);
      for (      Argument arg : newCommand.getRequest()) {
        if (oldCommand.getReqArgByName(arg.getName()) == null) {
          newReqArgs.add(arg);
        }
 else {
          stableReqArgs.put(arg.getName(),arg);
        }
      }
      for (      Argument arg : oldCommand.getRequest()) {
        if (newCommand.getReqArgByName(arg.getName()) == null) {
          removedReqArgs.add(arg);
          if (stableReqArgs.get(arg.getName()) != null) {
            stableReqArgs.remove(arg.getName());
          }
        }
      }
      for (Iterator<String> i=stableReqArgs.keySet().iterator(); i.hasNext(); ) {
        String argName=i.next();
        if (oldCommand.getReqArgByName(argName).isRequired() == newCommand.getReqArgByName(argName).isRequired()) {
          i.remove();
        }
      }
      if (newCommand.getResponse() != null && oldCommand.getResponse() != null) {
        for (        Argument arg : newCommand.getResponse()) {
          if (oldCommand.getResArgByName(arg.getName()) == null) {
            newRespArgs.add(arg);
          }
        }
        for (        Argument arg : oldCommand.getResponse()) {
          if (newCommand.getResArgByName(arg.getName()) == null) {
            removedRespArgs.add(arg);
          }
        }
      }
      if (newReqArgs.size() != 0 || newRespArgs.size() != 0 || removedReqArgs.size() != 0 || removedRespArgs.size() != 0 || stableReqArgs.size() != 0 || stableReqArgs.size() != 0) {
        StringBuffer commandInfo=new StringBuffer();
        commandInfo.append("String_Node_Str" + key);
        out.write(commandInfo.toString());
        out.write("String_Node_Str");
        if (newReqArgs.size() != 0 || removedReqArgs.size() != 0) {
          StringBuffer request=new StringBuffer();
          request.append("String_Node_Str");
          out.write(request.toString());
          if (newReqArgs.size() != 0) {
            StringBuffer newParameters=new StringBuffer();
            newParameters.append("String_Node_Str");
            for (            Argument newArg : newReqArgs) {
              String isRequiredParam="String_Node_Str";
              if (newArg.isRequired()) {
                isRequiredParam="String_Node_Str";
              }
              newParameters.append(newArg.getName() + "String_Node_Str" + isRequiredParam+ "String_Node_Str");
            }
            newParameters.delete(newParameters.length() - 2,newParameters.length() - 1);
            out.write(newParameters.toString());
            out.write("String_Node_Str");
          }
          if (removedReqArgs.size() != 0) {
            StringBuffer removedParameters=new StringBuffer();
            removedParameters.append("String_Node_Str");
            for (            Argument removedArg : removedReqArgs) {
              removedParameters.append(removedArg.getName() + "String_Node_Str");
            }
            removedParameters.delete(removedParameters.length() - 2,removedParameters.length() - 1);
            out.write(removedParameters.toString());
            out.write("String_Node_Str");
          }
          if (stableReqArgs.size() != 0) {
            StringBuffer changedParameters=new StringBuffer();
            changedParameters.append("String_Node_Str");
            for (            Argument stableArg : stableReqArgs.values()) {
              String newRequired="String_Node_Str";
              String oldRequired="String_Node_Str";
              if (oldCommand.getReqArgByName(stableArg.getName()).isRequired() == true)               oldRequired="String_Node_Str";
              if (newCommand.getReqArgByName(stableArg.getName()).isRequired() == true)               newRequired="String_Node_Str";
              changedParameters.append(stableArg.getName() + "String_Node_Str" + oldRequired+ "String_Node_Str"+ newRequired+ "String_Node_Str");
            }
            changedParameters.delete(changedParameters.length() - 2,changedParameters.length() - 1);
            out.write(changedParameters.toString());
            out.write("String_Node_Str");
          }
        }
        if (newRespArgs.size() != 0 || removedRespArgs.size() != 0) {
          StringBuffer changedResponseParams=new StringBuffer();
          changedResponseParams.append("String_Node_Str");
          out.write(changedResponseParams.toString());
          if (newRespArgs.size() != 0) {
            StringBuffer newRespParams=new StringBuffer();
            newRespParams.append("String_Node_Str");
            for (            Argument newArg : newRespArgs) {
              newRespParams.append(newArg.getName() + "String_Node_Str");
            }
            newRespParams.delete(newRespParams.length() - 2,newRespParams.length() - 1);
            out.write(newRespParams.toString());
            out.write("String_Node_Str");
          }
          if (removedRespArgs.size() != 0) {
            StringBuffer removedRespParams=new StringBuffer();
            removedRespParams.append("String_Node_Str");
            for (            Argument removedArg : removedRespArgs) {
              removedRespParams.append(removedArg.getName() + "String_Node_Str");
            }
            removedRespParams.delete(removedRespParams.length() - 2,removedRespParams.length() - 1);
            out.write(removedRespParams.toString());
            out.write("String_Node_Str");
          }
        }
      }
    }
    out.close();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  String newFile=null;
  String oldFile=null;
  String dirName="String_Node_Str";
  LinkedHashMap<String,Command> commands=new LinkedHashMap<String,Command>();
  LinkedHashMap<String,Command> oldCommands=new LinkedHashMap<String,Command>();
  ArrayList<Command> addedCommands=new ArrayList<Command>();
  ArrayList<Command> removedCommands=new ArrayList<Command>();
  HashMap<String,Command> stableCommands=new HashMap<String,Command>();
  XStream xs=new XStream(new DomDriver());
  xs.alias("String_Node_Str",Command.class);
  xs.alias("String_Node_Str",Argument.class);
  List<String> argsList=Arrays.asList(args);
  Iterator<String> iter=argsList.iterator();
  while (iter.hasNext()) {
    String arg=iter.next();
    if (arg.equals("String_Node_Str")) {
      newFile=iter.next();
    }
    if (arg.equals("String_Node_Str")) {
      oldFile=iter.next();
    }
    if (arg.equals("String_Node_Str")) {
      dirName=iter.next();
    }
  }
  try {
    try {
      ObjectInputStream inOld=xs.createObjectInputStream(new FileReader(oldFile));
      while (true) {
        Command c1=(Command)inOld.readObject();
        oldCommands.put(c1.getName(),c1);
      }
    }
 catch (    EOFException ex) {
    }
    try {
      ObjectInputStream inNew=xs.createObjectInputStream(new FileReader(newFile));
      while (true) {
        Command c=(Command)inNew.readObject();
        commands.put(c.getName(),c);
      }
    }
 catch (    EOFException ex) {
    }
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
  for (  String key : commands.keySet()) {
    if (!oldCommands.containsKey(key)) {
      addedCommands.add(commands.get(key));
    }
 else {
      stableCommands.put(commands.get(key).getName(),commands.get(key));
    }
  }
  for (  String key : oldCommands.keySet()) {
    if (!commands.containsKey(key)) {
      removedCommands.add(oldCommands.get(key));
      if (stableCommands.get(key) != null) {
        stableCommands.remove(key);
      }
    }
  }
  try {
    FileWriter fstream=new FileWriter(dirName + "String_Node_Str");
    BufferedWriter out=new BufferedWriter(fstream);
    out.write("String_Node_Str");
    for (    Command c : addedCommands) {
      if (c.getDescription() != null && !c.getDescription().isEmpty()) {
        out.write("String_Node_Str" + c.getName() + "String_Node_Str"+ c.getDescription()+ "String_Node_Str");
      }
 else {
        out.write("String_Node_Str" + c.getName() + "String_Node_Str");
      }
    }
    out.write("String_Node_Str");
    for (    Command c : removedCommands) {
      if (c.getDescription() != null && !c.getDescription().isEmpty()) {
        out.write("String_Node_Str" + c.getName() + "String_Node_Str"+ c.getDescription()+ "String_Node_Str");
      }
 else {
        out.write("String_Node_Str" + c.getName() + "String_Node_Str");
      }
    }
    out.write("String_Node_Str");
    for (    String key : stableCommands.keySet()) {
      if (commands.get(key).isAsync() != oldCommands.get(key).isAsync()) {
        String type="String_Node_Str";
        if (commands.get(key).isAsync()) {
          type="String_Node_Str";
        }
        out.write("String_Node_Str" + stableCommands.get(key).getName() + "String_Node_Str"+ type);
      }
    }
    out.write("String_Node_Str");
    for (    String key : stableCommands.keySet()) {
      ArrayList<Argument> newReqArgs=new ArrayList<Argument>();
      ArrayList<Argument> removedReqArgs=new ArrayList<Argument>();
      HashMap<String,Argument> stableReqArgs=new HashMap<String,Argument>();
      ArrayList<Argument> newRespArgs=new ArrayList<Argument>();
      ArrayList<Argument> removedRespArgs=new ArrayList<Argument>();
      Command newCommand=commands.get(key);
      Command oldCommand=oldCommands.get(key);
      for (      Argument arg : newCommand.getRequest()) {
        if (oldCommand.getReqArgByName(arg.getName()) == null) {
          if (!(arg.getName().equals("String_Node_Str") || arg.getName().equals("String_Node_Str") || arg.getName().equals("String_Node_Str"))) {
            newReqArgs.add(arg);
          }
        }
 else {
          stableReqArgs.put(arg.getName(),arg);
        }
      }
      for (      Argument arg : oldCommand.getRequest()) {
        if (newCommand.getReqArgByName(arg.getName()) == null) {
          removedReqArgs.add(arg);
          if (stableReqArgs.get(arg.getName()) != null) {
            stableReqArgs.remove(arg.getName());
          }
        }
      }
      for (Iterator<String> i=stableReqArgs.keySet().iterator(); i.hasNext(); ) {
        String argName=i.next();
        if (oldCommand.getReqArgByName(argName).isRequired() == newCommand.getReqArgByName(argName).isRequired()) {
          i.remove();
        }
      }
      if (newCommand.getResponse() != null && oldCommand.getResponse() != null) {
        for (        Argument arg : newCommand.getResponse()) {
          if (oldCommand.getResArgByName(arg.getName()) == null) {
            newRespArgs.add(arg);
          }
        }
        for (        Argument arg : oldCommand.getResponse()) {
          if (newCommand.getResArgByName(arg.getName()) == null) {
            removedRespArgs.add(arg);
          }
        }
      }
      if (newReqArgs.size() != 0 || newRespArgs.size() != 0 || removedReqArgs.size() != 0 || removedRespArgs.size() != 0 || stableReqArgs.size() != 0 || stableReqArgs.size() != 0) {
        StringBuffer commandInfo=new StringBuffer();
        commandInfo.append("String_Node_Str" + key);
        out.write(commandInfo.toString());
        out.write("String_Node_Str");
        if (newReqArgs.size() != 0 || removedReqArgs.size() != 0 || stableReqArgs.size() != 0) {
          StringBuffer request=new StringBuffer();
          request.append("String_Node_Str");
          out.write(request.toString());
          if (newReqArgs.size() != 0) {
            StringBuffer newParameters=new StringBuffer();
            newParameters.append("String_Node_Str");
            for (            Argument newArg : newReqArgs) {
              String isRequiredParam="String_Node_Str";
              if (newArg.isRequired()) {
                isRequiredParam="String_Node_Str";
              }
              newParameters.append(newArg.getName() + "String_Node_Str" + isRequiredParam+ "String_Node_Str");
            }
            newParameters.delete(newParameters.length() - 2,newParameters.length() - 1);
            out.write(newParameters.toString());
            out.write("String_Node_Str");
          }
          if (removedReqArgs.size() != 0) {
            StringBuffer removedParameters=new StringBuffer();
            removedParameters.append("String_Node_Str");
            for (            Argument removedArg : removedReqArgs) {
              removedParameters.append(removedArg.getName() + "String_Node_Str");
            }
            removedParameters.delete(removedParameters.length() - 2,removedParameters.length() - 1);
            out.write(removedParameters.toString());
            out.write("String_Node_Str");
          }
          if (stableReqArgs.size() != 0) {
            StringBuffer changedParameters=new StringBuffer();
            changedParameters.append("String_Node_Str");
            for (            Argument stableArg : stableReqArgs.values()) {
              String newRequired="String_Node_Str";
              String oldRequired="String_Node_Str";
              if (oldCommand.getReqArgByName(stableArg.getName()).isRequired() == true)               oldRequired="String_Node_Str";
              if (newCommand.getReqArgByName(stableArg.getName()).isRequired() == true)               newRequired="String_Node_Str";
              changedParameters.append(stableArg.getName() + "String_Node_Str" + oldRequired+ "String_Node_Str"+ newRequired+ "String_Node_Str");
            }
            changedParameters.delete(changedParameters.length() - 2,changedParameters.length() - 1);
            out.write(changedParameters.toString());
            out.write("String_Node_Str");
          }
        }
        if (newRespArgs.size() != 0 || removedRespArgs.size() != 0) {
          StringBuffer changedResponseParams=new StringBuffer();
          changedResponseParams.append("String_Node_Str");
          out.write(changedResponseParams.toString());
          if (newRespArgs.size() != 0) {
            StringBuffer newRespParams=new StringBuffer();
            newRespParams.append("String_Node_Str");
            for (            Argument newArg : newRespArgs) {
              newRespParams.append(newArg.getName() + "String_Node_Str");
            }
            newRespParams.delete(newRespParams.length() - 2,newRespParams.length() - 1);
            out.write(newRespParams.toString());
            out.write("String_Node_Str");
          }
          if (removedRespArgs.size() != 0) {
            StringBuffer removedRespParams=new StringBuffer();
            removedRespParams.append("String_Node_Str");
            for (            Argument removedArg : removedRespArgs) {
              removedRespParams.append(removedArg.getName() + "String_Node_Str");
            }
            removedRespParams.delete(removedRespParams.length() - 2,removedRespParams.length() - 1);
            out.write(removedRespParams.toString());
            out.write("String_Node_Str");
          }
        }
      }
    }
    out.close();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}