nus-yam/ex-repair huggingface dataset:
Program: 38618
Project: 38618
Buggy source:
/** 
 * Returns true if query is a subgraph of target molecule
 * @return
 * @throws CDKException
 */
private synchronized boolean findSubgraphs() throws CDKException {
  boolean isSubgraph=false;
  if ((getTarget() == null) || (getQuery() == null)) {
    throw new CDKException("String_Node_Str");
  }
  if (getQuery().getAtomCount() == 1 || getTarget().getAtomCount() == 1) {
    singleMapping(isMatchBonds());
  }
 else {
    if (getQuery().getAtomCount() > getTarget().getAtomCount()) {
      return false;
    }
 else {
      List<AtomAtomMapping> mappingsVF2=new ArrayList<>();
      VF2Sub mapper;
      if (getQuery() instanceof IQueryAtomContainer) {
        mapper=new VF2Sub((IQueryAtomContainer)getQuery(),getTarget());
      }
 else {
        mapper=new VF2Sub(getQuery(),getTarget(),isMatchBonds(),isMatchRings(),isMatchAtomType());
      }
      isSubgraph=mapper.isSubgraph();
      List<AtomAtomMapping> atomMappings=mapper.getAllAtomMapping();
      if (isSubgraph) {
        mappingsVF2.addAll(atomMappings);
      }
 else {
        return false;
      }
      setVFMappings(mappingsVF2);
    }
  }
  return isSubgraph;
}

Fixed version (ground truth):
/** 
 * Returns true if query is a subgraph of target molecule
 * @return
 * @throws CDKException
 */
private synchronized boolean findSubgraphs() throws CDKException {
  boolean isSubgraph;
  if ((getTarget() == null) || (getQuery() == null)) {
    throw new CDKException("String_Node_Str");
  }
  if (getQuery().getAtomCount() == 1 || getTarget().getAtomCount() == 1) {
    isSubgraph=singleMapping();
  }
 else {
    if (getQuery().getAtomCount() > getTarget().getAtomCount()) {
      return false;
    }
 else {
      List<AtomAtomMapping> mappingsVF2=new ArrayList<>();
      VF2Sub mapper;
      if (getQuery() instanceof IQueryAtomContainer) {
        mapper=new VF2Sub((IQueryAtomContainer)getQuery(),getTarget());
      }
 else {
        mapper=new VF2Sub(getQuery(),getTarget(),isMatchBonds(),isMatchRings(),isMatchAtomType());
      }
      isSubgraph=mapper.isSubgraph();
      List<AtomAtomMapping> atomMappings=mapper.getAllAtomMapping();
      if (isSubgraph) {
        mappingsVF2.addAll(atomMappings);
      }
 else {
        return false;
      }
      setVFMappings(mappingsVF2);
    }
  }
  return isSubgraph;
}
Program: 38619
Project: 38619
Buggy source:
/** 
 * Constructor
 * @param queryBond query GraphMolecule
 * @param shouldMatchBonds bond match flag
 * @param matchAtomTypes
 */
public DefaultBondMatcher(IBond queryBond,boolean shouldMatchBonds,boolean matchAtomTypes){
  super();
  this.queryBond=queryBond;
  this.shouldMatchBonds=shouldMatchBonds;
  this.matchAtomTypes=matchAtomTypes;
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param queryBond query GraphMolecule
 * @param shouldMatchBonds bond match flag
 * @param shouldMatchRings
 * @param matchAtomTypes
 */
public DefaultBondMatcher(IBond queryBond,boolean shouldMatchBonds,boolean shouldMatchRings,boolean matchAtomTypes){
  super();
  this.queryBond=queryBond;
  this.shouldMatchBonds=shouldMatchBonds;
  this.shouldMatchRings=shouldMatchRings;
  this.matchAtomTypes=matchAtomTypes;
}
Program: 38620
Project: 38620
Buggy source:
/** 
 * {@inheritDoc}
 * @param targetBond target bond
 * @return true if bonds match
 */
@Override public boolean matches(IBond targetBond){
  if (this.queryBond != null && queryBond instanceof IQueryBond) {
    return ((IQueryBond)queryBond).matches(targetBond);
  }
 else   if ((queryBond != null && targetBond != null) && (!isBondMatchFlag() || (isBondMatchFlag() && isBondTypeMatch(targetBond)))) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @param targetBond target bond
 * @return true if bonds match
 */
@Override public boolean matches(IBond targetBond){
  if (this.queryBond != null && queryBond instanceof IQueryBond) {
    return ((IQueryBond)queryBond).matches(targetBond);
  }
 else   if ((queryBond != null && targetBond != null) && isBondMatchFlag() && isBondTypeMatch(targetBond)) {
    return true;
  }
 else   if ((queryBond != null && targetBond != null) && !isBondMatchFlag() && isShouldMatchRings()) {
    if (queryBond.getFlag(CDKConstants.ISAROMATIC) && targetBond.getFlag(CDKConstants.ISAROMATIC)) {
      return true;
    }
    return !queryBond.getFlag(CDKConstants.ISAROMATIC) && !targetBond.getFlag(CDKConstants.ISAROMATIC);
  }
  return false;
}
Program: 38621
Project: 38621
Buggy source:
/** 
 * @param bondA1
 * @param bondA2
 * @param matchBond
 * @param shouldMatchRings
 * @param matchAtomTypes (atom type also matched and symbol matched)
 * @return
 */
public static boolean matches(IBond bondA1,IBond bondA2,boolean matchBond,boolean shouldMatchRings,boolean matchAtomTypes){
  if (!isAtomMatch(bondA1,bondA2,shouldMatchRings,matchAtomTypes)) {
    return false;
  }
  return !matchBond || isBondMatch(new DefaultBondMatcher(bondA1,matchBond,matchAtomTypes),bondA2);
}

Fixed version (ground truth):
/** 
 * @param bondA1
 * @param bondA2
 * @param matchBond
 * @param shouldMatchRings
 * @param matchAtomTypes (atom type also matched and symbol matched)
 * @return
 */
public static boolean matches(IBond bondA1,IBond bondA2,boolean matchBond,boolean shouldMatchRings,boolean matchAtomTypes){
  if (!isAtomMatch(bondA1,bondA2,shouldMatchRings,matchAtomTypes)) {
    return false;
  }
  return isBondMatch(new DefaultBondMatcher(bondA1,matchBond,shouldMatchRings,matchAtomTypes),bondA2);
}
Program: 38622
Project: 38622
Buggy source:
/** 
 * @param list
 * @param source
 * @param target
 */
protected synchronized void identifyMatchedParts(List<List<CDKRMap>> list,IAtomContainer source,IAtomContainer target){
  List<IAtom> array1=new ArrayList<IAtom>();
  List<IAtom> array2=new ArrayList<IAtom>();
  for (  List<CDKRMap> rMap : list) {
    Map<Integer,Integer> atomNumbersFromContainer=new TreeMap<>();
    for (    CDKRMap rmap : rMap) {
      IAtom sourceAtom=source.getAtom(rmap.getId1());
      IAtom targetAtom=target.getAtom(rmap.getId2());
      array1.add(sourceAtom);
      array2.add(targetAtom);
      int indexI=source.getAtomNumber(sourceAtom);
      int indexJ=target.getAtomNumber(targetAtom);
      atomNumbersFromContainer.put(indexI,indexJ);
    }
    getMappings().add(atomNumbersFromContainer);
  }
}

Fixed version (ground truth):
/** 
 * @param list
 * @param source
 * @param target
 */
protected synchronized void identifyMatchedParts(List<List<CDKRMap>> list,IAtomContainer source,IAtomContainer target){
  for (  List<CDKRMap> rMap : list) {
    Map<Integer,Integer> atomNumbersFromContainer=new TreeMap<>();
    for (    CDKRMap rmap : rMap) {
      IAtom sourceAtom=source.getAtom(rmap.getId1());
      IAtom targetAtom=target.getAtom(rmap.getId2());
      int indexI=source.getAtomNumber(sourceAtom);
      int indexJ=target.getAtomNumber(targetAtom);
      atomNumbersFromContainer.put(indexI,indexJ);
    }
    getMappings().add(atomNumbersFromContainer);
  }
}
Program: 38623
Project: 38623
Buggy source:
/** 
 * @param list
 * @param source
 * @param target
 */
protected synchronized void identifySingleAtomsMatchedParts(List<CDKRMap> list,IAtomContainer source,IAtomContainer target){
  List<IAtom> array1=new ArrayList<>();
  List<IAtom> array2=new ArrayList<>();
  TreeMap<Integer,Integer> atomNumbersFromContainer=new TreeMap<>();
  for (  CDKRMap rmap : list) {
    IAtom sAtom=source.getAtom(rmap.getId1());
    IAtom tAtom=target.getAtom(rmap.getId2());
    array1.add(sAtom);
    array2.add(tAtom);
    int indexI=source.getAtomNumber(sAtom);
    int indexJ=target.getAtomNumber(tAtom);
    atomNumbersFromContainer.put(indexI,indexJ);
    getMappings().add(atomNumbersFromContainer);
  }
}

Fixed version (ground truth):
/** 
 * @param list
 * @param source
 * @param target
 */
protected synchronized void identifySingleAtomsMatchedParts(List<CDKRMap> list,IAtomContainer source,IAtomContainer target){
  TreeMap<Integer,Integer> atomNumbersFromContainer=new TreeMap<>();
  for (  CDKRMap rmap : list) {
    IAtom sAtom=source.getAtom(rmap.getId1());
    IAtom tAtom=target.getAtom(rmap.getId2());
    int indexI=source.getAtomNumber(sAtom);
    int indexJ=target.getAtomNumber(tAtom);
    atomNumbersFromContainer.put(indexI,indexJ);
    getMappings().add(atomNumbersFromContainer);
  }
}
Program: 38625
Project: 38625
Buggy source:
/** 
 * Default
 */
public SingleMapping(){
  connectedBondOrder=new TreeMap<Integer,Double>();
}

Fixed version (ground truth):
/** 
 * Default
 */
public SingleMapping(){
  connectedBondOrder=new TreeMap<>();
}
Program: 38627
Project: 38627
Buggy source:
private <K,V>Map<K,V> sortByValue(Map<K,V> map){
  List list=new LinkedList(map.entrySet());
  Collections.sort(list,new Comparator(){
    @Override public int compare(    Object object1,    Object object2){
      return ((Comparable)((Map.Entry<K,V>)(object1)).getValue()).compareTo(((Map.Entry<K,V>)(object2)).getValue());
    }
  }
);
  Map<K,V> result=new LinkedHashMap<K,V>();
  for (Iterator it=list.iterator(); it.hasNext(); ) {
    Map.Entry<K,V> entry=(Map.Entry<K,V>)it.next();
    result.put(entry.getKey(),entry.getValue());
  }
  return result;
}

Fixed version (ground truth):
private <K,V>Map<K,V> sortByValue(Map<K,V> map){
  List list=new LinkedList(map.entrySet());
  Collections.sort(list,new Comparator(){
    @Override public int compare(    Object object1,    Object object2){
      return ((Comparable)((Map.Entry<K,V>)(object1)).getValue()).compareTo(((Map.Entry<K,V>)(object2)).getValue());
    }
  }
);
  Map<K,V> result=new LinkedHashMap<>();
  for (Iterator it=list.iterator(); it.hasNext(); ) {
    Map.Entry<K,V> entry=(Map.Entry<K,V>)it.next();
    result.put(entry.getKey(),entry.getValue());
  }
  return result;
}
Program: 38628
Project: 38628
Buggy source:
/** 
 * Returns single mapping solutions.
 * @param source
 * @param target
 * @return Mappings
 * @throws CDKException
 */
@TestMethod("String_Node_Str") protected synchronized List<Map<IAtom,IAtom>> getOverLaps(IQueryAtomContainer source,IAtomContainer target) throws CDKException {
  List<Map<IAtom,IAtom>> mappings=new ArrayList<Map<IAtom,IAtom>>();
  this.source=source;
  this.target=target;
  if (source.getAtomCount() == 1 || (source.getAtomCount() > 0 && source.getBondCount() == 0)) {
    setSourceSingleAtomMap(mappings);
  }
  if (target.getAtomCount() == 1 || (target.getAtomCount() > 0 && target.getBondCount() == 0)) {
    setTargetSingleAtomMap(mappings);
  }
  return postFilter(mappings);
}

Fixed version (ground truth):
/** 
 * Returns single mapping solutions.
 * @param source
 * @param target
 * @return Mappings
 * @throws CDKException
 */
@TestMethod("String_Node_Str") protected synchronized List<Map<IAtom,IAtom>> getOverLaps(IQueryAtomContainer source,IAtomContainer target) throws CDKException {
  List<Map<IAtom,IAtom>> mappings=new ArrayList<>();
  this.source=source;
  this.target=target;
  if (source.getAtomCount() == 1 || (source.getAtomCount() > 0 && source.getBondCount() == 0)) {
    setSourceSingleAtomMap(mappings);
  }
  if (target.getAtomCount() == 1 || (target.getAtomCount() > 0 && target.getBondCount() == 0)) {
    setTargetSingleAtomMap(mappings);
  }
  return postFilter(mappings);
}
Program: 38629
Project: 38629
Buggy source:
private synchronized List<Map<IAtom,IAtom>> postFilter(List<Map<IAtom,IAtom>> mappings){
  List<Map<IAtom,IAtom>> sortedMap=new ArrayList<Map<IAtom,IAtom>>();
  if (mappings.isEmpty()) {
    return sortedMap;
  }
  Map<Integer,Double> sortedMapByValue=sortByValue(connectedBondOrder);
  for (  Integer key : sortedMapByValue.keySet()) {
    Map<IAtom,IAtom> mapToBeMoved=mappings.get(key);
    sortedMap.add(mapToBeMoved);
  }
  return sortedMap;
}

Fixed version (ground truth):
private synchronized List<Map<IAtom,IAtom>> postFilter(List<Map<IAtom,IAtom>> mappings){
  List<Map<IAtom,IAtom>> sortedMap=new ArrayList<>();
  if (mappings.isEmpty()) {
    return sortedMap;
  }
  Map<Integer,Double> sortedMapByValue=sortByValue(connectedBondOrder);
  for (  Integer key : sortedMapByValue.keySet()) {
    Map<IAtom,IAtom> mapToBeMoved=mappings.get(key);
    sortedMap.add(mapToBeMoved);
  }
  return sortedMap;
}
Program: 38630
Project: 38630
Buggy source:
private synchronized BondMatcher createBondMatcher(IBond bond){
  return new DefaultBondMatcher(bond,isBondMatchFlag(),isMatchAtomType());
}

Fixed version (ground truth):
private synchronized BondMatcher createBondMatcher(IBond bond){
  return new DefaultBondMatcher(bond,isBondMatchFlag(),isShouldMatchRings(),isMatchAtomType());
}
Program: 38631
Project: 38631
Buggy source:
boolean matchBonds(IBond queryBond,IBond targetBond){
  BondMatcher defaultVFBondMatcher=new DefaultBondMatcher(queryBond,shouldMatchBonds,shouldMatchAtomType);
  return defaultVFBondMatcher.matches(targetBond);
}

Fixed version (ground truth):
boolean matchBonds(IBond queryBond,IBond targetBond){
  BondMatcher defaultVFBondMatcher=new DefaultBondMatcher(queryBond,shouldMatchBonds,shouldMatchRings,shouldMatchAtomType);
  return defaultVFBondMatcher.matches(targetBond);
}
Program: 38632
Project: 38632
Buggy source:
private synchronized boolean substructureAlgorithm() throws CDKException {
  Substructure mcs;
  mcs=new Substructure(getQueryContainer(),getTargetContainer(),isMatchBonds(),isMatchRings(),true);
  clearMaps();
  if (isSubgraph()) {
    getMCSList().addAll(mcs.getAllAtomMapping());
  }
  return mcs.isSubgraph();
}

Fixed version (ground truth):
private synchronized boolean substructureAlgorithm() throws CDKException {
  Substructure mcs;
  mcs=new Substructure(getQueryContainer(),getTargetContainer(),isMatchBonds(),isMatchRings(),true);
  clearMaps();
  if (mcs.isSubgraph()) {
    getMCSList().addAll(mcs.getAllAtomMapping());
  }
  return mcs.isSubgraph();
}
Program: 38633
Project: 38633
Buggy source:
/** 
 * {@inheritDoc}
 * @param targetAtom
 * @return
 */
@Override public boolean matches(IAtom targetAtom){
  if (targetAtom instanceof IQueryAtom) {
    return ((IQueryAtom)targetAtom).matches(getQueryAtom());
  }
 else   if (getQueryAtom() != null && getQueryAtom() instanceof IQueryAtom) {
    return ((IQueryAtom)getQueryAtom()).matches(targetAtom);
  }
 else {
    if (!matchSymbol(targetAtom)) {
      return false;
    }
    if (isShouldMatchRings() && isAtomAttachedToRing(getQueryAtom()) && isAtomAttachedToRing(targetAtom)) {
      return true;
    }
 else     if (isShouldMatchRings() && (isAliphaticAtom(getQueryAtom()) && isRingAtom(targetAtom))) {
      return false;
    }
 else     if (isShouldMatchRings() && (isRingAtom(getQueryAtom()) && isAliphaticAtom(targetAtom))) {
      return false;
    }
 else     if (isShouldMatchRings() && (isRingAtom(getQueryAtom()) && isRingAtom(targetAtom))) {
      if (getQueryAtom().getProperty(SMALLEST_RING_SIZE) != targetAtom.getProperty(SMALLEST_RING_SIZE)) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @param targetAtom
 * @return
 */
@Override public boolean matches(IAtom targetAtom){
  if (targetAtom instanceof IQueryAtom) {
    return ((IQueryAtom)targetAtom).matches(getQueryAtom());
  }
 else   if (getQueryAtom() != null && getQueryAtom() instanceof IQueryAtom) {
    return ((IQueryAtom)getQueryAtom()).matches(targetAtom);
  }
 else {
    if (!matchSymbol(targetAtom)) {
      return false;
    }
    if (isShouldMatchRings() && isAtomAttachedToRing(getQueryAtom()) && !isRingAtom(getQueryAtom())&& isAtomAttachedToRing(targetAtom)&& !isRingAtom(targetAtom)) {
      return true;
    }
 else     if (isShouldMatchRings() && (isAliphaticAtom(getQueryAtom()) && isRingAtom(targetAtom))) {
      return false;
    }
 else     if (isShouldMatchRings() && (isRingAtom(getQueryAtom()) && isAliphaticAtom(targetAtom))) {
      return false;
    }
 else     if (isShouldMatchRings() && (isRingAtom(getQueryAtom()) && isRingAtom(targetAtom))) {
      if (getQueryAtom().getProperty(SMALLEST_RING_SIZE) != targetAtom.getProperty(SMALLEST_RING_SIZE)) {
        return false;
      }
    }
  }
  return true;
}
Program: 38634
Project: 38634
Buggy source:
public Map<String,String> getStringDataTypes(){
  return stringDataTypes;
}

Fixed version (ground truth):
public Map<String,String> getStringDataTypes(){
  return Collections.unmodifiableMap(stringDataTypes);
}
Program: 38635
Project: 38635
Buggy source:
/** 
 * Returns Target molecule
 * @return
 * @throws IOException
 * @throws CDKException
 */
public IAtomContainer getTarget() throws IOException, CDKException {
  String filenameOrData=argumentHandler.getTargetFilepath();
  String type=argumentHandler.getTargetType();
  if (isSingleFileTarget) {
    ISimpleChemObjectReader reader=getReader(type,filenameOrData);
    IChemFile chemFile=reader.read(new ChemFile());
    IAtomContainer molecule=(IAtomContainer)ChemFileManipulator.getAllAtomContainers(chemFile).get(0);
    configure(molecule,type);
    return molecule;
  }
 else {
    return getMolFromString(filenameOrData,type);
  }
}

Fixed version (ground truth):
/** 
 * Returns Target molecule
 * @return
 * @throws IOException
 * @throws CDKException
 */
public IAtomContainer getTarget() throws IOException, CDKException {
  String filenameOrData=argumentHandler.getTargetFilepath();
  String type=argumentHandler.getTargetType();
  if (isSingleFileTarget) {
    ISimpleChemObjectReader reader=getReader(type,filenameOrData);
    IChemFile chemFile=reader.read(new ChemFile());
    IAtomContainer molecule=ChemFileManipulator.getAllAtomContainers(chemFile).get(0);
    configure(molecule,type);
    return molecule;
  }
 else {
    return getMolFromString(filenameOrData,type);
  }
}
Program: 38636
Project: 38636
Buggy source:
public Map<String,String> getMultipleDataTypes(){
  return multipleDataTypes;
}

Fixed version (ground truth):
public Map<String,String> getMultipleDataTypes(){
  return Collections.unmodifiableMap(multipleDataTypes);
}
Program: 38637
Project: 38637
Buggy source:
public Map<String,String> getSingularDataTypes(){
  return singularDataTypes;
}

Fixed version (ground truth):
public Map<String,String> getSingularDataTypes(){
  return Collections.unmodifiableMap(singularDataTypes);
}
Program: 38638
Project: 38638
Buggy source:
/** 
 * Return Query molecule
 * @return
 * @throws IOException
 * @throws CDKException
 */
public IAtomContainer getQuery() throws IOException, CDKException {
  String filenameOrData=argumentHandler.getQueryFilepath();
  String type=argumentHandler.getQueryType();
  if (isSingleFileQuery) {
    ISimpleChemObjectReader reader=getReader(type,filenameOrData);
    IChemFile chemFile=reader.read(new ChemFile());
    IAtomContainer molecule=(IAtomContainer)ChemFileManipulator.getAllAtomContainers(chemFile).get(0);
    configure(molecule,type);
    return molecule;
  }
 else {
    return getMolFromString(filenameOrData,type);
  }
}

Fixed version (ground truth):
/** 
 * Return Query molecule
 * @return
 * @throws IOException
 * @throws CDKException
 */
public IAtomContainer getQuery() throws IOException, CDKException {
  String filenameOrData=argumentHandler.getQueryFilepath();
  String type=argumentHandler.getQueryType();
  if (isSingleFileQuery) {
    ISimpleChemObjectReader reader=getReader(type,filenameOrData);
    IChemFile chemFile=reader.read(new ChemFile());
    IAtomContainer molecule=ChemFileManipulator.getAllAtomContainers(chemFile).get(0);
    configure(molecule,type);
    return molecule;
  }
 else {
    return getMolFromString(filenameOrData,type);
  }
}
Program: 38643
Project: 38643
Buggy source:
protected synchronized boolean hasClique(Map<Integer,Integer> cliqueMap,List<Map<Integer,Integer>> mapGlobal){
  for (  Map<Integer,Integer> storedMap : mapGlobal) {
    if (cliqueMap.size() < storedMap.size()) {
      return true;
    }
    if (cliqueMap.keySet().equals(storedMap.keySet()) && cliqueMap.values().equals(storedMap.values())) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @param cliqueMap
 * @param mapGlobal
 * @return
 */
protected synchronized boolean hasClique(Map<Integer,Integer> cliqueMap,List<Map<Integer,Integer>> mapGlobal){
  for (  Map<Integer,Integer> storedMap : mapGlobal) {
    if (cliqueMap.size() < storedMap.size()) {
      return true;
    }
 else     if (cliqueMap.equals(storedMap)) {
      return true;
    }
  }
  return false;
}
Program: 38644
Project: 38644
Buggy source:
private boolean hasMap(Map<Integer,Integer> maps,List<Map<Integer,Integer>> mapGlobal){
  for (  Map<Integer,Integer> test : mapGlobal) {
    if (test.equals(maps)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean hasMap(Map<Integer,Integer> maps,List<Map<Integer,Integer>> mapGlobal){
  for (  Map<Integer,Integer> test : mapGlobal) {
    if (test.size() > maps.size()) {
      return true;
    }
    if (test.equals(maps)) {
      return true;
    }
  }
  return false;
}
Program: 38645
Project: 38645
Buggy source:
@Override public void onCreate(SQLiteDatabase db){
  db.execSQL(ActiveRegions.DATABASE_CREATE_ACTIVEREGIONS);
  db.execSQL(ActiveTimes.DATABASE_CREATE_ACTIVETIMES);
  db.execSQL(Contexts.DATABASE_CREATE_CONTEXTS);
  db.execSQL(ContextTimes.DATABASE_CREATE_CONTEXTTIMES);
  db.execSQL(ContextsTasks.DATABASE_CREATE_TASKCONTEXTS);
  db.execSQL(Tasks.DATABASE_CREATE_TASKS);
}

Fixed version (ground truth):
@Override public void onCreate(SQLiteDatabase db){
  db.execSQL(ActiveRegions.DATABASE_CREATE_ACTIVEREGIONS);
  db.execSQL(ActiveTimes.DATABASE_CREATE_ACTIVETIMES);
  db.execSQL(ContextRegions.DATABASE_CREATE_CONTEXTREGIONS);
  db.execSQL(Contexts.DATABASE_CREATE_CONTEXTS);
  db.execSQL(ContextTimes.DATABASE_CREATE_CONTEXTTIMES);
  db.execSQL(Families.DATABASE_CREATE_FAMILIES);
  db.execSQL(ContextsTasks.DATABASE_CREATE_TASKCONTEXTS);
  db.execSQL(Tasks.DATABASE_CREATE_TASKS);
}
Program: 38646
Project: 38646
Buggy source:
@Test public void testMaxConnectionWaitingTime() throws Exception {
  TransactorImpl<IDatabase1> transactor=transactorBuilder.setMetricsTracking(true).setMaxTotalConnections(1).get();
  transactor.execute(a -> {
  }
);
  double firstMaxConnectionWaitingTime=transactor.getDbMetrics().getMaxConnectionWaitingTime();
  int connectionCount=5;
  final Long[] startingTimes=new Long[connectionCount];
  final Long[] schedulingTimes=new Long[connectionCount];
  Future[] futures=new Future[connectionCount];
  for (int i=0; i < connectionCount; i++) {
    int finalI=i;
    futures[i]=executorService.submit(() -> {
      schedulingTimes[finalI]=stopwatch.elapsedMillis();
      transactor.execute(a -> {
        startingTimes[finalI]=stopwatch.elapsedMillis();
        sleepMillis(100);
      }
);
    }
);
  }
  long measuredMaxWaitingTime=0;
  for (int i=0; i < connectionCount; i++) {
    futures[i].get();
    measuredMaxWaitingTime=Math.max(measuredMaxWaitingTime,startingTimes[i] - schedulingTimes[i]);
  }
  DbMetrics dbMetrics=transactor.getDbMetrics();
  double maxConnectionsWaitingTime=dbMetrics.getMaxConnectionWaitingTime();
  transactor.close();
  double expectedMaxConnectionsWaitingTime=Math.max(measuredMaxWaitingTime,firstMaxConnectionWaitingTime);
  assertRoughEqual(maxConnectionsWaitingTime,expectedMaxConnectionsWaitingTime,20);
}

Fixed version (ground truth):
@Test public void testMaxConnectionWaitingTime() throws Exception {
  TransactorImpl<IDatabase1> transactor=transactorBuilder.setMetricsTracking(true).setMaxTotalConnections(1).get();
  transactor.execute(a -> {
  }
);
  double firstMaxConnectionWaitingTime=transactor.getDbMetrics().getMaxConnectionWaitingTime();
  int connectionCount=5;
  final Long[] startingTimes=new Long[connectionCount];
  final Long[] schedulingTimes=new Long[connectionCount];
  Future[] futures=new Future[connectionCount];
  for (int i=0; i < connectionCount; i++) {
    int finalI=i;
    futures[i]=executorService.submit(() -> {
      schedulingTimes[finalI]=stopwatch.elapsedMillis();
      transactor.execute(a -> {
        startingTimes[finalI]=stopwatch.elapsedMillis();
        sleepMillis(100);
      }
);
    }
);
  }
  long measuredMaxWaitingTime=0;
  for (int i=0; i < connectionCount; i++) {
    futures[i].get();
    measuredMaxWaitingTime=Math.max(measuredMaxWaitingTime,startingTimes[i] - schedulingTimes[i]);
  }
  DbMetrics dbMetrics=transactor.getDbMetrics();
  double maxConnectionsWaitingTime=dbMetrics.getMaxConnectionWaitingTime();
  transactor.close();
  double expectedMaxConnectionsWaitingTime=Math.max(measuredMaxWaitingTime,firstMaxConnectionWaitingTime);
  assertRoughEqual(maxConnectionsWaitingTime,expectedMaxConnectionsWaitingTime,100);
}
Program: 38647
Project: 38647
Buggy source:
private String getWhereSqlCriteria(){
  StringBuilder sb=new StringBuilder();
  Iterator<WhereConstraint> it=whereConstraints.iterator();
  while (it.hasNext()) {
    WhereConstraint constraint=it.next();
    sb.append(constraint.getSqlStatement());
    if (it.hasNext()) {
      sb.append("String_Node_Str");
    }
  }
  return sb.toString();
}

Fixed version (ground truth):
private String getWhereSqlCriteria(){
  StringBuilder sb=new StringBuilder();
  Iterator<WhereConstraint> it=whereConstraints.iterator();
  while (it.hasNext()) {
    WhereConstraint constraint=it.next();
    sb.append("String_Node_Str").append(constraint.getSqlStatement()).append("String_Node_Str");
    if (it.hasNext()) {
      sb.append("String_Node_Str");
    }
  }
  return sb.toString();
}
Program: 38650
Project: 38650
Buggy source:
void deleteExistingEntries(IDb db,Long recordId) throws IOException {
  for (  String key : types.keySet()) {
    db.createDeletion().from(table.table).where(table.scope.equalTo(recordId)).where(table.type.notEqualTo(ValueType.SCOPE.value)).where(table.key.equalTo(key).or(table.key.startsWith(key + JsonDbConstants.PATH_SEPARATOR))).execute();
  }
}

Fixed version (ground truth):
void deleteExistingEntries(IDb db,Long recordId) throws IOException {
  for (  String key : types.keySet()) {
    List<Long> rowIdsToDelete=db.createQuery().from(table.table).where(table.scope.equalTo(recordId)).where(table.type.notEqualTo(ValueType.SCOPE.value)).where(table.key.equalTo(key).or(table.key.startsWith(key + JsonDbConstants.PATH_SEPARATOR))).select(table.id).fetch().gets(table.id);
    db.createDeletion().from(table.table).where(table.id.in(rowIdsToDelete)).execute();
  }
}
Program: 38651
Project: 38651
Buggy source:
/** 
 * Creation of 100000 records By store: 16730 ms (0.17 ms per record) By model: 16965 ms (0.17 ms per record) Difference: 0.99 <p> Update of 100000 records By store: 44386 ms (0.44 ms per record) By model: 21601 ms (0.22 ms per record) Difference: 2.05 <p> Query (5 times) of 100000 records By store: 1718 ms (0.02 ms per record) By model: 946 ms (0.01 ms per record) Difference: 1.82 <p> Deletion of 100000 records By store: 43240 ms (0.43 ms per record) By model: 6926 ms (0.07 ms per record) Difference: 6.24
 */
@Test public void testPerformance() throws Exception {
  int size=200;
  testRecordCreation(size);
  testRecordUpdate(size);
  testRecordQuery(5,size);
  testRecordDeletion(size);
}

Fixed version (ground truth):
/** 
 * Creation of 100000 records By store: 16730 ms (0.17 ms per record) By model: 16965 ms (0.17 ms per record) Difference: 0.99 <p> Update of 100000 records By store: 67403 ms (0.67 ms per record) By model: 23117 ms (0.23 ms per record) Difference: 2.92 <p> Query (5 times) of 100000 records By store: 1718 ms (0.02 ms per record) By model: 946 ms (0.01 ms per record) Difference: 1.82 <p> Deletion of 100000 records By store: 43240 ms (0.43 ms per record) By model: 6926 ms (0.07 ms per record) Difference: 6.24
 */
@Test public void testPerformance() throws Exception {
  int size=200;
  testRecordCreation(size);
  testRecordUpdate(size);
  testRecordQuery(5,size);
  testRecordDeletion(size);
}
Program: 38652
Project: 38652
Buggy source:
private Set<Long> querySubRecordsByRecordConstraints(IDb db) throws IOException {
  Set<Long> recordIds=null;
  for (  Map.Entry<String,List<GenericConstraint>> entry : recordConstraints.entrySet()) {
    if (recordIds != null && recordIds.isEmpty()) {
      return Collections.emptySet();
    }
    GenericQuery query=db.createQuery().from(table.table).leftJoin(scope.table).on(table.scopeColumn.equalTo(scope.idColumn)).where(table.typeColumn.notEqualTo(ValueType.SCOPE.value)).select(table.scopeColumn);
    if (recordIds != null) {
      query.where(table.scopeColumn.in(recordIds));
    }
    for (    GenericConstraint constraint : scopeConstraints) {
      query.where(constraint);
    }
    String key=entry.getKey();
    if (key.contains("String_Node_Str")) {
      query.where(table.keyColumn.matches(key));
    }
 else {
      query.where(table.keyColumn.equalTo(key));
    }
    List<GenericConstraint> constraints=entry.getValue();
    for (    GenericConstraint constraint : constraints) {
      query.where(constraint);
    }
    recordIds=Sets.newHashSet(query.fetch().gets(table.scopeColumn));
  }
  return recordIds;
}

Fixed version (ground truth):
private Set<Long> querySubRecordsByRecordConstraints(IDb db) throws IOException {
  Set<Long> recordIds=null;
  for (  Map.Entry<String,List<GenericConstraint>> entry : recordConstraints.entrySet()) {
    if (recordIds != null && recordIds.isEmpty()) {
      return Collections.emptySet();
    }
    GenericQuery query=db.createQuery().from(table.table).leftJoin(scope.table).on(table.scopeColumn.equalTo(scope.idColumn)).where(scope.scopeColumn.equalTo(executionRecordId)).where(table.typeColumn.notEqualTo(ValueType.SCOPE.value)).select(table.scopeColumn);
    if (recordIds != null) {
      query.where(table.scopeColumn.in(recordIds));
    }
    for (    GenericConstraint constraint : scopeConstraints) {
      query.where(constraint);
    }
    String key=entry.getKey();
    if (key.contains("String_Node_Str")) {
      query.where(table.keyColumn.matches(key));
    }
 else {
      query.where(table.keyColumn.equalTo(key));
    }
    List<GenericConstraint> constraints=entry.getValue();
    for (    GenericConstraint constraint : constraints) {
      query.where(constraint);
    }
    recordIds=Sets.newHashSet(query.fetch().gets(table.scopeColumn));
  }
  return recordIds;
}
Program: 38658
Project: 38658
Buggy source:
public boolean isRootScope(){
  return scopeId < 0;
}

Fixed version (ground truth):
public boolean isRootScope(){
  return scopeId == null;
}
Program: 38659
Project: 38659
Buggy source:
@Test public void testMaxConnectionWaitingTime() throws Exception {
  TransactorImpl<IDatabase1> transactor=transactorBuilder.setMaxTotalConnections(1).get();
  Future<Long> future1=executorService.submit(() -> transactor.query(a -> {
    sleepMillis(100);
    return stopwatch.elapsedMillis();
  }
));
  final Long[] startingTime2=new Long[1];
  Future future2=executorService.submit(() -> {
    startingTime2[0]=stopwatch.elapsedMillis();
    transactor.execute(a -> {
      sleepMillis(100);
    }
);
  }
);
  long finishingTime1=future1.get();
  future2.get();
  DbMetrics dbMetrics=transactor.getDbMetrics();
  double maxConnectionsWaitingTime=dbMetrics.getMaxConnectionWaitingTime();
  transactor.close();
  double expectedMaxConnectionsWaitingTime=finishingTime1 - startingTime2[0];
  expectedMaxConnectionsWaitingTime=(expectedMaxConnectionsWaitingTime > 0) ? expectedMaxConnectionsWaitingTime : 0;
  assertRoughEqual(maxConnectionsWaitingTime,expectedMaxConnectionsWaitingTime,20);
}

Fixed version (ground truth):
@Test public void testMaxConnectionWaitingTime() throws Exception {
  TransactorImpl<IDatabase1> transactor=transactorBuilder.setMaxTotalConnections(1).get();
  sleepMillis(200);
  Future<Long> future1=executorService.submit(() -> transactor.query(a -> {
    sleepMillis(100);
    return stopwatch.elapsedMillis();
  }
));
  final Long[] startingTime2=new Long[1];
  Future future2=executorService.submit(() -> {
    startingTime2[0]=stopwatch.elapsedMillis();
    transactor.execute(a -> {
      sleepMillis(100);
    }
);
  }
);
  long finishingTime1=future1.get();
  future2.get();
  DbMetrics dbMetrics=transactor.getDbMetrics();
  double maxConnectionsWaitingTime=dbMetrics.getMaxConnectionWaitingTime();
  transactor.close();
  double expectedMaxConnectionsWaitingTime=finishingTime1 - startingTime2[0];
  LOG.info("String_Node_Str",maxConnectionsWaitingTime);
  LOG.info("String_Node_Str",expectedMaxConnectionsWaitingTime);
  expectedMaxConnectionsWaitingTime=(expectedMaxConnectionsWaitingTime > 0) ? expectedMaxConnectionsWaitingTime : 0;
  assertRoughEqual(maxConnectionsWaitingTime,expectedMaxConnectionsWaitingTime,20);
}
Program: 38660
Project: 38660
Buggy source:
@Test public void testQueryOverhead() throws Exception {
  TransactorImpl<IDatabase1> transactor1=transactorBuilder.setMetricsTracking(false).get();
  long startTime1=stopwatch.elapsedMillis();
  for (int i=0; i < 10; i++) {
    transactor1.execute(db -> {
      Thread.sleep(20);
    }
);
  }
  long finishTime1=stopwatch.elapsedMillis() - startTime1;
  System.out.println("String_Node_Str" + finishTime1);
  transactor1.close();
  TransactorImpl<IDatabase1> transactor2=transactorBuilder.setMetricsTracking(false).get();
  long startTime2=stopwatch.elapsedMillis();
  for (int i=0; i < 10; i++) {
    transactor2.execute(db -> {
      Thread.sleep(20);
    }
);
  }
  long finishTime2=stopwatch.elapsedMillis() - startTime2;
  System.out.println("String_Node_Str" + finishTime2);
  transactor2.close();
  assertRoughEqual(finishTime1,finishTime2,.2 * finishTime1);
}

Fixed version (ground truth):
@Test public void testQueryOverhead() throws Exception {
  TransactorImpl<IDatabase1> transactor1=transactorBuilder.setMetricsTracking(false).get();
  long startTime1=stopwatch.elapsedMillis();
  for (int i=0; i < 10; i++) {
    transactor1.execute(db -> {
      Thread.sleep(20);
    }
);
  }
  long finishTime1=stopwatch.elapsedMillis() - startTime1;
  System.out.println("String_Node_Str" + finishTime1);
  transactor1.close();
  TransactorImpl<IDatabase1> transactor2=transactorBuilder.setMetricsTracking(true).get();
  long startTime2=stopwatch.elapsedMillis();
  for (int i=0; i < 10; i++) {
    transactor2.execute(db -> {
      Thread.sleep(20);
    }
);
  }
  long finishTime2=stopwatch.elapsedMillis() - startTime2;
  System.out.println("String_Node_Str" + finishTime2);
  transactor2.close();
  assertRoughEqual(finishTime1,finishTime2,.2 * finishTime1);
}
Program: 38661
Project: 38661
Buggy source:
@Before public void prepare() throws Exception {
  transactorBuilder.get().query(IDb::deleteAll);
  stopwatch.start();
}

Fixed version (ground truth):
@Before public void prepare() throws Exception {
  transactorBuilder.get().query(IDb::deleteAll);
  stopwatch.start();
  executorService=Executors.newFixedThreadPool(5);
}
Program: 38662
Project: 38662
Buggy source:
@Test public void testAverageConnectionWaitingTime() throws Exception {
  TransactorImpl<IDatabase1> transactor=transactorBuilder.setMaxTotalConnections(1).get();
  executorService=Executors.newFixedThreadPool(2);
  Future<Long> future1=executorService.submit(() -> transactor.query(a -> {
    sleepMillis(100);
    return stopwatch.elapsedMillis();
  }
));
  final Long[] startingTime2=new Long[1];
  Future future2=executorService.submit(() -> {
    startingTime2[0]=stopwatch.elapsedMillis();
    transactor.execute(a -> {
      sleepMillis(100);
    }
);
  }
);
  long finishingTime1=future1.get();
  future2.get();
  DbMetrics dbMetrics=transactor.getDbMetrics();
  double averageConnectionsWaitingTime=dbMetrics.getAverageConnectionWaitingTime();
  transactor.close();
  double expectedAverageConnectionsWaitingTime=(finishingTime1 - startingTime2[0]) / 2;
  expectedAverageConnectionsWaitingTime=(expectedAverageConnectionsWaitingTime > 0) ? expectedAverageConnectionsWaitingTime : 0;
  assertRoughEqual(averageConnectionsWaitingTime,expectedAverageConnectionsWaitingTime,15);
}

Fixed version (ground truth):
@Test public void testAverageConnectionWaitingTime() throws Exception {
  TransactorImpl<IDatabase1> transactor=transactorBuilder.setMaxTotalConnections(1).get();
  Future<Long> future1=executorService.submit(() -> transactor.query(a -> {
    sleepMillis(100);
    return stopwatch.elapsedMillis();
  }
));
  final Long[] startingTime2=new Long[1];
  Future future2=executorService.submit(() -> {
    startingTime2[0]=stopwatch.elapsedMillis();
    transactor.execute(a -> {
      sleepMillis(100);
    }
);
  }
);
  long finishingTime1=future1.get();
  future2.get();
  DbMetrics dbMetrics=transactor.getDbMetrics();
  double averageConnectionsWaitingTime=dbMetrics.getAverageConnectionWaitingTime();
  transactor.close();
  double expectedAverageConnectionsWaitingTime=(finishingTime1 - startingTime2[0]) / 2;
  expectedAverageConnectionsWaitingTime=(expectedAverageConnectionsWaitingTime > 0) ? expectedAverageConnectionsWaitingTime : 0;
  assertRoughEqual(averageConnectionsWaitingTime,expectedAverageConnectionsWaitingTime,15);
}
Program: 38663
Project: 38663
Buggy source:
@Test public void testAverageConnectionExecutionTime() throws Exception {
  TransactorImpl<IDatabase1> transactor=transactorBuilder.setMaxTotalConnections(2).get();
  executorService=Executors.newFixedThreadPool(5);
  Future<Long> future1=executorService.submit(() -> {
    long start=stopwatch.elapsedMillis();
    transactor.execute(a -> {
      sleepMillis(100);
    }
);
    return stopwatch.elapsedMillis() - start;
  }
);
  Future<Long> future2=executorService.submit(() -> {
    long start=stopwatch.elapsedMillis();
    transactor.execute(a -> {
      sleepMillis(100);
    }
);
    return stopwatch.elapsedMillis() - start;
  }
);
  double expectedAverageConnectionExecutionTime=((double)future1.get() + (double)future2.get()) / 2;
  DbMetrics dbMetrics=transactor.getDbMetrics();
  double averageConnectionExecutionTime=dbMetrics.getAverageConnectionExecutionTime();
  transactor.close();
  assertRoughEqual(averageConnectionExecutionTime,expectedAverageConnectionExecutionTime,20);
}

Fixed version (ground truth):
@Test public void testAverageConnectionExecutionTime() throws Exception {
  TransactorImpl<IDatabase1> transactor=transactorBuilder.setMaxTotalConnections(2).get();
  Future<Long> future1=executorService.submit(() -> {
    long start=stopwatch.elapsedMillis();
    transactor.execute(a -> {
      sleepMillis(100);
    }
);
    return stopwatch.elapsedMillis() - start;
  }
);
  Future<Long> future2=executorService.submit(() -> {
    long start=stopwatch.elapsedMillis();
    transactor.execute(a -> {
      sleepMillis(100);
    }
);
    return stopwatch.elapsedMillis() - start;
  }
);
  double expectedAverageConnectionExecutionTime=((double)future1.get() + (double)future2.get()) / 2;
  DbMetrics dbMetrics=transactor.getDbMetrics();
  double averageConnectionExecutionTime=dbMetrics.getAverageConnectionExecutionTime();
  transactor.close();
  assertRoughEqual(averageConnectionExecutionTime,expectedAverageConnectionExecutionTime,20);
}
Program: 38664
Project: 38664
Buggy source:
@Test public void testOpenedConnectionsNumber() throws Exception {
  executorService=Executors.newFixedThreadPool(5);
  TransactorImpl<IDatabase1> transactor=transactorBuilder.setMaxTotalConnections(2).get();
  Future future1=executorService.submit(() -> transactor.execute(a -> {
    sleepMillis(50);
  }
));
  Future future2=executorService.submit(() -> transactor.execute(a -> {
    sleepMillis(50);
  }
));
  Future future3=executorService.submit(() -> transactor.execute(a -> {
    sleepMillis(50);
  }
));
  future1.get();
  future2.get();
  future3.get();
  DbMetrics dbMetrics=transactor.getDbMetrics();
  double openedConnectionsNumber=dbMetrics.getOpenedConnectionsNumber();
  transactor.close();
  assertTrue(openedConnectionsNumber == 2);
}

Fixed version (ground truth):
@Test public void testOpenedConnectionsNumber() throws Exception {
  TransactorImpl<IDatabase1> transactor=transactorBuilder.setMaxTotalConnections(2).get();
  Future future1=executorService.submit(() -> transactor.execute(a -> {
    sleepMillis(50);
  }
));
  Future future2=executorService.submit(() -> transactor.execute(a -> {
    sleepMillis(50);
  }
));
  Future future3=executorService.submit(() -> transactor.execute(a -> {
    sleepMillis(50);
  }
));
  future1.get();
  future2.get();
  future3.get();
  DbMetrics dbMetrics=transactor.getDbMetrics();
  double openedConnectionsNumber=dbMetrics.getOpenedConnectionsNumber();
  transactor.close();
  assertTrue(openedConnectionsNumber == 2);
}
Program: 38665
Project: 38665
Buggy source:
@Test public void testMaxConnectionWaitingTime() throws Exception {
  TransactorImpl<IDatabase1> transactor=transactorBuilder.setMaxTotalConnections(1).get();
  executorService=Executors.newFixedThreadPool(2);
  Future<Long> future1=executorService.submit(() -> transactor.query(a -> {
    sleepMillis(100);
    return stopwatch.elapsedMillis();
  }
));
  final Long[] startingTime2=new Long[1];
  Future future2=executorService.submit(() -> {
    startingTime2[0]=stopwatch.elapsedMillis();
    transactor.execute(a -> {
      sleepMillis(100);
    }
);
  }
);
  long finishingTime1=future1.get();
  future2.get();
  DbMetrics dbMetrics=transactor.getDbMetrics();
  double maxConnectionsWaitingTime=dbMetrics.getMaxConnectionWaitingTime();
  transactor.close();
  double expectedMaxConnectionsWaitingTime=finishingTime1 - startingTime2[0];
  expectedMaxConnectionsWaitingTime=(expectedMaxConnectionsWaitingTime > 0) ? expectedMaxConnectionsWaitingTime : 0;
  assertRoughEqual(maxConnectionsWaitingTime,expectedMaxConnectionsWaitingTime,20);
}

Fixed version (ground truth):
@Test public void testMaxConnectionWaitingTime() throws Exception {
  TransactorImpl<IDatabase1> transactor=transactorBuilder.setMaxTotalConnections(1).get();
  Future<Long> future1=executorService.submit(() -> transactor.query(a -> {
    sleepMillis(100);
    return stopwatch.elapsedMillis();
  }
));
  final Long[] startingTime2=new Long[1];
  Future future2=executorService.submit(() -> {
    startingTime2[0]=stopwatch.elapsedMillis();
    transactor.execute(a -> {
      sleepMillis(100);
    }
);
  }
);
  long finishingTime1=future1.get();
  future2.get();
  DbMetrics dbMetrics=transactor.getDbMetrics();
  double maxConnectionsWaitingTime=dbMetrics.getMaxConnectionWaitingTime();
  transactor.close();
  double expectedMaxConnectionsWaitingTime=finishingTime1 - startingTime2[0];
  expectedMaxConnectionsWaitingTime=(expectedMaxConnectionsWaitingTime > 0) ? expectedMaxConnectionsWaitingTime : 0;
  assertRoughEqual(maxConnectionsWaitingTime,expectedMaxConnectionsWaitingTime,20);
}
Program: 38666
Project: 38666
Buggy source:
@After public void cleanup() throws Exception {
  executorService.shutdown();
  stopwatch.reset();
}

Fixed version (ground truth):
@After public void cleanup() throws Exception {
  stopwatch.reset();
}
Program: 38667
Project: 38667
Buggy source:
@Override public String getSummary(){
  String summary="String_Node_Str";
  summary+=("String_Node_Str");
  summary+=String.format("String_Node_Str",getAverageIdleConnectionsMinValue(),getAverageIdleConnectionsMaxValue());
  summary+=String.format("String_Node_Str",getAverageActiveConnections());
  summary+=("String_Node_Str" + getTotalQueries());
  summary+=("String_Node_Str" + getOpenedConnectionsNumber());
  summary+=String.format("String_Node_Str" + "String_Node_Str",getMaxConnectionsProportion());
  summary+=String.format("String_Node_Str",getAverageConnectionExecutionTime());
  summary+=String.format("String_Node_Str",getAverageConnectionWaitingTime());
  summary+=String.format("String_Node_Str",getMaxConnectionWaitingTime());
  summary+=("String_Node_Str" + lifeTimeStopwatch.elapsedMillis() + "String_Node_Str");
  summary+=("String_Node_Str");
  summary+=("String_Node_Str" + minIdleConnections);
  summary+=("String_Node_Str" + maxTotalConnections);
  summary+=("String_Node_Str" + keepAliveMillis + "String_Node_Str");
  summary+=("String_Node_Str" + maxWaitMillis + "String_Node_Str");
  return summary;
}

Fixed version (ground truth):
@Override public String getSummary(){
  String summary="String_Node_Str";
  summary+=("String_Node_Str");
  summary+=String.format("String_Node_Str",getAverageIdleConnectionsMinValue(),getAverageIdleConnectionsMaxValue());
  summary+=String.format("String_Node_Str",getAverageActiveConnections());
  summary+=("String_Node_Str" + getTotalQueries());
  summary+=("String_Node_Str" + getOpenedConnectionsNumber());
  summary+=String.format("String_Node_Str",100 * getMaxConnectionsProportion());
  summary+=String.format("String_Node_Str",getAverageConnectionExecutionTime());
  summary+=String.format("String_Node_Str",getAverageConnectionWaitingTime());
  summary+=String.format("String_Node_Str",getMaxConnectionWaitingTime());
  summary+=("String_Node_Str" + lifeTimeStopwatch.elapsedMillis() + "String_Node_Str");
  summary+=("String_Node_Str");
  summary+=("String_Node_Str" + minIdleConnections);
  summary+=("String_Node_Str" + maxTotalConnections);
  summary+=("String_Node_Str" + keepAliveMillis + "String_Node_Str");
  summary+=("String_Node_Str" + maxWaitMillis + "String_Node_Str");
  return summary;
}
Program: 38668
Project: 38668
Buggy source:
private <T>T query(IQuery<DB,T> query,boolean asTransaction){
  DB connection=dbManager.getConnection();
  connection.setAutoCommit(!asTransaction);
  try {
    long startTime=System.currentTimeMillis();
    T value=query.query(connection);
    if (asTransaction) {
      connection.commit();
    }
    long executionTime=System.currentTimeMillis() - startTime;
    queryMetrics.update(executionTime,Thread.currentThread().getStackTrace()[3]);
    return value;
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    if (asTransaction) {
      connection.rollback();
    }
    throw new SqlExecutionFailureException(e);
  }
 finally {
    dbManager.returnConnection(connection);
  }
}

Fixed version (ground truth):
private <T>T query(IQuery<DB,T> query,boolean asTransaction){
  DB connection=dbManager.getConnection();
  connection.setAutoCommit(!asTransaction);
  try {
    long startTime=System.currentTimeMillis();
    T value=query.query(connection);
    if (asTransaction) {
      connection.commit();
    }
    long executionTime=System.currentTimeMillis() - startTime;
    if (metricsTrackingEnabled) {
      queryMetrics.update(executionTime,Thread.currentThread().getStackTrace()[3]);
    }
    return value;
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    if (asTransaction) {
      connection.rollback();
    }
    throw new SqlExecutionFailureException(e);
  }
 finally {
    dbManager.returnConnection(connection);
  }
}
Program: 38669
Project: 38669
Buggy source:
private void execute(IExecution<DB> execution,boolean asTransaction){
  DB connection=dbManager.getConnection();
  connection.setAutoCommit(!asTransaction);
  try {
    long startTime=System.currentTimeMillis();
    execution.execute(connection);
    if (asTransaction) {
      connection.commit();
    }
    long executionTime=System.currentTimeMillis() - startTime;
    queryMetrics.update(executionTime,Thread.currentThread().getStackTrace()[3]);
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    if (asTransaction) {
      connection.rollback();
    }
    throw new SqlExecutionFailureException(e);
  }
 finally {
    dbManager.returnConnection(connection);
  }
}

Fixed version (ground truth):
private void execute(IExecution<DB> execution,boolean asTransaction){
  DB connection=dbManager.getConnection();
  connection.setAutoCommit(!asTransaction);
  try {
    long startTime=System.currentTimeMillis();
    execution.execute(connection);
    if (asTransaction) {
      connection.commit();
    }
    long executionTime=System.currentTimeMillis() - startTime;
    if (metricsTrackingEnabled) {
      queryMetrics.update(executionTime,Thread.currentThread().getStackTrace()[3]);
    }
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    if (asTransaction) {
      connection.rollback();
    }
    throw new SqlExecutionFailureException(e);
  }
 finally {
    dbManager.returnConnection(connection);
  }
}
Program: 38670
Project: 38670
Buggy source:
@Override public void close(){
  if (metricsTrackingEnabled) {
    LOG.info(dbManager.getMetrics().getSummary());
    LOG.info("String_Node_Str" + "String_Node_Str" + (queryMetrics.getSummary()));
  }
  dbManager.close();
}

Fixed version (ground truth):
@Override public void close(){
  if (metricsTrackingEnabled) {
    LOG.info(dbManager.getMetrics().getSummary());
    LOG.info("String_Node_Str",queryMetrics.getSummary());
  }
  dbManager.close();
}