nus-yam/ex-repair huggingface dataset:
Program: 154151
Project: 154151
Buggy source:
@Override public void attach(String attachment,String cladeRoot,String prefix){
  ItemList items=reader.processCatalog(source,true);
  Term attachTerm=null;
  if (!"String_Node_Str".equals(attachment)) {
    attachTerm=target.getTermbyName(attachment);
    if (attachTerm == null) {
      if (!target.isEmpty()) {
        System.err.println("String_Node_Str" + source.getAbsolutePath() + "String_Node_Str"+ attachment+ "String_Node_Str"+ target);
        return;
      }
 else {
        attachTerm=target.addTerm(attachment);
        logger.info("String_Node_Str" + attachment + "String_Node_Str");
      }
    }
  }
  if (items.hasColumn(KnownField.CLASS)) {
    processClassColumn(items,attachTerm);
  }
  if (items.hasColumn(KnownField.ORDER)) {
    processOrderColumn(items,attachTerm);
  }
  if (items.hasColumn(KnownField.FAMILY)) {
    processFamilyColumn(items,attachTerm);
  }
  if (items.hasColumn(KnownField.SUBFAMILY)) {
    processSubFamilyColumn(items,attachTerm);
  }
  if (items.hasColumn(KnownField.GENUS)) {
    processGenusColumn(items,attachTerm);
  }
  if (items.hasColumn(KnownField.SPECIES)) {
    processSpeciesColumn(items,attachTerm);
  }
  logger.info("String_Node_Str" + target.getTermbyName("String_Node_Str").getID());
}

Fixed version (ground truth):
/** 
 * @param targetParentName name of parent node for attached clade
 * @param sourceRootName name of root node (child of parent) for attached clade
 * @param prefix prefix for newly generated terms
 */
@Override public void attach(String targetParentName,String sourceRootName,String prefix){
  ItemList items=reader.processCatalog(source,true);
  Term attachTerm=null;
  if (!"String_Node_Str".equals(targetParentName)) {
    attachTerm=target.getTermbyName(targetParentName);
    if (attachTerm == null) {
      if (!target.isEmpty()) {
        System.err.println("String_Node_Str" + source.getAbsolutePath() + "String_Node_Str"+ targetParentName+ "String_Node_Str"+ target);
        return;
      }
 else {
        attachTerm=target.addTerm(targetParentName);
        logger.info("String_Node_Str" + targetParentName + "String_Node_Str");
      }
    }
  }
  if (items.hasColumn(KnownField.CLASS)) {
    processClassColumn(items,attachTerm);
  }
  if (items.hasColumn(KnownField.ORDER)) {
    processOrderColumn(items,attachTerm);
  }
  if (items.hasColumn(KnownField.FAMILY)) {
    processFamilyColumn(items,attachTerm);
  }
  if (items.hasColumn(KnownField.SUBFAMILY)) {
    processSubFamilyColumn(items,attachTerm);
  }
  if (items.hasColumn(KnownField.GENUS)) {
    processGenusColumn(items,attachTerm);
  }
  if (items.hasColumn(KnownField.SPECIES)) {
    processSpeciesColumn(items,attachTerm);
  }
  logger.info("String_Node_Str" + target.getTermbyName("String_Node_Str").getID());
}
Program: 154152
Project: 154152
Buggy source:
/** 
 * wrapper to call save the OBOSession to the Store's targetFile
 */
@Override public void saveStore(){
  u.saveOBOSession(targetFile);
}

Fixed version (ground truth):
/** 
 * wrapper to call save the OBOSession to the Store's targetFile
 */
@Override public void saveStore(){
  logger.info("String_Node_Str" + getTermbyName("String_Node_Str"));
  u.saveOBOSession(targetFile);
}
Program: 154153
Project: 154153
Buggy source:
private void processMergeAction(Node action,TaxonStore target,String targetPrefixStr){
  final Map<Integer,String> synPrefixes=new HashMap<Integer,String>();
  final List<ColumnType> columns=processAttachElement(action,synPrefixes);
  final String formatStr=getAttribute(action,"String_Node_Str");
  final Merger m=getMerger(formatStr,columns,synPrefixes);
  final String sourceStr=getAttribute(action,"String_Node_Str");
  final String mergePrefix=getAttribute(action,PREFIXITEMSTR);
  final String subAction=getAttribute(action,SUBACTIONSTR);
  if (!"String_Node_Str".equals(sourceStr)) {
    m.setSource(getSourceFile(sourceStr));
    logger.info("String_Node_Str" + sourceStr);
  }
 else   m.setSource(null);
  m.setTarget(target);
  if (subAction == null) {
    m.setSubAction("String_Node_Str");
  }
 else {
    m.setSubAction(subAction.toUpperCase());
  }
  if (mergePrefix == null) {
    m.merge(targetPrefixStr);
  }
 else {
    m.merge(mergePrefix);
  }
}

Fixed version (ground truth):
private void processMergeAction(Node action,TaxonStore target,String targetPrefixStr){
  final Map<Integer,String> synPrefixes=new HashMap<Integer,String>();
  final List<ColumnType> columns=processAttachElement(action,synPrefixes);
  final String formatStr=getAttribute(action,"String_Node_Str");
  final Merger m=getMerger(formatStr,columns,synPrefixes);
  final String sourceStr=getAttribute(action,"String_Node_Str");
  final String mergePrefix=getAttribute(action,PREFIXITEMSTR);
  final String subAction=getAttribute(action,SUBACTIONSTR);
  final String uriTemplate=getAttribute(action,URITEMPLATESTR);
  if (!"String_Node_Str".equals(sourceStr)) {
    m.setSource(getSourceFile(sourceStr));
    logger.info("String_Node_Str" + sourceStr);
  }
 else   m.setSource(null);
  m.setTarget(target);
  if (subAction == null) {
    m.setSubAction("String_Node_Str");
  }
 else {
    m.setSubAction(subAction.toUpperCase());
  }
  if (uriTemplate != null) {
    m.setURITemplate(uriTemplate);
  }
  if (mergePrefix == null) {
    m.merge(targetPrefixStr);
  }
 else {
    m.merge(mergePrefix);
  }
}
Program: 154154
Project: 154154
Buggy source:
private ColumnType processColumnElement(Node column,int index,Map<Integer,String> synPrefixes){
  if (column.getAttributes().getLength() > 0) {
    String newName;
    if (column.getAttributes().getNamedItem("String_Node_Str") != null)     newName=column.getAttributes().getNamedItem("String_Node_Str").getNodeValue();
 else     newName="String_Node_Str" + Integer.toString(index);
    ColumnType col=new ColumnType(newName);
    if (column.getAttributes().getNamedItem(PREFIXITEMSTR) != null) {
      String synPrefix=column.getAttributes().getNamedItem(PREFIXITEMSTR).getNodeValue();
      synPrefixes.put(index,synPrefix);
    }
    if (column.getAttributes().getNamedItem("String_Node_Str") != null) {
      col.setType(column.getAttributes().getNamedItem("String_Node_Str").getNodeValue());
    }
    return col;
  }
 else   throw new RuntimeException("String_Node_Str" + index + "String_Node_Str");
}

Fixed version (ground truth):
private ColumnType processColumnElement(Node column,int index,Map<Integer,String> synPrefixes){
  if (column.getAttributes().getNamedItem("String_Node_Str") != null) {
    final ColumnType col=new ColumnType(column.getAttributes().getNamedItem("String_Node_Str").getNodeValue());
    if (column.getAttributes().getNamedItem("String_Node_Str") != null)     col.setName(column.getAttributes().getNamedItem("String_Node_Str").getNodeValue());
 else     col.setName("String_Node_Str" + Integer.toString(index));
    if (column.getAttributes().getNamedItem(PREFIXITEMSTR) != null) {
      String synPrefix=column.getAttributes().getNamedItem(PREFIXITEMSTR).getNodeValue();
      synPrefixes.put(index,synPrefix);
    }
    return col;
  }
 else   throw new RuntimeException("String_Node_Str" + index + "String_Node_Str");
}
Program: 154155
Project: 154155
Buggy source:
private List<ColumnType> processChildNodesOfAttach(NodeList childNodes,Map<Integer,String> synPrefixes){
  List<ColumnType> result=new ArrayList<ColumnType>();
  for (int i=0; i < childNodes.getLength(); i++) {
    Node child=childNodes.item(i);
    String childName=child.getNodeName();
    if (COLUMNSYNTAXSTR.equals(childName)) {
      NodeList columnElements=child.getChildNodes();
      for (int j=0; j < columnElements.getLength(); j++) {
        final Node column=columnElements.item(j);
        if (column.getNodeType() == Node.ELEMENT_NODE) {
          result.add(processColumnElement(column,j,synPrefixes));
        }
      }
    }
 else     if (Node.TEXT_NODE != child.getNodeType()) {
      logger.warn("String_Node_Str" + child);
    }
  }
  return result;
}

Fixed version (ground truth):
private List<ColumnType> processChildNodesOfAttach(NodeList childNodes,Map<Integer,String> synPrefixes){
  List<ColumnType> result=new ArrayList<ColumnType>();
  for (int i=0; i < childNodes.getLength(); i++) {
    Node child=childNodes.item(i);
    String childName=child.getNodeName();
    if (COLUMNSYNTAXSTR.equals(childName)) {
      int columnCount=0;
      NodeList columnElements=child.getChildNodes();
      for (int j=0; j < columnElements.getLength(); j++) {
        final Node column=columnElements.item(j);
        if (column.getNodeType() == Node.ELEMENT_NODE) {
          result.add(processColumnElement(column,columnCount,synPrefixes));
          columnCount++;
        }
      }
    }
 else     if (Node.TEXT_NODE != child.getNodeType()) {
      logger.warn("String_Node_Str" + child);
    }
  }
  return result;
}
Program: 154156
Project: 154156
Buggy source:
private void mergeXrefs(ItemList items){
  for (  Item item : items.getContents()) {
  }
}

Fixed version (ground truth):
private void mergeXrefs(ItemList items){
  int termCount=0;
  final ColumnType c=reader.getColumn(KnownField.SPECIES);
  if (c == null)   return;
  for (  Item item : items.getContents()) {
    final String genus=item.getFieldValue(KnownField.GENUS);
    String species=item.getFieldValue(KnownField.SPECIES);
    if (species.indexOf(' ') != -1) {
      species=species.substring(0,species.indexOf(' '));
    }
    final Term matchingTerm=target.getTermbyName(genus + "String_Node_Str" + species);
    if (matchingTerm != null) {
      termCount++;
      String finalURI=expandURI(item);
      logger.info("String_Node_Str" + finalURI);
      int colonpos=finalURI.indexOf(':');
      String rest=finalURI.substring(colonpos + 1);
      target.addXRefToTerm(matchingTerm,"String_Node_Str",rest);
    }
  }
}
Program: 154162
Project: 154162
Buggy source:
/** 
 * Note: this returns a String->String table because the only reference to the parent taxon is the name - the id adjacent to the parent name is not for the parent.
 * @param itemList
 * @return
 */
Map<String,Set<String>> buildTree(List<PBDBItem> itemList){
  if (itemList == null)   throw new RuntimeException("String_Node_Str");
  Map<String,Set<String>> result=new HashMap<String,Set<String>>();
  for (  PBDBItem item : itemList) {
    if (item.isValid()) {
      String name=item.getName();
      String parentName=item.getParentName();
      if (result.containsKey(parentName)) {
        Set<String> children=result.get(parentName);
        children.add(name);
      }
 else {
        Set<String> children=new HashSet<String>();
        children.add(name);
        result.put(parentName,children);
      }
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Note: this returns a String->String table because the only reference to the parent taxon is the name - the id adjacent to the parent name is not for the parent.
 * @param itemList
 * @return
 */
Map<String,String> buildTree(List<PBDBItem> itemList){
  if (itemList == null)   throw new RuntimeException("String_Node_Str");
  Map<String,String> result=new HashMap<String,String>();
  for (  PBDBItem item : itemList) {
    if (item.isValid()) {
      String name=item.getName();
      String parentName=item.getParentName();
      if (result.containsKey(name)) {
        throw new RuntimeException("String_Node_Str");
      }
 else {
        result.put(name,parentName);
      }
    }
  }
  return result;
}
Program: 154163
Project: 154163
Buggy source:
/** 
 * @param parent ignored in this merger
 * @param cladeRoot ignored in this merger - each term provides it's own parentage
 */
@Override public void attach(String parent,String cladeRoot,String prefix){
  if (target == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (source == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  final File taxonUnitsFile=new File(source.getAbsolutePath() + '/' + TAXONUNITSFILENAME);
  final File synonymLinksFile=new File(source.getAbsolutePath() + '/' + SYNONYMLINKSFILENAME);
  List<PBDBItem> itemList=null;
  try {
    itemList=buildPBDBList(taxonUnitsFile);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str" + taxonUnitsFile);
    e.printStackTrace();
  }
  Map<Integer,Integer> synonymMap;
  try {
    synonymMap=buildSynonymLinks(synonymLinksFile);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str" + synonymLinksFile);
  }
  Map<String,Set<String>> taxonTree=buildTree(itemList);
}

Fixed version (ground truth):
/** 
 * @param defaultParent generally ignored, except if no names in a term's lineage resolves
 * @param cladeRoot ignored in this merger
 */
@Override public void attach(String defaultParent,String cladeRoot,String prefix){
  if (target == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (source == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  final File taxonUnitsFile=new File(source.getAbsolutePath() + '/' + TAXONUNITSFILENAME);
  final File synonymLinksFile=new File(source.getAbsolutePath() + '/' + SYNONYMLINKSFILENAME);
  final Term defaultParentTaxon=target.getTerm(defaultParent);
  List<PBDBItem> itemList=null;
  try {
    itemList=buildPBDBList(taxonUnitsFile);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str" + taxonUnitsFile);
    e.printStackTrace();
  }
  Map<Integer,Integer> synonymMap;
  try {
    synonymMap=buildSynonymLinks(synonymLinksFile);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str" + synonymLinksFile);
  }
  Map<String,String> taxonTree=buildTree(itemList);
  Map<String,Term> termDictionary=new HashMap<String,Term>();
  for (  Term t : target.getTerms()) {
    termDictionary.put(t.getLabel(),t);
  }
  for (  String tName : taxonTree.keySet()) {
    System.out.println("String_Node_Str" + tName);
    if (!termDictionary.containsKey(tName)) {
      Term newTerm=target.addTerm(tName);
      termDictionary.put(tName,newTerm);
    }
  }
  for (  String tName : taxonTree.keySet()) {
    Term child=termDictionary.get(tName);
    Term parent=termDictionary.get(taxonTree.get(tName));
    if (parent == null) {
      parent=defaultParentTaxon;
    }
    if (!parent.getChildren().contains(child)) {
      target.attachParent(child,parent);
    }
  }
  for (  PBDBItem item : itemList) {
    if (item.isValid()) {
    }
 else {
    }
  }
}
Program: 154164
Project: 154164
Buggy source:
protected static void send(Message message,String template,Map<String,Object> params){
  String bodyHtml=null;
  String bodyText="String_Node_Str";
  try {
    Template templateHtml=TemplateLoader.load(template + "String_Node_Str");
    bodyHtml=templateHtml.render(params);
    message.setHtmlBody(bodyHtml);
  }
 catch (  TemplateNotFoundException e) {
    Logger.debug("String_Node_Str",e);
  }
  try {
    Template templateText=TemplateLoader.load(template + "String_Node_Str");
    bodyText=templateText.render(params);
    message.setTextBody(bodyText);
  }
 catch (  TemplateNotFoundException e) {
    Logger.debug("String_Node_Str",e);
  }
  if (StringUtils.isNotEmpty(bodyHtml) || StringUtils.isNotEmpty(bodyText)) {
    Logger.debug("String_Node_Str");
    try {
      getMailService().send(message);
    }
 catch (    IOException e) {
      Logger.error("String_Node_Str",e);
    }
catch (    ApiDeadlineExceededException e) {
      Logger.error("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
protected static void send(Message message,String template,Map<String,Object> params){
  String bodyHtml=null;
  String bodyText="String_Node_Str";
  try {
    Template templateHtml=TemplateLoader.load(template + "String_Node_Str");
    bodyHtml=templateHtml.render(params);
    message.setHtmlBody(bodyHtml);
  }
 catch (  TemplateNotFoundException e) {
    Logger.error("String_Node_Str",e);
  }
  try {
    Template templateText=TemplateLoader.load(template + "String_Node_Str");
    bodyText=templateText.render(params);
    message.setTextBody(bodyText);
  }
 catch (  TemplateNotFoundException e) {
    Logger.error("String_Node_Str",e);
  }
  if (StringUtils.isNotEmpty(bodyHtml) || StringUtils.isNotEmpty(bodyText)) {
    Logger.debug("String_Node_Str");
    try {
      getMailService().send(message);
    }
 catch (    IOException e) {
      Logger.error("String_Node_Str",e);
    }
catch (    ApiDeadlineExceededException e) {
      Logger.error("String_Node_Str",e);
    }
  }
}
Program: 154165
Project: 154165
Buggy source:
public static void authenticate(@Required String username,String password) throws Throwable {
  Boolean allowed=(Boolean)Security.authenticate(username,password);
  if (validation.hasErrors() || !allowed) {
    flash.keep("String_Node_Str");
    flash.error(Messages.get("String_Node_Str"));
    params.flash();
  }
 else {
    User user=User.findByEmail(username);
    Logger.debug("String_Node_Str" + username + "String_Node_Str"+ user.email);
    if (user != null) {
      user.createUserSession();
    }
  }
  Secure.redirectToOriginalURL();
}

Fixed version (ground truth):
public static void authenticate(@Required String username,String password) throws Throwable {
  Boolean allowed=(Boolean)Security.authenticate(username,password);
  if (validation.hasErrors() || !allowed) {
    Logger.debug("String_Node_Str" + validation.hasErrors() + "String_Node_Str"+ allowed);
    flash.keep("String_Node_Str");
    flash.error(Messages.get("String_Node_Str"));
    params.flash();
  }
 else {
    User user=User.findByEmail(username);
    Logger.debug("String_Node_Str" + username + "String_Node_Str"+ user.email);
    if (user != null) {
      user.createUserSession();
    }
  }
  Secure.redirectToOriginalURL();
}
Program: 154166
Project: 154166
Buggy source:
public static void index(){
  if (session.contains("String_Node_Str") && User.findById(Long.valueOf(session.get("String_Node_Str"))) != null) {
    Cities.index();
  }
  render();
}

Fixed version (ground truth):
public static void index(){
  if (Security.isConnected()) {
    Cities.index();
  }
 else {
    render();
  }
}
Program: 154167
Project: 154167
Buggy source:
public static void edit(Long id){
  Logger.debug("String_Node_Str" + id);
  Deal deal=Deal.findById(id);
  render(deal);
}

Fixed version (ground truth):
public static void edit(Long id){
  Logger.debug("String_Node_Str" + id);
  User user=User.findByEmail(Security.connected());
  Deal deal=Deal.findById(id);
  if (deal != null && deal.owner != null && deal.owner.equals(user)) {
    render(deal,user);
  }
 else {
    notFound();
  }
}
Program: 154168
Project: 154168
Buggy source:
public static void index(){
  User owner=User.findByEmail(Security.connected());
  List<Deal> deals=Deal.findActiveDealsByOwner(owner);
  Logger.debug("String_Node_Str" + deals.size());
  render(deals);
}

Fixed version (ground truth):
public static void index(){
  User user=User.findByEmail(Security.connected());
  List<Deal> deals=Deal.findActiveDealsByOwner(user);
  render(deals,user);
}
Program: 154169
Project: 154169
Buggy source:
public static void updateAccount(User user){
  validation.email("String_Node_Str",user.email);
  validation.required("String_Node_Str",user.firstName);
  validation.required("String_Node_Str",user.lastName);
  validation.required("String_Node_Str",user.password);
  Logger.debug("String_Node_Str" + user.email);
  User dbUser=User.findById(Long.valueOf(session.get("String_Node_Str")));
  user.password=DigestUtils.md5Hex(user.password);
  dbUser.updateDetails(user);
  if (!validation.hasErrors()) {
    dbUser.update();
    flash.success(Messages.get("String_Node_Str"));
  }
 else {
    flash.error(Messages.get("String_Node_Str"));
    params.flash();
    validation.keep();
    Logger.debug("String_Node_Str" + validation.errorsMap().toString());
  }
  redirect("String_Node_Str");
}

Fixed version (ground truth):
public static void updateAccount(User user,String returnUrl){
  validation.email("String_Node_Str",user.email);
  validation.required("String_Node_Str",user.firstName);
  validation.required("String_Node_Str",user.lastName);
  validation.required("String_Node_Str",user.password);
  Logger.debug("String_Node_Str" + user.email);
  User dbUser=User.findById(Long.valueOf(session.get("String_Node_Str")));
  user.password=DigestUtils.md5Hex(user.password);
  dbUser.updateDetails(user);
  if (!validation.hasErrors()) {
    dbUser.update();
    flash.success(Messages.get("String_Node_Str"));
  }
 else {
    flash.error(Messages.get("String_Node_Str"));
    params.flash();
    validation.keep();
    Logger.debug("String_Node_Str" + validation.errorsMap().toString());
  }
  redirect(returnUrl);
}
Program: 154170
Project: 154170
Buggy source:
protected static void send(Message message,String template,Map<String,Object> params){
  String bodyHtml=null;
  String bodyText="String_Node_Str";
  try {
    Template templateHtml=TemplateLoader.load(template + "String_Node_Str");
    bodyHtml=templateHtml.render(params);
    message.setHtmlBody(bodyHtml);
  }
 catch (  TemplateNotFoundException e) {
    Logger.error("String_Node_Str",e);
  }
  try {
    Template templateText=TemplateLoader.load(template + "String_Node_Str");
    bodyText=templateText.render(params);
    message.setTextBody(bodyText);
  }
 catch (  TemplateNotFoundException e) {
    Logger.error("String_Node_Str",e);
  }
  if (StringUtils.isNotEmpty(bodyHtml) || StringUtils.isNotEmpty(bodyText)) {
    Logger.debug("String_Node_Str");
    try {
      getMailService().send(message);
    }
 catch (    IOException e) {
      Logger.error("String_Node_Str",e);
    }
catch (    ApiDeadlineExceededException e) {
      Logger.error("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
protected static void send(Message message,String template,Map<String,Object> params){
  String bodyHtml=null;
  String bodyText="String_Node_Str";
  try {
    Template templateHtml=TemplateLoader.load(template + "String_Node_Str");
    bodyHtml=templateHtml.render(params);
    message.setHtmlBody(bodyHtml);
  }
 catch (  TemplateNotFoundException e) {
    Logger.info("String_Node_Str",e);
  }
  try {
    Template templateText=TemplateLoader.load(template + "String_Node_Str");
    bodyText=templateText.render(params);
    message.setTextBody(bodyText);
  }
 catch (  TemplateNotFoundException e) {
    Logger.error("String_Node_Str",e);
  }
  if (StringUtils.isNotEmpty(bodyHtml) || StringUtils.isNotEmpty(bodyText)) {
    try {
      Logger.debug("String_Node_Str",bodyHtml);
      getMailService().send(message);
    }
 catch (    IOException e) {
      Logger.error("String_Node_Str",e);
    }
catch (    ApiDeadlineExceededException e) {
      Logger.error("String_Node_Str",e);
    }
  }
}
Program: 154171
Project: 154171
Buggy source:
/** 
 * Search for the nearest city and return the active deals
 * @param lat
 * @param lng
 */
public static void findCityDealsByLatLong(@Required double lat,@Required double lng,@Required @As("String_Node_Str") Date checkin,@Required int nights){
  if (validation.hasErrors()) {
    renderJSON(null);
  }
 else {
    List<City> cities=City.findActiveCities();
    City city=GeoHelper.getNearestCity(lat,lng,cities);
    Logger.debug("String_Node_Str",lat,lng,city);
    renderJSON(DealsService.findTonightDealsByCityV3(city));
  }
}

Fixed version (ground truth):
/** 
 * Search for the nearest city and return the active deals
 * @param lat
 * @param lng
 */
public static void findCityDealsByLatLong(@Required double lat,@Required double lng,@Required @As("String_Node_Str") Date checkin,@Required int nights){
  if (validation.hasErrors()) {
    renderJSON(null);
  }
 else {
    List<City> cities=City.findActiveCities();
    City city=GeoHelper.getNearestCity(lat,lng,cities);
    Logger.debug("String_Node_Str",lat,lng,city);
    renderJSON(DealsService.findDealsByCityAndDateV3(city,checkin,nights));
  }
}
Program: 154172
Project: 154172
Buggy source:
/** 
 * Search for a city by name and return the active deals
 * @param name
 */
public static void findCityDealsByCityName(@Required String name,@Required @As("String_Node_Str") Date checkin,@Required int nights){
  if (validation.hasErrors()) {
    renderJSON(null);
  }
 else {
    City city=City.findByUrl(name.toLowerCase());
    Logger.debug("String_Node_Str",name,city);
    renderJSON(DealsService.findTonightDealsByCityV3(city));
  }
}

Fixed version (ground truth):
/** 
 * Search for a city by name and return the active deals
 * @param name
 */
public static void findCityDealsByCityName(@Required String name,@Required @As("String_Node_Str") Date checkin,@Required int nights){
  if (validation.hasErrors()) {
    renderJSON(null);
  }
 else {
    City city=City.findByUrl(name.toLowerCase());
    Logger.debug("String_Node_Str",name,city);
    renderJSON(DealsService.findDealsByCityAndDateV3(city,checkin,nights));
  }
}
Program: 154173
Project: 154173
Buggy source:
/** 
 * V3 Limits the deals number per city zone to the MAXDEALS
 * @param dealsMap
 * @return Returns a DealsCityDTO with all the active deals in all the zones of a city.
 */
private static List<DealsCityDTO> findCityZonesWithActiveDeals(LinkedHashMap<City,List<Deal>> dealsMap,Boolean noLimits,Boolean hideAppOnly){
  List<DealsCityDTO> cityZones=new ArrayList<DealsCityDTO>();
  for (  City city : dealsMap.keySet()) {
    List<Deal> zoneDeals=selectMaxDeals(dealsMap.get(city),noLimits,hideAppOnly);
    if (zoneDeals.size() > 0) {
      List<DealDTOV3> dealsDtos=new ArrayList<DealDTOV3>();
      for (      Deal deal : zoneDeals) {
        dealsDtos.add(new DealDTOV3(deal));
      }
      DealsCityDTO dealsCity=new DealsCityDTO(city,dealsDtos);
      cityZones.add(dealsCity);
    }
  }
  return cityZones;
}

Fixed version (ground truth):
/** 
 * V3 Limits the deals number per city zone to the MAXDEALS
 * @param dealsMap
 * @return Returns a DealsCityDTO with all the active deals in all the zones of a city.
 */
private static List<CityZoneDTO> findCityZonesWithActiveDeals(LinkedHashMap<City,List<Deal>> dealsMap,Boolean noLimits,Boolean hideAppOnly){
  List<CityZoneDTO> cityZones=new ArrayList<CityZoneDTO>();
  for (  City city : dealsMap.keySet()) {
    List<Deal> zoneDeals=selectMaxDeals(dealsMap.get(city),noLimits,hideAppOnly);
    if (zoneDeals.size() > 0) {
      List<DealDTOV3> dealsDtos=new ArrayList<DealDTOV3>();
      for (      Deal deal : zoneDeals) {
        dealsDtos.add(new DealDTOV3(deal));
      }
      CityZoneDTO dealsCity=new CityZoneDTO(city,dealsDtos);
      cityZones.add(dealsCity);
    }
  }
  return cityZones;
}
Program: 154174
Project: 154174
Buggy source:
/** 
 * V3 Check each deal limit hour to show it as active or not. Also limits the deals number per city zone to the MAXDEALS
 * @param dealsMap
 * @param hour
 * @return Returns a DealsCityDTO with all the active deals in all the zones of a city at a given hour.
 */
private static List<DealsCityDTO> findCityZonesWithActiveDealsByNight(LinkedHashMap<City,List<Deal>> dealsMap,Integer hour,Boolean noLimits,Boolean hideAppOnly){
  List<DealsCityDTO> cityZones=new ArrayList<DealsCityDTO>();
  Logger.debug("String_Node_Str" + hour);
  for (  City city : dealsMap.keySet()) {
    List<Deal> zoneDeals=selectMaxDealsByHour(dealsMap.get(city),hour,noLimits,hideAppOnly);
    if (zoneDeals.size() > 0) {
      List<DealDTOV3> dealsDtos=new ArrayList<DealDTOV3>();
      for (      Deal deal : zoneDeals) {
        dealsDtos.add(new DealDTOV3(deal));
      }
      DealsCityDTO dealsCity=new DealsCityDTO(city,dealsDtos);
      cityZones.add(dealsCity);
    }
  }
  return cityZones;
}

Fixed version (ground truth):
/** 
 * V3 Check each deal limit hour to show it as active or not. Also limits the deals number per city zone to the MAXDEALS
 * @param dealsMap
 * @param hour
 * @return Returns a DealsCityDTO with all the active deals in all the zones of a city at a given hour.
 */
private static List<CityZoneDTO> findCityZonesWithActiveDealsByNight(LinkedHashMap<City,List<Deal>> dealsMap,Integer hour,Boolean noLimits,Boolean hideAppOnly){
  List<CityZoneDTO> cityZones=new ArrayList<CityZoneDTO>();
  Logger.debug("String_Node_Str" + hour);
  for (  City city : dealsMap.keySet()) {
    List<Deal> zoneDeals=selectMaxDealsByHour(dealsMap.get(city),hour,noLimits,hideAppOnly);
    if (zoneDeals.size() > 0) {
      List<DealDTOV3> dealsDtos=new ArrayList<DealDTOV3>();
      for (      Deal deal : zoneDeals) {
        dealsDtos.add(new DealDTOV3(deal));
      }
      CityZoneDTO dealsCity=new CityZoneDTO(city,dealsDtos);
      cityZones.add(dealsCity);
    }
  }
  return cityZones;
}
Program: 154175
Project: 154175
Buggy source:
/** 
 * Version 3. Cities can have root cities and zones.
 * @param city
 * @param noLimits 
 * @return all the active deals by city base on current time
 */
public static List<DealsCityDTO> findCityZonesDeals(City city,Boolean noLimits,Boolean hideAppOnly){
  if (city != null) {
    if (!city.isRootCityWithZones()) {
      String root=city.root;
      city=City.findByUrl(root);
    }
switch (DateHelper.getCurrentStateByCityHour(city.utcOffset)) {
case (DateHelper.CITY_CLOSED):
      Logger.info("String_Node_Str");
    return new ArrayList<DealsCityDTO>();
case (DateHelper.CITY_OPEN_DAY):
  LinkedHashMap<City,List<Deal>> dealsMap=findAllActiveDealsByCityV2(city);
Logger.info("String_Node_Str");
return findCityZonesWithActiveDeals(dealsMap,noLimits,hideAppOnly);
case (DateHelper.CITY_OPEN_NIGHT):
LinkedHashMap<City,List<Deal>> dealsMapAll=findAllActiveDealsByCityV2(city);
Integer hour=DateHelper.getCurrentHour(city.utcOffset);
Logger.debug("String_Node_Str" + hour);
return findCityZonesWithActiveDealsByNight(dealsMapAll,hour,noLimits,hideAppOnly);
default :
Logger.error("String_Node_Str");
return new ArrayList<DealsCityDTO>();
}
}
 else {
Logger.error("String_Node_Str");
return null;
}
}

Fixed version (ground truth):
/** 
 * Version 3. Cities can have root cities and zones.
 * @param city
 * @param noLimits 
 * @return all the active deals by city base on current time
 */
public static CityRootDTO findCityZonesDeals(City city,Boolean noLimits,Boolean hideAppOnly){
  if (city != null) {
    if (!city.isRootCityWithZones()) {
      String root=city.root;
      city=City.findByUrl(root);
    }
switch (DateHelper.getCurrentStateByCityHour(city.utcOffset)) {
case (DateHelper.CITY_CLOSED):
      Logger.info("String_Node_Str");
    return null;
case (DateHelper.CITY_OPEN_DAY):
  LinkedHashMap<City,List<Deal>> dealsMap=findAllActiveDealsByCityV2(city);
Logger.info("String_Node_Str");
List<CityZoneDTO> zones=findCityZonesWithActiveDeals(dealsMap,noLimits,hideAppOnly);
return new CityRootDTO(city,zones);
case (DateHelper.CITY_OPEN_NIGHT):
LinkedHashMap<City,List<Deal>> dealsMapAll=findAllActiveDealsByCityV2(city);
Integer hour=DateHelper.getCurrentHour(city.utcOffset);
Logger.debug("String_Node_Str" + hour);
List<CityZoneDTO> zonesNight=findCityZonesWithActiveDealsByNight(dealsMapAll,hour,noLimits,hideAppOnly);
return new CityRootDTO(city,zonesNight);
default :
Logger.error("String_Node_Str");
return null;
}
}
 else {
Logger.error("String_Node_Str");
return null;
}
}
Program: 154176
Project: 154176
Buggy source:
public static List<DealsCityDTO> findTonightDealsByCityV3(City city){
  Boolean noLimits=Boolean.FALSE;
  Boolean hideAppOnly=Boolean.TRUE;
  List<DealsCityDTO> deals=findCityZonesDeals(city,noLimits,hideAppOnly);
  return deals;
}

Fixed version (ground truth):
public static CityRootDTO findTonightDealsByCityV3(City city,int nights){
  if (nights > MAX_NIGHTS) {
    Logger.debug("String_Node_Str",nights);
    return null;
  }
 else {
    Boolean noLimits=Boolean.FALSE;
    Boolean hideAppOnly=Boolean.TRUE;
    return findCityZonesDeals(city,noLimits,hideAppOnly);
  }
}
Program: 154177
Project: 154177
Buggy source:
private static void doHotUsaReservation(Booking booking){
  String localizador=HotUsaApiHelper.reservation(booking);
  if (localizador != null) {
    Logger.debug("String_Node_Str" + localizador);
    booking.code=localizador;
    booking.update();
  }
 else {
    validation.addError("String_Node_Str",Messages.get("String_Node_Str"));
    renderBookingError(booking);
  }
}

Fixed version (ground truth):
private static void doHotUsaReservation(Booking booking){
  String localizador=HotUsaApiHelper.reservation(booking);
  if (localizador != null) {
    Logger.debug("String_Node_Str" + localizador);
    booking.code=localizador;
    booking.needConfirmation=Boolean.TRUE;
    booking.update();
  }
 else {
    validation.addError("String_Node_Str",Messages.get("String_Node_Str"));
    renderBookingError(booking);
  }
}
Program: 154178
Project: 154178
Buggy source:
private static void validateAndSave(@Valid Booking booking){
  booking.validate();
  if (!validation.hasErrors()) {
    Logger.debug("String_Node_Str");
    booking.insert();
    booking.deal=Deal.findById(booking.deal.id);
    booking.user=User.findById(booking.user.id);
    booking.deal.isHotUsa=booking.deal.isHotUsa != null ? booking.deal.isHotUsa : Boolean.FALSE;
    if (booking.deal.isHotUsa) {
      doHotUsaReservation(booking);
    }
 else {
      updateDealRooms(booking.deal.id,booking.rooms);
    }
    Mails.hotelBookingConfirmation(booking);
    Mails.userBookingConfirmation(booking);
    String json=JsonHelper.jsonExcludeFieldsWithoutExposeAnnotation(new BookingStatusMessage(Http.StatusCode.CREATED,"String_Node_Str",Messages.get("String_Node_Str"),booking));
    renderJSON(json);
  }
 else {
    renderBookingError(booking);
  }
}

Fixed version (ground truth):
private static void validateAndSave(@Valid Booking booking){
  booking.validate();
  if (!validation.hasErrors()) {
    Logger.debug("String_Node_Str");
    booking.insert();
    booking.deal=Deal.findById(booking.deal.id);
    booking.user=User.findById(booking.user.id);
    booking.deal.isHotUsa=booking.deal.isHotUsa != null ? booking.deal.isHotUsa : Boolean.FALSE;
    if (booking.deal.isHotUsa) {
      doHotUsaReservation(booking);
    }
 else {
      updateDealRooms(booking.deal.id,booking.rooms);
      Mails.hotelBookingConfirmation(booking);
      Mails.userBookingConfirmation(booking);
    }
    String json=JsonHelper.jsonExcludeFieldsWithoutExposeAnnotation(new BookingStatusMessage(Http.StatusCode.CREATED,"String_Node_Str",Messages.get("String_Node_Str"),booking));
    renderJSON(json);
  }
 else {
    renderBookingError(booking);
  }
}
Program: 154179
Project: 154179
Buggy source:
private static String reservationRequest(Booking booking){
  String request="String_Node_Str" + "String_Node_Str" + "String_Node_Str" + booking.deal.hotelCode + "String_Node_Str"+ booking.creditCardName+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ booking.creditCard+ "String_Node_Str"+ "String_Node_Str"+ booking.creditCardName+ "String_Node_Str"+ "String_Node_Str"+ booking.deal.bookingLine+ "String_Node_Str"+ "String_Node_Str";
  return request;
}

Fixed version (ground truth):
private static String reservationRequest(Booking booking){
  Date date=getDateFromString(booking.creditCardExpiry);
  SimpleDateFormat sdf=new SimpleDateFormat("String_Node_Str");
  String dateText=sdf.format(date);
  String[] splitArr=StringUtils.split(dateText,"String_Node_Str");
  String year=splitArr[1];
  String month=splitArr[0];
  String card=convertCardToHotUsa(booking.creditCardType);
  String request="String_Node_Str" + "String_Node_Str" + "String_Node_Str" + booking.deal.hotelCode + "String_Node_Str"+ booking.creditCardName+ "String_Node_Str"+ "String_Node_Str"+ card+ "String_Node_Str"+ "String_Node_Str"+ booking.creditCard+ "String_Node_Str"+ month+ "String_Node_Str"+ year+ "String_Node_Str"+ "String_Node_Str"+ booking.creditCardName+ "String_Node_Str"+ "String_Node_Str"+ booking.deal.bookingLine+ "String_Node_Str"+ "String_Node_Str";
  return request;
}
Program: 154181
Project: 154181
Buggy source:
public static String reservation(Booking booking){
  String wsReq=reservationRequest(booking);
  Document xml=prepareRequest(wsReq);
  if (xml != null) {
    String status=xml.getElementsByTagName("String_Node_Str").item(0).getTextContent();
    Logger.debug("String_Node_Str" + status);
    if (status.equals("String_Node_Str")) {
      String localizador=xml.getElementsByTagName("String_Node_Str").item(0).getTextContent();
      Logger.debug("String_Node_Str" + localizador);
      return localizador;
    }
 else {
      Logger.error("String_Node_Str");
    }
  }
 else {
    Logger.error("String_Node_Str");
  }
  return null;
}

Fixed version (ground truth):
public static String reservation(Booking booking){
  String wsReq=reservationRequest(booking);
  Logger.debug("String_Node_Str" + wsReq);
  Document xml=prepareRequest(wsReq);
  if (xml != null) {
    String status=xml.getElementsByTagName("String_Node_Str").item(0).getTextContent();
    Logger.debug("String_Node_Str" + status);
    if (status.equals("String_Node_Str")) {
      String localizador=xml.getElementsByTagName("String_Node_Str").item(0).getTextContent();
      Logger.debug("String_Node_Str" + localizador);
      return localizador;
    }
 else {
      Logger.error("String_Node_Str");
    }
  }
 else {
    Logger.error("String_Node_Str");
  }
  return null;
}
Program: 154182
Project: 154182
Buggy source:
public static void update(String json){
  String body=json != null ? json : params.get("String_Node_Str");
  Logger.debug("String_Node_Str" + body);
  if (body != null) {
    User user=new Gson().fromJson(body,User.class);
    User dbUser=User.findById(user.id);
    dbUser.updateDetails(user);
    dbUser.update();
    renderJSON(new UserDTO(dbUser));
  }
}

Fixed version (ground truth):
public static void update(Long id){
  String body=params.get("String_Node_Str");
  Logger.debug("String_Node_Str" + body);
  if (body != null) {
    User user=new Gson().fromJson(body,User.class);
    User dbUser=User.findById(id);
    dbUser.updateDetails(user);
    dbUser.validate();
    if (!validation.hasErrors()) {
      dbUser.update();
      UserStatusMessage message=new UserStatusMessage(Http.StatusCode.OK,"String_Node_Str","String_Node_Str",dbUser);
      Logger.debug("String_Node_Str" + new Gson().toJson(message));
      renderJSON(message);
    }
 else {
      UserStatusMessage message=new UserStatusMessage(Http.StatusCode.INTERNAL_ERROR,"String_Node_Str",validation.errors().toString(),dbUser);
      Logger.debug("String_Node_Str" + new Gson().toJson(message));
      renderJSON(message);
    }
  }
}
Program: 154183
Project: 154183
Buggy source:
private static void validateAndSave(@Valid User user){
  user.validate();
  if (!validation.hasErrors()) {
    user.insert();
    UserStatusMessage message=new UserStatusMessage(Http.StatusCode.CREATED,"String_Node_Str","String_Node_Str",user);
    Logger.debug("String_Node_Str" + new Gson().toJson(message));
    renderJSON(message);
  }
 else {
    UserStatusMessage message=new UserStatusMessage(Http.StatusCode.INTERNAL_ERROR,"String_Node_Str","String_Node_Str",user);
    Logger.debug("String_Node_Str" + new Gson().toJson(message));
    renderJSON(message);
  }
}

Fixed version (ground truth):
private static void validateAndSave(@Valid User user){
  user.validate();
  if (!validation.hasErrors()) {
    user.insert();
    UserStatusMessage message=new UserStatusMessage(Http.StatusCode.CREATED,"String_Node_Str","String_Node_Str",user);
    Logger.debug("String_Node_Str" + new Gson().toJson(message));
    Mails.welcome(user);
    renderJSON(message);
  }
 else {
    UserStatusMessage message=new UserStatusMessage(Http.StatusCode.INTERNAL_ERROR,"String_Node_Str",validation.errors().toString(),user);
    Logger.debug("String_Node_Str" + new Gson().toJson(message));
    renderJSON(message);
  }
}
Program: 154185
Project: 154185
Buggy source:
public UserDTO(User user){
  validateUser(user);
  id=user.id;
  email=user.email;
  firstName=user.firstName;
  lastName=user.lastName;
  token=user.token;
  secret=user.secret;
}

Fixed version (ground truth):
public UserDTO(User user){
  validateUser(user);
  id=user.id;
  email=user.email;
  firstName=user.firstName;
  lastName=user.lastName;
  token=user.token;
  secret=user.secret;
  password=user.password;
}
Program: 154186
Project: 154186
Buggy source:
private static User findByEmailAndPassword(String email,String password){
  return User.all().filter("String_Node_Str",email.trim().toLowerCase()).filter("String_Node_Str",true).filter("String_Node_Str",password.trim()).get();
}

Fixed version (ground truth):
public static User findByEmailAndPassword(String email,String password){
  return User.all().filter("String_Node_Str",email.trim().toLowerCase()).filter("String_Node_Str",true).filter("String_Node_Str",password.trim()).get();
}
Program: 154187
Project: 154187
Buggy source:
private static void validateAndSave(@Valid User user){
  if (!validation.hasErrors() && user.emailValid()) {
    user.insert();
    renderJSON(new UserStatusMessage(Http.StatusCode.CREATED,"String_Node_Str","String_Node_Str",user));
  }
 else {
    renderJSON(new UserStatusMessage(Http.StatusCode.INTERNAL_ERROR,"String_Node_Str","String_Node_Str",user));
  }
}

Fixed version (ground truth):
private static void validateAndSave(@Valid User user){
  user.validate();
  if (!validation.hasErrors()) {
    user.insert();
    UserStatusMessage message=new UserStatusMessage(Http.StatusCode.CREATED,"String_Node_Str","String_Node_Str",user);
    Logger.debug("String_Node_Str" + new Gson().toJson(message));
    renderJSON(message);
  }
 else {
    UserStatusMessage message=new UserStatusMessage(Http.StatusCode.INTERNAL_ERROR,"String_Node_Str","String_Node_Str",user);
    Logger.debug("String_Node_Str" + new Gson().toJson(message));
    renderJSON(message);
  }
}
Program: 154189
Project: 154189
Buggy source:
@Override public void insert(){
  this.validated=true;
  this.validationCode=RandomStringUtils.randomAlphanumeric(12);
  this.token=RandomStringUtils.randomAlphanumeric(12);
  this.secret=RandomStringUtils.randomAlphanumeric(24);
  this.email=this.email.toLowerCase();
  super.insert();
}

Fixed version (ground truth):
@Override public void insert(){
  this.validated=true;
  this.validationCode=RandomStringUtils.randomAlphanumeric(12);
  this.token=RandomStringUtils.randomAlphanumeric(12);
  this.secret=RandomStringUtils.randomAlphanumeric(24);
  this.email=this.email.toLowerCase();
  this.created=Calendar.getInstance().getTime();
  super.insert();
}
Program: 154190
Project: 154190
Buggy source:
public static User findByEmail(String email){
  return User.all().filter("String_Node_Str",email.toLowerCase()).get();
}

Fixed version (ground truth):
public static User findByEmail(String email){
  return User.all().filter("String_Node_Str",email.trim().toLowerCase()).get();
}
Program: 154191
Project: 154191
Buggy source:
@Test public void createIdenticalUsers(){
  new User("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str").insert();
  User user=new User("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  if (user.emailValid()) {
    user.insert();
  }
  int count=User.all().filter("String_Node_Str","String_Node_Str").count();
  assertEquals(1,count);
}

Fixed version (ground truth):
@Test public void createIdenticalUsers(){
  new User("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str").insert();
  User user=new User("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  user.validate();
  if (!Validation.hasErrors()) {
    user.insert();
  }
  int count=User.all().filter("String_Node_Str","String_Node_Str").count();
  assertEquals(1,count);
}
Program: 154192
Project: 154192
Buggy source:
public static void create(String json){
  String body=json != null ? json : params.get("String_Node_Str");
  Logger.debug("String_Node_Str" + body);
  if (body != null) {
    BookingDTO bookingDto=new Gson().fromJson(body,BookingDTO.class);
    validateAndSave(bookingDto.toBooking());
  }
}

Fixed version (ground truth):
public static void create(String json){
  String body=json != null ? json : params.get("String_Node_Str");
  Logger.debug("String_Node_Str" + body);
  if (body != null) {
    BookingDTO bookingDto;
    try {
      bookingDto=new Gson().fromJson(body,BookingDTO.class);
      validateAndSave(bookingDto.toBooking());
    }
 catch (    JsonParseException e) {
      Logger.error("String_Node_Str",e);
      String messageJson=JsonHelper.jsonExcludeFieldsWithoutExposeAnnotation(new BookingStatusMessage(Http.StatusCode.INTERNAL_ERROR,"String_Node_Str",Messages.get("String_Node_Str"),null));
      renderJSON(messageJson);
    }
  }
}
Program: 154193
Project: 154193
Buggy source:
public static void rememberPassword(String json){
  String body=json != null ? json : params.get("String_Node_Str");
  Logger.debug("String_Node_Str" + body);
  if (body != null) {
    User user=new Gson().fromJson(body,User.class);
    user=User.findByEmail(user.email);
    if (user != null) {
      String newPassword=user.resetPassword();
      Mails.lostPassword(user,newPassword);
      renderJSON(new StatusMessage(Http.StatusCode.OK,"String_Node_Str",Messages.get("String_Node_Str")));
    }
 else {
      renderJSON(new StatusMessage(Http.StatusCode.INTERNAL_ERROR,"String_Node_Str",Messages.get("String_Node_Str")));
    }
  }
}

Fixed version (ground truth):
public static void rememberPassword(String json){
  String body=json != null ? json : params.get("String_Node_Str");
  Logger.debug("String_Node_Str" + body);
  if (body != null) {
    User user=new Gson().fromJson(body,User.class);
    user=User.findByEmail(user.email);
    if (user != null) {
      user.setPasswordResetCode();
      Mails.lostPassword(user);
      renderJSON(new StatusMessage(Http.StatusCode.OK,"String_Node_Str",Messages.get("String_Node_Str")));
    }
 else {
      renderJSON(new StatusMessage(Http.StatusCode.INTERNAL_ERROR,"String_Node_Str",Messages.get("String_Node_Str")));
    }
  }
}
Program: 154194
Project: 154194
Buggy source:
/** 
 * Computes MD5 signature.
 * @param data The data to be signed.
 * @param key The signing key.
 * @param timestamp The timestamp
 * @param secret The private secret
 * @return The base64-encoded MD5 signature.
 * @throws java.security.SignatureException when signature generation fails
 */
public static String calculateMD5(String data,String key,long timestamp,String secret){
  String signature=data + key + timestamp+ secret;
  String dataMd5=Codec.hexMD5(signature);
  String result=Codec.encodeBASE64(dataMd5);
  return result;
}

Fixed version (ground truth):
/** 
 * Computes MD5 signature.
 * @param data The data to be signed.
 * @param key The signing key.
 * @param timestamp The timestamp
 * @param secret The private secret
 * @return The base64-encoded MD5 signature.
 * @throws java.security.SignatureException when signature generation fails
 */
public static String calculateMD5(String data,String key,long timestamp,String secret){
  String signature=data + key + timestamp+ secret;
  String result=DigestUtils.md5Hex(signature);
  return result;
}
Program: 154195
Project: 154195
Buggy source:
public void creditCardValid(){
  if (Validation.valid("String_Node_Str",this).message("String_Node_Str").ok && Validation.valid("String_Node_Str",this).message("String_Node_Str").ok && Validation.valid("String_Node_Str",this).message("String_Node_Str").ok) {
    if (!CreditCardHelper.validCC(this.creditCard)) {
      Validation.addError("String_Node_Str",Messages.get("String_Node_Str"),creditCard);
    }
 else {
      creditCardExpiryValid();
    }
  }
}

Fixed version (ground truth):
public void creditCardValid(){
  if (Validation.valid("String_Node_Str",this).message("String_Node_Str").ok && Validation.valid("String_Node_Str",this).message("String_Node_Str").ok && Validation.valid("String_Node_Str",this).message("String_Node_Str").ok&& Validation.valid("String_Node_Str",this).message("String_Node_Str").ok) {
    if (!CreditCardHelper.validCC(this.creditCard)) {
      Validation.addError("String_Node_Str",Messages.get("String_Node_Str"),creditCard);
    }
 else {
      creditCardExpiryValid();
    }
  }
}
Program: 154196
Project: 154196
Buggy source:
private void validateEmail(){
  if (Validation.valid("String_Node_Str",this).ok && User.findByEmail(this.email) != null) {
    Validation.addError("String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
private void validateEmail(){
  if (Validation.valid("String_Node_Str",this).message(Messages.get("String_Node_Str")).ok && User.findByEmail(this.email) != null) {
    Validation.addError("String_Node_Str",Messages.get("String_Node_Str"));
  }
}