nus-yam/ex-repair huggingface dataset:
Program: 26583
Project: 26583
Buggy source:
public InstanceMethodExpr(int line,Expr target,String methodName,IPersistentVector args) throws Exception {
  this.line=line;
  this.args=args;
  this.methodName=methodName;
  this.target=target;
  if (target.hasJavaClass()) {
    List methods=Reflector.getMethods(target.getJavaClass(),args.count(),methodName,false);
    if (methods.isEmpty())     method=null;
 else {
      int methodidx=0;
      if (methods.size() > 1) {
        ArrayList<Class[]> params=new ArrayList();
        for (int i=0; i < methods.size(); i++)         params.add(((java.lang.reflect.Method)methods.get(i)).getParameterTypes());
        methodidx=getMatchingParams(params,args);
      }
      method=(java.lang.reflect.Method)(methodidx >= 0 ? methods.get(methodidx) : null);
    }
  }
 else   method=null;
}

Fixed version (ground truth):
public InstanceMethodExpr(int line,Expr target,String methodName,IPersistentVector args) throws Exception {
  this.line=line;
  this.args=args;
  this.methodName=methodName;
  this.target=target;
  if (target.hasJavaClass()) {
    List methods=Reflector.getMethods(target.getJavaClass(),args.count(),methodName,false);
    if (methods.isEmpty())     method=null;
 else {
      int methodidx=0;
      if (methods.size() > 1) {
        ArrayList<Class[]> params=new ArrayList();
        for (int i=0; i < methods.size(); i++)         params.add(((java.lang.reflect.Method)methods.get(i)).getParameterTypes());
        methodidx=getMatchingParams(params,args);
      }
      java.lang.reflect.Method m=(java.lang.reflect.Method)(methodidx >= 0 ? methods.get(methodidx) : null);
      if (m != null && !Modifier.isPublic(m.getDeclaringClass().getModifiers())) {
        m=Reflector.getAsMethodOfPublicBase(m.getDeclaringClass(),m);
      }
      method=m;
    }
  }
 else   method=null;
}
Program: 26584
Project: 26584
Buggy source:
static Object prepRet(Object x){
  if (x instanceof Boolean)   return ((Boolean)x).booleanValue() ? RT.T : null;
  return x;
}

Fixed version (ground truth):
static Object prepRet(Object x){
  if (x instanceof Boolean)   return ((Boolean)x).booleanValue() ? x : null;
  return x;
}
Program: 26586
Project: 26586
Buggy source:
private void emitLocal(GeneratorAdapter gen,LocalBinding lb){
  if (closes.contains(lb))   gen.getField(fntype,lb.name,OBJECT_TYPE);
 else   gen.visitVarInsn(OBJECT_TYPE.getOpcode(Opcodes.ILOAD),lb.idx);
}

Fixed version (ground truth):
private void emitLocal(GeneratorAdapter gen,LocalBinding lb){
  if (closes.contains(lb)) {
    gen.loadThis();
    gen.getField(fntype,lb.name,OBJECT_TYPE);
  }
 else   gen.visitVarInsn(OBJECT_TYPE.getOpcode(Opcodes.ILOAD),lb.idx);
}
Program: 26587
Project: 26587
Buggy source:
public IPersistentMap put(Object key,Object val){
  int i=indexOf(key);
  Object[] newArray;
  if (i >= 0) {
    if (array[i + 1] == val)     return this;
    newArray=array.clone();
    newArray[i + 1]=val;
  }
 else {
    newArray=new Object[array.length + 2];
    if (array.length > 0)     System.arraycopy(array,0,newArray,2,array.length);
    newArray[0]=key;
    newArray[1]=val;
  }
  return new PersistentArrayMap(newArray);
}

Fixed version (ground truth):
public IPersistentMap put(Object key,Object val){
  int i=indexOf(key);
  Object[] newArray;
  if (i >= 0) {
    if (array[i + 1] == val)     return this;
    newArray=array.clone();
    newArray[i + 1]=val;
  }
 else {
    newArray=new Object[array.length + 2];
    if (array.length > 0)     System.arraycopy(array,0,newArray,2,array.length);
    newArray[0]=key;
    newArray[1]=val;
  }
  return create(newArray);
}
Program: 26588
Project: 26588
Buggy source:
public Object get(Object key){
  int i=indexOf(key);
  if (i >= 0)   return array[i + 1];
  return null;
}

Fixed version (ground truth):
final public Object get(Object key){
  int i=indexOf(key);
  if (i >= 0)   return array[i + 1];
  return null;
}
Program: 26589
Project: 26589
Buggy source:
int indexOf(Object key){
  for (int i=0; i < array.length; i+=2) {
    if (equalKey(array[i],key))     return i;
  }
  return -1;
}

Fixed version (ground truth):
private int indexOf(Object key){
  for (int i=0; i < array.length; i+=2) {
    if (equalKey(array[i],key))     return i;
  }
  return -1;
}
Program: 26590
Project: 26590
Buggy source:
public int compareTo(MavenCentralComparableVersion o){
  if ((getDate() == null) == (o.getDate() == null)) {
    return super.compareTo(o);
  }
 else   if (getDate() == null) {
    return version.getLastUpdateDate().compareTo(o.getDate());
  }
  return getDate().compareTo(o.getVersion().getLastUpdateDate());
}

Fixed version (ground truth):
public int compareTo(MavenCentralComparableVersion o){
  if ((getDate() == null) == (o.getDate() == null)) {
    int result=super.compareTo(o);
    if (result != 0) {
      return result;
    }
    return version.getVersion().compareTo(o.getVersion().getVersion());
  }
 else   if (getDate() == null) {
    return version.getLastUpdateDate().compareTo(o.getDate());
  }
  return getDate().compareTo(o.getVersion().getLastUpdateDate());
}
Program: 26591
Project: 26591
Buggy source:
@Override public void delete(Project project) throws ServiceException, SecurityServiceException {
  for (  Artifact artifact : project.getArtifacts()) {
    artifact.setProject(null);
    artifactService.update(artifact);
    for (    ArtifactVersion artifactVersion : artifact.getVersions()) {
      artifactVersion.setProjectVersion(null);
      artifactVersionService.update(artifactVersion);
    }
  }
  super.delete(project);
}

Fixed version (ground truth):
@Override public void delete(Project project) throws ServiceException, SecurityServiceException {
  for (  Artifact artifact : project.getArtifacts()) {
    artifact.setProject(null);
    for (    ArtifactVersion artifactVersion : artifact.getVersions()) {
      artifactVersion.setProjectVersion(null);
    }
    artifactService.update(artifact);
  }
  super.delete(project);
}
Program: 26592
Project: 26592
Buggy source:
@SuppressWarnings("String_Node_Str") private void hackPortal(String portalGUID) throws Exception {
  JSONObject main=new JSONObject();
  JSONObject params=new JSONObject();
  params.put("String_Node_Str",portalGUID);
  params.put("String_Node_Str",syncTimestamp);
  params.put("String_Node_Str",S2Wrapper.encodeLocation(currentLocation));
  main.put("String_Node_Str",params);
  URL getObjectsURL=new URL(baseURL + "String_Node_Str");
  URLConnection getObjectsCon=getObjectsURL.openConnection();
  getObjectsCon.setRequestProperty("String_Node_Str",authCookie);
  getObjectsCon.setRequestProperty("String_Node_Str",this.xsrfToken);
  getObjectsCon.setDoOutput(true);
  OutputStreamWriter out=new OutputStreamWriter(getObjectsCon.getOutputStream());
  out.write(main.toString());
  out.close();
  BufferedReader br=new BufferedReader(new InputStreamReader(getObjectsCon.getInputStream()));
  String line=br.readLine();
  br.close();
  DebugHandler.debugln(line);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void hackPortal(String portalGUID) throws Exception {
  JSONObject main=new JSONObject();
  JSONObject params=new JSONObject();
  DebugHandler.debugInfo("String_Node_Str" + portalGUID);
  params.put("String_Node_Str",portalGUID);
  params.put("String_Node_Str",syncTimestamp);
  params.put("String_Node_Str",S2Wrapper.encodeLocation(currentLocation));
  main.put("String_Node_Str",params);
  URL getObjectsURL=new URL(baseURL + "String_Node_Str");
  URLConnection getObjectsCon=getObjectsURL.openConnection();
  getObjectsCon.setRequestProperty("String_Node_Str",authCookie);
  getObjectsCon.setRequestProperty("String_Node_Str",this.xsrfToken);
  getObjectsCon.setDoOutput(true);
  OutputStreamWriter out=new OutputStreamWriter(getObjectsCon.getOutputStream());
  out.write(main.toString());
  out.close();
  BufferedReader br=new BufferedReader(new InputStreamReader(getObjectsCon.getInputStream()));
  String line=br.readLine();
  br.close();
  DebugHandler.debugln(line);
  DebugHandler.debugInfo("String_Node_Str");
}
Program: 26593
Project: 26593
Buggy source:
public void updateLocation(S2LatLng s2ll) throws Exception {
  double lat=s2ll.latDegrees();
  double lng=s2ll.lngDegrees();
  String add="String_Node_Str" + Double.toString(lat) + "String_Node_Str"+ Double.toString(lng)+ "String_Node_Str"+ Double.toString(lat)+ "String_Node_Str"+ Double.toString(lng);
  for (int i=0; i < cw.localPortals.size(); i++)   System.out.println(add);
  jLabel.setIcon(new ImageIcon(new URL(add)));
  debugJTArea.setText(DebugHandler.debugLines);
  infoJTArea.setText(DebugHandler.infoLines);
  debugVertical.setValue(debugVertical.getMaximum());
  String inventorySTR="String_Node_Str";
  for (int i=0; i < player.inventory.size(); i++)   inventorySTR+=player.inventory.get(i).toString() + "String_Node_Str";
  itemsJTArea.setText(inventorySTR);
  frame.pack();
}

Fixed version (ground truth):
public void updateLocation(S2LatLng s2ll) throws Exception {
  double lat=s2ll.latDegrees();
  double lng=s2ll.lngDegrees();
  String add="String_Node_Str" + Double.toString(lat) + "String_Node_Str"+ Double.toString(lng)+ "String_Node_Str"+ Double.toString(lat)+ "String_Node_Str"+ Double.toString(lng);
  if (cw.localPortals != null) {
    int cwSize=cw.localHackablePortals.size();
    System.out.println(cw.localHackablePortals.size());
    for (int i=0; i < cwSize; i++)     add+="String_Node_Str" + Double.toString(cw.localHackablePortals.get(i).location.latDegrees()) + "String_Node_Str"+ Double.toString(cw.localHackablePortals.get(i).location.lngDegrees());
  }
  System.out.println(add);
  jLabel.setIcon(new ImageIcon(new URL(add)));
  debugJTArea.setText(DebugHandler.debugLines);
  infoJTArea.setText(DebugHandler.infoLines);
  debugVertical.setValue(debugVertical.getMaximum());
  String inventorySTR="String_Node_Str";
  for (int i=0; i < player.inventory.size(); i++)   inventorySTR+=player.inventory.get(i).toString() + "String_Node_Str";
  itemsJTArea.setText(inventorySTR);
  frame.pack();
}
Program: 26594
Project: 26594
Buggy source:
public void run() throws Exception {
  String curLine=br.readLine();
  String[] firstLocation=curLine.split("String_Node_Str");
  currentLocation=S2LatLng.fromDegrees(Double.parseDouble(firstLocation[0]),Double.parseDouble(firstLocation[1]));
  cw.newLocation(currentLocation);
  cw.printLocalHackablePortalNames();
  GUI gui=new GUI(cw.player,cw);
  while ((curLine=br.readLine()) != null) {
    cw.getInventory();
    System.out.println("String_Node_Str" + curLine);
    DebugHandler.debugInfo("String_Node_Str" + curLine);
    System.out.println(curLine.toString());
    String[] newLocation=curLine.split("String_Node_Str");
    S2LatLng newLoc=S2LatLng.fromDegrees(Double.parseDouble(newLocation[0]),Double.parseDouble(newLocation[1]));
    Double dist=S2Wrapper.GreatEarthDistance(currentLocation,newLoc);
    TransitHandler th=new TransitHandler(currentLocation,newLoc,gui);
    th.start();
    int waitTimeSeconds=(int)(dist / 5.0);
    System.out.println("String_Node_Str" + waitTimeSeconds + "String_Node_Str");
    DebugHandler.debugInfo("String_Node_Str" + waitTimeSeconds + "String_Node_Str");
    th.join();
    System.out.println("String_Node_Str");
    DebugHandler.debugInfo("String_Node_Str");
    currentLocation=newLoc;
    cw.newLocation(newLoc);
    cw.printLocalHackablePortalNames();
  }
}

Fixed version (ground truth):
public void run() throws Exception {
  String curLine=br.readLine();
  String[] firstLocation=curLine.split("String_Node_Str");
  currentLocation=S2LatLng.fromDegrees(Double.parseDouble(firstLocation[0]),Double.parseDouble(firstLocation[1]));
  cw.newLocation(currentLocation);
  cw.printLocalHackablePortalNames();
  GUI gui=new GUI(cw.player,cw);
  while ((curLine=br.readLine()) != null) {
    System.out.println("String_Node_Str" + curLine);
    DebugHandler.debugInfo("String_Node_Str" + curLine);
    System.out.println(curLine.toString());
    String[] newLocation=curLine.split("String_Node_Str");
    S2LatLng newLoc=S2LatLng.fromDegrees(Double.parseDouble(newLocation[0]),Double.parseDouble(newLocation[1]));
    Double dist=S2Wrapper.GreatEarthDistance(currentLocation,newLoc);
    TransitHandler th=new TransitHandler(currentLocation,newLoc,gui);
    th.start();
    int waitTimeSeconds=(int)(dist / 5.0);
    System.out.println("String_Node_Str" + waitTimeSeconds + "String_Node_Str");
    DebugHandler.debugInfo("String_Node_Str" + waitTimeSeconds + "String_Node_Str");
    th.join();
    System.out.println("String_Node_Str");
    DebugHandler.debugInfo("String_Node_Str");
    currentLocation=newLoc;
    cw.newLocation(newLoc);
    cw.printLocalHackablePortalNames();
    cw.hackLocalPortals();
    cw.getInventory();
  }
}
Program: 26595
Project: 26595
Buggy source:
private String resolveLocalizedErrorMessage(FieldError fieldError,Locale locale){
  String localizedErrorMessage=null;
  String[] fieldErrorCodes=fieldError.getCodes();
  for (int index=0; index < fieldErrorCodes.length; index++) {
    String fieldErrorCode=fieldErrorCodes[index];
    LOGGER.debug("String_Node_Str",fieldErrorCode,locale);
    localizedErrorMessage=getMessageForCode(fieldErrorCode,fieldError.getArguments(),locale);
    LOGGER.debug("String_Node_Str",localizedErrorMessage);
    if (localizedErrorMessage != null) {
      LOGGER.debug("String_Node_Str",localizedErrorMessage);
      break;
    }
  }
  if (localizedErrorMessage == null) {
    localizedErrorMessage=fieldErrorCodes[0];
  }
  return localizedErrorMessage;
}

Fixed version (ground truth):
private String resolveLocalizedErrorMessage(FieldError fieldError,Locale locale){
  String localizedErrorMessage=messageSource.getMessage(fieldError,locale);
  if (localizedErrorMessage.equals(fieldError.getDefaultMessage())) {
    String[] fieldErrorCodes=fieldError.getCodes();
    localizedErrorMessage=fieldErrorCodes[0];
  }
  return localizedErrorMessage;
}
Program: 26596
Project: 26596
Buggy source:
private String resolveLocalizedErrorMessage(FieldError fieldError,Locale locale){
  String localizedErrorMessage=null;
  String[] fieldErrorCodes=fieldError.getCodes();
  for (int index=0; index < fieldErrorCodes.length; index++) {
    String fieldErrorCode=fieldErrorCodes[index];
    LOGGER.debug("String_Node_Str",fieldErrorCode,locale);
    localizedErrorMessage=getMessageForCode(fieldErrorCode,fieldError.getArguments(),locale);
    LOGGER.debug("String_Node_Str",localizedErrorMessage);
    if (localizedErrorMessage != null) {
      LOGGER.debug("String_Node_Str",localizedErrorMessage);
      break;
    }
  }
  if (localizedErrorMessage == null) {
    localizedErrorMessage=fieldErrorCodes[0];
  }
  return localizedErrorMessage;
}

Fixed version (ground truth):
private String resolveLocalizedErrorMessage(FieldError fieldError,Locale locale){
  String localizedErrorMessage=messageSource.getMessage(fieldError,locale);
  if (localizedErrorMessage.equals(fieldError.getDefaultMessage())) {
    String[] fieldErrorCodes=fieldError.getCodes();
    localizedErrorMessage=fieldErrorCodes[0];
  }
  return localizedErrorMessage;
}
Program: 26597
Project: 26597
Buggy source:
private DoubleNode decodeDouble(int size) throws InvalidDatabaseException {
  if (size != 8) {
    throw new InvalidDatabaseException("String_Node_Str" + "String_Node_Str");
  }
  return new DoubleNode(this.threadBuffer.get().getDouble());
}

Fixed version (ground truth):
private DoubleNode decodeDouble(int size) throws InvalidDatabaseException {
  if (size != 8) {
    throw new InvalidDatabaseException("String_Node_Str" + "String_Node_Str");
  }
  return new DoubleNode(this.buffer.getDouble());
}
Program: 26598
Project: 26598
Buggy source:
private String decodeString(int size){
  ByteBuffer buffer=this.threadBuffer.get().slice();
  buffer.limit(size);
  return Charset.forName("String_Node_Str").decode(buffer).toString();
}

Fixed version (ground truth):
private String decodeString(int size){
  ByteBuffer buffer=this.buffer.slice();
  buffer.limit(size);
  return Charset.forName("String_Node_Str").decode(buffer).toString();
}
Program: 26599
Project: 26599
Buggy source:
void Decoder(ThreadBuffer threadBuffer,long pointerBase){
  this.pointerBase=pointerBase;
  this.threadBuffer=threadBuffer;
  this.objectMapper=new ObjectMapper();
}

Fixed version (ground truth):
void Decoder(ByteBuffer buffer,long pointerBase){
  this.pointerBase=pointerBase;
  this.buffer=buffer;
  this.objectMapper=new ObjectMapper();
}
Program: 26600
Project: 26600
Buggy source:
Result decode(int offset) throws IOException {
  ByteBuffer buffer=this.threadBuffer.get();
  if (offset >= buffer.capacity()) {
    throw new InvalidDatabaseException("String_Node_Str" + "String_Node_Str");
  }
  buffer.position(offset);
  int ctrlByte=0xFF & buffer.get();
  offset++;
  Type type=Type.fromControlByte(ctrlByte);
  if (type.equals(Type.POINTER)) {
    Result pointer=this.decodePointer(ctrlByte,offset);
    if (this.POINTER_TEST_HACK) {
      return pointer;
    }
    Result result=this.decode((pointer.getNode().asInt()));
    result.setOffset(pointer.getOffset());
    return result;
  }
  if (type.equals(Type.EXTENDED)) {
    int nextByte=buffer.get();
    int typeNum=nextByte + 7;
    if (typeNum < 8) {
      throw new InvalidDatabaseException("String_Node_Str" + "String_Node_Str" + typeNum + "String_Node_Str");
    }
    type=Type.get(typeNum);
    offset++;
  }
  int[] sizeArray=this.sizeFromCtrlByte(ctrlByte,offset);
  int size=sizeArray[0];
  offset=sizeArray[1];
  return this.decodeByType(type,offset,size);
}

Fixed version (ground truth):
Result decode(int offset) throws IOException {
  if (offset >= this.buffer.capacity()) {
    throw new InvalidDatabaseException("String_Node_Str" + "String_Node_Str");
  }
  this.buffer.position(offset);
  int ctrlByte=0xFF & this.buffer.get();
  offset++;
  Type type=Type.fromControlByte(ctrlByte);
  if (type.equals(Type.POINTER)) {
    Result pointer=this.decodePointer(ctrlByte,offset);
    if (this.POINTER_TEST_HACK) {
      return pointer;
    }
    Result result=this.decode((pointer.getNode().asInt()));
    result.setOffset(pointer.getOffset());
    return result;
  }
  if (type.equals(Type.EXTENDED)) {
    int nextByte=this.buffer.get();
    int typeNum=nextByte + 7;
    if (typeNum < 8) {
      throw new InvalidDatabaseException("String_Node_Str" + "String_Node_Str" + typeNum + "String_Node_Str");
    }
    type=Type.get(typeNum);
    offset++;
  }
  int[] sizeArray=this.sizeFromCtrlByte(ctrlByte,offset);
  int size=sizeArray[0];
  offset=sizeArray[1];
  return this.decodeByType(type,offset,size);
}
Program: 26601
Project: 26601
Buggy source:
private FloatNode decodeFloat(int size) throws InvalidDatabaseException {
  if (size != 4) {
    throw new InvalidDatabaseException("String_Node_Str" + "String_Node_Str");
  }
  return new FloatNode(this.threadBuffer.get().getFloat());
}

Fixed version (ground truth):
private FloatNode decodeFloat(int size) throws InvalidDatabaseException {
  if (size != 4) {
    throw new InvalidDatabaseException("String_Node_Str" + "String_Node_Str");
  }
  return new FloatNode(this.buffer.getFloat());
}
Program: 26602
Project: 26602
Buggy source:
private long decodeLong(int size){
  ByteBuffer buffer=this.threadBuffer.get();
  long integer=0;
  for (int i=0; i < size; i++) {
    integer=(integer << 8) | (buffer.get() & 0xFF);
  }
  return integer;
}

Fixed version (ground truth):
private long decodeLong(int size){
  long integer=0;
  for (int i=0; i < size; i++) {
    integer=(integer << 8) | (this.buffer.get() & 0xFF);
  }
  return integer;
}
Program: 26603
Project: 26603
Buggy source:
private int findAddressInTree(InetAddress address) throws InvalidDatabaseException {
  byte[] rawAddress=address.getAddress();
  int bitLength=rawAddress.length * 8;
  int record=this.startNode(bitLength);
  for (int i=0; i < bitLength; i++) {
    if (record >= this.metadata.nodeCount) {
      break;
    }
    int b=0xFF & rawAddress[i / 8];
    int bit=1 & (b >> 7 - (i % 8));
    record=this.readNode(record,bit);
  }
  if (record == this.metadata.nodeCount) {
    return 0;
  }
 else   if (record > this.metadata.nodeCount) {
    return record;
  }
  throw new InvalidDatabaseException("String_Node_Str");
}

Fixed version (ground truth):
private int findAddressInTree(ByteBuffer buffer,InetAddress address) throws InvalidDatabaseException {
  byte[] rawAddress=address.getAddress();
  int bitLength=rawAddress.length * 8;
  int record=this.startNode(buffer,bitLength);
  for (int i=0; i < bitLength; i++) {
    if (record >= this.metadata.nodeCount) {
      break;
    }
    int b=0xFF & rawAddress[i / 8];
    int bit=1 & (b >> 7 - (i % 8));
    record=this.readNode(buffer,record,bit);
  }
  if (record == this.metadata.nodeCount) {
    return 0;
  }
 else   if (record > this.metadata.nodeCount) {
    return record;
  }
  throw new InvalidDatabaseException("String_Node_Str");
}
Program: 26604
Project: 26604
Buggy source:
private int ipV4StartNode() throws InvalidDatabaseException {
  if (this.metadata.ipVersion == 4) {
    return 0;
  }
  if (this.ipV4Start != 0) {
    return this.ipV4Start;
  }
  int node=0;
  for (int i=0; i < 96 && node < this.metadata.nodeCount; i++) {
    node=this.readNode(node,0);
  }
  this.ipV4Start=node;
  return node;
}

Fixed version (ground truth):
private int ipV4StartNode(ByteBuffer buffer) throws InvalidDatabaseException {
  if (this.metadata.ipVersion == 4) {
    return 0;
  }
  if (this.ipV4Start != 0) {
    return this.ipV4Start;
  }
  int node=0;
  for (int i=0; i < 96 && node < this.metadata.nodeCount; i++) {
    node=this.readNode(buffer,node,0);
  }
  this.ipV4Start=node;
  return node;
}
Program: 26605
Project: 26605
Buggy source:
private int findMetadataStart(String databaseName) throws InvalidDatabaseException {
  ByteBuffer buffer=this.threadBuffer.get();
  int fileSize=buffer.capacity();
  FILE:   for (int i=0; i < fileSize - METADATA_START_MARKER.length + 1; i++) {
    for (int j=0; j < METADATA_START_MARKER.length; j++) {
      byte b=buffer.get(fileSize - i - j- 1);
      if (b != METADATA_START_MARKER[METADATA_START_MARKER.length - j - 1]) {
        continue FILE;
      }
    }
    return fileSize - i;
  }
  throw new InvalidDatabaseException("String_Node_Str" + databaseName + "String_Node_Str");
}

Fixed version (ground truth):
private int findMetadataStart(ByteBuffer buffer,String databaseName) throws InvalidDatabaseException {
  int fileSize=buffer.capacity();
  FILE:   for (int i=0; i < fileSize - METADATA_START_MARKER.length + 1; i++) {
    for (int j=0; j < METADATA_START_MARKER.length; j++) {
      byte b=buffer.get(fileSize - i - j- 1);
      if (b != METADATA_START_MARKER[METADATA_START_MARKER.length - j - 1]) {
        continue FILE;
      }
    }
    return fileSize - i;
  }
  throw new InvalidDatabaseException("String_Node_Str" + databaseName + "String_Node_Str");
}
Program: 26606
Project: 26606
Buggy source:
private int startNode(int bitLength) throws InvalidDatabaseException {
  if (this.metadata.ipVersion == 6 && bitLength == 32) {
    return this.ipV4StartNode();
  }
  return 0;
}

Fixed version (ground truth):
private int startNode(ByteBuffer buffer,int bitLength) throws InvalidDatabaseException {
  if (this.metadata.ipVersion == 6 && bitLength == 32) {
    return this.ipV4StartNode(buffer);
  }
  return 0;
}
Program: 26607
Project: 26607
Buggy source:
/** 
 * Looks up the <code>address</code> in the MaxMind DB.
 * @param ipAddress the IP address to look up.
 * @return the record for the IP address.
 * @throws IOException if a file I/O error occurs.
 */
public JsonNode get(InetAddress ipAddress) throws IOException {
  int pointer=this.findAddressInTree(ipAddress);
  if (pointer == 0) {
    return null;
  }
  return this.resolveDataPointer(pointer);
}

Fixed version (ground truth):
/** 
 * Looks up the <code>address</code> in the MaxMind DB.
 * @param ipAddress the IP address to look up.
 * @return the record for the IP address.
 * @throws IOException if a file I/O error occurs.
 */
public JsonNode get(InetAddress ipAddress) throws IOException {
  ByteBuffer buffer=this.bufferHolder.get();
  int pointer=this.findAddressInTree(buffer,ipAddress);
  if (pointer == 0) {
    return null;
  }
  return this.resolveDataPointer(buffer,pointer);
}
Program: 26608
Project: 26608
Buggy source:
private JsonNode resolveDataPointer(int pointer) throws IOException {
  int resolved=(pointer - this.metadata.nodeCount) + this.metadata.searchTreeSize;
  if (resolved >= this.threadBuffer.get().capacity()) {
    throw new InvalidDatabaseException("String_Node_Str" + "String_Node_Str");
  }
  return this.decoder.decode(resolved).getNode();
}

Fixed version (ground truth):
private JsonNode resolveDataPointer(ByteBuffer buffer,int pointer) throws IOException {
  int resolved=(pointer - this.metadata.nodeCount) + this.metadata.searchTreeSize;
  if (resolved >= buffer.capacity()) {
    throw new InvalidDatabaseException("String_Node_Str" + "String_Node_Str");
  }
  Decoder decoder=new Decoder(buffer,this.metadata.searchTreeSize + DATA_SECTION_SEPARATOR_SIZE);
  return decoder.decode(resolved).getNode();
}
Program: 26609
Project: 26609
Buggy source:
private Reader(ThreadBuffer buffer,String name) throws IOException {
  this.threadBuffer=buffer;
  int start=this.findMetadataStart(name);
  Decoder metadataDecoder=new Decoder(this.threadBuffer,start);
  this.metadata=new Metadata(metadataDecoder.decode(start).getNode());
  this.decoder=new Decoder(this.threadBuffer,this.metadata.searchTreeSize + DATA_SECTION_SEPARATOR_SIZE);
}

Fixed version (ground truth):
private Reader(BufferHolder bufferHolder,String name) throws IOException {
  this.bufferHolder=bufferHolder;
  ByteBuffer buffer=this.bufferHolder.get();
  int start=this.findMetadataStart(buffer,name);
  Decoder metadataDecoder=new Decoder(buffer,start);
  this.metadata=new Metadata(metadataDecoder.decode(start).getNode());
}
Program: 26610
Project: 26610
Buggy source:
/** 
 * Closes the MaxMind DB and returns resources to the system.
 * @throws IOException if an I/O error occurs.
 */
@Override public void close() throws IOException {
  this.threadBuffer.close();
}

Fixed version (ground truth):
/** 
 * Closes the MaxMind DB and returns resources to the system.
 * @throws IOException if an I/O error occurs.
 */
@Override public void close() throws IOException {
  this.bufferHolder.close();
}
Program: 26611
Project: 26611
Buggy source:
private int readNode(int nodeNumber,int index) throws InvalidDatabaseException {
  ByteBuffer buffer=this.threadBuffer.get();
  int baseOffset=nodeNumber * this.metadata.nodeByteSize;
switch (this.metadata.recordSize) {
case 24:
    buffer.position(baseOffset + index * 3);
  return Decoder.decodeInteger(buffer,0,3);
case 28:
int middle=buffer.get(baseOffset + 3);
if (index == 0) {
middle=(0xF0 & middle) >>> 4;
}
 else {
middle=0x0F & middle;
}
buffer.position(baseOffset + index * 4);
return Decoder.decodeInteger(buffer,middle,3);
case 32:
buffer.position(baseOffset + index * 4);
return Decoder.decodeInteger(buffer,0,4);
default :
throw new InvalidDatabaseException("String_Node_Str" + this.metadata.recordSize);
}
}

Fixed version (ground truth):
private int readNode(ByteBuffer buffer,int nodeNumber,int index) throws InvalidDatabaseException {
  int baseOffset=nodeNumber * this.metadata.nodeByteSize;
switch (this.metadata.recordSize) {
case 24:
    buffer.position(baseOffset + index * 3);
  return Decoder.decodeInteger(buffer,0,3);
case 28:
int middle=buffer.get(baseOffset + 3);
if (index == 0) {
middle=(0xF0 & middle) >>> 4;
}
 else {
middle=0x0F & middle;
}
buffer.position(baseOffset + index * 4);
return Decoder.decodeInteger(buffer,middle,3);
case 32:
buffer.position(baseOffset + index * 4);
return Decoder.decodeInteger(buffer,0,4);
default :
throw new InvalidDatabaseException("String_Node_Str" + this.metadata.recordSize);
}
}
Program: 26613
Project: 26613
Buggy source:
@SuppressWarnings("String_Node_Str") @Test public void testWithPointers() throws InvalidDatabaseException, IOException, URISyntaxException {
  File file=new File(PointerTest.class.getResource("String_Node_Str").toURI());
  ThreadBuffer ptf=new ThreadBuffer(file,FileMode.MEMORY);
  try {
    Decoder decoder=new Decoder(ptf,0);
    ObjectMapper om=new ObjectMapper();
    ObjectNode map=om.createObjectNode();
    map.put("String_Node_Str","String_Node_Str");
    assertEquals(map,decoder.decode(0).getNode());
    map=om.createObjectNode();
    map.put("String_Node_Str","String_Node_Str");
    assertEquals(map,decoder.decode(22).getNode());
    map=om.createObjectNode();
    map.put("String_Node_Str","String_Node_Str");
    assertEquals(map,decoder.decode(37).getNode());
    map=om.createObjectNode();
    map.put("String_Node_Str","String_Node_Str");
    assertEquals(map,decoder.decode(50).getNode());
    map=om.createObjectNode();
    map.put("String_Node_Str","String_Node_Str");
    assertEquals(map,decoder.decode(55).getNode());
    map=om.createObjectNode();
    map.put("String_Node_Str","String_Node_Str");
    assertEquals(map,decoder.decode(57).getNode());
  }
  finally {
    ptf.close();
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Test public void testWithPointers() throws InvalidDatabaseException, IOException, URISyntaxException {
  File file=new File(PointerTest.class.getResource("String_Node_Str").toURI());
  BufferHolder ptf=new BufferHolder(file,FileMode.MEMORY);
  try {
    Decoder decoder=new Decoder(ptf.get(),0);
    ObjectMapper om=new ObjectMapper();
    ObjectNode map=om.createObjectNode();
    map.put("String_Node_Str","String_Node_Str");
    assertEquals(map,decoder.decode(0).getNode());
    map=om.createObjectNode();
    map.put("String_Node_Str","String_Node_Str");
    assertEquals(map,decoder.decode(22).getNode());
    map=om.createObjectNode();
    map.put("String_Node_Str","String_Node_Str");
    assertEquals(map,decoder.decode(37).getNode());
    map=om.createObjectNode();
    map.put("String_Node_Str","String_Node_Str");
    assertEquals(map,decoder.decode(50).getNode());
    map=om.createObjectNode();
    map.put("String_Node_Str","String_Node_Str");
    assertEquals(map,decoder.decode(55).getNode());
    map=om.createObjectNode();
    map.put("String_Node_Str","String_Node_Str");
    assertEquals(map,decoder.decode(57).getNode());
  }
  finally {
    ptf.close();
  }
}
Program: 26614
Project: 26614
Buggy source:
/** 
 * Constructs a Reader for the MaxMind DB format. The file passed to it must be a valid MaxMind DB file such as a GeoIP2 database file.
 * @param database the MaxMind DB file to use.
 * @param fileMode the mode to open the file with.
 * @throws IOException if there is an error opening or reading from the file.
 */
public MaxMindDbReader(File database,FileMode fileMode) throws IOException {
  this.threadBuffer=new ThreadBuffer(database,fileMode);
  int start=this.findMetadataStart(database.getName());
  Decoder metadataDecoder=new Decoder(this.threadBuffer,0);
  this.metadata=new Metadata(metadataDecoder.decode(start).getNode());
  this.decoder=new Decoder(this.threadBuffer,this.metadata.searchTreeSize + DATA_SECTION_SEPARATOR_SIZE);
}

Fixed version (ground truth):
/** 
 * Constructs a Reader for the MaxMind DB format. The file passed to it must be a valid MaxMind DB file such as a GeoIP2 database file.
 * @param database the MaxMind DB file to use.
 * @param fileMode the mode to open the file with.
 * @throws IOException if there is an error opening or reading from the file.
 */
public MaxMindDbReader(File database,FileMode fileMode) throws IOException {
  this.threadBuffer=new ThreadBuffer(database,fileMode);
  int start=this.findMetadataStart(database.getName());
  Decoder metadataDecoder=new Decoder(this.threadBuffer,start);
  this.metadata=new Metadata(metadataDecoder.decode(start).getNode());
  this.decoder=new Decoder(this.threadBuffer,this.metadata.searchTreeSize + DATA_SECTION_SEPARATOR_SIZE);
}
Program: 26615
Project: 26615
Buggy source:
private int findAddressInTree(InetAddress address) throws InvalidDatabaseException {
  byte[] rawAddress=address.getAddress();
  int bitLength=rawAddress.length * 8;
  int record=this.startNode(bitLength);
  for (int i=0; i < bitLength; i++) {
    int b=0xFF & rawAddress[i / 8];
    int bit=1 & (b >> 7 - (i % 8));
    record=this.readNode(record,bit);
    if (record == this.metadata.nodeCount) {
      return 0;
    }
 else     if (record > this.metadata.nodeCount) {
      return record;
    }
  }
  throw new InvalidDatabaseException("String_Node_Str");
}

Fixed version (ground truth):
private int findAddressInTree(InetAddress address) throws InvalidDatabaseException {
  byte[] rawAddress=address.getAddress();
  int bitLength=rawAddress.length * 8;
  int record=this.startNode(bitLength);
  for (int i=0; i < bitLength; i++) {
    if (record >= this.metadata.nodeCount) {
      break;
    }
    int b=0xFF & rawAddress[i / 8];
    int bit=1 & (b >> 7 - (i % 8));
    record=this.readNode(record,bit);
  }
  if (record == this.metadata.nodeCount) {
    return 0;
  }
 else   if (record > this.metadata.nodeCount) {
    return record;
  }
  throw new InvalidDatabaseException("String_Node_Str");
}
Program: 26616
Project: 26616
Buggy source:
private int ipV4StartNode() throws InvalidDatabaseException {
  if (this.metadata.ipVersion == 4) {
    return 0;
  }
  if (this.ipV4Start != 0) {
    return this.ipV4Start;
  }
  int node=0;
  for (int i=0; i < 96; i++) {
    int nextNode=this.readNode(node,0);
    if (nextNode >= this.metadata.nodeCount) {
      break;
    }
    node=nextNode;
  }
  this.ipV4Start=node;
  return node;
}

Fixed version (ground truth):
private int ipV4StartNode() throws InvalidDatabaseException {
  if (this.metadata.ipVersion == 4) {
    return 0;
  }
  if (this.ipV4Start != 0) {
    return this.ipV4Start;
  }
  int node=0;
  for (int i=0; i < 96 && node < this.metadata.nodeCount; i++) {
    node=this.readNode(node,0);
  }
  this.ipV4Start=node;
  return node;
}
Program: 26617
Project: 26617
Buggy source:
@Test public void testNoIpV4SearchTree() throws IOException, URISyntaxException {
  URI file=ReaderTest.class.getResource("String_Node_Str").toURI();
  MaxMindDbReader reader=new MaxMindDbReader(new File(file));
  assertEquals("String_Node_Str",reader.get(InetAddress.getByName("String_Node_Str")).textValue());
}

Fixed version (ground truth):
@Test public void testNoIpV4SearchTree() throws IOException, URISyntaxException {
  URI file=ReaderTest.class.getResource("String_Node_Str").toURI();
  MaxMindDbReader reader=new MaxMindDbReader(new File(file));
  assertEquals("String_Node_Str",reader.get(InetAddress.getByName("String_Node_Str")).textValue());
  assertEquals("String_Node_Str",reader.get(InetAddress.getByName("String_Node_Str")).textValue());
}
Program: 26618
Project: 26618
Buggy source:
private int ipV4StartNode() throws InvalidDatabaseException {
  if (this.metadata.ipVersion == 4) {
    return 0;
  }
  if (this.ipV4Start != 0) {
    return this.ipV4Start;
  }
  int node=0;
  int nextNode=0;
  for (int i=0; i < 96 && nextNode < this.metadata.nodeCount; i++) {
    node=nextNode;
    nextNode=this.readNode(node,0);
  }
  this.ipV4Start=node;
  return node;
}

Fixed version (ground truth):
private int ipV4StartNode() throws InvalidDatabaseException {
  if (this.metadata.ipVersion == 4) {
    return 0;
  }
  if (this.ipV4Start != 0) {
    return this.ipV4Start;
  }
  int node=0;
  int nextNode=0;
  for (int i=0; i < 96; i++) {
    nextNode=this.readNode(node,0);
    if (nextNode >= this.metadata.nodeCount) {
      break;
    }
    node=nextNode;
  }
  this.ipV4Start=node;
  return node;
}
Program: 26619
Project: 26619
Buggy source:
private int findAddressInTree(InetAddress address) throws InvalidDatabaseException {
  byte[] rawAddress=address.getAddress();
  int nodeNum=this.startNode(rawAddress.length * 8);
  for (int i=0; i < rawAddress.length * 8; i++) {
    int b=0xFF & rawAddress[i / 8];
    int bit=1 & (b >> 7 - (i % 8));
    int record=this.readNode(nodeNum,bit);
    if (record == this.metadata.nodeCount) {
      return 0;
    }
 else     if (record > this.metadata.nodeCount) {
      return record;
    }
    nodeNum=record;
  }
  throw new InvalidDatabaseException("String_Node_Str");
}

Fixed version (ground truth):
private int findAddressInTree(InetAddress address) throws InvalidDatabaseException {
  byte[] rawAddress=address.getAddress();
  int bitLength=rawAddress.length * 8;
  int record=this.startNode(bitLength);
  for (int i=0; i < bitLength; i++) {
    int b=0xFF & rawAddress[i / 8];
    int bit=1 & (b >> 7 - (i % 8));
    record=this.readNode(record,bit);
    if (record == this.metadata.nodeCount) {
      return 0;
    }
 else     if (record > this.metadata.nodeCount) {
      return record;
    }
  }
  throw new InvalidDatabaseException("String_Node_Str");
}
Program: 26620
Project: 26620
Buggy source:
private int ipV4StartNode() throws InvalidDatabaseException {
  if (this.metadata.ipVersion == 4) {
    return 0;
  }
  if (this.ipV4Start != 0) {
    return this.ipV4Start;
  }
  int nodeNum=0;
  for (int i=0; i < 96; i++) {
    nodeNum=this.readNode(nodeNum,0);
  }
  this.ipV4Start=nodeNum;
  return nodeNum;
}

Fixed version (ground truth):
private int ipV4StartNode() throws InvalidDatabaseException {
  if (this.metadata.ipVersion == 4) {
    return 0;
  }
  if (this.ipV4Start != 0) {
    return this.ipV4Start;
  }
  int node=0;
  int nextNode=0;
  for (int i=0; i < 96 && nextNode < this.metadata.nodeCount; i++) {
    node=nextNode;
    nextNode=this.readNode(node,0);
  }
  this.ipV4Start=node;
  return node;
}
Program: 26621
Project: 26621
Buggy source:
private int startNode(int length) throws InvalidDatabaseException {
  if (this.metadata.ipVersion == 6 && length == 32) {
    return this.ipV4StartNode();
  }
  return 0;
}

Fixed version (ground truth):
private int startNode(int bitLength) throws InvalidDatabaseException {
  if (this.metadata.ipVersion == 6 && bitLength == 32) {
    return this.ipV4StartNode();
  }
  return 0;
}
Program: 26622
Project: 26622
Buggy source:
private long findMetadataStart() throws IOException {
  long fileSize=this.fc.size();
  System.out.println(fileSize);
  FILE:   for (long i=0; i < fileSize - METADATE_START_MARKER.length + 1; i++) {
    for (int j=0; j < METADATE_START_MARKER.length; j++) {
      ByteBuffer b=ByteBuffer.wrap(new byte[1]);
      this.fc.read(b,fileSize - i - j- 1);
      System.out.println(b.get(0));
      if (b.get(0) != METADATE_START_MARKER[METADATE_START_MARKER.length - j - 1]) {
        continue FILE;
      }
    }
    return fileSize - i;
  }
  return -1;
}

Fixed version (ground truth):
private long findMetadataStart() throws IOException {
  long fileSize=this.fc.size();
  FILE:   for (long i=0; i < fileSize - METADATE_START_MARKER.length + 1; i++) {
    for (int j=0; j < METADATE_START_MARKER.length; j++) {
      ByteBuffer b=ByteBuffer.wrap(new byte[1]);
      this.fc.read(b,fileSize - i - j- 1);
      if (b.get(0) != METADATE_START_MARKER[METADATE_START_MARKER.length - j - 1]) {
        continue FILE;
      }
    }
    return fileSize - i;
  }
  return -1;
}
Program: 26623
Project: 26623
Buggy source:
private long[] splitNodeIntoRecords(ByteBuffer bytes) throws MaxMindDbException {
  long[] nodes=new long[2];
switch (this.metadata.recordSize.intValue()) {
case 24:
    nodes[0]=Util.decodeLong(Arrays.copyOfRange(bytes.array(),0,3));
  nodes[1]=Util.decodeLong(Arrays.copyOfRange(bytes.array(),3,6));
return nodes;
case 28:
nodes[0]=Util.decodeLong(Arrays.copyOfRange(bytes.array(),0,3));
nodes[1]=Util.decodeLong(Arrays.copyOfRange(bytes.array(),4,7));
nodes[0]=((0xF0 & bytes.get(3)) << 24) | nodes[0];
nodes[1]=((0x0F & bytes.get(3)) << 24) | nodes[1];
return nodes;
case 32:
nodes[0]=Util.decodeLong(Arrays.copyOfRange(bytes.array(),0,4));
nodes[1]=Util.decodeLong(Arrays.copyOfRange(bytes.array(),4,8));
return nodes;
default :
throw new MaxMindDbException("String_Node_Str" + this.metadata.recordSize);
}
}

Fixed version (ground truth):
private long[] splitNodeIntoRecords(ByteBuffer bytes) throws MaxMindDbException {
  long[] nodes=new long[2];
switch (this.metadata.recordSize.intValue()) {
case 24:
    nodes[0]=Util.decodeLong(Arrays.copyOfRange(bytes.array(),0,3));
  nodes[1]=Util.decodeLong(Arrays.copyOfRange(bytes.array(),3,6));
return nodes;
case 28:
nodes[0]=Util.decodeLong(Arrays.copyOfRange(bytes.array(),0,3));
nodes[1]=Util.decodeLong(Arrays.copyOfRange(bytes.array(),4,7));
nodes[0]=((0xF0 & bytes.get(3)) << 20) | nodes[0];
nodes[1]=((0x0F & bytes.get(3)) << 24) | nodes[1];
return nodes;
case 32:
nodes[0]=Util.decodeLong(Arrays.copyOfRange(bytes.array(),0,4));
nodes[1]=Util.decodeLong(Arrays.copyOfRange(bytes.array(),4,8));
return nodes;
default :
throw new MaxMindDbException("String_Node_Str" + this.metadata.recordSize);
}
}
Program: 26624
Project: 26624
Buggy source:
private void updateFields(){
  NotificationDataSource datasource=new NotificationDataSource(this);
  datasource.open();
  NotificationItem item=datasource.getItem(savedId);
  datasource.close();
  final EditText editText=(EditText)findViewById(R.id.entryText);
  String newLine=System.getProperty("String_Node_Str");
  String final_text=item.getTitle();
  if (!item.getLongText().equals("String_Node_Str"))   final_text+=newLine + item.getLongText();
  editText.setText(final_text);
  resetBkg();
  icon=item.getIcon();
  if (icon.equals(CHECKMARK_GRAY)) {
    checkmarkGray.setSelected(true);
  }
  if (icon.equals("String_Node_Str")) {
    checkmarkOrange.setSelected(true);
  }
  if (icon.equals("String_Node_Str")) {
    checkmarkRed.setSelected(true);
  }
  if (icon.equals("String_Node_Str")) {
    checkmarkGreen.setSelected(true);
  }
  if (item.getReminderTime() > 0) {
    reminderCalendar.setTimeInMillis(item.getReminderTime());
    dateBtn.setText(DateFormat.getDateFormat(this).format(reminderCalendar.getTime()));
    TimeBtn.setText(DateFormat.getTimeFormat(this).format(reminderCalendar.getTime()));
    reminderSet.setVisibility(View.VISIBLE);
    reminderNone.setVisibility(View.GONE);
    useAlarm=true;
  }
}

Fixed version (ground truth):
private void updateFields(){
  NotificationDataSource datasource=new NotificationDataSource(this);
  datasource.open();
  NotificationItem item=datasource.getItem(savedId);
  datasource.close();
  final EditText editText=(EditText)findViewById(R.id.entryText);
  String newLine=System.getProperty("String_Node_Str");
  String final_text=item.getTitle();
  if (!item.getLongText().equals("String_Node_Str"))   final_text+=newLine + item.getLongText();
  editText.setText(final_text);
  resetBkg();
  icon=item.getIcon();
  if (icon.equals(NotificationItem.CHECKMARK_GRAY)) {
    checkmarkGray.setSelected(true);
  }
  if (icon.equals(NotificationItem.CHECKMARK_ORANGE)) {
    checkmarkOrange.setSelected(true);
  }
  if (icon.equals(NotificationItem.CHECKMARK_RED)) {
    checkmarkRed.setSelected(true);
  }
  if (icon.equals(NotificationItem.CHECKMARK_GREEN)) {
    checkmarkGreen.setSelected(true);
  }
  if (item.getReminderTime() > 0) {
    reminderCalendar.setTimeInMillis(item.getReminderTime());
    dateBtn.setText(DateFormat.getDateFormat(this).format(reminderCalendar.getTime()));
    TimeBtn.setText(DateFormat.getTimeFormat(this).format(reminderCalendar.getTime()));
    reminderSet.setVisibility(View.VISIBLE);
    reminderNone.setVisibility(View.GONE);
    useAlarm=true;
  }
}
Program: 26625
Project: 26625
Buggy source:
private void autoSaveNote(String sharedText){
  shareInfo=sharedText;
  shareFields(shareInfo);
  icon=CHECKMARK_GRAY;
  addBtn(null);
}

Fixed version (ground truth):
private void autoSaveNote(String sharedText){
  shareInfo=sharedText;
  shareFields(shareInfo);
  icon=NotificationItem.CHECKMARK_GRAY;
  addBtn(null);
}
Program: 26626
Project: 26626
Buggy source:
@Click void checkmark_orange(){
  resetBkg();
  checkmarkOrange.setSelected(true);
  icon="String_Node_Str";
}

Fixed version (ground truth):
@Click void checkmark_orange(){
  resetBkg();
  checkmarkOrange.setSelected(true);
  icon=NotificationItem.CHECKMARK_ORANGE;
}
Program: 26628
Project: 26628
Buggy source:
@Click void checkmark_red(){
  resetBkg();
  checkmarkRed.setSelected(true);
  icon="String_Node_Str";
}

Fixed version (ground truth):
@Click void checkmark_red(){
  resetBkg();
  checkmarkRed.setSelected(true);
  icon=NotificationItem.CHECKMARK_RED;
}
Program: 26629
Project: 26629
Buggy source:
@Click void checkmark_green(){
  resetBkg();
  checkmarkGreen.setSelected(true);
  icon="String_Node_Str";
}

Fixed version (ground truth):
@Click void checkmark_green(){
  resetBkg();
  checkmarkGreen.setSelected(true);
  icon=NotificationItem.CHECKMARK_GREEN;
}
Program: 26630
Project: 26630
Buggy source:
@Click void checkmark_gray(){
  resetBkg();
  checkmarkGray.setSelected(true);
  icon=CHECKMARK_GRAY;
}

Fixed version (ground truth):
@Click void checkmark_gray(){
  resetBkg();
  checkmarkGray.setSelected(true);
  icon=NotificationItem.CHECKMARK_GRAY;
}
Program: 26632
Project: 26632
Buggy source:
private void sort(int[] input,int lowIndex,int highIndex){
  if (highIndex <= lowIndex)   return;
  int pivot1=input[lowIndex];
  int pivot2=input[highIndex];
  if (pivot1 > pivot2) {
    exchange(input,lowIndex,highIndex);
    pivot1=input[lowIndex];
    pivot2=input[highIndex];
  }
  int i=lowIndex + 1;
  int lt=lowIndex + 1;
  int gt=highIndex - 1;
  while (i <= gt) {
    if (less(input[i],pivot1)) {
      exchange(input,i++,lt++);
    }
 else     if (less(pivot2,input[i])) {
      exchange(input,i,gt--);
    }
 else {
      i++;
    }
  }
  exchange(input,lowIndex,--lt);
  exchange(input,highIndex,++gt);
  sort(input,lowIndex,lt - 1);
  sort(input,lt + 1,gt - 1);
  sort(input,gt + 1,highIndex);
}

Fixed version (ground truth):
private void sort(int[] input,int lowIndex,int highIndex){
  if (highIndex <= lowIndex)   return;
  while (input[lowIndex + 1] >= input[lowIndex]) {
    lowIndex++;
    if (lowIndex >= highIndex) {
      return;
    }
  }
  int pivot1=input[lowIndex];
  int pivot2=input[highIndex];
  if (pivot1 > pivot2) {
    exchange(input,lowIndex,highIndex);
    pivot1=input[lowIndex];
    pivot2=input[highIndex];
  }
  int i=lowIndex + 1;
  int lt=lowIndex + 1;
  int gt=highIndex - 1;
  while (i <= gt) {
    if (less(input[i],pivot1)) {
      exchange(input,i++,lt++);
    }
 else     if (less(pivot2,input[i])) {
      exchange(input,i,gt--);
    }
 else {
      i++;
    }
  }
  exchange(input,lowIndex,--lt);
  exchange(input,highIndex,++gt);
  sort(input,lowIndex,lt - 1);
  sort(input,lt + 1,gt - 1);
  sort(input,gt + 1,highIndex);
}
Program: 26633
Project: 26633
Buggy source:
@Override public boolean onTouchEvent(MotionEvent event){
  if (isEnabled()) {
    isLastTouch=true;
    if (event.getAction() == MotionEvent.ACTION_DOWN) {
      press=true;
    }
 else     if (event.getAction() == MotionEvent.ACTION_MOVE) {
      float x=event.getX();
      x=(x < ball.xIni) ? ball.xIni : x;
      x=(x > ball.xFin) ? ball.xFin : x;
      if (x > ball.xCen) {
        check=true;
      }
 else {
        check=false;
      }
      ViewHelper.setX(ball,x);
      ball.changeBackground();
      if ((event.getX() <= getWidth() && event.getX() >= 0)) {
        isLastTouch=false;
        press=false;
      }
    }
 else     if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) {
      press=false;
      isLastTouch=false;
      if (eventCheck != check) {
        eventCheck=check;
        if (onCheckListener != null)         onCheckListener.onCheck(check);
      }
      if ((event.getX() <= getWidth() && event.getX() >= 0)) {
        ball.animateCheck();
      }
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(MotionEvent event){
  if (isEnabled()) {
    isLastTouch=true;
    if (event.getAction() == MotionEvent.ACTION_DOWN) {
      press=true;
    }
 else     if (event.getAction() == MotionEvent.ACTION_MOVE) {
      float x=event.getX();
      x=(x < ball.xIni) ? ball.xIni : x;
      x=(x > ball.xFin) ? ball.xFin : x;
      if (x > ball.xCen) {
        eventCheck=true;
      }
 else {
        eventCheck=false;
      }
      ViewHelper.setX(ball,x);
      ball.changeBackground();
      if ((event.getX() <= getWidth() && event.getX() >= 0)) {
        isLastTouch=false;
        press=false;
      }
    }
 else     if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) {
      press=false;
      isLastTouch=false;
      if (eventCheck != check) {
        check=eventCheck;
        if (onCheckListener != null)         onCheckListener.onCheck(check);
      }
      if ((event.getX() <= getWidth() && event.getX() >= 0)) {
        ball.animateCheck();
      }
    }
  }
  return true;
}