nus-yam/ex-repair huggingface dataset:
Program: 6349
Project: 6349
Buggy source:
public void dump(PrintWriter out,ClassInfo strcli,int arrygcinfo){
  int addr=stringTableAddress + startAddress;
  commentary(string,addr,out);
  out.println("String_Node_Str" + (addr + 4) + "String_Node_Str");
  out.println("String_Node_Str" + strcli.methodsAddress + "String_Node_Str");
  out.println("String_Node_Str" + (addr + 5) + "String_Node_Str");
  out.println("String_Node_Str" + string.length() + "String_Node_Str");
  out.println("String_Node_Str" + (addr + 2) + "String_Node_Str");
  byte chrsp[]=string.getBytes();
  out.print("String_Node_Str");
  for (int i=0; i < chrsp.length; i++) {
    out.print(chrsp[i] + "String_Node_Str");
    if ((i & 0x07) == 7) {
      out.println();
      out.print("String_Node_Str");
    }
  }
  out.println();
}

Fixed version (ground truth):
public void dump(PrintWriter out,ClassInfo strcli,int arrygcinfo){
  int addr=stringTableAddress + startAddress;
  commentary(string,addr,out);
  out.println("String_Node_Str" + (addr + 4) + "String_Node_Str");
  out.println("String_Node_Str" + strcli.methodsAddress + "String_Node_Str");
  out.println("String_Node_Str" + (addr + 5) + "String_Node_Str");
  out.println("String_Node_Str" + string.length() + "String_Node_Str");
  out.println("String_Node_Str" + (addr + 2) + "String_Node_Str");
  byte chrsp[]=null;
  try {
    chrsp=string.getBytes("String_Node_Str");
  }
 catch (  java.io.UnsupportedEncodingException e) {
    System.err.println(e);
    System.exit(-1);
  }
  out.print("String_Node_Str");
  for (int i=0; i < chrsp.length; i++) {
    out.print(chrsp[i] + "String_Node_Str");
    if ((i & 0x07) == 7) {
      out.println();
      out.print("String_Node_Str");
    }
  }
  out.println();
}
Program: 6350
Project: 6350
Buggy source:
/** 
 * Scan all thread stacks atomic.
 */
static void getStackRoots(){
  int i, j, cnt;
synchronized (mutex) {
    i=Native.getSP();
    for (j=128; j <= i; ++j) {
      push(Native.rdIntMem(j));
    }
    cnt=RtThreadImpl.getCnt();
    for (i=0; i < cnt; ++i) {
      if (i != RtThreadImpl.getActive()) {
        int[] mem=RtThreadImpl.getStack(i);
        int sp=RtThreadImpl.getSP(i) - 128;
        for (j=0; j <= sp; ++j) {
          push(mem[j]);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Scan all thread stacks atomic.
 */
static void getStackRoots(){
  int i, j, cnt;
synchronized (mutex) {
    i=Native.getSP();
    for (j=Const.STACK_OFF; j <= i; ++j) {
      push(Native.rdIntMem(j));
    }
    cnt=RtThreadImpl.getCnt();
    for (i=0; i < cnt; ++i) {
      if (i != RtThreadImpl.getActive()) {
        int[] mem=RtThreadImpl.getStack(i);
        int sp=RtThreadImpl.getSP(i) - Const.STACK_OFF;
        for (j=0; j <= sp; ++j) {
          push(mem[j]);
        }
      }
    }
  }
}
Program: 6351
Project: 6351
Buggy source:
public static void debug(){
synchronized (monitor) {
    int i, j;
    for (i=cnt - 1; i >= 0; --i) {
      util.Dbg.wr('\n');
      util.Dbg.intVal(ref[i].sp);
      util.Dbg.wr('\n');
      for (j=0; j <= ref[i].sp - 128; ++j) {
        util.Dbg.intVal(ref[i].stack[j]);
      }
      util.Dbg.wr('\n');
      trace(ref[i].stack,ref[i].sp);
    }
  }
}

Fixed version (ground truth):
public static void debug(){
synchronized (monitor) {
    int i, j;
    for (i=cnt - 1; i >= 0; --i) {
      util.Dbg.wr('\n');
      util.Dbg.intVal(ref[i].sp);
      util.Dbg.wr('\n');
      for (j=0; j <= ref[i].sp - Const.STACK_OFF; ++j) {
        util.Dbg.intVal(ref[i].stack[j]);
      }
      util.Dbg.wr('\n');
      trace(ref[i].stack,ref[i].sp);
    }
  }
}
Program: 6352
Project: 6352
Buggy source:
static void trace(int[] stack,int sp){
  int fp, mp, vp, addr, loc, args;
  int val;
  fp=sp - 4;
  while (fp > 128 + 5) {
    mp=stack[fp + 4 - 128];
    vp=stack[fp + 2 - 128];
    val=Native.rdMem(mp);
    addr=val >>> 10;
    util.Dbg.intVal(addr);
    val=Native.rdMem(mp + 1);
    args=val & 0x1f;
    loc=(val >>> 5) & 0x1f;
    fp=vp + args + loc;
  }
}

Fixed version (ground truth):
static void trace(int[] stack,int sp){
  int fp, mp, vp, addr, loc, args;
  int val;
  fp=sp - 4;
  while (fp > Const.STACK_OFF + 5) {
    mp=stack[fp + 4 - Const.STACK_OFF];
    vp=stack[fp + 2 - Const.STACK_OFF];
    val=Native.rdMem(mp);
    addr=val >>> 10;
    util.Dbg.intVal(addr);
    val=Native.rdMem(mp + 1);
    args=val & 0x1f;
    loc=(val >>> 5) & 0x1f;
    fp=vp + args + loc;
  }
}
Program: 6353
Project: 6353
Buggy source:
/** 
 * Read a set of bytes from the stream. Limited from 1 until 4 bytes.
 * @param location
 * @param size
 * @return
 */
private synchronized int readBytes(int location,int size){
  int value;
  int i;
  if ((size < 1) || (size > 4) || (location + size >= buf.length)) {
    throw new ArrayIndexOutOfBoundsException("String_Node_Str" + location);
  }
  value=0;
  for (i=0; i < size; i++) {
    value<<=8;
    value=value | buf[location];
    location++;
  }
  return value;
}

Fixed version (ground truth):
/** 
 * Read a set of bytes from the stream. Limited from 1 until 4 bytes.
 * @param location
 * @param size
 * @return
 */
private synchronized int readBytes(int location,int size){
  int value;
  int i;
  if ((size < 1) || (size > 4) || (location + size > buf.length)) {
    throw new ArrayIndexOutOfBoundsException("String_Node_Str" + location + "String_Node_Str"+ size+ "String_Node_Str");
  }
  value=0;
  for (i=0; i < size; i++) {
    value<<=8;
    value=value | (buf[location] & 0x00ff);
    location++;
  }
  return value;
}
Program: 6354
Project: 6354
Buggy source:
/** 
 * Set the "flags" field.
 * @param value
 */
public synchronized void setFlags(int value){
  arrayOutputStream.overwriteInt(value,FLAGS_INDEX);
}

Fixed version (ground truth):
/** 
 * Set the "flags" field.
 * @param value
 */
public synchronized void setFlags(int value){
  arrayOutputStream.overwriteByte(value,FLAGS_INDEX);
}
Program: 6355
Project: 6355
Buggy source:
/** 
 * Add a method to the table. Return its method ID.
 * @param method
 * @return
 */
public int addMethod(MethodInfo method){
  int methodId=method.getCodeAddress();
  if (isValidIndex(methodId) == false) {
    methodList.setSize(methodId + 1);
  }
  methodList.setElementAt(method,methodId);
  return methodId;
}

Fixed version (ground truth):
/** 
 * Add a method to the table. Return its method ID.
 * @param method
 * @return
 */
public int addMethod(MethodInfo method){
  int methodId=getMethodId(method);
  if (isValidIndex(methodId) == false) {
    methodList.setSize(methodId + 1);
  }
  methodList.setElementAt(method,methodId);
  return methodId;
}
Program: 6356
Project: 6356
Buggy source:
public int getMethodStructPointer(String className,String methodSignature){
  int methodId;
  MethodInfo methodInfo;
  methodInfo=getMethodInfo(className,methodSignature);
  methodId=methodInfo.getStructAddress();
  return methodId;
}

Fixed version (ground truth):
public int getMethodStructPointer(String className,String methodSignature){
  int methodStructPointer;
  MethodInfo methodInfo;
  methodInfo=getMethodInfo(className,methodSignature);
  methodStructPointer=methodInfo.getStructAddress();
  return methodStructPointer;
}
Program: 6357
Project: 6357
Buggy source:
private int getMethodId(MethodInfo methodInfo){
  return methodInfo.getCodeAddress();
}

Fixed version (ground truth):
private int getMethodId(MethodInfo methodInfo){
  return MethodTable.getMethodId(methodInfo);
}
Program: 6358
Project: 6358
Buggy source:
/** 
 * writes data to nand at the address given returns true if error occurred
 */
public boolean writeChunkToNAND(int deviceGenericDevice,int devicenDataBytesPerChunk,int chunkInNAND,byte[] data,int dataIndex,byte[] spare,int spareIndex){
  if (data != null) {
    int column=0, pointer=0, addr0, addr1;
    addr0=(chunkInNAND % 32) & 0x1f;
    addr0=(addr0 & 0x1f) | (((chunkInNAND / 32) << 5) & 0xe0);
    addr1=((chunkInNAND / 32) >>> 3) & 0xff;
    Native.wrMem(pointer,IO_NAND + CLE);
    Native.wrMem(COMMAND_PROGRAM,IO_NAND + CLE);
    Native.wrMem(column,IO_NAND + ALE);
    Native.wrMem(addr0,IO_NAND + ALE);
    Native.wrMem(addr1,IO_NAND + ALE);
    for (int i=0; i < devicenDataBytesPerChunk; i++)     Native.wrMem(data[dataIndex + i],IO_NAND + 0);
    Native.wrMem(COMMAND_PROGRAM_CONFIRM,IO_NAND + CLE);
    waitForNandReady("String_Node_Str");
    if (errorOccurred())     return false;
  }
  if (spare != null) {
    int column=0, pointer=80, addr0, addr1;
    addr0=0;
    addr1=0;
    Native.wrMem(pointer,IO_NAND + CLE);
    Native.wrMem(COMMAND_PROGRAM,IO_NAND + CLE);
    Native.wrMem(column,IO_NAND + ALE);
    Native.wrMem(addr0,IO_NAND + ALE);
    Native.wrMem(addr1,IO_NAND + ALE);
    for (int i=0; i < DebugSettings.SPARE_SERIALIZED_LENGTH; i++)     Native.wrMem(spare[spareIndex + i],IO_NAND + 0);
    Native.wrMem(COMMAND_PROGRAM_CONFIRM,IO_NAND + CLE);
    waitForNandReady("String_Node_Str");
    if (errorOccurred())     return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * writes data to nand at the address given returns true if error occurred
 */
public boolean writeChunkToNAND(int deviceGenericDevice,int devicenDataBytesPerChunk,int chunkInNAND,byte[] data,int dataIndex,byte[] spare,int spareIndex){
  if (data != null) {
    int column=0, pointer=0, addr0, addr1;
    addr0=(chunkInNAND % 32) & 0x1f;
    addr0=(addr0 & 0x1f) | (((chunkInNAND / 32) << 5) & 0xe0);
    addr1=((chunkInNAND / 32) >>> 3) & 0xff;
    Native.wrMem(pointer,IO_NAND + CLE);
    Native.wrMem(COMMAND_PROGRAM,IO_NAND + CLE);
    Native.wrMem(column,IO_NAND + ALE);
    Native.wrMem(addr0,IO_NAND + ALE);
    Native.wrMem(addr1,IO_NAND + ALE);
    for (int i=0; i < devicenDataBytesPerChunk; i++)     Native.wrMem(data[dataIndex + i],IO_NAND + 0);
    Native.wrMem(COMMAND_PROGRAM_CONFIRM,IO_NAND + CLE);
    waitForNandReady("String_Node_Str");
    if (errorOccurred())     return false;
  }
  if (spare != null) {
    int column=0, pointer=80, addr0, addr1;
    addr0=(chunkInNAND % 32) & 0x1f;
    addr0=(addr0 & 0x1f) | (((chunkInNAND / 32) << 5) & 0xe0);
    addr1=((chunkInNAND / 32) >>> 3) & 0xff;
    Native.wrMem(pointer,IO_NAND + CLE);
    Native.wrMem(COMMAND_PROGRAM,IO_NAND + CLE);
    Native.wrMem(column,IO_NAND + ALE);
    Native.wrMem(addr0,IO_NAND + ALE);
    Native.wrMem(addr1,IO_NAND + ALE);
    for (int i=0; i < DebugSettings.SPARE_SERIALIZED_LENGTH; i++)     Native.wrMem(spare[spareIndex + i],IO_NAND + 0);
    Native.wrMem(COMMAND_PROGRAM_CONFIRM,IO_NAND + CLE);
    waitForNandReady("String_Node_Str");
    if (errorOccurred())     return false;
  }
  return true;
}
Program: 6359
Project: 6359
Buggy source:
public boolean eraseBlockInNAND(int deviceGenericDevice,int devicenDataBytesPerChunk,int blockNumber){
  int addr0=(blockNumber & 0x07) << 5;
  int addr1=(blockNumber >>> 3) & 0xff;
  System.out.print("String_Node_Str");
  System.out.println(blockNumber);
  System.out.print("String_Node_Str");
  System.out.println(Integer.toHexString(addr0));
  System.out.print("String_Node_Str");
  System.out.println(Integer.toHexString(addr1));
  Native.wrMem(COMMAND_ERASE,IO_NAND + CLE);
  Native.wrMem(addr0,IO_NAND + ALE);
  Native.wrMem(addr1,IO_NAND + ALE);
  Native.wrMem(COMMAND_ERASE_CONFIRM,IO_NAND + CLE);
  waitForNandReady("String_Node_Str");
  return !errorOccurred();
}

Fixed version (ground truth):
public boolean eraseBlockInNAND(int deviceGenericDevice,int devicenDataBytesPerChunk,int blockNumber){
  int addr0=(blockNumber & 0x07) << 5;
  int addr1=(blockNumber >>> 3) & 0xff;
  Native.wrMem(COMMAND_ERASE,IO_NAND + CLE);
  Native.wrMem(addr0,IO_NAND + ALE);
  Native.wrMem(addr1,IO_NAND + ALE);
  Native.wrMem(COMMAND_ERASE_CONFIRM,IO_NAND + CLE);
  waitForNandReady("String_Node_Str");
  return !errorOccurred();
}
Program: 6360
Project: 6360
Buggy source:
/** 
 * waits until the nand is ready
 */
static int waitForNandReady(String msg){
  int i=0;
  int j;
  while (((j=Native.rdMem(0x100000)) & 0x100) != 0x100) {
    i++;
  }
  System.out.print(msg);
  System.out.println(i);
  return j;
}

Fixed version (ground truth):
/** 
 * waits until the nand is ready
 */
static int waitForNandReady(String msg){
  int i=0;
  int j;
  while (((j=Native.rdMem(0x100000)) & 0x100) != 0x100) {
    i++;
  }
  return j;
}
Program: 6363
Project: 6363
Buggy source:
public void init(InstructionHandle stih,InstructionHandle endih){
  WCETBasicBlock wcbb=new WCETBasicBlock(stih,endih,this,WCETBasicBlock.BNODE);
  S.sucbb=wcbb;
  bbs.put(new Integer(wcbb.getStart()),wcbb);
}

Fixed version (ground truth):
public void init(InstructionHandle stih,InstructionHandle endih){
  WCETBasicBlock wcbb=null;
  if (stih.getInstruction() instanceof InvokeInstruction && (((InvokeInstruction)stih.getInstruction()).getClassName(getCpg())).indexOf("String_Node_Str") == -1) {
    wcbb=new WCETBasicBlock(stih,endih,this,WCETBasicBlock.INODE);
  }
 else {
    wcbb=new WCETBasicBlock(stih,endih,this,WCETBasicBlock.BNODE);
  }
  S.sucbb=wcbb;
  bbs.put(new Integer(wcbb.getStart()),wcbb);
}
Program: 6365
Project: 6365
Buggy source:
public void visitJavaClass(JavaClass clazz){
  super.visitJavaClass(clazz);
  Method[] methods=clazz.getMethods();
  if (wca.init) {
    for (int i=0; i < methods.length; i++) {
      Method m=methods[i];
      String methodId=m.getName() + m.getSignature();
      if (!m.isAbstract()) {
        WCETMethodBlock wcmb=new WCETMethodBlock(m,clazz,wca);
        wca.msigtowcmb.put(methodId,wcmb);
        wca.wcmbs.add(wcmb);
        wcmb.controlFlowGraph();
        wcmb.directedGraph();
        if (m.getName().equalsIgnoreCase("String_Node_Str") || m.getName().equalsIgnoreCase("String_Node_Str")) {
          wca.wcmbapp=wcmb;
        }
      }
 else       System.out.println("String_Node_Str" + m.getName());
    }
  }
  if (wca.analyze) {
    for (int i=0; i < methods.length; i++) {
      Method m=methods[i];
      String methodId=m.getName() + m.getSignature();
      if (!m.isAbstract()) {
        WCETMethodBlock wcmb=(WCETMethodBlock)wca.mtowcmb.get(m);
        wca.wcasb.append(wcmb.toString());
        wcmb.link();
        wca.dotout.print("String_Node_Str" + wcmb.dotf + "String_Node_Str"+ wcmb.dotf.substring(0,wcmb.dotf.length() - 4)+ "String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
public void visitJavaClass(JavaClass clazz){
  super.visitJavaClass(clazz);
  Method[] methods=clazz.getMethods();
  if (wca.init) {
    for (int i=0; i < methods.length; i++) {
      Method m=methods[i];
      String methodId=m.getName() + m.getSignature();
      if (!m.isAbstract()) {
        WCETMethodBlock wcmb=new WCETMethodBlock(m,clazz,wca);
        wca.msigtowcmb.put(methodId,wcmb);
        wca.wcmbs.add(wcmb);
        wcmb.controlFlowGraph();
        wcmb.directedGraph();
        System.out.println("String_Node_Str" + (clazz.getClassName() + "String_Node_Str" + m.getName()) + "String_Node_Str"+ wca.appmethod);
        if ((clazz.getClassName() + "String_Node_Str" + m.getName()).equalsIgnoreCase(wca.appmethod)) {
          wca.wcmbapp=wcmb;
        }
      }
 else       System.out.println("String_Node_Str" + m.getName());
    }
  }
  if (wca.analyze) {
    for (int i=0; i < methods.length; i++) {
      Method m=methods[i];
      String methodId=m.getName() + m.getSignature();
      if (!m.isAbstract()) {
        WCETMethodBlock wcmb=(WCETMethodBlock)wca.mtowcmb.get(m);
        wca.wcasb.append(wcmb.toString());
        wcmb.link();
        wca.dotout.print("String_Node_Str" + wcmb.dotf + "String_Node_Str"+ wcmb.dotf.substring(0,wcmb.dotf.length() - 4)+ "String_Node_Str");
      }
    }
  }
}
Program: 6368
Project: 6368
Buggy source:
/** 
 * Fill in the destination MAC address. If not in the cache use this packet for a ARP request. The IP packet get's lost.
 * @param p
 */
static void fillETH(Packet p){
  Entry e=Entry.find(p.buf[4]);
  if (e == null) {
    sendRequest(p);
  }
 else {
    int[] mac=e.mac;
    p.llh[0]=mac[0] << 8 | mac[1];
    p.llh[1]=mac[2] << 8 | mac[3];
    p.llh[2]=mac[4] << 8 | mac[5];
    p.llh[6]=0x0800;
  }
}

Fixed version (ground truth):
/** 
 * Fill in the destination MAC address. If not in the cache use this packet for a ARP request. The IP packet get's lost.
 * @param p
 */
static void fillETH(Packet p){
  Entry e=Entry.find(p.buf[4]);
  if (p.llh[6] == 0x0806)   e=Entry.find(p.buf[6]);
  if (e == null) {
    sendRequest(p);
  }
 else {
    int[] mac=e.mac;
    p.llh[0]=mac[0] << 8 | mac[1];
    p.llh[1]=mac[2] << 8 | mac[3];
    p.llh[2]=mac[4] << 8 | mac[5];
  }
}
Program: 6369
Project: 6369
Buggy source:
/** 
 * very simple generation of IP header. just swap source and destination.
 */
private static void doIp(Packet p,int prot){
  int[] buf=p.buf;
  int len=p.len;
  int i;
  if (len == 0) {
    p.setStatus(Packet.FREE);
  }
 else {
    buf[0]=0x45000000 + len;
    buf[1]=getId();
    buf[2]=(0x20 << 24) + (prot << 16);
    i=buf[3];
    buf[3]=buf[4];
    buf[4]=i;
    buf[2]|=chkSum(buf,0,20);
    p.setStatus(Packet.SND);
  }
}

Fixed version (ground truth):
/** 
 * very simple generation of IP header. just swap source and destination.
 */
private static void doIp(Packet p,int prot){
  int[] buf=p.buf;
  int len=p.len;
  int i;
  if (len == 0) {
    p.setStatus(Packet.FREE);
  }
 else {
    buf[0]=0x45000000 + len;
    buf[1]=getId();
    buf[2]=(0x20 << 24) + (prot << 16);
    i=buf[3];
    buf[3]=buf[4];
    buf[4]=i;
    buf[2]|=chkSum(buf,0,20);
    p.llh[6]=0x0800;
    p.setStatus(Packet.SND);
  }
}
Program: 6373
Project: 6373
Buggy source:
/** 
 * Reads the next three-byte integer from the byte stream.
 * @return The next three-byte integer.
 */
public INT24 readInt24(){
  if (bytePosition * 8 + bitPosition + 24 > data.length * 8) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (bitPosition != 0) {
    throw new IllegalStateException("String_Node_Str");
  }
  final int firstByte=readByte() & 0xFF;
  final int secondByte=readByte() & 0xFF;
  final int thirdByte=readByte() & 0xFF;
  return new INT24(8 * bytePosition + bitPosition - 24,thirdByte << 16 | secondByte << 8 | firstByte);
}

Fixed version (ground truth):
/** 
 * Reads the next three-byte integer from the byte stream.
 * @return The next three-byte integer.
 */
public INT24 readInt24(){
  if (bytePosition * 8 + bitPosition + 24 > data.length * 8) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (bitPosition != 0) {
    throw new IllegalStateException("String_Node_Str");
  }
  final int firstByte=readByte() & 0xFF;
  final int secondByte=readByte() & 0xFF;
  final int thirdByte=readByte() & 0xFF;
  int value=thirdByte << 16 | secondByte << 8 | firstByte;
  if (value > 0x7FFFFF) {
    value=value - 0x1000000;
  }
  return new INT24(8 * bytePosition + bitPosition - 24,value);
}
Program: 6374
Project: 6374
Buggy source:
@Check public void checkRefsExceptionInMatchingState(ExceptionRef exRef){
  EObject owner=objLookup.getVersionedOwner(exRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  if (owner != null && stateRes.definesState(owner)) {
    if (!referencedStateChecker.stateMatches(exRef.getException().getState(),owner))     error("String_Node_Str",ServiceDslPackage.Literals.EXCEPTION_REF__EXCEPTION);
  }
}

Fixed version (ground truth):
@Check public void checkRefsExceptionInMatchingState(ExceptionRef exRef){
  EObject owner=objLookup.getStatefulOwner(exRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  if (owner != null && stateRes.definesState(owner)) {
    if (!referencedStateChecker.stateMatches(exRef.getException().getState(),owner))     error("String_Node_Str",ServiceDslPackage.Literals.EXCEPTION_REF__EXCEPTION);
  }
}
Program: 6375
Project: 6375
Buggy source:
@Check(CheckType.NORMAL) public void checkNotRefsLowerStateBO(VersionedTypeRef boRef){
  EObject owner=objLookup.getVersionedOwner(boRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  LifecycleState ownerState=stateRes.getLifecycleState(owner);
  if (owner != null) {
    if (stateComparator.compare(ownerState,boRef.getType().getState()) > 0 && !(ownerState != null && ownerState.isIsEnd()))     warning("String_Node_Str" + getObjectTypeName(boRef.getType()) + "String_Node_Str",ServiceDslPackage.Literals.VERSIONED_TYPE_REF__TYPE);
  }
}

Fixed version (ground truth):
@Check(CheckType.NORMAL) public void checkNotRefsLowerStateBO(VersionedTypeRef boRef){
  EObject owner=objLookup.getStatefulOwner(boRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  LifecycleState ownerState=stateRes.getLifecycleState(owner);
  if (owner != null) {
    if (stateComparator.compare(ownerState,boRef.getType().getState()) > 0 && !(ownerState != null && ownerState.isIsEnd()))     warning("String_Node_Str" + getObjectTypeName(boRef.getType()) + "String_Node_Str",ServiceDslPackage.Literals.VERSIONED_TYPE_REF__TYPE);
  }
}
Program: 6376
Project: 6376
Buggy source:
@Check(CheckType.NORMAL) public void checkNotRefsLowerStateException(ExceptionRef exRef){
  EObject owner=objLookup.getVersionedOwner(exRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  LifecycleState ownerState=stateRes.getLifecycleState(owner);
  if (owner != null && stateRes.definesState(owner)) {
    if (stateComparator.compare(ownerState,exRef.getException().getState()) > 0 && !(ownerState != null && ownerState.isIsEnd()))     warning("String_Node_Str",ServiceDslPackage.Literals.EXCEPTION_REF__EXCEPTION);
  }
}

Fixed version (ground truth):
@Check(CheckType.NORMAL) public void checkNotRefsLowerStateException(ExceptionRef exRef){
  EObject owner=objLookup.getStatefulOwner(exRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  LifecycleState ownerState=stateRes.getLifecycleState(owner);
  if (owner != null && stateRes.definesState(owner)) {
    if (stateComparator.compare(ownerState,exRef.getException().getState()) > 0 && !(ownerState != null && ownerState.isIsEnd()))     warning("String_Node_Str",ServiceDslPackage.Literals.EXCEPTION_REF__EXCEPTION);
  }
}
Program: 6377
Project: 6377
Buggy source:
@Check public void checkDoesNotRefRetiredBO(BusinessObjectRef boRef){
  EObject owner=objLookup.getVersionedOwner(boRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  LifecycleState ownerState=stateRes.getLifecycleState(owner);
  if (owner != null && stateRes.definesState(owner) && ownerState.isIsEnd() && boRef.getType().getState() != null && boRef.getType().getState().isIsEnd())   error("String_Node_Str" + ownerState.getName() + "String_Node_Str",ServiceDslPackage.Literals.BUSINESS_OBJECT_REF__TYPE);
}

Fixed version (ground truth):
@Check public void checkDoesNotRefRetiredBO(BusinessObjectRef boRef){
  EObject owner=objLookup.getStatefulOwner(boRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  LifecycleState ownerState=stateRes.getLifecycleState(owner);
  if (owner != null && stateRes.definesState(owner) && ownerState.isIsEnd() && boRef.getType().getState() != null && boRef.getType().getState().isIsEnd())   error("String_Node_Str" + ownerState.getName() + "String_Node_Str",ServiceDslPackage.Literals.BUSINESS_OBJECT_REF__TYPE);
}
Program: 6378
Project: 6378
Buggy source:
@Check public void checkDoesNotRefRetiredService(ServiceRef svcRef){
  EObject owner=objLookup.getVersionedOwner(svcRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  LifecycleState ownerState=stateRes.getLifecycleState(owner);
  if (owner != null && stateRes.definesState(owner) && ownerState.isIsEnd() && svcRef.getService().getState() != null && svcRef.getService().getState().isIsEnd())   error("String_Node_Str" + ownerState.getName() + "String_Node_Str",ServiceDslPackage.Literals.SERVICE_REF__SERVICE);
}

Fixed version (ground truth):
@Check public void checkDoesNotRefRetiredService(ServiceRef svcRef){
  EObject owner=objLookup.getStatefulOwner(svcRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  LifecycleState ownerState=stateRes.getLifecycleState(owner);
  if (owner != null && stateRes.definesState(owner) && ownerState.isIsEnd() && svcRef.getService().getState() != null && svcRef.getService().getState().isIsEnd())   error("String_Node_Str" + ownerState.getName() + "String_Node_Str",ServiceDslPackage.Literals.SERVICE_REF__SERVICE);
}
Program: 6379
Project: 6379
Buggy source:
@Check public void checkExDoesNotRefRetiredException(ExceptionRef exRef){
  EObject owner=objLookup.getVersionedOwner(exRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  LifecycleState ownerState=stateRes.getLifecycleState(owner);
  if (owner != null && stateRes.definesState(owner) && ownerState.isIsEnd() && exRef.getException().getState() != null && exRef.getException().getState().isIsEnd())   error("String_Node_Str" + ownerState.getName() + "String_Node_Str",ServiceDslPackage.Literals.EXCEPTION_REF__EXCEPTION);
}

Fixed version (ground truth):
@Check public void checkExDoesNotRefRetiredException(ExceptionRef exRef){
  EObject owner=objLookup.getStatefulOwner(exRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  LifecycleState ownerState=stateRes.getLifecycleState(owner);
  if (owner != null && stateRes.definesState(owner) && ownerState.isIsEnd() && exRef.getException().getState() != null && exRef.getException().getState().isIsEnd())   error("String_Node_Str" + ownerState.getName() + "String_Node_Str",ServiceDslPackage.Literals.EXCEPTION_REF__EXCEPTION);
}
Program: 6380
Project: 6380
Buggy source:
@Check public void checkDoesNotRefRetiredEnumeration(EnumTypeRef enumRef){
  EObject owner=objLookup.getVersionedOwner(enumRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  LifecycleState ownerState=stateRes.getLifecycleState(owner);
  if (owner != null && stateRes.definesState(owner) && ownerState.isIsEnd() && enumRef.getType().getState() != null && enumRef.getType().getState().isIsEnd())   error("String_Node_Str" + ownerState.getName() + "String_Node_Str",ServiceDslPackage.Literals.ENUM_TYPE_REF__TYPE);
}

Fixed version (ground truth):
@Check public void checkDoesNotRefRetiredEnumeration(EnumTypeRef enumRef){
  EObject owner=objLookup.getStatefulOwner(enumRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  LifecycleState ownerState=stateRes.getLifecycleState(owner);
  if (owner != null && stateRes.definesState(owner) && ownerState.isIsEnd() && enumRef.getType().getState() != null && enumRef.getType().getState().isIsEnd())   error("String_Node_Str" + ownerState.getName() + "String_Node_Str",ServiceDslPackage.Literals.ENUM_TYPE_REF__TYPE);
}
Program: 6381
Project: 6381
Buggy source:
@Check public void checkRefsBOInMatchingState(BusinessObjectRef boRef){
  EObject owner=objLookup.getVersionedOwner(boRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  if (owner != null && stateRes.definesState(owner)) {
    if (!referencedStateChecker.stateMatches(((BusinessObject)boRef.getType()).getState(),owner))     error("String_Node_Str",ServiceDslPackage.Literals.BUSINESS_OBJECT_REF__TYPE);
  }
}

Fixed version (ground truth):
@Check public void checkRefsBOInMatchingState(BusinessObjectRef boRef){
  EObject owner=objLookup.getStatefulOwner(boRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  if (owner != null && stateRes.definesState(owner)) {
    if (!referencedStateChecker.stateMatches(((BusinessObject)boRef.getType()).getState(),owner))     error("String_Node_Str",ServiceDslPackage.Literals.BUSINESS_OBJECT_REF__TYPE);
  }
}
Program: 6382
Project: 6382
Buggy source:
@Check(CheckType.NORMAL) public void checkNotRefsLowerStateEnumeration(EnumTypeRef enumRef){
  EObject owner=objLookup.getVersionedOwner(enumRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  LifecycleState ownerState=stateRes.getLifecycleState(owner);
  if (owner != null && stateRes.definesState(owner)) {
    if (stateComparator.compare(ownerState,enumRef.getType().getState()) > 0 && !(ownerState != null && ownerState.isIsEnd()))     warning("String_Node_Str",ServiceDslPackage.Literals.ENUM_TYPE_REF__TYPE);
  }
}

Fixed version (ground truth):
@Check(CheckType.NORMAL) public void checkNotRefsLowerStateEnumeration(EnumTypeRef enumRef){
  EObject owner=objLookup.getStatefulOwner(enumRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  LifecycleState ownerState=stateRes.getLifecycleState(owner);
  if (owner != null && stateRes.definesState(owner)) {
    if (stateComparator.compare(ownerState,enumRef.getType().getState()) > 0 && !(ownerState != null && ownerState.isIsEnd()))     warning("String_Node_Str",ServiceDslPackage.Literals.ENUM_TYPE_REF__TYPE);
  }
}
Program: 6383
Project: 6383
Buggy source:
@Check public void checkRefsServiceInMatchingState(ServiceRef svcRef){
  EObject owner=objLookup.getVersionedOwner(svcRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  if (owner != null && stateRes.definesState(owner)) {
    if (!referencedStateChecker.stateMatches(svcRef.getService().getState(),owner))     error("String_Node_Str",ServiceDslPackage.Literals.SERVICE_REF__SERVICE);
  }
}

Fixed version (ground truth):
@Check public void checkRefsServiceInMatchingState(ServiceRef svcRef){
  EObject owner=objLookup.getStatefulOwner(svcRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  if (owner != null && stateRes.definesState(owner)) {
    if (!referencedStateChecker.stateMatches(svcRef.getService().getState(),owner))     error("String_Node_Str",ServiceDslPackage.Literals.SERVICE_REF__SERVICE);
  }
}
Program: 6384
Project: 6384
Buggy source:
@Check public void checkServiceOpDoesNotRefRetiredException(ExceptionRef exRef){
  EObject owner=objLookup.getVersionedOwner(exRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  LifecycleState ownerState=stateRes.getLifecycleState(owner);
  if (owner != null && stateRes.definesState(owner) && ownerState.isIsEnd() && exRef.getException().getState() != null && exRef.getException().getState().isIsEnd())   error("String_Node_Str" + ownerState.getName() + "String_Node_Str",ServiceDslPackage.Literals.EXCEPTION_REF__EXCEPTION);
}

Fixed version (ground truth):
@Check public void checkServiceOpDoesNotRefRetiredException(ExceptionRef exRef){
  EObject owner=objLookup.getStatefulOwner(exRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  LifecycleState ownerState=stateRes.getLifecycleState(owner);
  if (owner != null && stateRes.definesState(owner) && ownerState.isIsEnd() && exRef.getException().getState() != null && exRef.getException().getState().isIsEnd())   error("String_Node_Str" + ownerState.getName() + "String_Node_Str",ServiceDslPackage.Literals.EXCEPTION_REF__EXCEPTION);
}
Program: 6385
Project: 6385
Buggy source:
@Check public void checkRefsEnumerationInMatchingState(EnumTypeRef enumRef){
  EObject owner=objLookup.getVersionedOwner(enumRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  if (owner != null && stateRes.definesState(owner)) {
    if (!referencedStateChecker.stateMatches(((Enumeration)enumRef.getType()).getState(),owner))     error("String_Node_Str",ServiceDslPackage.Literals.ENUM_TYPE_REF__TYPE);
  }
}

Fixed version (ground truth):
@Check public void checkRefsEnumerationInMatchingState(EnumTypeRef enumRef){
  EObject owner=objLookup.getStatefulOwner(enumRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  if (owner != null && stateRes.definesState(owner)) {
    if (!referencedStateChecker.stateMatches(((Enumeration)enumRef.getType()).getState(),owner))     error("String_Node_Str",ServiceDslPackage.Literals.ENUM_TYPE_REF__TYPE);
  }
}
Program: 6386
Project: 6386
Buggy source:
@Check(CheckType.NORMAL) public void checkNotRefsLowerStateService(ServiceRef svcRef){
  EObject owner=objLookup.getVersionedOwner(svcRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  LifecycleState ownerState=stateRes.getLifecycleState(owner);
  if (owner != null && stateRes.definesState(owner)) {
    if (stateComparator.compare(ownerState,svcRef.getService().getState()) > 0 && !(ownerState != null && ownerState.isIsEnd()))     warning("String_Node_Str",ServiceDslPackage.Literals.SERVICE_REF__SERVICE);
  }
}

Fixed version (ground truth):
@Check(CheckType.NORMAL) public void checkNotRefsLowerStateService(ServiceRef svcRef){
  EObject owner=objLookup.getStatefulOwner(svcRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  LifecycleState ownerState=stateRes.getLifecycleState(owner);
  if (owner != null && stateRes.definesState(owner)) {
    if (stateComparator.compare(ownerState,svcRef.getService().getState()) > 0 && !(ownerState != null && ownerState.isIsEnd()))     warning("String_Node_Str",ServiceDslPackage.Literals.SERVICE_REF__SERVICE);
  }
}
Program: 6387
Project: 6387
Buggy source:
@Check public void checkRefsVersionedTypeInMatchingState(VersionedTypeRef verTypeRef){
  EObject owner=objLookup.getVersionedOwner(verTypeRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  if (owner != null && stateRes.definesState(owner)) {
    if (!referencedStateChecker.stateMatches(verTypeRef.getType().getState(),owner))     error("String_Node_Str" + getObjectTypeName(verTypeRef.getType()) + "String_Node_Str",ServiceDslPackage.Literals.VERSIONED_TYPE_REF__TYPE);
  }
}

Fixed version (ground truth):
@Check public void checkRefsVersionedTypeInMatchingState(VersionedTypeRef verTypeRef){
  EObject owner=objLookup.getStatefulOwner(verTypeRef);
  ILifecycleStateResolver stateRes=new StateAttributeLifecycleStateResolver(owner.eResource().getResourceSet());
  if (owner != null && stateRes.definesState(owner)) {
    if (!referencedStateChecker.stateMatches(verTypeRef.getType().getState(),owner))     error("String_Node_Str" + getObjectTypeName(verTypeRef.getType()) + "String_Node_Str",ServiceDslPackage.Literals.VERSIONED_TYPE_REF__TYPE);
  }
}
Program: 6389
Project: 6389
Buggy source:
public DependencyDescription next(){
  next=successor();
  return next;
}

Fixed version (ground truth):
public DependencyDescription next(){
  DependencyDescription next=successor();
  return next;
}
Program: 6390
Project: 6390
Buggy source:
/** 
 * Find all transitive dependencies of the Property. The dependency graph is build from all properties transitively  referenced via the properties' type references if these have properties themselves, i.e. they are BusinessOobjects 
 * @param prop Property from which to start the traversal of the dependency graph
 * @param includeInheritedProperties
 * @param includeCycleTypes include the BO in the result even if it already was visited. However traversal of this path stops here
 * @return {@link DependencyDescription} keyed with the {@link IEObjectDesription} of the referring property 
 */
public DependencyDescription getTransitiveDependencies(final Property prop,final boolean includeInheritedProperties,final boolean includeCycleTypes,List<IEObjectDescription> visitedDependendies,DependencyDescription referrer){
  TypeRef typeRef=prop.getType();
  if (typeRef instanceof VersionedTypeRef) {
    VersionedTypeRef verTypeRef=(VersionedTypeRef)typeRef;
    VersionedType verType=verTypeRef.getType();
    DependencyDescription depRef=buildDependencyDescription(prop,(BusinessObject)verType,includeInheritedProperties,includeCycleTypes,visitedDependendies,referrer);
    return depRef;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Find all transitive dependencies of the Property. The dependency graph is build from all properties transitively  referenced via the properties' type references if these have properties themselves, i.e. they are BusinessOobjects 
 * @param prop Property from which to start the traversal of the dependency graph
 * @param includeInheritedProperties
 * @param includeCycleTypes include the BO in the result even if it already was visited. However traversal of this path stops here
 * @return {@link DependencyDescription} keyed with the {@link IEObjectDesription} of the referring property 
 */
public DependencyDescription getTransitiveDependencies(final Property prop,final boolean includeInheritedProperties,final boolean includeCycleTypes,List<IEObjectDescription> visitedDependendies,DependencyDescription referrer){
  TypeRef typeRef=prop.getType();
  if (typeRef instanceof VersionedTypeRef) {
    VersionedTypeRef verTypeRef=(VersionedTypeRef)typeRef;
    VersionedType verType=verTypeRef.getType();
    DependencyDescription depRef=buildDependencyDescription(prop,verType,includeInheritedProperties,includeCycleTypes,visitedDependendies,referrer);
    return depRef;
  }
  return null;
}
Program: 6391
Project: 6391
Buggy source:
public boolean apply(IEObjectDescription canditate){
  return depName.equals(canditate.getQualifiedName()) && version.equals(canditate.getUserData(VersionedResourceDescriptionStrategy.VERSION_KEY));
}

Fixed version (ground truth):
public boolean apply(IEObjectDescription input){
  return BaseDslEqualityHelper.isEqual(input,target);
}
Program: 6392
Project: 6392
Buggy source:
public VersionedType toVersionedType(IEObjectDescription desc,Resource res){
  final QualifiedName depName=desc.getName();
  final String version=desc.getUserData(VersionedResourceDescriptionStrategy.VERSION_KEY);
  Iterable<IEObjectDescription> objDescs=pericateSearch.search(new Predicate<IEObjectDescription>(){
    public boolean apply(    IEObjectDescription canditate){
      return depName.equals(canditate.getQualifiedName()) && version.equals(canditate.getUserData(VersionedResourceDescriptionStrategy.VERSION_KEY));
    }
  }
);
  VersionedType verType=null;
  if (objDescs.iterator().hasNext()) {
    IEObjectDescription objDesc=objDescs.iterator().next();
    EObject o=objDesc.getEObjectOrProxy();
    if (o.eIsProxy())     o=EcoreUtil.resolve(o,res);
    if (o instanceof VersionedType) {
      verType=(VersionedType)o;
    }
  }
  return verType;
}

Fixed version (ground truth):
public VersionedType toVersionedType(IEObjectDescription desc,Resource res){
  VersionedType verType=null;
  EObject o=desc.getEObjectOrProxy();
  if (o.eIsProxy())   o=EcoreUtil.resolve(o,res);
  if (o instanceof VersionedType) {
    verType=(VersionedType)o;
  }
  return verType;
}
Program: 6395
Project: 6395
Buggy source:
private void buildDataSources(NamingContextBuilder builder,DataSource[] dataSources){
  for (  DataSource dataSource : dataSources) {
    boolean xa=false;
    for (    Class<?> intf : ClassUtils.getAllInterfacesForClass(dataSource.driverClass())) {
      if (intf == XADataSource.class) {
        xa=true;
        break;
      }
    }
    javax.sql.DataSource ds;
    if (xa) {
      AtomikosDataSourceBean realDs=new AtomikosDataSourceBean();
      realDs.setXaDataSourceClassName(dataSource.driverClass().getName());
      Properties p=new Properties();
      p.setProperty("String_Node_Str",dataSource.username());
      p.setProperty("String_Node_Str",dataSource.password());
      p.setProperty("String_Node_Str",dataSource.url());
      realDs.setXaProperties(p);
      realDs.setPoolSize(1);
      ds=realDs;
    }
 else {
      AtomikosNonXADataSourceBean realDs=new AtomikosNonXADataSourceBean();
      realDs.setDriverClassName(dataSource.driverClass().getName());
      realDs.setUrl(dataSource.url());
      realDs.setUser(dataSource.username());
      realDs.setPassword(dataSource.password());
      ds=realDs;
    }
    builder.bind(dataSource.name(),ds);
  }
}

Fixed version (ground truth):
private void buildDataSources(NamingContextBuilder builder,DataSource[] dataSources){
  for (  DataSource dataSource : dataSources) {
    boolean xa=false;
    for (    Class<?> intf : ClassUtils.getAllInterfacesForClass(dataSource.driverClass())) {
      if (intf == XADataSource.class) {
        xa=true;
        break;
      }
    }
    javax.sql.DataSource ds;
    if (xa) {
      AtomikosDataSourceBean realDs=new AtomikosDataSourceBean();
      realDs.setXaDataSourceClassName(dataSource.driverClass().getName());
      Properties p=new Properties();
      p.setProperty("String_Node_Str",dataSource.username());
      p.setProperty("String_Node_Str",dataSource.password());
      p.setProperty("String_Node_Str",dataSource.url());
      realDs.setXaProperties(p);
      realDs.setPoolSize(1);
      ds=realDs;
    }
 else {
      AtomikosNonXADataSourceBean realDs=new AtomikosNonXADataSourceBean();
      realDs.setDriverClassName(dataSource.driverClass().getName());
      realDs.setUrl(dataSource.url());
      realDs.setUser(dataSource.username());
      realDs.setPassword(dataSource.password());
      realDs.setUniqueResourceName(dataSource.driverClass().getName());
      ds=realDs;
    }
    builder.bind(dataSource.name(),ds);
  }
}
Program: 6396
Project: 6396
Buggy source:
@Override public void onLoadFinished(final Loader<Cursor> loader,final Cursor data){
  cursorAdapter.swapCursor(data);
}

Fixed version (ground truth):
@Override public void onLoadFinished(final Loader<Cursor> loader,final Cursor data){
  cursorAdapter.swapCursor(data);
synchronized (this) {
    loaded=true;
    for (    Runnable action : actionsOnLoadFinished) {
      action.run();
    }
    actionsOnLoadFinished.clear();
  }
}
Program: 6397
Project: 6397
Buggy source:
@Override public void onLoaderReset(final Loader<Cursor> loader){
  cursorAdapter.swapCursor(null);
}

Fixed version (ground truth):
@Override public void onLoaderReset(final Loader<Cursor> loader){
  cursorAdapter.swapCursor(null);
synchronized (this) {
    loaded=false;
  }
}
Program: 6398
Project: 6398
Buggy source:
private void startEditingItem(final long id){
  if (todoItemsStorage != null) {
    closeDrawer();
    lockDrawer();
    editingItem=todoItemsStorage.loadTodoItem(id);
    getEditSummaryWidget().setText(editingItem.summary);
    getEditBodyWidget().setText(editingItem.body);
    final Spinner spinner=getEditItemTagsWidget();
    final int position=Util.getItemPosition(editingItemTagsAdapter,editingItem.tagID);
    if (position != -1)     spinner.setSelection(position);
    getPrioSliderButton().setSelection(editingItem.prio - 1);
    getProgressSliderButton().setSelection(editingItem.getProgress() / 10);
    updateDueDateButton();
    getSlidingView().setSlideListener(new SlidingView.SlideListener(){
      public void slidingFinished(){
        final EditText editText=getEditBodyWidget();
        if (editingItem.caretPos != null) {
          final Editable text=editText.getText();
          final int savedCaretPos=editingItem.caretPos;
          if (savedCaretPos >= 0 && savedCaretPos < text.length())           Selection.setSelection(text,savedCaretPos);
        }
        editText.requestFocus();
      }
    }
);
  }
}

Fixed version (ground truth):
private void startEditingItem(final long id){
  if (todoItemsStorage != null) {
    closeDrawer();
    lockDrawer();
    editingItem=todoItemsStorage.loadTodoItem(id);
    getEditSummaryWidget().setText(editingItem.summary);
    getEditBodyWidget().setText(editingItem.body);
    editingItemTagsLoaderCallbacks.addOnLoadFinishedAction(new Runnable(){
      @Override public void run(){
        final Spinner spinner=getEditItemTagsWidget();
        final int position=Util.getItemPosition(editingItemTagsAdapter,editingItem.tagID);
        if (position != -1)         spinner.setSelection(position);
 else         Log.w(TAG,"String_Node_Str" + editingItem.tagID);
      }
    }
);
    getPrioSliderButton().setSelection(editingItem.prio - 1);
    getProgressSliderButton().setSelection(editingItem.getProgress() / 10);
    updateDueDateButton();
    getSlidingView().setSlideListener(new SlidingView.SlideListener(){
      public void slidingFinished(){
        final EditText editText=getEditBodyWidget();
        if (editingItem.caretPos != null) {
          final Editable text=editText.getText();
          final int savedCaretPos=editingItem.caretPos;
          if (savedCaretPos >= 0 && savedCaretPos < text.length())           Selection.setSelection(text,savedCaretPos);
        }
        editText.requestFocus();
      }
    }
);
  }
}
Program: 6400
Project: 6400
Buggy source:
@Override public boolean onTouchEvent(final MotionEvent ev){
  if (replaying || (deleteItemListener == null && slideLeftListener == null))   return super.onTouchEvent(ev);
  if (state == State.ITEM_FLYING) {
    if (dragItemNum != pointToPositionWithInvisible((int)(ev.getX()),(int)(ev.getY())))     return true;
  }
  boolean processed=false;
switch (ev.getAction()) {
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
    processed=processUpEvent();
  break;
case MotionEvent.ACTION_DOWN:
if (scrolling) break;
processed=processDownEvent(ev);
break;
case MotionEvent.ACTION_MOVE:
if (scrolling) break;
processed=processMoveEvent(ev);
break;
}
if (processed) {
if (state != State.DRAGGING_ITEM) intercepted.add(MotionEvent.obtain(ev));
return true;
}
 else if (intercepted.size() > 0) {
replaying=true;
try {
for (final MotionEvent event : intercepted) {
super.dispatchTouchEvent(event);
}
return super.onTouchEvent(ev);
}
 catch (Exception e) {
Log.i(TAG,"String_Node_Str" + ev + "String_Node_Str"+ e);
}
 finally {
replaying=false;
intercepted.clear();
}
return true;
}
 else try {
return super.onTouchEvent(ev);
}
 catch (Exception e) {
Log.i(TAG,"String_Node_Str" + ev + "String_Node_Str"+ e);
return true;
}
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(final MotionEvent ev){
  if (replaying || (deleteItemListener == null && slideLeftListener == null))   return super.onTouchEvent(ev);
  if (state == State.ITEM_FLYING) {
    if (dragItemNum != pointToPositionWithInvisible((int)(ev.getX()),(int)(ev.getY())))     return true;
  }
  boolean processed=false;
switch (ev.getAction()) {
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
    processed=processUpEvent();
  break;
case MotionEvent.ACTION_DOWN:
if (scrolling) break;
processed=processDownEvent(ev);
break;
case MotionEvent.ACTION_MOVE:
if (scrolling) break;
processed=processMoveEvent(ev);
break;
}
if (processed) {
return true;
}
 else if (intercepted.size() > 0) {
replaying=true;
try {
for (final MotionEvent event : intercepted) {
super.dispatchTouchEvent(event);
}
return super.onTouchEvent(ev);
}
 catch (Exception e) {
Log.i(TAG,"String_Node_Str" + ev + "String_Node_Str"+ e);
}
 finally {
replaying=false;
intercepted.clear();
}
return true;
}
 else try {
return super.onTouchEvent(ev);
}
 catch (Exception e) {
Log.i(TAG,"String_Node_Str" + ev + "String_Node_Str"+ e);
return true;
}
}