nus-yam/ex-repair huggingface dataset:
Program: 187085
Project: 187085
Buggy source:
private int getMethodId(MethodInfo methodInfo){
  return methodInfo.getCodeAddress();
}

Fixed version (ground truth):
private int getMethodId(MethodInfo methodInfo){
  return MethodTable.getMethodId(methodInfo);
}
Program: 187086
Project: 187086
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: 187087
Project: 187087
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: 187088
Project: 187088
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: 187091
Project: 187091
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: 187093
Project: 187093
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: 187096
Project: 187096
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: 187097
Project: 187097
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: 187101
Project: 187101
Buggy source:
public EXIFIFDPointer(){
  super("String_Node_Str",TAG_EXIF_IFD_POINTER,1 << TIFFTag.TIFF_LONG,EXIFTIFFTagSet.getInstance());
}

Fixed version (ground truth):
public EXIFIFDPointer(){
  super("String_Node_Str",TAG_EXIF_IFD_POINTER,1 << TIFFTag.TIFF_LONG | 1 << TIFFTag.TIFF_IFD_POINTER,EXIFTIFFTagSet.getInstance());
}
Program: 187102
Project: 187102
Buggy source:
/** 
 * Constructs a <code>TIFFTagSet</code>, given a <code>List</code> of <code>TIFFTag</code> objects.
 * @param tags a <code>List</code> object containing<code>TIFFTag</code> objects to be added to this tag set.
 * @throws IllegalArgumentException if <code>tags</code> is<code>null</code>, or contains objects that are not instances of the <code>TIFFTag</code> class.
 */
public TIFFTagSet(List tags){
  if (tags == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Iterator iter=tags.iterator();
  while (iter.hasNext()) {
    Object o=iter.next();
    if (!(o instanceof TIFFTag)) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    TIFFTag tag=(TIFFTag)o;
    allowedTagsByNumber.put(new Integer(tag.getNumber()),tag);
    allowedTagsByName.put(tag.getName(),tag);
  }
}

Fixed version (ground truth):
/** 
 * Constructs a <code>TIFFTagSet</code>, given a <code>List</code> of <code>TIFFTag</code> objects.
 * @param tags a <code>List</code> object containing<code>TIFFTag</code> objects to be added to this tag set.
 * @throws IllegalArgumentException if <code>tags</code> is<code>null</code>, or contains objects that are not instances of the <code>TIFFTag</code> class.
 */
public TIFFTagSet(List tags){
  if (tags == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Iterator iter=tags.iterator();
  while (iter.hasNext()) {
    Object o=iter.next();
    if (!(o instanceof TIFFTag)) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    TIFFTag tag=(TIFFTag)o;
    allowedTagsByNumber.put(Integer.valueOf(tag.getNumber()),tag);
    allowedTagsByName.put(tag.getName(),tag);
  }
}
Program: 187103
Project: 187103
Buggy source:
@Test public void readFromFileDirect() throws IOException {
  final File file=TestData.file(this,"String_Node_Str");
  final ImageReadParam param=new ImageReadParam();
  param.setSourceRegion(new Rectangle(0,0,2,2));
  final TIFFImageReader reader=(TIFFImageReader)new TIFFImageReaderSpi().createReaderInstance();
  reader.setInput(new FileImageInputStream(file));
  BufferedImage image=reader.read(0,param);
  Assert.assertEquals(2,image.getWidth());
  Assert.assertEquals(2,image.getHeight());
  image.flush();
  image=null;
  image=reader.read(1,param);
  Assert.assertEquals(2,image.getWidth());
  Assert.assertEquals(2,image.getHeight());
  image.flush();
  image=null;
  image=reader.read(2,param);
  Assert.assertEquals(2,image.getWidth());
  Assert.assertEquals(2,image.getHeight());
  image.flush();
  image=null;
  image=reader.read(1,param);
  Assert.assertEquals(2,image.getWidth());
  Assert.assertEquals(2,image.getHeight());
  image.flush();
  image=null;
  image=reader.read(3,param);
  Assert.assertEquals(2,image.getWidth());
  Assert.assertEquals(2,image.getHeight());
  image.flush();
  image=null;
  image=reader.read(0,param);
  Assert.assertEquals(2,image.getWidth());
  Assert.assertEquals(2,image.getHeight());
  image.flush();
  image=null;
  reader.dispose();
}

Fixed version (ground truth):
@Test public void readFromFileDirect() throws IOException {
  final File file=TestData.file(this,"String_Node_Str");
  final ImageReadParam param=new ImageReadParam();
  param.setSourceRegion(new Rectangle(0,0,2,2));
  final TIFFImageReader reader=(TIFFImageReader)new TIFFImageReaderSpi().createReaderInstance();
  FileImageInputStream inputStream=new FileImageInputStream(file);
  try {
    reader.setInput(inputStream);
    BufferedImage image=reader.read(0,param);
    Assert.assertEquals(2,image.getWidth());
    Assert.assertEquals(2,image.getHeight());
    image.flush();
    image=null;
    image=reader.read(1,param);
    Assert.assertEquals(2,image.getWidth());
    Assert.assertEquals(2,image.getHeight());
    image.flush();
    image=null;
    image=reader.read(2,param);
    Assert.assertEquals(2,image.getWidth());
    Assert.assertEquals(2,image.getHeight());
    image.flush();
    image=null;
    image=reader.read(1,param);
    Assert.assertEquals(2,image.getWidth());
    Assert.assertEquals(2,image.getHeight());
    image.flush();
    image=null;
    image=reader.read(3,param);
    Assert.assertEquals(2,image.getWidth());
    Assert.assertEquals(2,image.getHeight());
    image.flush();
    image=null;
    image=reader.read(0,param);
    Assert.assertEquals(2,image.getWidth());
    Assert.assertEquals(2,image.getHeight());
    image.flush();
    image=null;
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,e.getMessage(),e);
  }
 finally {
    if (inputStream != null) {
      inputStream.flush();
      inputStream.close();
    }
    if (reader != null) {
      reader.dispose();
    }
  }
}
Program: 187107
Project: 187107
Buggy source:
/** 
 * This is a small utility method used to build an ImageInputStream from a URL.
 * @param url URL to be used in order to build an ImageInputStream.
 * @return The built ImageInputStream.
 * @throws IOException In case an IOError occurs.
 * @throws UnsupportedEncodingException In case hte URL is encoded with an unsupported encoding.
 * @throws FileNotFoundException In case the url points to a file but the provided path is invalid.
 */
static ImageInputStream checkURL(final URL url) throws FileNotFoundException, UnsupportedEncodingException, IOException {
  ensureNotNull("String_Node_Str",url);
  final String protocol=url.getProtocol();
  if (protocol.equalsIgnoreCase("String_Node_Str"))   return new FileImageInputStream(new File(URLDecoder.decode(url.getFile(),"String_Node_Str")));
 else   if (protocol.equalsIgnoreCase("String_Node_Str"))   return new MemoryCacheImageInputStream(url.openStream());
  return null;
}

Fixed version (ground truth):
/** 
 * This is a small utility method used to build an ImageInputStream from a URL.
 * @param url URL to be used in order to build an ImageInputStream.
 * @return The built ImageInputStream.
 * @throws IOException In case an IOError occurs.
 * @throws UnsupportedEncodingException In case hte URL is encoded with an unsupported encoding.
 * @throws FileNotFoundException In case the url points to a file but the provided path is invalid.
 */
static ImageInputStream checkURL(final URL url) throws FileNotFoundException, UnsupportedEncodingException, IOException {
  ensureNotNull("String_Node_Str",url);
  final String protocol=url.getProtocol();
  if (protocol.equalsIgnoreCase("String_Node_Str"))   return new FileImageInputStream(Utilities.urlToFile(url));
 else   if (protocol.equalsIgnoreCase("String_Node_Str"))   return new MemoryCacheImageInputStream(url.openStream());
  return null;
}
Program: 187109
Project: 187109
Buggy source:
/** 
 * Allows to customize kakadu error management.
 * @param errorManagement
 */
public final static void setKakaduInputErrorManagement(final int errorManagement){
switch (errorManagement) {
case KakaduErrorManagement.FAST:
    gdal.SetConfigOption("String_Node_Str","String_Node_Str");
  break;
case KakaduErrorManagement.FUSSY:
gdal.SetConfigOption("String_Node_Str","String_Node_Str");
break;
case KakaduErrorManagement.RESILIENT:
gdal.SetConfigOption("String_Node_Str","String_Node_Str");
break;
default :
throw new IllegalArgumentException("String_Node_Str" + errorManagement);
}
}

Fixed version (ground truth):
/** 
 * Allows to customize kakadu error management.
 * @param errorManagement
 */
public final static void setKakaduInputErrorManagement(final KakaduErrorManagementType errorManagement){
switch (errorManagement) {
case FAST:
    gdal.SetConfigOption("String_Node_Str","String_Node_Str");
  break;
case FUSSY:
gdal.SetConfigOption("String_Node_Str","String_Node_Str");
break;
case RESILIENT:
gdal.SetConfigOption("String_Node_Str","String_Node_Str");
break;
default :
throw new IllegalArgumentException("String_Node_Str" + errorManagement);
}
}
Program: 187110
Project: 187110
Buggy source:
protected void setUp() throws Exception {
  super.setUp();
}

Fixed version (ground truth):
protected void setUp() throws Exception {
  super.setUp();
  JAI.getDefaultInstance().getTileScheduler().setParallelism(2);
  JAI.getDefaultInstance().getTileScheduler().setPriority(6);
  JAI.getDefaultInstance().getTileScheduler().setPrefetchPriority(2);
  JAI.getDefaultInstance().getTileScheduler().setPrefetchParallelism(1);
  JAI.getDefaultInstance().getTileCache().setMemoryCapacity(64 * 1024 * 1024);
  JAI.getDefaultInstance().getTileCache().setMemoryThreshold(1.0f);
}
Program: 187111
Project: 187111
Buggy source:
public void testBoxInfo() throws IOException {
  File file=new File(fileName);
  if (!file.exists()) {
    file=TestData.file(this,fileName);
  }
  JP2KKakaduImageReader reader=new JP2KKakaduImageReader(new JP2KKakaduImageReaderSpi());
  reader.setInput(file);
  IIOMetadata imageMetadata=reader.getImageMetadata(0);
  IIOMetadata streamMetadata=reader.getStreamMetadata();
  reader.dispose();
  if (TestData.isInteractiveTest()) {
    if (imageMetadata != null)     displayImageIOMetadata(imageMetadata.getAsTree(JP2KImageMetadata.nativeMetadataFormatName));
    if (streamMetadata != null)     displayImageIOMetadata(streamMetadata.getAsTree(JP2KStreamMetadata.nativeMetadataFormatName));
  }
}

Fixed version (ground truth):
public void testBoxInfo() throws IOException {
  if (!runTests)   return;
  File file=new File(fileName);
  if (!file.exists()) {
    file=TestData.file(this,fileName);
  }
  JP2KKakaduImageReader reader=new JP2KKakaduImageReader(new JP2KKakaduImageReaderSpi());
  reader.setInput(file);
  IIOMetadata imageMetadata=reader.getImageMetadata(0);
  IIOMetadata streamMetadata=reader.getStreamMetadata();
  reader.dispose();
  if (TestData.isInteractiveTest()) {
    if (imageMetadata != null)     displayImageIOMetadata(imageMetadata.getAsTree(JP2KImageMetadata.nativeMetadataFormatName));
    if (streamMetadata != null)     displayImageIOMetadata(streamMetadata.getAsTree(JP2KStreamMetadata.nativeMetadataFormatName));
  }
}
Program: 187112
Project: 187112
Buggy source:
public static void main(java.lang.String[] args){
  junit.textui.TestRunner.run(suite());
}

Fixed version (ground truth):
public static void main(java.lang.String[] args){
  if (!runTests)   return;
  junit.textui.TestRunner.run(suite());
}
Program: 187113
Project: 187113
Buggy source:
/** 
 * Test Read without exploiting JAI-ImageIO Tools
 * @throws IOException
 */
public void testManualRead() throws IOException {
  final File file=TestData.file(this,"String_Node_Str");
  JP2KKakaduImageReader reader=new JP2KKakaduImageReader(new JP2KKakaduImageReaderSpi());
  reader.setInput(file);
  ImageReadParam param=new ImageReadParam();
  param.setSourceSubsampling(4,4,0,0);
  RenderedImage image=reader.read(0,param);
  if (TestData.isInteractiveTest())   visualize(image,"String_Node_Str");
 else   assertNotNull(image.getData());
}

Fixed version (ground truth):
/** 
 * Test Read without exploiting JAI-ImageIO Tools
 * @throws IOException
 */
public void testManualRead() throws IOException {
  if (!runTests)   return;
  final File file=TestData.file(this,"String_Node_Str");
  JP2KKakaduImageReader reader=new JP2KKakaduImageReader(new JP2KKakaduImageReaderSpi());
  reader.setInput(file);
  RenderedImage image=reader.read(0);
  if (TestData.isInteractiveTest())   ImageIOUtilities.visualize(image,"String_Node_Str");
 else   assertNotNull(image.getData());
  assertEquals(361,image.getWidth());
  assertEquals(488,image.getHeight());
}
Program: 187114
Project: 187114
Buggy source:
public static void main(java.lang.String[] args){
  junit.textui.TestRunner.run(suite());
}

Fixed version (ground truth):
public static void main(java.lang.String[] args){
  if (!runTests)   return;
  junit.textui.TestRunner.run(suite());
}
Program: 187115
Project: 187115
Buggy source:
public void testJaiReadFromFile() throws IOException {
  final File file=TestData.file(this,"String_Node_Str");
  ImageReadDescriptorMT.register(JAI.getDefaultInstance());
  final ParameterBlockJAI pbjImageRead=new ParameterBlockJAI("String_Node_Str");
  ImageLayout l=new ImageLayout();
  l.setTileHeight(256);
  l.setTileWidth(256);
  ImageReadParam rp=new JP2KKakaduImageReadParam();
  rp.setSourceSubsampling(1,1,0,0);
  pbjImageRead.setParameter("String_Node_Str",rp);
  pbjImageRead.setParameter("String_Node_Str",file);
  pbjImageRead.setParameter("String_Node_Str",0);
  RenderedOp image=JAI.create("String_Node_Str",pbjImageRead,new RenderingHints(JAI.KEY_IMAGE_LAYOUT,l));
  if (TestData.isInteractiveTest())   visualize(image,800,600);
 else   assertNotNull(image.getTiles());
}

Fixed version (ground truth):
public void testJaiReadFromFile() throws IOException {
  if (!runTests)   return;
  final File file=TestData.file(this,"String_Node_Str");
  ImageReadDescriptorMT.register(JAI.getDefaultInstance());
  final ParameterBlockJAI pbjImageRead=new ParameterBlockJAI("String_Node_Str");
  ImageLayout l=new ImageLayout();
  l.setTileHeight(256);
  l.setTileWidth(256);
  ImageReadParam rp=new JP2KKakaduImageReadParam();
  rp.setSourceSubsampling(1,1,0,0);
  pbjImageRead.setParameter("String_Node_Str",rp);
  pbjImageRead.setParameter("String_Node_Str",file);
  pbjImageRead.setParameter("String_Node_Str",0);
  RenderedOp image=JAI.create("String_Node_Str",pbjImageRead,new RenderingHints(JAI.KEY_IMAGE_LAYOUT,l));
  if (TestData.isInteractiveTest())   ImageIOUtilities.visualize(image);
 else   assertNotNull(image.getTiles());
}
Program: 187116
Project: 187116
Buggy source:
/** 
 * Constructs a   {@link FileImageInputStreamExtImpl} that will read from agiven  {@link File}. <p> The eraf contents must not change between the time this object is constructed and the time of the last call to a read method.
 * @param f a  {@link File} to read from.
 * @param bufferSize size of the underlying buffer.
 * @exception NullPointerException if <code>f</code> is <code>null</code>.
 * @exception SecurityException if a security manager exists and does not allow read access to the eraf.
 * @exception FileNotFoundException if <code>f</code> is a directory or cannot be opened for reading for any other reason.
 * @exception IOException if an I/O error occurs.
 */
public FileImageInputStreamExtImpl(File f,int bufferSize) throws FileNotFoundException, IOException {
  if (f == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (!f.exists() || f.isDirectory() || !f.canRead()) {
    final StringBuilder buff=new StringBuilder("String_Node_Str");
    buff.append("String_Node_Str").append(f.exists()).append("String_Node_Str");
    buff.append("String_Node_Str").append(f.isDirectory()).append("String_Node_Str");
    buff.append("String_Node_Str").append(f.canRead()).append("String_Node_Str");
    throw new IllegalArgumentException(buff.toString());
  }
  this.file=f;
  this.eraf=bufferSize <= 0 ? new EnhancedRandomAccessFile(f,"String_Node_Str") : new EnhancedRandomAccessFile(f,"String_Node_Str",bufferSize);
  this.eraf.setByteOrder(ByteOrder.BIG_ENDIAN);
}

Fixed version (ground truth):
/** 
 * Constructs a   {@link FileImageInputStreamExtImpl} that will read from agiven  {@link File}. <p> The eraf contents must not change between the time this object is constructed and the time of the last call to a read method.
 * @param f a  {@link File} to read from.
 * @param bufferSize size of the underlying buffer.
 * @exception NullPointerException if <code>f</code> is <code>null</code>.
 * @exception SecurityException if a security manager exists and does not allow read access to the eraf.
 * @exception FileNotFoundException if <code>f</code> is a directory or cannot be opened for reading for any other reason.
 * @exception IOException if an I/O error occurs.
 */
public FileImageInputStreamExtImpl(File f,int bufferSize) throws FileNotFoundException, IOException {
  if (f == null) {
    throw new NullPointerException("String_Node_Str");
  }
  final StringBuilder buff=new StringBuilder("String_Node_Str");
  if (!f.exists() || f.isDirectory()) {
    buff.append("String_Node_Str").append(f.exists()).append("String_Node_Str");
    buff.append("String_Node_Str").append(f.isDirectory()).append("String_Node_Str");
    throw new FileNotFoundException(buff.toString());
  }
  if (!f.exists() || f.isDirectory() || !f.canRead()) {
    buff.append("String_Node_Str").append(f.canRead()).append("String_Node_Str");
    throw new IOException(buff.toString());
  }
  this.file=f;
  this.eraf=bufferSize <= 0 ? new EnhancedRandomAccessFile(f,"String_Node_Str") : new EnhancedRandomAccessFile(f,"String_Node_Str",bufferSize);
  this.eraf.setByteOrder(ByteOrder.BIG_ENDIAN);
}
Program: 187117
Project: 187117
Buggy source:
/** 
 * Return attribute values as a <code>String</code>.
 * @return a <code>String</code> containing attribute values.
 */
public String getValuesAsString(){
  if (values != null)   return H4DatatypeUtilities.getValuesAsString(datatype,values);
 else   return "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Return attribute values as a <code>String</code>.
 * @return a <code>String</code> containing attribute values.
 */
public String getValuesAsString() throws HDFException {
  return H4DatatypeUtilities.getValuesAsString(datatype,getValues());
}
Program: 187118
Project: 187118
Buggy source:
private H4SDS(H4SDSCollection h4SdsCollection,int index,int identifier) throws HDFException {
  h4SDSCollectionOwner=h4SdsCollection;
  this.index=index;
  this.identifier=identifier;
  isOpened=true;
}

Fixed version (ground truth):
private H4SDS(H4SDSCollection h4SdsCollection,int index,int identifier) throws HDFException {
  h4SDSCollectionOwner=h4SdsCollection;
  this.index=index;
  this.identifier=identifier;
  init();
  isOpened=true;
}
Program: 187119
Project: 187119
Buggy source:
/** 
 * CSonstructor which builds and initialize a <code>H4SDSCollection</code> given an input   {@link H4File}.
 * @param h4file the input  {@link H4File}
 */
public H4SDSCollection(H4File h4file){
  this.h4File=h4file;
  final String filePath=h4file.getFilePath();
  try {
    identifier=HDFLibrary.SDstart(filePath,HDFConstants.DFACC_RDONLY | HDFConstants.DFACC_PARALLEL);
    if (identifier != HDFConstants.FAIL) {
      final int[] sdsFileInfo=new int[2];
      if (HDFLibrary.SDfileinfo(identifier,sdsFileInfo)) {
        numAttributes=sdsFileInfo[1];
        initDecorated();
        final int sdsTotalNum=sdsFileInfo[0];
        sdsList=new ArrayList(sdsTotalNum);
        sdsNamesToIndexes=Collections.synchronizedMap(new HashMap(sdsTotalNum));
        for (int i=0; i < sdsTotalNum; i++) {
          H4SDS candidateSds=H4SDS.buildH4SDS(this,i);
          if (candidateSds != null) {
            sdsList.add(numSDS,candidateSds);
            final String name=candidateSds.getName();
            sdsNamesToIndexes.put(name,new Integer(numSDS));
            numSDS++;
            candidateSds.close();
          }
        }
      }
    }
 else {
    }
  }
 catch (  HDFException e) {
    throw new RuntimeException("String_Node_Str" + h4file.getFilePath(),e);
  }
}

Fixed version (ground truth):
/** 
 * Constructor which builds and initialize a <code>H4SDSCollection</code> given an input   {@link H4File}.
 * @param h4file the input  {@link H4File}
 */
public H4SDSCollection(H4File h4file){
  this.h4File=h4file;
  final String filePath=h4file.getFilePath();
  try {
    identifier=HDFLibrary.SDstart(filePath,HDFConstants.DFACC_RDONLY | HDFConstants.DFACC_PARALLEL);
    if (identifier != HDFConstants.FAIL) {
      final int[] sdsFileInfo=new int[2];
      if (HDFLibrary.SDfileinfo(identifier,sdsFileInfo)) {
        numAttributes=sdsFileInfo[1];
        initDecorated();
        final int sdsTotalNum=sdsFileInfo[0];
        sdsList=new ArrayList(sdsTotalNum);
        sdsNamesToIndexes=Collections.synchronizedMap(new HashMap(sdsTotalNum));
        for (int i=0; i < sdsTotalNum; i++) {
          H4SDS candidateSds=H4SDS.buildH4SDS(this,i);
          if (candidateSds != null) {
            sdsList.add(numSDS,candidateSds);
            final String name=candidateSds.getName();
            sdsNamesToIndexes.put(name,new Integer(numSDS));
            numSDS++;
            candidateSds.close();
          }
        }
      }
    }
 else {
    }
  }
 catch (  HDFException e) {
    throw new RuntimeException("String_Node_Str" + h4file.getFilePath(),e);
  }
}
Program: 187121
Project: 187121
Buggy source:
protected void setUp() throws Exception {
  super.setUp();
}

Fixed version (ground truth):
/** 
 * @see junit.framework.TestCase#setUp()
 */
protected void setUp() throws Exception {
  super.setUp();
}
Program: 187122
Project: 187122
Buggy source:
protected void tearDown() throws Exception {
  super.tearDown();
}

Fixed version (ground truth):
/** 
 * @see junit.framework.TestCase#tearDown()
 */
protected void tearDown() throws Exception {
  super.tearDown();
}
Program: 187125
Project: 187125
Buggy source:
@Override public void onClick(DialogInterface dialog,int which){
  Log.d("String_Node_Str","String_Node_Str" + ((InstanceIndexItem)item).getTitle());
  ((InstanceIndexItem)item).deleteAssociatedFiles(context,true);
  mDataset.remove(position);
  notifyItemRemoved(position);
}

Fixed version (ground truth):
@Override public void onClick(DialogInterface dialog,int which){
  Log.d("String_Node_Str","String_Node_Str" + ((InstanceIndexItem)item).getTitle());
  ((InstanceIndexItem)item).deleteAssociatedFiles(context,true);
  mDataset.remove(safePosition);
  notifyItemRemoved(safePosition);
}
Program: 187126
Project: 187126
Buggy source:
@Override public boolean onLongClick(View v){
  if (item instanceof InstanceIndexItem) {
    new AlertDialog.Builder(context).setTitle("String_Node_Str").setMessage("String_Node_Str" + item.getTitle() + "String_Node_Str"+ sdf.format(new Date(((InstanceIndexItem)item).getStoryCreationDate()))+ "String_Node_Str").setNegativeButton("String_Node_Str",new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int which){
        Log.d("String_Node_Str","String_Node_Str" + ((InstanceIndexItem)item).getTitle());
        ((InstanceIndexItem)item).deleteAssociatedFiles(context,false);
        mDataset.remove(position);
        notifyItemRemoved(position);
      }
    }
).setNeutralButton("String_Node_Str",new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int which){
        Log.d("String_Node_Str","String_Node_Str" + ((InstanceIndexItem)item).getTitle());
        ((InstanceIndexItem)item).deleteAssociatedFiles(context,true);
        mDataset.remove(position);
        notifyItemRemoved(position);
      }
    }
).setPositiveButton("String_Node_Str",null).show();
  }
 else {
    Log.d("String_Node_Str","String_Node_Str");
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onLongClick(View v){
  safePosition=InstanceIndexItemAdapter.this.mDataset.indexOf(item);
  if (item instanceof InstanceIndexItem) {
    new AlertDialog.Builder(context).setTitle("String_Node_Str").setMessage("String_Node_Str" + item.getTitle() + "String_Node_Str"+ sdf.format(new Date(((InstanceIndexItem)item).getStoryCreationDate()))+ "String_Node_Str").setNegativeButton("String_Node_Str",new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int which){
        Log.d("String_Node_Str","String_Node_Str" + ((InstanceIndexItem)item).getTitle());
        ((InstanceIndexItem)item).deleteAssociatedFiles(context,false);
        mDataset.remove(safePosition);
        notifyItemRemoved(safePosition);
      }
    }
).setNeutralButton("String_Node_Str",new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int which){
        Log.d("String_Node_Str","String_Node_Str" + ((InstanceIndexItem)item).getTitle());
        ((InstanceIndexItem)item).deleteAssociatedFiles(context,true);
        mDataset.remove(safePosition);
        notifyItemRemoved(safePosition);
      }
    }
).setPositiveButton("String_Node_Str",null).show();
  }
 else {
    Log.d("String_Node_Str","String_Node_Str");
  }
  return true;
}
Program: 187127
Project: 187127
Buggy source:
public DeleteListener(Context context,BaseIndexItem item,int position){
  this.context=context;
  this.item=item;
  this.position=position;
}

Fixed version (ground truth):
public DeleteListener(Context context,BaseIndexItem item){
  this.context=context;
  this.item=item;
}
Program: 187129
Project: 187129
Buggy source:
public static void launchLiger(Context context,String splId,String instancePath,String splPath){
  if (splId.equals("String_Node_Str")) {
    boolean readyToOpen=DownloadHelper.checkAndDownloadNew(context);
    if (!readyToOpen) {
      Log.d("String_Node_Str","String_Node_Str");
      Toast.makeText(context,"String_Node_Str",Toast.LENGTH_LONG).show();
      return;
    }
  }
  Intent ligerIntent=new Intent(context,MainActivity.class);
  ligerIntent.putExtra(MainActivity.INTENT_KEY_WINDOW_TITLE,context.getString(R.string.app_name));
  String lang=StoryMakerApp.getCurrentLocale().getLanguage();
  ligerIntent.putExtra("String_Node_Str",lang);
  SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
  int pslideduration=Integer.parseInt(settings.getString("String_Node_Str","String_Node_Str"));
  ligerIntent.putExtra("String_Node_Str",pslideduration * 1000);
  if (splId != null && !splId.isEmpty()) {
    ligerIntent.putExtra(MainActivity.INTENT_KEY_STORYPATH_LIBRARY_ID,splId);
  }
 else   if (splPath != null && !splPath.isEmpty()) {
    ligerIntent.putExtra(MainActivity.INTENT_KEY_STORYPATH_LIBRARY_PATH,splPath);
  }
 else   if (instancePath != null && !instancePath.isEmpty()) {
    ligerIntent.putExtra(MainActivity.INTENT_KEY_STORYPATH_INSTANCE_PATH,instancePath);
  }
  context.startActivity(ligerIntent);
}

Fixed version (ground truth):
public static void launchLiger(Context context,String splId,String instancePath,String splPath){
  if ((splId != null) && (splId.equals("String_Node_Str"))) {
    boolean readyToOpen=DownloadHelper.checkAndDownloadNew(context);
    if (!readyToOpen) {
      Log.d("String_Node_Str","String_Node_Str");
      Toast.makeText(context,"String_Node_Str",Toast.LENGTH_LONG).show();
      return;
    }
  }
  Intent ligerIntent=new Intent(context,MainActivity.class);
  ligerIntent.putExtra(MainActivity.INTENT_KEY_WINDOW_TITLE,context.getString(R.string.app_name));
  String lang=StoryMakerApp.getCurrentLocale().getLanguage();
  ligerIntent.putExtra("String_Node_Str",lang);
  SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
  int pslideduration=Integer.parseInt(settings.getString("String_Node_Str","String_Node_Str"));
  ligerIntent.putExtra("String_Node_Str",pslideduration * 1000);
  if (splId != null && !splId.isEmpty()) {
    ligerIntent.putExtra(MainActivity.INTENT_KEY_STORYPATH_LIBRARY_ID,splId);
  }
 else   if (splPath != null && !splPath.isEmpty()) {
    ligerIntent.putExtra(MainActivity.INTENT_KEY_STORYPATH_LIBRARY_PATH,splPath);
  }
 else   if (instancePath != null && !instancePath.isEmpty()) {
    ligerIntent.putExtra(MainActivity.INTENT_KEY_STORYPATH_INSTANCE_PATH,instancePath);
  }
  context.startActivity(ligerIntent);
}
Program: 187130
Project: 187130
Buggy source:
/** 
 * Calculated object level methods 
 */
protected ContentValues getValues(){
  ContentValues values=new ContentValues();
  values.put(StoryMakerDB.Schema.AudioClip.COL_PATH,path);
  values.put(StoryMakerDB.Schema.AudioClip.COL_POSITION_CLIP_ID,positionClipId);
  values.put(StoryMakerDB.Schema.AudioClip.COL_POSITION_INDEX,positionIndex);
  values.put(StoryMakerDB.Schema.AudioClip.COL_VOLUME,volume);
  values.put(StoryMakerDB.Schema.AudioClip.COL_CLIP_SPAN,clipSpan);
  values.put(StoryMakerDB.Schema.AudioClip.COL_TRUNCATE,truncate);
  values.put(StoryMakerDB.Schema.AudioClip.COL_OVERLAP,overlap);
  values.put(StoryMakerDB.Schema.AudioClip.COL_FILL_REPEAT,fillRepeat);
  if (createdAt != null) {
    values.put(StoryMakerDB.Schema.Media.COL_CREATED_AT,createdAt.getTime());
  }
  if (updatedAt != null) {
    values.put(StoryMakerDB.Schema.Media.COL_UPDATED_AT,updatedAt.getTime());
  }
  return values;
}

Fixed version (ground truth):
/** 
 * Calculated object level methods 
 */
protected ContentValues getValues(){
  ContentValues values=new ContentValues();
  values.put(StoryMakerDB.Schema.AudioClip.COL_SCENE_ID,sceneId);
  values.put(StoryMakerDB.Schema.AudioClip.COL_PATH,path);
  values.put(StoryMakerDB.Schema.AudioClip.COL_POSITION_CLIP_ID,positionClipId);
  values.put(StoryMakerDB.Schema.AudioClip.COL_POSITION_INDEX,positionIndex);
  values.put(StoryMakerDB.Schema.AudioClip.COL_VOLUME,volume);
  values.put(StoryMakerDB.Schema.AudioClip.COL_CLIP_SPAN,clipSpan);
  values.put(StoryMakerDB.Schema.AudioClip.COL_TRUNCATE,truncate);
  values.put(StoryMakerDB.Schema.AudioClip.COL_OVERLAP,overlap);
  values.put(StoryMakerDB.Schema.AudioClip.COL_FILL_REPEAT,fillRepeat);
  if (createdAt != null) {
    values.put(StoryMakerDB.Schema.Media.COL_CREATED_AT,createdAt.getTime());
  }
  if (updatedAt != null) {
    values.put(StoryMakerDB.Schema.Media.COL_UPDATED_AT,updatedAt.getTime());
  }
  return values;
}
Program: 187131
Project: 187131
Buggy source:
/** 
 * getters and setters 
 */
public String getPath(){
  return path;
}

Fixed version (ground truth):
public String getPath(){
  return path;
}
Program: 187132
Project: 187132
Buggy source:
@Override public void onTabSelected(ActionBar.Tab tab,android.app.FragmentTransaction ft){
}

Fixed version (ground truth):
@Override public void onTabSelected(ActionBar.Tab tab,android.app.FragmentTransaction ft){
  mViewPager.setCurrentItem(tab.getPosition());
}
Program: 187133
Project: 187133
Buggy source:
@Override public void onTabUnselected(ActionBar.Tab tab,android.app.FragmentTransaction ft){
  mViewPager.setCurrentItem(tab.getPosition());
}

Fixed version (ground truth):
@Override public void onTabUnselected(ActionBar.Tab tab,android.app.FragmentTransaction ft){
}
Program: 187134
Project: 187134
Buggy source:
@Override public void onRemove(Account account){
  authTable.delete(getApplicationContext(),Integer.parseInt(account.getId()));
}

Fixed version (ground truth):
@Override public void onRemove(Account account){
  authTable.delete(getApplicationContext(),account.getId());
}
Program: 187136
Project: 187136
Buggy source:
@Override public void onSuccess(Account account){
  Auth auth=authTable.getAuthDefault(getApplicationContext(),account.getSite());
  if (auth == null) {
    auth=new Auth(getApplicationContext(),-1,account.getName(),account.getSite(),null,null,null,null,null);
    auth.insert();
  }
  auth.setCredentials(account.getCredentials());
  auth.setData(account.getData());
  auth.setUserName(account.getUserName());
  auth.setExpires(null);
  authTable.updateLastLogin(getApplicationContext(),account.getSite(),auth.getUserName());
  auth.update();
}

Fixed version (ground truth):
@Override public void onSuccess(Account account){
  Auth auth=authTable.getAuthDefault(getApplicationContext(),account.getSite());
  if (auth == null) {
    auth=new Auth(getApplicationContext(),-1,account.getName(),account.getSite(),null,null,null,null,null);
    auth.insert();
  }
  account.setId(auth.getId());
  auth.setCredentials(account.getCredentials());
  auth.setData(account.getData());
  auth.setUserName(account.getUserName());
  auth.setExpires(null);
  authTable.updateLastLogin(getApplicationContext(),account.getSite(),auth.getUserName());
  auth.update();
}
Program: 187137
Project: 187137
Buggy source:
public Account convertToAccountObject(){
  return new Account(Integer.toString(this.id),this.name,this.site,this.userName,this.credentials,this.data,this.credentialsExist(),this.credentialsAreValid());
}

Fixed version (ground truth):
public Account convertToAccountObject(){
  return new Account(this.id,this.name,this.site,this.userName,this.credentials,this.data,this.credentialsExist(),this.credentialsAreValid());
}
Program: 187138
Project: 187138
Buggy source:
public Cursor getJobsAsCursor(String type,String site,String spec){
  String selection=StoryMakerDB.Schema.Jobs.COL_PUBLISH_JOB_ID + "String_Node_Str";
  ArrayList<String> selArgs=new ArrayList<String>();
  selArgs.add("String_Node_Str" + id);
  if (Utils.stringNotBlank(type)) {
    selection+="String_Node_Str" + StoryMakerDB.Schema.Jobs.COL_TYPE + "String_Node_Str";
    selArgs.add("String_Node_Str" + type);
  }
 else   if (Utils.stringNotBlank(site)) {
    selection+="String_Node_Str" + StoryMakerDB.Schema.Jobs.COL_SITE + "String_Node_Str";
    selArgs.add("String_Node_Str" + site);
  }
 else   if (Utils.stringNotBlank(spec)) {
    selection+="String_Node_Str" + StoryMakerDB.Schema.Jobs.COL_SPEC + "String_Node_Str";
    selArgs.add("String_Node_Str" + spec);
  }
  String[] selectionArgs=selArgs.toArray(new String[]{});
  if (mDB == null) {
    return context.getContentResolver().query((new JobTable()).getURI(),null,selection,selectionArgs,null);
  }
 else {
    return mDB.query((new JobTable()).getTableName(),null,selection,selectionArgs,null,null,null);
  }
}

Fixed version (ground truth):
public Cursor getJobsAsCursor(String type,String site,String spec){
  String selection=StoryMakerDB.Schema.Jobs.COL_PUBLISH_JOB_ID + "String_Node_Str";
  ArrayList<String> selArgs=new ArrayList<String>();
  selArgs.add("String_Node_Str" + id);
  if (Utils.stringNotBlank(type)) {
    selection+="String_Node_Str" + StoryMakerDB.Schema.Jobs.COL_TYPE + "String_Node_Str";
    selArgs.add("String_Node_Str" + type);
  }
  if (Utils.stringNotBlank(site)) {
    selection+="String_Node_Str" + StoryMakerDB.Schema.Jobs.COL_SITE + "String_Node_Str";
    selArgs.add("String_Node_Str" + site);
  }
  if (Utils.stringNotBlank(spec)) {
    selection+="String_Node_Str" + StoryMakerDB.Schema.Jobs.COL_SPEC + "String_Node_Str";
    selArgs.add("String_Node_Str" + spec);
  }
  String[] selectionArgs=selArgs.toArray(new String[]{});
  if (mDB == null) {
    return context.getContentResolver().query((new JobTable()).getURI(),null,selection,selectionArgs,null);
  }
 else {
    return mDB.query((new JobTable()).getTableName(),null,selection,selectionArgs,null,null,null);
  }
}
Program: 187139
Project: 187139
Buggy source:
@Override public void insert(){
  Cursor cursorDupes=(new MediaTable(mDB)).getAsCursor(context,sceneId,clipIndex);
  if ((cursorDupes.getCount() > 0) && cursorDupes.moveToFirst()) {
    do {
      (new Media(mDB,context,cursorDupes)).delete();
    }
 while (cursorDupes.moveToNext());
  }
  ContentValues values=getValues();
  if (mDB == null) {
    Uri uri=context.getContentResolver().insert(ProjectsProvider.MEDIA_CONTENT_URI,values);
    String lastSegment=uri.getLastPathSegment();
    int newId=Integer.parseInt(lastSegment);
    this.setId(newId);
  }
 else {
    int newId=(int)mDB.insert((new MediaTable(mDB)).getTableName(),null,values);
    this.setId(newId);
  }
  cursorDupes.close();
  super.insert();
}

Fixed version (ground truth):
@Override public void insert(){
  Cursor cursorDupes=(new MediaTable(mDB)).getAsCursor(context,sceneId,clipIndex);
  if ((cursorDupes.getCount() > 0) && cursorDupes.moveToFirst()) {
    do {
      (new Media(mDB,context,cursorDupes)).delete();
    }
 while (cursorDupes.moveToNext());
  }
  ContentValues values=getValues();
  if (mDB == null) {
    Uri uri=context.getContentResolver().insert(ProjectsProvider.MEDIA_CONTENT_URI,values);
    String lastSegment=uri.getLastPathSegment();
    int newId=Integer.parseInt(lastSegment);
    this.setId(newId);
  }
 else {
    int newId=(int)mDB.insert((new MediaTable(mDB)).getTableName(),null,values);
    this.setId(newId);
  }
  cursorDupes.close();
}