nus-yam/ex-repair huggingface dataset:
Program: 101503
Project: 101503
Buggy source:
private void initIncFile(){
  try {
    File tempIncfile=new File(getExpandedDataPath().getPath() + File.separator + "String_Node_Str");
    if (tempIncfile.exists()) {
      this.incfile=tempIncfile;
    }
  }
 catch (  BookException e) {
    log.error("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
private void initIncFile(){
  try {
    File tempIncfile=new File(getExpandedDataPath().getPath() + File.separator + INCFILE);
    if (tempIncfile.exists()) {
      this.incfile=tempIncfile;
    }
  }
 catch (  BookException e) {
    log.error("String_Node_Str" + e.getMessage());
  }
}
Program: 101504
Project: 101504
Buggy source:
private void createDataFiles() throws IOException, BookException {
  String path=getExpandedDataPath().getPath();
  File otTextFile=new File(path + File.separator + SwordConstants.FILE_OT);
  otTextFile.createNewFile();
  File ntTextFile=new File(path + File.separator + SwordConstants.FILE_NT);
  ntTextFile.createNewFile();
}

Fixed version (ground truth):
private void createDataFiles() throws IOException, BookException {
  String path=getExpandedDataPath().getPath();
  File otTextFile=new File(path + File.separator + SwordConstants.FILE_OT);
  if (!otTextFile.exists() && !otTextFile.createNewFile()) {
    throw new IOException("String_Node_Str");
  }
  File ntTextFile=new File(path + File.separator + SwordConstants.FILE_NT);
  if (!ntTextFile.exists() && !ntTextFile.createNewFile()) {
    throw new IOException("String_Node_Str");
  }
}
Program: 101505
Project: 101505
Buggy source:
private File createDataTextFile(int index) throws BookException, IOException {
  String dataPath=getExpandedDataPath().getPath();
  dataPath+=File.separator + new DecimalFormat("String_Node_Str").format(index);
  File dataFile=new File(dataPath);
  if (!dataFile.createNewFile()) {
    log.info("String_Node_Str" + dataPath);
  }
  return dataFile;
}

Fixed version (ground truth):
private File createDataTextFile(int index) throws BookException, IOException {
  String dataPath=getExpandedDataPath().getPath();
  dataPath+=File.separator + new DecimalFormat("String_Node_Str").format(index);
  File dataFile=new File(dataPath);
  if (!dataFile.exists() && !dataFile.createNewFile()) {
    throw new IOException("String_Node_Str");
  }
  return dataFile;
}
Program: 101506
Project: 101506
Buggy source:
private void createIndexFiles() throws IOException, BookException {
  String path=getExpandedDataPath().getPath();
  File otIndexFile=new File(path + File.separator + SwordConstants.FILE_OT+ SwordConstants.EXTENSION_VSS);
  otIndexFile.createNewFile();
  File ntIndexFile=new File(path + File.separator + SwordConstants.FILE_NT+ SwordConstants.EXTENSION_VSS);
  ntIndexFile.createNewFile();
}

Fixed version (ground truth):
private void createIndexFiles() throws IOException, BookException {
  String path=getExpandedDataPath().getPath();
  File otIndexFile=new File(path + File.separator + SwordConstants.FILE_OT+ SwordConstants.EXTENSION_VSS);
  if (!otIndexFile.exists() && !otIndexFile.createNewFile()) {
    throw new IOException("String_Node_Str");
  }
  File ntIndexFile=new File(path + File.separator + SwordConstants.FILE_NT+ SwordConstants.EXTENSION_VSS);
  if (!ntIndexFile.exists() && !ntIndexFile.createNewFile()) {
    throw new IOException("String_Node_Str");
  }
}
Program: 101507
Project: 101507
Buggy source:
private void createIncfile() throws IOException, BookException {
  File tempIncfile=new File(getExpandedDataPath().getPath() + File.separator + "String_Node_Str");
  tempIncfile.createNewFile();
  this.incfile=tempIncfile;
}

Fixed version (ground truth):
private void createIncfile() throws IOException, BookException {
  File tempIncfile=new File(getExpandedDataPath().getPath() + File.separator + INCFILE);
  if (!tempIncfile.exists() && !tempIncfile.createNewFile()) {
    throw new IOException("String_Node_Str");
  }
  this.incfile=tempIncfile;
}
Program: 101508
Project: 101508
Buggy source:
protected void updateDataFile(int testament,long ordinal) throws IOException {
  StringBuffer buf=new StringBuffer();
  buf.append(new DecimalFormat("String_Node_Str").format(ordinal));
  buf.append("String_Node_Str");
  String fileName=buf.toString();
  BufferedOutputStream bos=new BufferedOutputStream(new FileOutputStream(txtFile[testament],true));
  bos.write(fileName.getBytes());
  bos.close();
}

Fixed version (ground truth):
protected void updateDataFile(int testament,long ordinal) throws IOException {
  StringBuffer buf=new StringBuffer();
  buf.append(new DecimalFormat("String_Node_Str").format(ordinal));
  buf.append("String_Node_Str");
  String fileName=buf.toString();
  BufferedOutputStream bos=null;
  try {
    bos=new BufferedOutputStream(new FileOutputStream(txtFile[testament],true));
    bos.write(fileName.getBytes());
  }
  finally {
    if (bos != null) {
      bos.close();
    }
  }
}
Program: 101509
Project: 101509
Buggy source:
private int readIncfile() throws IOException {
  int ret=-1;
  if (this.incfile != null) {
    FileInputStream fis=null;
    try {
      fis=new FileInputStream(this.incfile);
      byte[] buffer=new byte[4];
      fis.read(buffer);
      ret=SwordUtil.decodeLittleEndian32(buffer,0);
    }
 catch (    FileNotFoundException e) {
      log.error("String_Node_Str");
      log.error(e.getMessage());
    }
 finally {
      fis.close();
    }
  }
  return ret;
}

Fixed version (ground truth):
private int readIncfile() throws IOException {
  int ret=-1;
  if (this.incfile != null) {
    FileInputStream fis=null;
    try {
      fis=new FileInputStream(this.incfile);
      byte[] buffer=new byte[4];
      if (fis.read(buffer) != 4) {
        log.error("String_Node_Str");
        throw new IOException("String_Node_Str");
      }
      ret=SwordUtil.decodeLittleEndian32(buffer,0);
    }
 catch (    FileNotFoundException e) {
      log.error("String_Node_Str");
      log.error(e.getMessage());
    }
 finally {
      if (fis != null) {
        fis.close();
      }
    }
  }
  return ret;
}
Program: 101510
Project: 101510
Buggy source:
private void writeTextDataFile(File dataFile,byte[] textData) throws IOException {
  BufferedOutputStream bos=new BufferedOutputStream(new FileOutputStream(dataFile,false));
  bos.write(textData);
  bos.close();
}

Fixed version (ground truth):
private void writeTextDataFile(File dataFile,byte[] textData) throws IOException {
  BufferedOutputStream bos=null;
  try {
    bos=new BufferedOutputStream(new FileOutputStream(dataFile,false));
    bos.write(textData);
  }
  finally {
    if (bos != null) {
      bos.close();
    }
  }
}
Program: 101511
Project: 101511
Buggy source:
private void prepopulateIndexFiles() throws IOException {
  try {
    File ntIndexFile=idxFile[SwordConstants.TESTAMENT_NEW];
    BufferedOutputStream ntIdxBos=new BufferedOutputStream(new FileOutputStream(ntIndexFile,false));
    File otIndexFile=idxFile[SwordConstants.TESTAMENT_OLD];
    BufferedOutputStream otIdxBos=new BufferedOutputStream(new FileOutputStream(otIndexFile,false));
    for (int i=0; i < BibleInfo.versesInBible(); i++) {
      if ((i + 1) >= SwordConstants.ORDINAL_MAT11) {
        writeInitialIndex(ntIdxBos);
      }
 else {
        writeInitialIndex(otIdxBos);
      }
    }
    ntIdxBos.close();
    otIdxBos.close();
  }
 catch (  FileNotFoundException e) {
    throw new IOException(e.getMessage());
  }
}

Fixed version (ground truth):
private void prepopulateIndexFiles() throws IOException {
  File otIndexFile=idxFile[SwordConstants.TESTAMENT_OLD];
  BufferedOutputStream otIdxBos=new BufferedOutputStream(new FileOutputStream(otIndexFile,false));
  try {
    for (int i=0; i < SwordConstants.ORDINAL_MAT11; i++) {
      writeInitialIndex(otIdxBos);
    }
  }
  finally {
    otIdxBos.close();
  }
  File ntIndexFile=idxFile[SwordConstants.TESTAMENT_NEW];
  BufferedOutputStream ntIdxBos=new BufferedOutputStream(new FileOutputStream(ntIndexFile,false));
  try {
    int totVerses=BibleInfo.versesInBible();
    for (int i=SwordConstants.ORDINAL_MAT11; i < totVerses; i++) {
      writeInitialIndex(ntIdxBos);
    }
  }
  finally {
    ntIdxBos.close();
  }
}
Program: 101513
Project: 101513
Buggy source:
/** 
 * Migrates the user's project dir, if necessary and possible.
 * @param oldPath the path to the old, deprecated location
 * @param newPath the path to the new location
 * @return newPath if the migration was possible or not needed.
 */
private URI migrateUserProjectDir(URI oldPath,URI newPath){
  if (oldPath.toString().equals(newPath.toString())) {
    return newPath;
  }
  if (NetUtil.isDirectory(oldPath)) {
    File oldDir=new File(oldPath.getPath());
    File newDir=new File(newPath.getPath());
    oldDir.renameTo(newDir);
    if (NetUtil.isDirectory(newPath)) {
      return newPath;
    }
    return oldPath;
  }
  return newPath;
}

Fixed version (ground truth):
/** 
 * Migrates the user's project dir, if necessary and possible.
 * @param oldPath the path to the old, deprecated location
 * @param newPath the path to the new location
 * @return newPath if the migration was possible or not needed.
 */
private URI migrateUserProjectDir(URI oldPath,URI newPath){
  if (oldPath.toString().equals(newPath.toString())) {
    return newPath;
  }
  if (NetUtil.isDirectory(oldPath)) {
    File oldDir=new File(oldPath.getPath());
    File newDir=new File(newPath.getPath());
    if (!NetUtil.isDirectory(newPath)) {
      if (oldDir.renameTo(newDir)) {
        return newPath;
      }
      return oldPath;
    }
  }
  return newPath;
}
Program: 101514
Project: 101514
Buggy source:
/** 
 * Unpack a zip file to a given directory. Honor the paths as given in the zip file.
 * @param file The zip file to download
 * @param destdir The directory to unpack up
 * @throws IOException If there is an file error
 */
public static void unpackZip(File file,File destdir) throws IOException {
  byte[] dbuf=new byte[4096];
  ZipFile zf=new ZipFile(file);
  Enumeration entries=zf.entries();
  while (entries.hasMoreElements()) {
    ZipEntry entry=(ZipEntry)entries.nextElement();
    String entrypath=entry.getName();
    File entryFile=new File(destdir,entrypath);
    File parentDir=entryFile.getParentFile();
    if (!parentDir.isDirectory()) {
      parentDir.mkdirs();
      if (!parentDir.isDirectory()) {
        throw new MalformedURLException(UserMsg.CREATE_DIR_FAIL.toString(parentDir.toString()));
      }
    }
    URI child=NetUtil.getURI(entryFile);
    OutputStream dataOut=NetUtil.getOutputStream(child);
    InputStream dataIn=zf.getInputStream(entry);
    while (true) {
      int count=dataIn.read(dbuf);
      if (count == -1) {
        break;
      }
      dataOut.write(dbuf,0,count);
    }
    dataOut.close();
  }
}

Fixed version (ground truth):
/** 
 * Unpack a zip file to a given directory. Honor the paths as given in the zip file.
 * @param file The zip file to download
 * @param destdir The directory to unpack up
 * @throws IOException If there is an file error
 */
public static void unpackZip(File file,File destdir) throws IOException {
  byte[] dbuf=new byte[4096];
  ZipFile zf=new ZipFile(file);
  Enumeration entries=zf.entries();
  while (entries.hasMoreElements()) {
    ZipEntry entry=(ZipEntry)entries.nextElement();
    String entrypath=entry.getName();
    File entryFile=new File(destdir,entrypath);
    File parentDir=entryFile.getParentFile();
    if (!parentDir.isDirectory()) {
      if (!parentDir.mkdirs()) {
        throw new MalformedURLException(UserMsg.CREATE_DIR_FAIL.toString(parentDir.toString()));
      }
    }
    URI child=NetUtil.getURI(entryFile);
    OutputStream dataOut=NetUtil.getOutputStream(child);
    InputStream dataIn=zf.getInputStream(entry);
    while (true) {
      int count=dataIn.read(dbuf);
      if (count == -1) {
        break;
      }
      dataOut.write(dbuf,0,count);
    }
    dataOut.close();
  }
}
Program: 101515
Project: 101515
Buggy source:
/** 
 * If the directory does not exist, create it. Note this currently only works with file: type URIs
 * @param orig The directory URI to create
 */
public static void makeDirectory(URI orig) throws MalformedURLException {
  checkFileURI(orig);
  File file=new File(orig.getPath());
  if (file.isFile()) {
    throw new MalformedURLException(UserMsg.IS_FILE.toString(orig));
  }
  if (!file.isDirectory()) {
    file.mkdirs();
    if (!file.isDirectory()) {
      throw new MalformedURLException(UserMsg.CREATE_DIR_FAIL.toString(orig));
    }
  }
}

Fixed version (ground truth):
/** 
 * If the directory does not exist, create it. Note this currently only works with file: type URIs
 * @param orig The directory URI to create
 */
public static void makeDirectory(URI orig) throws MalformedURLException {
  checkFileURI(orig);
  File file=new File(orig.getPath());
  if (file.isFile()) {
    throw new MalformedURLException(UserMsg.IS_FILE.toString(orig));
  }
  if (!file.isDirectory()) {
    if (!file.mkdirs()) {
      throw new MalformedURLException(UserMsg.CREATE_DIR_FAIL.toString(orig));
    }
  }
}
Program: 101516
Project: 101516
Buggy source:
public void startElement(String uri,String localname,String qname,Attributes attrs) throws SAXException {
  Element ele=null;
  if (stack.size() > 0) {
    Object top=stack.getFirst();
    if (top instanceof Element) {
      ele=(Element)top;
      if (ele == null) {
        return;
      }
    }
  }
  Tag t=getTag(localname,qname);
  if (t != null) {
    stack.addFirst(t.processTag(ele,attrs));
  }
}

Fixed version (ground truth):
public void startElement(String uri,String localname,String qname,Attributes attrs) throws SAXException {
  Element ele=null;
  if (stack.size() > 0) {
    Object top=stack.getFirst();
    if (top == null) {
      return;
    }
    if (top instanceof Element) {
      ele=(Element)top;
    }
  }
  Tag t=getTag(localname,qname);
  if (t != null) {
    stack.addFirst(t.processTag(ele,attrs));
  }
}
Program: 101517
Project: 101517
Buggy source:
private static boolean migrate(File oldPath,File newPath){
  if (oldPath.equals(newPath) || !oldPath.exists()) {
    return true;
  }
  File parent=newPath.getParentFile();
  if (!parent.exists()) {
    parent.mkdirs();
  }
  return oldPath.renameTo(newPath);
}

Fixed version (ground truth):
private static boolean migrate(File oldPath,File newPath){
  if (oldPath.equals(newPath) || !oldPath.exists()) {
    return true;
  }
  File parent=newPath.getParentFile();
  if (!parent.exists() && !parent.mkdirs()) {
    return false;
  }
  return oldPath.renameTo(newPath);
}
Program: 101519
Project: 101519
Buggy source:
public void deleteIndex(Book book) throws BookException {
  File tempPath=null;
  try {
    File storage=NetUtil.getAsFile(getStorageArea(book));
    String finalCanonicalPath=storage.getCanonicalPath();
    tempPath=new File(finalCanonicalPath + '.' + IndexStatus.CREATING.toString());
    FileUtil.delete(tempPath);
    storage.renameTo(tempPath);
    book.setIndexStatus(IndexStatus.UNDONE);
  }
 catch (  IOException ex) {
    throw new BookException(UserMsg.DELETE_FAILED,ex);
  }
  FileUtil.delete(tempPath);
}

Fixed version (ground truth):
public void deleteIndex(Book book) throws BookException {
  File tempPath=null;
  try {
    File storage=NetUtil.getAsFile(getStorageArea(book));
    String finalCanonicalPath=storage.getCanonicalPath();
    tempPath=new File(finalCanonicalPath + '.' + IndexStatus.CREATING.toString());
    FileUtil.delete(tempPath);
    if (!storage.renameTo(tempPath)) {
      throw new BookException(UserMsg.DELETE_FAILED);
    }
    book.setIndexStatus(IndexStatus.UNDONE);
  }
 catch (  IOException ex) {
    throw new BookException(UserMsg.DELETE_FAILED,ex);
  }
  FileUtil.delete(tempPath);
}
Program: 101520
Project: 101520
Buggy source:
public boolean equals(Object obj){
  return list.equals(obj);
}

Fixed version (ground truth):
public boolean equals(Object obj){
  if (obj instanceof SetKeyList) {
    SetKeyList that=(SetKeyList)obj;
    return list.equals(that.list);
  }
  return false;
}
Program: 101521
Project: 101521
Buggy source:
/** 
 * Given the name of a stemmer, use that one.
 * @param language
 */
public void pickStemmer(String language){
  stemmerName=language;
  if (stemmerName != null) {
    stemmerName=book.getLanguage().getName();
    if (!allowedStemmers.matcher(stemmerName).matches()) {
      throw new IllegalArgumentException("String_Node_Str" + stemmerName);
    }
    if (defaultStopWordMap.containsKey(stemmerName)) {
      stopSet=StopFilter.makeStopSet((String[])defaultStopWordMap.get(stemmerName));
    }
  }
}

Fixed version (ground truth):
/** 
 * Given the name of a stemmer, use that one.
 * @param language
 */
public void pickStemmer(String language){
  stemmerName=language;
  if (stemmerName != null) {
    if (!allowedStemmers.matcher(stemmerName).matches()) {
      throw new IllegalArgumentException("String_Node_Str" + stemmerName);
    }
    if (defaultStopWordMap.containsKey(stemmerName)) {
      stopSet=StopFilter.makeStopSet((String[])defaultStopWordMap.get(stemmerName));
    }
  }
}
Program: 101522
Project: 101522
Buggy source:
public boolean incrementToken() throws IOException {
  return super.incrementToken();
}

Fixed version (ground truth):
public boolean incrementToken() throws IOException {
  return input.incrementToken();
}
Program: 101523
Project: 101523
Buggy source:
public boolean incrementToken() throws IOException {
  if (number == null) {
    if (super.incrementToken()) {
      try {
        String tokenText=termAtt.term();
        number=new StrongsNumber(tokenText);
        String s=number.getStrongsNumber();
        if (!s.equals(tokenText)) {
          termAtt.setTermBuffer(s);
          if (!number.isPart()) {
            number=null;
          }
        }
      }
 catch (      BookException e) {
        DataPolice.report(e.getDetailedMessage());
      }
      return true;
    }
    return false;
  }
  termAtt.setTermBuffer(number.getFullStrongsNumber());
  number=null;
  return true;
}

Fixed version (ground truth):
public boolean incrementToken() throws IOException {
  if (number == null) {
    if (input.incrementToken()) {
      try {
        String tokenText=termAtt.term();
        number=new StrongsNumber(tokenText);
        String s=number.getStrongsNumber();
        if (!s.equals(tokenText)) {
          termAtt.setTermBuffer(s);
          if (!number.isPart()) {
            number=null;
          }
        }
      }
 catch (      BookException e) {
        DataPolice.report(e.getDetailedMessage());
      }
      return true;
    }
    return false;
  }
  termAtt.setTermBuffer(number.getFullStrongsNumber());
  number=null;
  return true;
}
Program: 101525
Project: 101525
Buggy source:
public void testMetaData() throws Exception {
  for (int i=0; i < bmds.length; i++) {
    BookMetaData bmd=bmds[i];
    assertTrue(bmd.getInitials() != null);
    assertTrue(bmd.getInitials().length() > 0);
    assertTrue(bmd.getName() != null);
    assertTrue(bmd.getName().length() > 0);
    assertTrue(bmd.getName().length() > bmd.getInitials().length());
  }
}

Fixed version (ground truth):
public void testMetaData() throws Exception {
  for (int i=0; i < bmds.length; i++) {
    BookMetaData bmd=bmds[i];
    assertTrue(bmd.getInitials() != null);
    assertTrue(bmd.getInitials().length() > 0);
    assertTrue(bmd.getName() != null);
    assertTrue(bmd.getName().length() > 0);
  }
}
Program: 101526
Project: 101526
Buggy source:
/** 
 * Read all the books that we can get our hands on.
 */
public static void main(String[] args) throws IOException, JDOMException {
  Logger.outputEverything();
  CWProject.setHome("String_Node_Str","String_Node_Str","String_Node_Str");
  ChoiceFactory.getDataMap().put("String_Node_Str",new String[]{});
  ChoiceFactory.getDataMap().put("String_Node_Str",new String[]{});
  Config config=new Config("String_Node_Str");
  Document xmlconfig=XMLUtil.getDocument("String_Node_Str");
  Locale defaultLocale=Locale.getDefault();
  ResourceBundle configResources=ResourceBundle.getBundle("String_Node_Str",defaultLocale,CWClassLoader.instance(ReadEverything.class));
  config.add(xmlconfig,configResources);
  config.setProperties(ResourceUtil.getProperties("String_Node_Str"));
  config.localToApplication();
  log.warn("String_Node_Str");
  List comments=Books.installed().getBooks();
  for (Iterator cit=comments.iterator(); cit.hasNext(); ) {
    Book book=(Book)cit.next();
    log.warn("String_Node_Str" + book.getInitials());
    Key set=book.getGlobalKeyList();
    testReadMultiple(book,set);
  }
}

Fixed version (ground truth):
/** 
 * Read all the books that we can get our hands on.
 */
public static void main(String[] args){
  Logger.outputEverything();
  log.warn("String_Node_Str");
  List comments=Books.installed().getBooks();
  for (Iterator cit=comments.iterator(); cit.hasNext(); ) {
    Book book=(Book)cit.next();
    if (!book.isLocked()) {
      log.warn("String_Node_Str" + book.getInitials());
      Key set=book.getGlobalKeyList();
      testReadMultiple(book,set);
    }
  }
}
Program: 101527
Project: 101527
Buggy source:
public void testAddConfigEntry(){
  ConfigEntryTable table=new ConfigEntryTable("String_Node_Str");
  assertNotNull(table);
  table.add(ConfigEntryType.LANG,"String_Node_Str");
  assertEquals(table.getValue(ConfigEntryType.LANG),"String_Node_Str");
}

Fixed version (ground truth):
public void testAddConfigEntry(){
  ConfigEntryTable table=new ConfigEntryTable("String_Node_Str");
  assertNotNull(table);
  table.add(ConfigEntryType.LANG,"String_Node_Str");
  assertEquals("String_Node_Str",((Language)table.getValue(ConfigEntryType.LANG)).getCode());
}
Program: 101528
Project: 101528
Buggy source:
public void testSearch(){
  try {
    String result=dwrBridge.search("String_Node_Str","String_Node_Str");
    assertEquals(result,"String_Node_Str");
  }
 catch (  BookException e) {
    fail();
  }
}

Fixed version (ground truth):
public void testSearch(){
  try {
    String result=dwrBridge.search("String_Node_Str","String_Node_Str");
    assertEquals("String_Node_Str",result);
  }
 catch (  BookException e) {
    fail();
  }
}
Program: 101530
Project: 101530
Buggy source:
/** 
 * Determine whether this entry is an alias for another.
 * @return whether this is an alias entry
 */
public boolean isLinkEntry(){
  String linkCheck=SwordUtil.decode(name,data,getKeyEnd() + 1,5,charset);
  return "String_Node_Str".equals(linkCheck);
}

Fixed version (ground truth):
/** 
 * Determine whether this entry is an alias for another.
 * @return whether this is an alias entry
 */
public boolean isLinkEntry(){
  if (data.length >= 5) {
    String linkCheck=SwordUtil.decode(name,data,getKeyEnd() + 1,5,charset);
    return "String_Node_Str".equals(linkCheck);
  }
  return false;
}
Program: 101531
Project: 101531
Buggy source:
/** 
 * Take the data stored permanently and copy it to the local storage area, using the specified stream
 */
public void setProperties(Properties prop){
  Iterator iter=prop.keySet().iterator();
  while (iter.hasNext()) {
    String key=(String)iter.next();
    String value=prop.getProperty(key);
    Choice model=getChoice(key);
    if (value != null && model.isSaveable()) {
      local.put(key,value);
    }
  }
}

Fixed version (ground truth):
/** 
 * Take the data stored permanently and copy it to the local storage area, using the specified stream
 */
public void setProperties(Properties prop){
  Iterator iter=prop.keySet().iterator();
  while (iter.hasNext()) {
    String key=(String)iter.next();
    String value=prop.getProperty(key);
    Choice model=getChoice(key);
    if (value != null && model != null && model.isSaveable()) {
      local.put(key,value);
    }
  }
}
Program: 101532
Project: 101532
Buggy source:
private static void getCanonicalContent(Element parent,String sID,Iterator iter,StringBuffer buffer){
  if (!isCanonical(parent)) {
    return;
  }
  Object data=null;
  Element ele=null;
  String eleName=null;
  String eID=null;
  while (iter.hasNext()) {
    data=iter.next();
    if (data instanceof Element) {
      ele=(Element)data;
      eleName=ele.getName();
      eID=ele.getAttributeValue(OSISUtil.OSIS_ATTR_SID);
      if (eID != null && eID.equals(sID) && eleName.equals(parent.getName())) {
        break;
      }
      OSISUtil.getCanonicalContent(ele,sID,ele.getContent().iterator(),buffer);
    }
 else     if (data instanceof Text) {
      int lastIndex=buffer.length() - 1;
      String text=((Text)data).getText();
      if (lastIndex >= 0 && !Character.isWhitespace(buffer.charAt(lastIndex)) && !Character.isWhitespace(text.charAt(0))) {
        buffer.append(' ');
      }
      buffer.append(text);
    }
  }
}

Fixed version (ground truth):
private static void getCanonicalContent(Element parent,String sID,Iterator iter,StringBuffer buffer){
  if (!isCanonical(parent)) {
    return;
  }
  Object data=null;
  Element ele=null;
  String eleName=null;
  String eID=null;
  while (iter.hasNext()) {
    data=iter.next();
    if (data instanceof Element) {
      ele=(Element)data;
      eleName=ele.getName();
      eID=ele.getAttributeValue(OSISUtil.OSIS_ATTR_SID);
      if (eID != null && eID.equals(sID) && eleName.equals(parent.getName())) {
        break;
      }
      OSISUtil.getCanonicalContent(ele,sID,ele.getContent().iterator(),buffer);
    }
 else     if (data instanceof Text) {
      int lastIndex=buffer.length() - 1;
      String text=((Text)data).getText();
      if (lastIndex >= 0 && !Character.isWhitespace(buffer.charAt(lastIndex)) && (text.length() == 0 || !Character.isWhitespace(text.charAt(0)))) {
        buffer.append(' ');
      }
      buffer.append(text);
    }
  }
}
Program: 101533
Project: 101533
Buggy source:
/** 
 * Singleton classes have private constructors.
 */
private Translations(){
  try {
    Properties props=ResourceUtil.getProperties(getClass());
    translation=props.getProperty(TRANSLATION_KEY,DEFAULT_TRANSLATION);
  }
 catch (  IOException e) {
    translation=DEFAULT_TRANSLATION;
  }
}

Fixed version (ground truth):
/** 
 * Singleton classes have private constructors.
 */
private Translations(){
  try {
    loadSupportedTranslations();
    Locale defaultLocale=Locale.getDefault();
    Properties props=ResourceUtil.getProperties(getClass());
    translation=props.getProperty(TRANSLATION_KEY);
    if (translation == null) {
      for (int i=0; i < translations.length; i++) {
        Locale supportedLocale=new Locale(translations[i]);
        if (supportedLocale.getLanguage().equals(defaultLocale.getLanguage()) && supportedLocale.getCountry().equals(defaultLocale.getCountry())) {
          translation=translations[i];
          return;
        }
      }
      for (int i=0; i < translations.length; i++) {
        Locale supportedLocale=new Locale(translations[i]);
        if (supportedLocale.getLanguage().equals(defaultLocale.getLanguage())) {
          translation=translations[i];
          return;
        }
      }
      translation=DEFAULT_TRANSLATION;
    }
  }
 catch (  IOException e) {
    translation=DEFAULT_TRANSLATION;
  }
}
Program: 101534
Project: 101534
Buggy source:
/** 
 * Given a SwordBookMetaData determine whether this BookType will work for it.
 * @param sbmd the BookMetaData that this BookType works upon
 * @return true if this is a useable BookType
 */
public boolean isSupported(SwordBookMetaData sbmd){
  return type != null && sbmd != null;
}

Fixed version (ground truth):
/** 
 * Given a SwordBookMetaData determine whether this BookType will work for it.
 * @param sbmd the BookMetaData that this BookType works upon
 * @return true if this is a usable BookType
 */
public boolean isSupported(SwordBookMetaData sbmd){
  return type != null && sbmd != null;
}
Program: 101535
Project: 101535
Buggy source:
/** 
 * Find a matching entry, returning it's index. Otherwise return < 0, such that (-pos - 1) gives the insertion index.
 * @param key
 * @return
 * @throws IOException
 */
private int search(String key) throws IOException {
  if (!checkActive()) {
    return -1;
  }
  SwordBookMetaData bmd=getBookMetaData();
  boolean isDailyDevotional=bmd.getBookCategory().equals(BookCategory.DAILY_DEVOTIONS);
  Calendar greg=new GregorianCalendar();
  DateFormatter nameDF=DateFormatter.getDateInstance();
  String target=key.toUpperCase(Locale.US);
  int low=1;
  int high=getCardinality() - 1;
  while (low <= high) {
    int mid=(low + high) >> 1;
    DataEntry entry=getEntry(key,mid);
    String midVal=entry.getKey();
    if (isDailyDevotional && midVal.length() >= 3) {
      String[] spec=StringUtil.splitAll(midVal,'.');
      greg.set(Calendar.MONTH,Integer.parseInt(spec[0]) - 1);
      greg.set(Calendar.DATE,Integer.parseInt(spec[1]));
      midVal=nameDF.format(greg.getTime());
    }
    int cmp=midVal.toUpperCase(Locale.US).compareTo(target);
    if (cmp < 0) {
      low=mid + 1;
    }
 else     if (cmp > 0) {
      high=mid - 1;
    }
 else {
      return mid;
    }
  }
  DataEntry entry=getEntry(key,0);
  String midVal=entry.getKey();
  if (isDailyDevotional && midVal.length() >= 3) {
    String[] spec=StringUtil.splitAll(midVal,'.');
    greg.set(Calendar.MONTH,Integer.parseInt(spec[0]) - 1);
    greg.set(Calendar.DATE,Integer.parseInt(spec[1]));
    midVal=nameDF.format(greg.getTime());
  }
  int cmp=midVal.toUpperCase(Locale.US).compareTo(target);
  if (cmp == 0) {
    return 0;
  }
  return -(low + 1);
}

Fixed version (ground truth):
/** 
 * Find a matching entry, returning it's index. Otherwise return < 0, such that (-pos - 1) gives the insertion index.
 * @param key
 * @return
 * @throws IOException
 */
private int search(String key) throws IOException {
}
Program: 101536
Project: 101536
Buggy source:
public Key get(int index){
  if (checkActive()) {
    try {
      if (index < getCardinality()) {
        DataEntry entry=getEntry(getBookMetaData().getInitials(),index);
        return new DefaultLeafKeyList(entry.getKey());
      }
    }
 catch (    IOException e) {
    }
  }
  throw new ArrayIndexOutOfBoundsException(index);
}

Fixed version (ground truth):
public Key get(int index){
  if (checkActive()) {
    try {
      if (index < getCardinality()) {
        DataEntry entry=getEntry(getBookMetaData().getInitials(),index);
        SwordBookMetaData bmd=getBookMetaData();
        boolean isDailyDevotional=bmd.getBookCategory().equals(BookCategory.DAILY_DEVOTIONS);
        Calendar greg=new GregorianCalendar();
        DateFormatter nameDF=DateFormatter.getDateInstance();
        String keytitle=entry.getKey();
        if (isDailyDevotional && keytitle.length() >= 3) {
          String[] spec=StringUtil.splitAll(keytitle,'.');
          greg.set(Calendar.MONTH,Integer.parseInt(spec[0]) - 1);
          greg.set(Calendar.DATE,Integer.parseInt(spec[1]));
          keytitle=nameDF.format(greg.getTime());
        }
        return new DefaultLeafKeyList(keytitle);
      }
    }
 catch (    IOException e) {
    }
  }
  throw new ArrayIndexOutOfBoundsException(index);
}
Program: 101537
Project: 101537
Buggy source:
private Key getStrongsKey(String txt){
  String text=txt;
  Matcher m=STRONGS_PATTERN.matcher(text);
  if (!m.matches()) {
    return null;
  }
  int pos=text.length() - 1;
  if (Character.isLetter(text.charAt(pos))) {
    text=text.substring(0,pos);
  }
  int strongsNumber=Integer.parseInt(text.substring(1));
  Key key=null;
  String internalName=sbmd.getInitials();
  if ("String_Node_Str".equals(internalName)) {
    key=backend.get(backend.indexOf(new DefaultLeafKeyList(ZERO_PAD.format(strongsNumber))));
  }
 else   if ("String_Node_Str".equals(internalName)) {
    key=backend.get(backend.indexOf(new DefaultLeafKeyList(ZERO_PAD.format(strongsNumber))));
  }
  return key;
}

Fixed version (ground truth):
private Key getStrongsKey(String txt){
  String text=txt;
  Matcher m=STRONGS_PATTERN.matcher(text);
  if (!m.matches()) {
    return null;
  }
  int pos=text.length() - 1;
  if (Character.isLetter(text.charAt(pos))) {
    text=text.substring(0,pos);
  }
  Key key=null;
  String internalName=sbmd.getInitials();
  if ("String_Node_Str".equals(internalName)) {
    int strongsNumber=Integer.parseInt(text.substring(1));
    key=backend.get(backend.indexOf(new DefaultLeafKeyList(ZERO_PAD.format(strongsNumber))));
  }
 else   if ("String_Node_Str".equals(internalName)) {
    int strongsNumber=Integer.parseInt(text.substring(1));
    key=backend.get(backend.indexOf(new DefaultLeafKeyList(ZERO_PAD.format(strongsNumber))));
  }
  return key;
}
Program: 101538
Project: 101538
Buggy source:
/** 
 * Copy this WebResource to the destination.
 * @param dest
 * @throws LucidException
 */
public void copy(URI dest) throws LucidException {
  InputStream in=null;
  OutputStream out=null;
  HttpMethod method=new GetMethod(uri.getPath());
  try {
    if (client.executeMethod(method) == HttpStatus.SC_OK) {
      in=method.getResponseBodyAsStream();
      out=NetUtil.getOutputStream(dest);
      byte[] buf=new byte[4096];
      int count=in.read(buf);
      while (-1 != count) {
        out.write(buf,0,count);
        count=in.read(buf);
      }
    }
  }
 catch (  IOException e) {
    throw new LucidException(UserMsg.MISSING_FILE,e);
  }
 finally {
    method.releaseConnection();
    IOUtil.close(in);
    IOUtil.close(out);
  }
}

Fixed version (ground truth):
/** 
 * Copy this WebResource to the destination.
 * @param dest
 * @throws LucidException
 */
public void copy(URI dest) throws LucidException {
  InputStream in=null;
  OutputStream out=null;
  HttpMethod method=new GetMethod(uri.getPath());
  try {
    int status=client.executeMethod(method);
    if (status == HttpStatus.SC_OK) {
      in=method.getResponseBodyAsStream();
      out=NetUtil.getOutputStream(dest);
      byte[] buf=new byte[4096];
      int count=in.read(buf);
      while (-1 != count) {
        out.write(buf,0,count);
        count=in.read(buf);
      }
    }
 else {
      String reason=HttpStatus.getStatusText(status);
      Reporter.informUser(this,UserMsg.MISSING_FILE,new Object[]{reason + ':' + uri.getPath()});
    }
  }
 catch (  IOException e) {
    throw new LucidException(UserMsg.MISSING_FILE,e,new Object[]{uri.toString()});
  }
 finally {
    method.releaseConnection();
    IOUtil.close(in);
    IOUtil.close(out);
  }
}
Program: 101539
Project: 101539
Buggy source:
protected void download(Progress job,String dir,String file,URI dest) throws InstallException {
}

Fixed version (ground truth):
protected void download(Progress job,String dir,String file,URI dest) throws InstallException {
  URI uri;
  try {
    uri=new URI(NetUtil.PROTOCOL_HTTP,host,dir + '/' + file,null);
  }
 catch (  URISyntaxException e1) {
    throw new InstallException(UserMsg.MISSING_FILE,e1,new Object[]{dir + '/' + file});
  }
  try {
    copy(job,uri,dest);
  }
 catch (  LucidException ex) {
    throw new InstallException(UserMsg.MISSING_FILE,ex,new Object[]{uri.toString()});
  }
}
Program: 101541
Project: 101541
Buggy source:
/** 
 * Find a matching entry, returning it's index. Otherwise return < 0, such that (-pos - 1) gives the insertion index.
 * @param key
 * @return
 * @throws IOException
 */
private int search(String key) throws IOException {
  if (!checkActive()) {
    return -1;
  }
  String target=external2internal(key);
  int total=getCardinality();
  int low=-1;
  int high=total;
  while (high - low > 1) {
    int mid=(low + high) >>> 1;
    if (normalizeForSearch(getEntry(key,mid).getKey()).compareTo(target) < 0) {
      low=mid;
    }
 else {
      high=mid;
    }
  }
  if (high < total && normalizeForSearch(getEntry(key,high).getKey()).compareTo(target) == 0) {
    return high;
  }
  if (normalizeForSearch(getEntry(key,0).getKey()).compareTo(target) == 0) {
    return 0;
  }
  return -(high + 1);
}

Fixed version (ground truth):
/** 
 * Find a matching entry, returning it's index. Otherwise return < 0, such that (-pos - 1) gives the insertion index.
 * @param key
 * @return
 * @throws IOException
 */
private int search(String key) throws IOException {
  if (!checkActive()) {
    return -1;
  }
  String target=external2internal(key);
  int total=getCardinality();
  int low=-1;
  int high=total;
  int match=-1;
  while (high - low > 1) {
    int mid=(low + high) >>> 1;
    int cmp=normalizeForSearch(getEntry(key,mid).getKey()).compareTo(target);
    if (cmp < 0) {
      low=mid;
    }
 else     if (cmp > 0) {
      high=mid;
    }
 else {
      match=mid;
      break;
    }
  }
  if (match >= 0) {
    return match;
  }
  if (normalizeForSearch(getEntry(key,0).getKey()).compareTo(target) == 0) {
    return 0;
  }
  return -(high + 1);
}
Program: 101542
Project: 101542
Buggy source:
/** 
 * Convert the Gregorian Calendar to a string.
 * @param externalKey
 * @return
 */
private String external2internal(String externalKey){
}

Fixed version (ground truth):
/** 
 * Convert the supplied key to something that can be understood by the module.
 * @param externalKey
 * @return the internal representation of the key.
 */
private String external2internal(String externalKey){
}
Program: 101543
Project: 101543
Buggy source:
/** 
 * Find a matching entry, returning it's index. Otherwise return < 0, such that (-pos - 1) gives the insertion index.
 * @param key
 * @return
 * @throws IOException
 */
private int search(String key) throws IOException {
  if (!checkActive()) {
    return -1;
  }
  String target=external2internal(key);
  int total=getCardinality();
  int low=-1;
  int high=total;
  while (high - low > 1) {
    int mid=(low + high) >>> 1;
    if (normalizeForSearch(getEntry(key,mid).getKey()).compareTo(target) < 0) {
      low=mid;
    }
 else {
      high=mid;
    }
  }
  if (high < total && normalizeForSearch(getEntry(key,high).getKey()).compareTo(target) == 0) {
    return high;
  }
  if (normalizeForSearch(getEntry(key,0).getKey()).compareTo(target) == 0) {
    return 0;
  }
  return -(high - 1);
}

Fixed version (ground truth):
/** 
 * Find a matching entry, returning it's index. Otherwise return < 0, such that (-pos - 1) gives the insertion index.
 * @param key
 * @return
 * @throws IOException
 */
private int search(String key) throws IOException {
  if (!checkActive()) {
    return -1;
  }
  String target=external2internal(key);
  int total=getCardinality();
  int low=-1;
  int high=total;
  while (high - low > 1) {
    int mid=(low + high) >>> 1;
    if (normalizeForSearch(getEntry(key,mid).getKey()).compareTo(target) < 0) {
      low=mid;
    }
 else {
      high=mid;
    }
  }
  if (high < total && normalizeForSearch(getEntry(key,high).getKey()).compareTo(target) == 0) {
    return high;
  }
  if (normalizeForSearch(getEntry(key,0).getKey()).compareTo(target) == 0) {
    return 0;
  }
  return -(high + 1);
}
Program: 101544
Project: 101544
Buggy source:
/** 
 * Lookup method to convert from a String
 */
public static OSType fromString(String name){
  for (int i=0; i < VALUES.length; i++) {
    OSType o=VALUES[i];
    if (o.name.startsWith(name)) {
      return o;
    }
  }
  return DEFAULT;
}

Fixed version (ground truth):
/** 
 * Lookup method to convert from a String
 */
public static OSType fromString(String name){
  for (int i=0; i < VALUES.length; i++) {
    OSType o=VALUES[i];
    if (name.startsWith(o.name)) {
      return o;
    }
  }
  return DEFAULT;
}
Program: 101545
Project: 101545
Buggy source:
public boolean requiresRestart(){
  return false;
}

Fixed version (ground truth):
public boolean requiresRestart(){
  return restart;
}
Program: 101546
Project: 101546
Buggy source:
public boolean isSaveable(){
  return true;
}

Fixed version (ground truth):
public boolean isSaveable(){
  return !external;
}
Program: 101547
Project: 101547
Buggy source:
/** 
 * @param newShown Whether this WebWarning should be shown.
 */
public static void setWarningShown(boolean newShown){
  WebWarning.instance().setShown(newShown);
}

Fixed version (ground truth):
/** 
 * From configuration set the state.
 * @param newShown Whether this WebWarning should be shown.
 */
public static void setWarningShown(boolean newShown){
  WebWarning.instance().setShown(newShown);
}
Program: 101548
Project: 101548
Buggy source:
public Element processTag(Element ele,Attributes attrs){
  String typeAttr=attrs.getValue("String_Node_Str");
  if ("String_Node_Str".equals(typeAttr)) {
    Element seg=OSISUtil.factory().createSeg();
    seg.setAttribute(OSISUtil.OSIS_ATTR_TYPE,OSISUtil.VARIANT_TYPE);
    String classAttr=attrs.getValue("String_Node_Str");
    if (classAttr != null) {
      seg.setAttribute(OSISUtil.OSIS_ATTR_SUBTYPE,OSISUtil.VARIANT_CLASS + classAttr);
    }
    if (ele != null) {
      ele.addContent(seg);
    }
    return seg;
  }
  Element div=OSISUtil.factory().createDiv();
  if (ele != null) {
    ele.addContent(div);
  }
  return div;
}

Fixed version (ground truth):
public Element processTag(Element ele,Attributes attrs){
  String typeAttr=attrs.getValue("String_Node_Str");
  if ("String_Node_Str".equals(typeAttr)) {
    Element seg=OSISUtil.factory().createSeg();
    seg.setAttribute(OSISUtil.OSIS_ATTR_TYPE,OSISUtil.VARIANT_TYPE);
    String classAttr=attrs.getValue("String_Node_Str");
    if (classAttr != null) {
      seg.setAttribute(OSISUtil.OSIS_ATTR_SUBTYPE,OSISUtil.VARIANT_CLASS + '-' + classAttr);
    }
    if (ele != null) {
      ele.addContent(seg);
    }
    return seg;
  }
  Element div=OSISUtil.factory().createDiv();
  if (ele != null) {
    ele.addContent(div);
  }
  return div;
}
Program: 101549
Project: 101549
Buggy source:
private static void getCanonicalContent(Element parent,String sID,Iterator iter,StringBuffer buffer){
  if (!isCanonical(parent)) {
    return;
  }
  Object data=null;
  Element ele=null;
  String eleName=null;
  String eID=null;
  while (iter.hasNext()) {
    data=iter.next();
    if (data instanceof Element) {
      ele=(Element)data;
      eleName=ele.getName();
      eID=ele.getAttributeValue(OSISUtil.OSIS_ATTR_SID);
      if (eID != null && eID.equals(sID) && eleName.equals(parent.getName())) {
        break;
      }
      OSISUtil.getCanonicalContent(ele,sID,ele.getContent().iterator(),buffer);
    }
 else     if (data instanceof Text) {
      buffer.append(((Text)data).getText());
    }
  }
}

Fixed version (ground truth):
private static void getCanonicalContent(Element parent,String sID,Iterator iter,StringBuffer buffer){
  if (!isCanonical(parent)) {
    return;
  }
  Object data=null;
  Element ele=null;
  String eleName=null;
  String eID=null;
  while (iter.hasNext()) {
    data=iter.next();
    if (data instanceof Element) {
      ele=(Element)data;
      eleName=ele.getName();
      eID=ele.getAttributeValue(OSISUtil.OSIS_ATTR_SID);
      if (eID != null && eID.equals(sID) && eleName.equals(parent.getName())) {
        break;
      }
      OSISUtil.getCanonicalContent(ele,sID,ele.getContent().iterator(),buffer);
    }
 else     if (data instanceof Text) {
      int lastIndex=buffer.length() - 1;
      String text=((Text)data).getText();
      if (lastIndex >= 0 && !Character.isWhitespace(buffer.charAt(lastIndex)) && !Character.isWhitespace(text.charAt(0))) {
        buffer.append(' ');
      }
      buffer.append(text);
    }
  }
}
Program: 101552
Project: 101552
Buggy source:
/** 
 * Get BookData representing one or more Book entries, but capped to a maximum number of entries.
 * @param bookInitials the book to use
 * @param reference a reference, appropriate for the book, of one or more entries
 * @param maxKeyCount the maximum number of entries to use
 * @throws NoSuchKeyException 
 */
private BookData getBookData(String bookInitials,String reference,int maxKeyCount) throws NoSuchKeyException {
  Book book=BookInstaller.getInstalledBook(bookInitials);
  if (book == null || reference == null || maxKeyCount < 1) {
    return null;
  }
  Key key=null;
  if (BookCategory.BIBLE.equals(book.getBookCategory())) {
    key=book.getKey(reference);
    ((Passage)key).trimVerses(maxKeyCount);
  }
 else   if (BookCategory.GENERAL_BOOK.equals(book.getBookCategory())) {
    key=book.getKey(reference);
  }
 else {
    key=book.createEmptyKeyList();
    Iterator iter=book.getKey(reference).iterator();
    int count=0;
    while (iter.hasNext()) {
      if (++count >= maxKeyCount) {
        break;
      }
      key.addAll((Key)iter.next());
    }
  }
  return new BookData(book,key);
}

Fixed version (ground truth):
/** 
 * Get BookData representing one or more Book entries, but capped to a maximum number of entries.
 * @param bookInitials the book to use
 * @param reference a reference, appropriate for the book, of one or more entries
 * @param maxKeyCount the maximum number of entries to use
 * @throws NoSuchKeyException 
 */
private BookData getBookData(String bookInitials,String reference,int maxKeyCount) throws NoSuchKeyException {
  Book book=BookInstaller.getInstalledBook(bookInitials);
  if (book == null || reference == null || maxKeyCount < 1) {
    return null;
  }
  Key key=null;
  if (BookCategory.BIBLE.equals(book.getBookCategory())) {
    key=book.getKey(reference);
    ((Passage)key).trimVerses(maxKeyCount);
  }
 else   if (BookCategory.GENERAL_BOOK.equals(book.getBookCategory())) {
    key=book.getKey(reference);
  }
 else {
    key=book.getKey(reference);
    if (key.getCardinality() > maxKeyCount) {
      Iterator iter=key.iterator();
      key=book.createEmptyKeyList();
      int count=0;
      while (iter.hasNext()) {
        if (++count >= maxKeyCount) {
          break;
        }
        key.addAll((Key)iter.next());
      }
    }
  }
  return new BookData(book,key);
}
Program: 101553
Project: 101553
Buggy source:
/** 
 * Accessor for the Sword directory
 * @return The new Sword directory
 */
public static File[] getAugmentPath(){
  return (File[])augmentPath.clone();
}

Fixed version (ground truth):
/** 
 * Retrieve the additional locations that Sword may hold Books.
 * @return The new Sword directory
 */
public static File[] getAugmentPath(){
  return (File[])augmentPath.clone();
}
Program: 101554
Project: 101554
Buggy source:
public static String[] getBookList(File bookDir){
  return bookDir.list(new CustomFilenameFilter());
}

Fixed version (ground truth):
/** 
 * Get a list of books in a given location.
 * @param bookDir the directory in which to look
 * @return the list of books in that location
 */
public static String[] getBookList(File bookDir){
  return bookDir.list(new CustomFilenameFilter());
}
Program: 101555
Project: 101555
Buggy source:
/** 
 * Accessor for the Sword directory
 * @param theNewDirs The new Sword directory
 * @throws BookException
 */
public static void setAugmentPath(File[] theNewDirs) throws BookException {
  File[] newDirs=theNewDirs;
  if (newDirs == null) {
    return;
  }
  SwordBookPath.augmentPath=(File[])newDirs.clone();
  Books.installed().registerDriver(SwordBookDriver.instance());
}

Fixed version (ground truth):
/** 
 * Establish additional locations that Sword may hold books.
 * @param theNewDirs The new Sword directories
 * @throws BookException
 */
public static void setAugmentPath(File[] theNewDirs) throws BookException {
  File[] newDirs=theNewDirs;
  if (newDirs == null) {
    return;
  }
  SwordBookPath.augmentPath=(File[])newDirs.clone();
  Books.installed().registerDriver(SwordBookDriver.instance());
}
Program: 101556
Project: 101556
Buggy source:
public String toString(){
  StringBuffer txt=new StringBuffer();
  txt.append("String_Node_Str");
  txt.append(getCoordinates(sourceStart,sourceLength));
  txt.append("String_Node_Str");
  txt.append(getCoordinates(targetStart,targetLength));
  txt.append("String_Node_Str");
  Iterator iter=diffs.iterator();
  while (iter.hasNext()) {
    Difference diff=(Difference)iter.next();
    txt.append(diff.getEditType().getSymbol());
    txt.append(diff.getText());
    txt.append('\n');
  }
  return txt.toString();
}

Fixed version (ground truth):
public String toString(){
  StringBuffer txt=new StringBuffer();
  txt.append("String_Node_Str");
  txt.append(getCoordinates(sourceStart,sourceLength));
  txt.append("String_Node_Str");
  txt.append(getCoordinates(targetStart,targetLength));
  txt.append("String_Node_Str");
  Iterator iter=diffs.iterator();
  while (iter.hasNext()) {
    Difference diff=(Difference)iter.next();
    txt.append(diff.getEditType().getSymbol());
    txt.append(encode(diff.getText()));
    txt.append('\n');
  }
  return txt.toString();
}