nus-yam/ex-repair huggingface dataset:
Program: 101464
Project: 101464
Buggy source:
/** 
 * Call with &lt;operation&gt; book. Where operation can be one of: <ul> <li>check - returns "TRUE" or "FALSE" indicating whether the index exists or not</li> <li>create - (re)create the index</li> <li>delete - delete the index if it exists</li> </ul> And book is the initials of a book, e.g. KJV.
 * @param args
 */
public static void main(String[] args){
  if (args.length != 2) {
    usage();
    return;
  }
  System.err.println("String_Node_Str" + args[0] + "String_Node_Str"+ args[1]);
  String operation=args[0];
  Book b=Books.installed().getBook(args[1]);
  if (b == null) {
    System.err.println("String_Node_Str");
    return;
  }
  BookIndexer indexer=new BookIndexer(b);
  if (operation.equalsIgnoreCase("String_Node_Str")) {
    try {
      indexer.createIndex();
    }
 catch (    BookException e) {
      System.err.println("String_Node_Str");
      e.printStackTrace();
    }
  }
 else   if (operation.equalsIgnoreCase("String_Node_Str")) {
    try {
      indexer.deleteIndex();
    }
 catch (    BookException e) {
      System.err.println("String_Node_Str");
      e.printStackTrace();
    }
  }
 else   if (operation.equalsIgnoreCase("String_Node_Str")) {
    System.err.println(indexer.isIndexed());
  }
 else {
    usage();
  }
}

Fixed version (ground truth):
/** 
 * Call with &lt;operation&gt; book. Where operation can be one of: <ul> <li>check - returns "TRUE" or "FALSE" indicating whether the index exists or not</li> <li>create - (re)create the index</li> <li>delete - delete the index if it exists</li> </ul> And book is the initials of a book, e.g. KJV.
 * @param args
 */
public static void main(String[] args){
  if (args.length != 2) {
    usage();
    return;
  }
  System.err.println("String_Node_Str" + args[0] + "String_Node_Str"+ args[1]);
  String operation=args[0];
  Book b=Books.installed().getBook(args[1]);
  if (b == null) {
    System.err.println("String_Node_Str");
    return;
  }
  BookIndexer indexer=new BookIndexer(b);
  if ("String_Node_Str".equalsIgnoreCase(operation)) {
    try {
      indexer.createIndex();
    }
 catch (    BookException e) {
      System.err.println("String_Node_Str");
      e.printStackTrace();
    }
  }
 else   if ("String_Node_Str".equalsIgnoreCase(operation)) {
    try {
      indexer.deleteIndex();
    }
 catch (    BookException e) {
      System.err.println("String_Node_Str");
      e.printStackTrace();
    }
  }
 else   if ("String_Node_Str".equalsIgnoreCase(operation)) {
    System.err.println(indexer.isIndexed());
  }
 else {
    usage();
  }
}
Program: 101466
Project: 101466
Buggy source:
/** 
 * When called from a method it will return the i-th class calling that method, up the call chain. If used with a -1 it will return the class making the call -2 and -3 will return this class
 * @throws ArrayIndexOutOfBoundsException if the index is not valid
 */
public static Class<?> getCallingClass(int i){
  return Thread.currentThread().getStackTrace()[CALL_CONTEXT_OFFSET + i].getClass();
}

Fixed version (ground truth):
/** 
 * When called from a method it will return the i-th class calling that method, up the call chain. If used with a -1 it will return the class making the call -2 and -3 will return this class
 * @throws ArrayIndexOutOfBoundsException if the index is not valid
 */
public static Class<?> getCallingClass(int i){
  try {
    return Class.forName(Thread.currentThread().getStackTrace()[CALL_CONTEXT_OFFSET + i].getClassName());
  }
 catch (  ClassNotFoundException e) {
    return CallContext.class;
  }
}
Program: 101467
Project: 101467
Buggy source:
/** 
 * Get the language name from the language code. If the code is null or empty then it is considered to be DEFAULT_LANG_CODE (that is, English). If it starts with x- or is too long then it will return unknown. If the code's name cannot be found, it will return the code. If a locale is used for the iso639Code, it will use the part before the '_'. Thus, this code does not support dialects, except as found in the iso639.
 * @param iso639Code
 * @return the name of the language
 */
public static String getLanguageName(String iso639Code){
  String code=getLanguageCode(iso639Code);
  try {
    return getLocalisedCommonLanguages().getString(code);
  }
 catch (  MissingResourceException e) {
    try {
      return allLangs.getString(code);
    }
 catch (    MissingResourceException e1) {
      return code;
    }
  }
}

Fixed version (ground truth):
/** 
 * Get the language name for the code. If the language name is not known then return the code.
 * @param languageCode
 * @return the name for the language.
 */
public static String getLanguageName(String languageCode){
  String name=instance.get(languageCode);
  if (name != null) {
    return name;
  }
  return languageCode;
}
Program: 101468
Project: 101468
Buggy source:
/** 
 * Split the specification on '-' into 1 to 3 parts.
 * @param specification
 */
private void parse(String specification){
  int len=specification.length();
  if (len < 2 || specification.charAt(0) == '-' || specification.charAt(1) == '-') {
    valid=false;
    code=UNKNOWN_LANG_CODE;
    return;
  }
  int partLen=0;
  int start=2;
  int split;
  for (split=start; split < len; ++split) {
    char c=specification.charAt(split);
    if (c == '-') {
      break;
    }
  }
  code=Language.toCanonicalLanguage(specification,start,split);
  partLen=split - start;
  valid=partLen == 2 || partLen == 3;
  start=split + 1;
  if (split < len) {
    for (split=start; split < len; ++split) {
      char c=specification.charAt(split);
      if (c == '-') {
        break;
      }
    }
    partLen=split - start;
    if (partLen == 4) {
      script=Language.toCanonicalScript(specification,start,split);
    }
 else     if (partLen == 2) {
      country=Language.toCanonicalCountry(specification,start,split);
    }
 else {
      valid=false;
    }
    start=split + 1;
  }
  if (country == null && split < len) {
    for (split=start; split < len; ++split) {
      char c=specification.charAt(split);
      if (c == '-') {
        break;
      }
    }
    partLen=split - start;
    if (partLen == 2) {
      country=Language.toCanonicalCountry(specification,start,split);
    }
 else {
      valid=false;
    }
    start=split + 1;
  }
  if (start <= len) {
    valid=false;
  }
}

Fixed version (ground truth):
/** 
 * Split the specification on '-' into 1 to 3 parts.
 * @param spec
 */
private void parse(String spec){
  String specification=spec;
  if (specification == null) {
    specification=DEFAULT_LANG_CODE;
  }
  int len=specification.length();
  if (len < 2 || specification.charAt(0) == '-' || specification.charAt(1) == '-') {
    valid=false;
    code=UNKNOWN_LANG_CODE;
    return;
  }
  int partLen=0;
  int start=0;
  int split;
  for (split=2; split < len; ++split) {
    char c=specification.charAt(split);
    if (c == '-') {
      break;
    }
  }
  code=Language.toCanonicalLanguage(specification,start,split);
  partLen=split - start;
  valid=partLen == 2 || partLen == 3;
  start=split + 1;
  if (split < len) {
    for (split=start; split < len; ++split) {
      char c=specification.charAt(split);
      if (c == '-') {
        break;
      }
    }
    partLen=split - start;
    if (partLen == 4) {
      script=Language.toCanonicalScript(specification,start,split);
    }
 else     if (partLen == 2) {
      country=Language.toCanonicalCountry(specification,start,split);
    }
 else {
      valid=false;
    }
    start=split + 1;
  }
  if (country == null && split < len) {
    for (split=start; split < len; ++split) {
      char c=specification.charAt(split);
      if (c == '-') {
        break;
      }
    }
    partLen=split - start;
    if (partLen == 2) {
      country=Language.toCanonicalCountry(specification,start,split);
    }
 else {
      valid=false;
    }
    start=split + 1;
  }
  if (start <= len) {
    valid=false;
  }
}
Program: 101469
Project: 101469
Buggy source:
private void adjustLanguage(){
  Language lang=(Language)getValue(ConfigEntryType.LANG);
  if (lang == null) {
    lang=Language.DEFAULT_LANG;
    add(ConfigEntryType.LANG,lang.toString());
  }
  testLanguage(internal,lang);
  Language langFrom=(Language)getValue(ConfigEntryType.GLOSSARY_FROM);
  Language langTo=(Language)getValue(ConfigEntryType.GLOSSARY_TO);
  if (langFrom != null || langTo != null) {
    if (langFrom == null) {
      log.warn("String_Node_Str" + internal + "String_Node_Str"+ ConfigEntryType.GLOSSARY_FROM.getName()+ '='+ Languages.DEFAULT_LANG_CODE);
      langFrom=Language.DEFAULT_LANG;
      add(ConfigEntryType.GLOSSARY_FROM,lang.getCode());
    }
    testLanguage(internal,langFrom);
    if (langTo == null) {
      log.warn("String_Node_Str" + internal + "String_Node_Str"+ ConfigEntryType.GLOSSARY_TO.getName()+ '='+ Languages.DEFAULT_LANG_CODE);
      langTo=Language.DEFAULT_LANG;
      add(ConfigEntryType.GLOSSARY_TO,lang.getCode());
    }
    testLanguage(internal,langTo);
    if (!langFrom.equals(lang) && !langTo.equals(lang)) {
      log.error("String_Node_Str" + internal + "String_Node_Str"+ ConfigEntryType.GLOSSARY_FROM.getName()+ "String_Node_Str"+ ConfigEntryType.GLOSSARY_FROM.getName()+ "String_Node_Str"+ ConfigEntryType.LANG.getName());
    }
 else     if (!langFrom.equals(lang)) {
      lang=langFrom;
      add(ConfigEntryType.LANG,lang.getCode());
    }
  }
}

Fixed version (ground truth):
private void adjustLanguage(){
  Language lang=(Language)getValue(ConfigEntryType.LANG);
  if (lang == null) {
    lang=Language.DEFAULT_LANG;
    add(ConfigEntryType.LANG,lang.toString());
  }
  testLanguage(internal,lang);
  Language langFrom=(Language)getValue(ConfigEntryType.GLOSSARY_FROM);
  Language langTo=(Language)getValue(ConfigEntryType.GLOSSARY_TO);
  if (langFrom != null || langTo != null) {
    if (langFrom == null) {
      log.warn("String_Node_Str" + internal + "String_Node_Str"+ ConfigEntryType.GLOSSARY_FROM.getName()+ '='+ Language.DEFAULT_LANG_CODE);
      langFrom=Language.DEFAULT_LANG;
      add(ConfigEntryType.GLOSSARY_FROM,lang.getCode());
    }
    testLanguage(internal,langFrom);
    if (langTo == null) {
      log.warn("String_Node_Str" + internal + "String_Node_Str"+ ConfigEntryType.GLOSSARY_TO.getName()+ '='+ Language.DEFAULT_LANG_CODE);
      langTo=Language.DEFAULT_LANG;
      add(ConfigEntryType.GLOSSARY_TO,lang.getCode());
    }
    testLanguage(internal,langTo);
    if (!langFrom.equals(lang) && !langTo.equals(lang)) {
      log.error("String_Node_Str" + internal + "String_Node_Str"+ ConfigEntryType.GLOSSARY_FROM.getName()+ "String_Node_Str"+ ConfigEntryType.GLOSSARY_FROM.getName()+ "String_Node_Str"+ ConfigEntryType.LANG.getName());
    }
 else     if (!langFrom.equals(lang)) {
      lang=langFrom;
      add(ConfigEntryType.LANG,lang.getCode());
    }
  }
}
Program: 101470
Project: 101470
Buggy source:
/** 
 * Do the actual parsing.
 * @param input
 * @return true when the input looks like a Strong's Number
 */
private boolean parse(String input){
  String text=input;
  language='U';
  strongsNumber=9999;
  part="String_Node_Str";
  Matcher m=STRONGS_PATTERN.matcher(text);
  if (!m.lookingAt()) {
    return false;
  }
  String lang=m.group(1);
  language=lang.charAt(0);
switch (language) {
case 'g':
    language='G';
  break;
case 'h':
language='H';
break;
default :
return false;
}
try {
strongsNumber=Short.parseShort(m.group(2));
}
 catch (NumberFormatException e) {
strongsNumber=0;
return false;
}
part=m.group(3);
return true;
}

Fixed version (ground truth):
/** 
 * Do the actual parsing.
 * @param input
 * @return true when the input looks like a Strong's Number
 */
private boolean parse(String input){
  String text=input;
  language='U';
  strongsNumber=9999;
  part="String_Node_Str";
  Matcher m=STRONGS_PATTERN.matcher(text);
  if (!m.lookingAt()) {
    return false;
  }
  String lang=m.group(1);
  language=lang.charAt(0);
switch (language) {
case 'g':
    language='G';
  break;
case 'h':
language='H';
break;
default :
}
try {
strongsNumber=Short.parseShort(m.group(2));
}
 catch (NumberFormatException e) {
strongsNumber=0;
return false;
}
part=m.group(3);
return true;
}
Program: 101471
Project: 101471
Buggy source:
/** 
 * Get the localized language name.
 * @return the name of the language
 */
public String getName(){
  if (name == null) {
    StringBuilder sb=new StringBuilder();
    if (script != null && country != null) {
      sb.append(code);
      sb.append('-');
      sb.append(script);
      sb.append('-');
      sb.append(country);
      found=sb.toString();
      name=Languages.getName(found);
    }
    if (code.equals(name) && script != null) {
      sb.setLength(0);
      sb.append(code);
      sb.append('-');
      sb.append(script);
      found=sb.toString();
      name=Languages.getName(found);
    }
    if (code.equals(name) && country != null) {
      sb.setLength(0);
      sb.append(code);
      sb.append('-');
      sb.append(country);
      found=sb.toString();
      name=Languages.getName(found);
    }
    if (code.equals(name)) {
      found=code;
      name=Languages.getName(code);
    }
    if (code.equals(name)) {
      name=new Locale(code).getDisplayLanguage();
    }
    if (code.equals(name)) {
      name=Languages.AllLanguages.getName(code);
    }
  }
  return name;
}

Fixed version (ground truth):
/** 
 * Get the localized language name.
 * @return the name of the language
 */
public String getName(){
  if (name == null) {
    name=code;
    StringBuilder sb=new StringBuilder();
    if (script != null && country != null) {
      sb.append(code);
      sb.append('-');
      sb.append(script);
      sb.append('-');
      sb.append(country);
      found=sb.toString();
      name=Languages.getName(found);
    }
    if (code.equals(name) && script != null) {
      sb.setLength(0);
      sb.append(code);
      sb.append('-');
      sb.append(script);
      found=sb.toString();
      name=Languages.getName(found);
    }
    if (code.equals(name) && country != null) {
      sb.setLength(0);
      sb.append(code);
      sb.append('-');
      sb.append(country);
      found=sb.toString();
      name=Languages.getName(found);
    }
    if (code.equals(name)) {
      found=code;
      name=Languages.getName(code);
    }
    if (code.equals(name)) {
      name=new Locale(code).getDisplayLanguage();
    }
    if (code.equals(name)) {
      name=Languages.AllLanguages.getName(code);
    }
  }
  return name;
}
Program: 101472
Project: 101472
Buggy source:
/** 
 * Ctor with some default values. A call to setBook() is still required after this ctor is called
 */
public DefaultBookMetaData(BookDriver driver,String name,BookCategory type){
  setDriver(driver);
  setName(name);
  setBookCategory(type);
  setLanguage(new Language(null));
}

Fixed version (ground truth):
/** 
 * Ctor with some default values. A call to setBook() is still required after this ctor is called
 */
public DefaultBookMetaData(BookDriver driver,String name,BookCategory type){
  setDriver(driver);
  setName(name);
  setBookCategory(type);
  setLanguage(Language.DEFAULT_LANG);
}
Program: 101473
Project: 101473
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);
    if (!storage.renameTo(tempPath)) {
      throw new BookException(JSMsg.gettext("String_Node_Str"));
    }
    book.setIndexStatus(IndexStatus.UNDONE);
  }
 catch (  IOException ex) {
    throw new BookException(JSMsg.gettext("String_Node_Str"),ex);
  }
  FileUtil.delete(tempPath);
}

Fixed version (ground truth):
public void deleteIndex(Book book) throws BookException {
  File tempPath=null;
  try {
    Index index=INDEXES.get(book);
    if (index != null) {
      index.close();
    }
    File storage=NetUtil.getAsFile(getStorageArea(book));
    String finalCanonicalPath=storage.getCanonicalPath();
    tempPath=new File(finalCanonicalPath + '.' + IndexStatus.CREATING.toString());
    if (tempPath.exists()) {
      FileUtil.delete(tempPath);
    }
    tempPath=new File(finalCanonicalPath + '.' + IndexStatus.CREATING.toString());
    if (!storage.renameTo(tempPath)) {
      throw new BookException(JSMsg.gettext("String_Node_Str"));
    }
    book.setIndexStatus(IndexStatus.UNDONE);
  }
 catch (  IOException ex) {
    throw new BookException(JSMsg.gettext("String_Node_Str"),ex);
  }
  FileUtil.delete(tempPath);
}
Program: 101474
Project: 101474
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);
    if (!storage.renameTo(tempPath)) {
      throw new BookException(JSMsg.gettext("String_Node_Str"));
    }
    book.setIndexStatus(IndexStatus.UNDONE);
  }
 catch (  IOException ex) {
    throw new BookException(JSMsg.gettext("String_Node_Str"),ex);
  }
  FileUtil.delete(tempPath);
}

Fixed version (ground truth):
public void deleteIndex(Book book) throws BookException {
  File tempPath=null;
  try {
    Index index=INDEXES.get(book);
    if (index != null) {
      index.close();
    }
    File storage=NetUtil.getAsFile(getStorageArea(book));
    String finalCanonicalPath=storage.getCanonicalPath();
    tempPath=new File(finalCanonicalPath + '.' + IndexStatus.CREATING.toString());
    if (tempPath.exists()) {
      FileUtil.delete(tempPath);
    }
    tempPath=new File(finalCanonicalPath + '.' + IndexStatus.CREATING.toString());
    if (!storage.renameTo(tempPath)) {
      throw new BookException(JSMsg.gettext("String_Node_Str"));
    }
    book.setIndexStatus(IndexStatus.UNDONE);
  }
 catch (  IOException ex) {
    throw new BookException(JSMsg.gettext("String_Node_Str"),ex);
  }
  FileUtil.delete(tempPath);
}
Program: 101475
Project: 101475
Buggy source:
@Override public boolean contains(Key obj){
  Versification v11n=getVersification();
  for (  Key aKey : obj) {
    Verse verse=(Verse)aKey;
    if (!store.get(v11n.getOrdinal(verse))) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean contains(Key obj){
  Versification v11n=getVersification();
  for (  Key aKey : obj) {
    Verse verse=(Verse)aKey;
    if (verse.getVerse() == 0) {
      continue;
    }
    if (!store.get(v11n.getOrdinal(verse))) {
      return false;
    }
  }
  return true;
}
Program: 101476
Project: 101476
Buggy source:
@Override public boolean contains(Key obj){
  Versification v11n=getVersification();
  for (  Key aKey : obj) {
    Verse verse=(Verse)aKey;
    if (!store.get(v11n.getOrdinal(verse))) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean contains(Key obj){
  Versification v11n=getVersification();
  for (  Key aKey : obj) {
    Verse verse=(Verse)aKey;
    if (verse.getVerse() == 0) {
      continue;
    }
    if (!store.get(v11n.getOrdinal(verse))) {
      return false;
    }
  }
  return true;
}
Program: 101477
Project: 101477
Buggy source:
@Override public String getRawText(Key key) throws BookException {
  checkActive();
  Verse verse=KeyUtil.getVerse(key);
  try {
    String v11nName=getBookMetaData().getProperty(ConfigEntryType.VERSIFICATION).toString();
    Versification v11n=Versifications.instance().getVersification(v11nName);
    int index=v11n.getOrdinal(verse);
    Testament testament=v11n.getTestament(index);
    index=v11n.getTestamentOrdinal(index);
    RandomAccessFile idxRaf=otIdxRaf;
    if (testament == Testament.OLD) {
      idxRaf=ntIdxRaf;
    }
    if (idxRaf == null) {
      return "String_Node_Str";
    }
    return getEntry(key.getName(),testament,index);
  }
 catch (  IOException ex) {
    throw new BookException(JSMsg.gettext("String_Node_Str",verse.getName()),ex);
  }
}

Fixed version (ground truth):
@Override public String getRawText(Key key) throws BookException {
  checkActive();
  Verse verse=KeyUtil.getVerse(key);
  try {
    String v11nName=getBookMetaData().getProperty(ConfigEntryType.VERSIFICATION).toString();
    Versification v11n=Versifications.instance().getVersification(v11nName);
    int index=v11n.getOrdinal(verse);
    Testament testament=v11n.getTestament(index);
    index=v11n.getTestamentOrdinal(index);
    RandomAccessFile idxRaf=otIdxRaf;
    if (testament == Testament.NEW) {
      idxRaf=ntIdxRaf;
    }
    if (idxRaf == null) {
      return "String_Node_Str";
    }
    return getEntry(key.getName(),testament,index);
  }
 catch (  IOException ex) {
    throw new BookException(JSMsg.gettext("String_Node_Str",verse.getName()),ex);
  }
}
Program: 101478
Project: 101478
Buggy source:
@Override public boolean contains(Key key){
  checkActive();
  Verse verse=KeyUtil.getVerse(key);
  try {
    String v11nName=getBookMetaData().getProperty(ConfigEntryType.VERSIFICATION).toString();
    Versification v11n=Versifications.instance().getVersification(v11nName);
    int index=v11n.getOrdinal(verse);
    Testament testament=v11n.getTestament(index);
    index=v11n.getTestamentOrdinal(index);
    RandomAccessFile idxRaf=otIdxRaf;
    if (testament == Testament.OLD) {
      idxRaf=ntIdxRaf;
    }
    if (idxRaf == null) {
      return false;
    }
    DataIndex dataIndex=getIndex(idxRaf,index);
    return dataIndex.getSize() > 0;
  }
 catch (  IOException ex) {
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean contains(Key key){
  checkActive();
  Verse verse=KeyUtil.getVerse(key);
  try {
    String v11nName=getBookMetaData().getProperty(ConfigEntryType.VERSIFICATION).toString();
    Versification v11n=Versifications.instance().getVersification(v11nName);
    int index=v11n.getOrdinal(verse);
    Testament testament=v11n.getTestament(index);
    index=v11n.getTestamentOrdinal(index);
    RandomAccessFile idxRaf=otIdxRaf;
    if (testament == Testament.NEW) {
      idxRaf=ntIdxRaf;
    }
    if (idxRaf == null) {
      return false;
    }
    DataIndex dataIndex=getIndex(idxRaf,index);
    return dataIndex.getSize() > 0;
  }
 catch (  IOException ex) {
    return false;
  }
}
Program: 101479
Project: 101479
Buggy source:
/** 
 * Get the text for an indexed entry in the book.
 * @param index the entry to get
 * @param name name of the entry
 * @param testament the testament for the entry
 * @return the text for the entry.
 * @throws IOException on a IO problem
 */
protected String getEntry(String name,Testament testament,long index) throws IOException {
  RandomAccessFile idxRaf=otIdxRaf;
  RandomAccessFile txtRaf=otTxtRaf;
  if (testament == Testament.OLD) {
    idxRaf=ntIdxRaf;
    txtRaf=ntTxtRaf;
  }
  DataIndex dataIndex=getIndex(idxRaf,index);
  int size=dataIndex.getSize();
  if (size == 0) {
    return "String_Node_Str";
  }
  if (size < 0) {
    log.error("String_Node_Str" + getBookMetaData().getInitials() + "String_Node_Str"+ name+ "String_Node_Str"+ size);
    return "String_Node_Str";
  }
  byte[] data=SwordUtil.readRAF(txtRaf,dataIndex.getOffset(),size);
  decipher(data);
  return SwordUtil.decode(name,data,getBookMetaData().getBookCharset());
}

Fixed version (ground truth):
/** 
 * Get the text for an indexed entry in the book.
 * @param index the entry to get
 * @param name name of the entry
 * @param testament the testament for the entry
 * @return the text for the entry.
 * @throws IOException on a IO problem
 */
protected String getEntry(String name,Testament testament,long index) throws IOException {
  RandomAccessFile idxRaf=otIdxRaf;
  RandomAccessFile txtRaf=otTxtRaf;
  if (testament == Testament.NEW) {
    idxRaf=ntIdxRaf;
    txtRaf=ntTxtRaf;
  }
  DataIndex dataIndex=getIndex(idxRaf,index);
  int size=dataIndex.getSize();
  if (size == 0) {
    return "String_Node_Str";
  }
  if (size < 0) {
    log.error("String_Node_Str" + getBookMetaData().getInitials() + "String_Node_Str"+ name+ "String_Node_Str"+ size);
    return "String_Node_Str";
  }
  byte[] data=SwordUtil.readRAF(txtRaf,dataIndex.getOffset(),size);
  decipher(data);
  return SwordUtil.decode(name,data,getBookMetaData().getBookCharset());
}
Program: 101480
Project: 101480
Buggy source:
@Override public void setAliasKey(Key alias,Key source) throws IOException {
  Verse aliasVerse=KeyUtil.getVerse(alias);
  Verse sourceVerse=KeyUtil.getVerse(source);
  String v11nName=getBookMetaData().getProperty(ConfigEntryType.VERSIFICATION).toString();
  Versification v11n=Versifications.instance().getVersification(v11nName);
  int aliasIndex=v11n.getOrdinal(aliasVerse);
  Testament testament=v11n.getTestament(aliasIndex);
  aliasIndex=v11n.getTestamentOrdinal(aliasIndex);
  RandomAccessFile idxRaf=otIdxRaf;
  if (testament == Testament.NEW) {
    idxRaf=ntIdxRaf;
  }
  int sourceOIndex=sourceVerse.getOrdinal();
  sourceOIndex=v11n.getTestamentOrdinal(sourceOIndex);
  DataIndex dataIndex=getIndex(idxRaf,sourceOIndex);
  updateIndexFile(idxRaf,aliasIndex,dataIndex.getOffset());
}

Fixed version (ground truth):
@Override public void setAliasKey(Key alias,Key source) throws IOException {
  Verse aliasVerse=KeyUtil.getVerse(alias);
  Verse sourceVerse=KeyUtil.getVerse(source);
  String v11nName=getBookMetaData().getProperty(ConfigEntryType.VERSIFICATION).toString();
  Versification v11n=Versifications.instance().getVersification(v11nName);
  int aliasIndex=v11n.getOrdinal(aliasVerse);
  Testament testament=v11n.getTestament(aliasIndex);
  aliasIndex=v11n.getTestamentOrdinal(aliasIndex);
  RandomAccessFile idxRaf=otIdxRaf;
  if (testament == Testament.NEW) {
    idxRaf=ntIdxRaf;
  }
  int sourceOIndex=v11n.getOrdinal(sourceVerse);
  sourceOIndex=v11n.getTestamentOrdinal(sourceOIndex);
  DataIndex dataIndex=getIndex(idxRaf,sourceOIndex);
  updateIndexFile(idxRaf,aliasIndex,dataIndex.getOffset());
}
Program: 101482
Project: 101482
Buggy source:
/** 
 * Write out the object to the given ObjectOutputStream
 * @param is The stream to read our state from
 * @throws IOException if the read fails
 * @throws ClassNotFoundException If the read data is incorrect
 */
protected void readObjectSupport(ObjectInputStream is) throws IOException, ClassNotFoundException {
  raiseEventSuppresion();
  raiseNormalizeProtection();
  int type=is.readInt();
switch (type) {
case BITWISE:
    BitSet store=(BitSet)is.readObject();
  for (int i=0; i < v11n.maximumOrdinal(); i++) {
    if (store.get(i)) {
      add(v11n.decodeOrdinal(i + 1));
    }
  }
break;
case DISTINCT:
int verses=is.readInt();
for (int i=0; i < verses; i++) {
int ord=is.readInt();
add(v11n.decodeOrdinal(ord));
}
break;
case RANGED:
int ranges=is.readInt();
for (int i=0; i < ranges; i++) {
int ord=is.readInt();
int count=is.readInt();
add(RestrictionType.NONE.toRange(getVersification(),v11n.decodeOrdinal(ord),count));
}
break;
default :
throw new ClassCastException(JSOtherMsg.lookupText("String_Node_Str"));
}
lowerEventSuppresionAndTest();
lowerNormalizeProtection();
}

Fixed version (ground truth):
/** 
 * Write out the object to the given ObjectOutputStream
 * @param is The stream to read our state from
 * @throws IOException if the read fails
 * @throws ClassNotFoundException If the read data is incorrect
 */
protected void readObjectSupport(ObjectInputStream is) throws IOException, ClassNotFoundException {
  raiseEventSuppresion();
  raiseNormalizeProtection();
  String v11nName=is.readUTF();
  v11n=Versifications.instance().getVersification(v11nName);
  int type=is.readInt();
switch (type) {
case BITWISE:
    BitSet store=(BitSet)is.readObject();
  for (int i=0; i < v11n.maximumOrdinal(); i++) {
    if (store.get(i)) {
      add(v11n.decodeOrdinal(i + 1));
    }
  }
break;
case DISTINCT:
int verses=is.readInt();
for (int i=0; i < verses; i++) {
int ord=is.readInt();
add(v11n.decodeOrdinal(ord));
}
break;
case RANGED:
int ranges=is.readInt();
for (int i=0; i < ranges; i++) {
int ord=is.readInt();
int count=is.readInt();
add(RestrictionType.NONE.toRange(getVersification(),v11n.decodeOrdinal(ord),count));
}
break;
default :
throw new ClassCastException(JSOtherMsg.lookupText("String_Node_Str"));
}
lowerEventSuppresionAndTest();
lowerNormalizeProtection();
}
Program: 101483
Project: 101483
Buggy source:
/** 
 * iterate, amalgamating Verses into VerseRanges
 */
protected VerseRangeIterator(Versification v11n,Iterator<Key> it,RestrictionType restrict){
  this.referenceSystem=v11n;
  this.it=it;
  this.restrict=restrict;
  if (it.hasNext()) {
    next_verse=(Verse)it.next();
  }
  calculateNext();
}

Fixed version (ground truth):
/** 
 * iterate, amalgamating Verses into VerseRanges
 */
protected VerseRangeIterator(Versification v11n,Iterator<Key> it,RestrictionType restrict){
  this.v11n=v11n;
  this.it=it;
  this.restrict=restrict;
  if (it.hasNext()) {
    next_verse=(Verse)it.next();
  }
  calculateNext();
}
Program: 101484
Project: 101484
Buggy source:
/** 
 * Find the next VerseRange
 */
private void calculateNext(){
  if (next_verse == null) {
    next_range=null;
    return;
  }
  Verse start=next_verse;
  Verse end=next_verse;
  findnext:   while (true) {
    if (!it.hasNext()) {
      next_verse=null;
      break;
    }
    next_verse=(Verse)it.next();
    if (!end.adjacentTo(next_verse)) {
      break;
    }
    if (!restrict.isSameScope(end,next_verse)) {
      break findnext;
    }
    end=next_verse;
  }
  next_range=new VerseRange(referenceSystem,start,end);
}

Fixed version (ground truth):
/** 
 * Find the next VerseRange
 */
private void calculateNext(){
  if (next_verse == null) {
    next_range=null;
    return;
  }
  Verse start=next_verse;
  Verse end=next_verse;
  findnext:   while (true) {
    if (!it.hasNext()) {
      next_verse=null;
      break;
    }
    next_verse=(Verse)it.next();
    if (!v11n.adjacentTo(end,next_verse)) {
      break;
    }
    if (!restrict.isSameScope(v11n,end,next_verse)) {
      break findnext;
    }
    end=next_verse;
  }
  next_range=new VerseRange(v11n,start,end);
}
Program: 101485
Project: 101485
Buggy source:
public void add(Key obj){
  optimizeWrites();
  Verse firstVerse=null;
  Verse lastVerse=null;
  for (  Key aKey : obj) {
    lastVerse=(Verse)aKey;
    if (firstVerse == null) {
      firstVerse=lastVerse;
    }
    store.set(lastVerse.getOrdinal());
  }
  if (suppressEvents == 0) {
    fireIntervalAdded(this,firstVerse,lastVerse);
  }
}

Fixed version (ground truth):
public void add(Key obj){
  Versification v11n=getVersification();
  optimizeWrites();
  Verse firstVerse=null;
  Verse lastVerse=null;
  for (  Key aKey : obj) {
    lastVerse=(Verse)aKey;
    if (firstVerse == null) {
      firstVerse=lastVerse;
    }
    store.set(v11n.getOrdinal(lastVerse));
  }
  if (suppressEvents == 0) {
    fireIntervalAdded(this,firstVerse,lastVerse);
  }
}
Program: 101486
Project: 101486
Buggy source:
/** 
 * Call the support mechanism in AbstractPassage
 * @param out The stream to write our state to
 * @serialData Write the ordinal number of this verse
 * @see AbstractPassage#writeObjectSupport(ObjectOutputStream)
 * @throws IOException if the read fails
 */
private void writeObject(ObjectOutputStream out) throws IOException {
  out.defaultWriteObject();
  writeObjectSupport(out);
}

Fixed version (ground truth):
/** 
 * Call the support mechanism in AbstractPassage
 * @param out The stream to write our state to
 * @serialData Write the ordinal number of this verse
 * @see AbstractPassage#writeObjectSupport(ObjectOutputStream)
 * @throws IOException if the read fails
 */
private void writeObject(ObjectOutputStream out) throws IOException {
  out.defaultWriteObject();
  out.writeUTF(getVersification().getName());
  writeObjectSupport(out);
}
Program: 101487
Project: 101487
Buggy source:
/** 
 * Call the support mechanism in AbstractPassage
 * @param in The stream to read our state from
 * @throws IOException if the read fails
 * @throws ClassNotFoundException If the read data is incorrect
 * @serialData Write the ordinal number of this verse
 * @see AbstractPassage#readObjectSupport(ObjectInputStream)
 */
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
  optimizeWrites();
  in.defaultReadObject();
  store=new BitSet(getVersification().maximumOrdinal() + 1);
  readObjectSupport(in);
}

Fixed version (ground truth):
/** 
 * Call the support mechanism in AbstractPassage
 * @param in The stream to read our state from
 * @throws IOException if the read fails
 * @throws ClassNotFoundException If the read data is incorrect
 * @serialData Write the ordinal number of this verse
 * @see AbstractPassage#readObjectSupport(ObjectInputStream)
 */
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
  optimizeWrites();
  in.defaultReadObject();
  String v11nName=in.readUTF();
  Versification v11n=Versifications.instance().getVersification(v11nName);
  store=new BitSet(v11n.maximumOrdinal() + 1);
  readObjectSupport(in);
}
Program: 101488
Project: 101488
Buggy source:
@Override public boolean contains(Key obj){
  for (  Key aKey : obj) {
    Verse verse=(Verse)aKey;
    if (!store.get(verse.getOrdinal())) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean contains(Key obj){
  Versification v11n=getVersification();
  for (  Key aKey : obj) {
    Verse verse=(Verse)aKey;
    if (!store.get(v11n.getOrdinal(verse))) {
      return false;
    }
  }
  return true;
}
Program: 101489
Project: 101489
Buggy source:
@Override public void retainAll(Key key){
  Passage that=KeyUtil.getPassage(key);
  optimizeWrites();
  BitSet thatStore=null;
  if (that instanceof BitwisePassage) {
    thatStore=((BitwisePassage)that).store;
  }
 else {
    thatStore=new BitSet(getVersification().maximumOrdinal() + 1);
    for (    Key aKey : that) {
      int ord=((Verse)aKey).getOrdinal();
      if (store.get(ord)) {
        thatStore.set(ord);
      }
    }
  }
  store.and(thatStore);
  fireIntervalRemoved(this,null,null);
}

Fixed version (ground truth):
@Override public void retainAll(Key key){
  Versification v11n=getVersification();
  Passage that=KeyUtil.getPassage(key);
  optimizeWrites();
  BitSet thatStore=null;
  if (that instanceof BitwisePassage) {
    thatStore=((BitwisePassage)that).store;
  }
 else {
    thatStore=new BitSet(v11n.maximumOrdinal() + 1);
    for (    Key aKey : that) {
      int ord=v11n.getOrdinal((Verse)aKey);
      if (store.get(ord)) {
        thatStore.set(ord);
      }
    }
  }
  store.and(thatStore);
  fireIntervalRemoved(this,null,null);
}
Program: 101490
Project: 101490
Buggy source:
/** 
 * Constructs a PassageEvent object.
 * @param source the source Object (typically <code>this</code>)
 * @param versesChanged an int specifying VERSES_CHANGED, VERSES_ADDED, VERSES_REMOVED
 * @param lower an int specifying the bottom of a range
 * @param upper an int specifying the top of a range
 */
public PassageEvent(Object source,EventType versesChanged,Verse lower,Verse upper){
  super(source);
  this.type=versesChanged;
  this.lower=lower;
  this.upper=upper;
  if (this.lower == null) {
    this.lower=VERSE_LOWEST;
  }
  if (this.upper == null) {
    this.upper=VERSE_HIGHEST;
  }
}

Fixed version (ground truth):
/** 
 * Constructs a PassageEvent object.
 * @param source the source Object (typically <code>this</code>)
 * @param versesChanged an int specifying VERSES_CHANGED, VERSES_ADDED, VERSES_REMOVED
 * @param lower an int specifying the bottom of a range
 * @param upper an int specifying the top of a range
 */
public PassageEvent(Object source,EventType versesChanged,Verse lower,Verse upper){
  super(source);
  this.type=versesChanged;
  this.lower=lower;
  this.upper=upper;
}
Program: 101492
Project: 101492
Buggy source:
/** 
 * A space separate string containing osisID from the reference element.
 * @return The references in the text
 */
public static String getReferences(Element root){
  KeyFactory keyf=PassageKeyFactory.instance();
  Key collector=keyf.createEmptyKeyList();
  for (  Content content : getDeepContent(root,OSISUtil.OSIS_ELEMENT_TITLE)) {
    Element ele=(Element)content;
    String attr=ele.getAttributeValue(OSISUtil.OSIS_ATTR_REF);
    if (attr != null) {
      try {
        Key key=keyf.getKey(attr);
        collector.addAll(key);
      }
 catch (      NoSuchKeyException e) {
        log.warn("String_Node_Str" + attr,e);
      }
    }
  }
  return collector.getOsisID();
}

Fixed version (ground truth):
/** 
 * A space separate string containing osisID from the reference element.
 * @return The references in the text
 */
public static String getReferences(Element root){
  KeyFactory keyf=PassageKeyFactory.instance();
  Key collector=keyf.createEmptyKeyList();
  for (  Content content : getDeepContent(root,OSISUtil.OSIS_ELEMENT_REFERENCE)) {
    Element ele=(Element)content;
    String attr=ele.getAttributeValue(OSISUtil.OSIS_ATTR_REF);
    if (attr != null) {
      try {
        Key key=keyf.getKey(attr);
        collector.addAll(key);
      }
 catch (      NoSuchKeyException e) {
        log.warn("String_Node_Str" + attr,e);
      }
    }
  }
  return collector.getOsisID();
}
Program: 101493
Project: 101493
Buggy source:
/** 
 * The text of non-reference notes.
 * @return The references in the text
 */
public static String getNotes(Element root){
  StringBuilder buffer=new StringBuilder();
  for (  Content content : getDeepContent(root,OSISUtil.OSIS_ELEMENT_TITLE)) {
    Element ele=(Element)content;
    String attr=ele.getAttributeValue(OSISUtil.OSIS_ATTR_TYPE);
    if (attr == null || !attr.equals(NOTETYPE_REFERENCE)) {
      if (buffer.length() > 0) {
        buffer.append(' ');
      }
      buffer.append(OSISUtil.getTextContent(ele.getContent()));
    }
  }
  return buffer.toString();
}

Fixed version (ground truth):
/** 
 * The text of non-reference notes.
 * @return The references in the text
 */
public static String getNotes(Element root){
  StringBuilder buffer=new StringBuilder();
  for (  Content content : getDeepContent(root,OSISUtil.OSIS_ELEMENT_NOTE)) {
    Element ele=(Element)content;
    String attr=ele.getAttributeValue(OSISUtil.OSIS_ATTR_TYPE);
    if (attr == null || !attr.equals(NOTETYPE_REFERENCE)) {
      if (buffer.length() > 0) {
        buffer.append(' ');
      }
      buffer.append(OSISUtil.getTextContent(ele.getContent()));
    }
  }
  return buffer.toString();
}
Program: 101494
Project: 101494
Buggy source:
/** 
 * A space separate string containing Strong's numbers.
 * @return The Strong's numbers in the text
 */
public static String getStrongsNumbers(Element root){
  StringBuilder buffer=new StringBuilder();
  for (  Content content : getDeepContent(root,OSISUtil.OSIS_ELEMENT_TITLE)) {
    Element ele=(Element)content;
    String attr=ele.getAttributeValue(OSISUtil.ATTRIBUTE_W_LEMMA);
    if (attr != null) {
      Matcher matcher=strongsNumberPattern.matcher(attr);
      while (matcher.find()) {
        String strongsNum=matcher.group(1);
        if (buffer.length() > 0) {
          buffer.append(' ');
        }
        buffer.append(strongsNum);
      }
    }
  }
  return buffer.toString().trim();
}

Fixed version (ground truth):
/** 
 * A space separate string containing Strong's numbers.
 * @return The Strong's numbers in the text
 */
public static String getStrongsNumbers(Element root){
  StringBuilder buffer=new StringBuilder();
  for (  Content content : getDeepContent(root,OSISUtil.OSIS_ELEMENT_W)) {
    Element ele=(Element)content;
    String attr=ele.getAttributeValue(OSISUtil.ATTRIBUTE_W_LEMMA);
    if (attr != null) {
      Matcher matcher=strongsNumberPattern.matcher(attr);
      while (matcher.find()) {
        String strongsNum=matcher.group(1);
        if (buffer.length() > 0) {
          buffer.append(' ');
        }
        buffer.append(strongsNum);
      }
    }
  }
  return buffer.toString().trim();
}
Program: 101495
Project: 101495
Buggy source:
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());
}

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());
  FeatureType feature=FeatureType.STRONGS_NUMBERS;
  table.add(ConfigEntryType.FEATURE,FeatureType.STRONGS_NUMBERS.toString());
  if (table.match(ConfigEntryType.FEATURE,feature.toString())) {
    assertTrue("String_Node_Str",true);
  }
 else {
    StringBuilder buffer=new StringBuilder((String)table.getValue(ConfigEntryType.SOURCE_TYPE));
    buffer.append(feature);
    if (table.match(ConfigEntryType.GLOBAL_OPTION_FILTER,buffer.toString())) {
      assertTrue("String_Node_Str",true);
    }
 else {
      assertTrue("String_Node_Str",table.match(ConfigEntryType.GLOBAL_OPTION_FILTER,feature.toString()));
    }
  }
  Book book=Books.installed().getBook("String_Node_Str");
  assertTrue("String_Node_Str",book.getBookMetaData().hasFeature(FeatureType.STRONGS_NUMBERS));
  try {
    Key key=book.getKey("String_Node_Str");
    BookData data=new BookData(book,key);
    try {
      Element osis=data.getOsisFragment();
      String strongsNumbers=OSISUtil.getStrongsNumbers(osis);
      assertTrue("String_Node_Str",strongsNumbers.length() > 0);
    }
 catch (    BookException e) {
      fail("String_Node_Str");
    }
  }
 catch (  NoSuchKeyException e1) {
    fail("String_Node_Str");
  }
}
Program: 101496
Project: 101496
Buggy source:
@Override public boolean contains(Key key){
  checkActive();
  try {
    DataPolice.setKey(key);
    TreeNode node=find(key);
    if (node == null) {
      return false;
    }
    byte[] userData=node.getUserData();
    return userData.length == 8;
  }
 catch (  IOException e) {
    return false;
  }
 finally {
    DataPolice.setKey(null);
  }
}

Fixed version (ground truth):
@Override public boolean contains(Key key){
  checkActive();
  try {
    DataPolice.setKey(key);
    return null != find(key);
  }
 catch (  IOException e) {
    return false;
  }
 finally {
    DataPolice.setKey(null);
  }
}
Program: 101497
Project: 101497
Buggy source:
@Override public boolean contains(Key key){
  checkActive();
  try {
    DataPolice.setKey(key);
    TreeNode node=find(key);
    byte[] userData=node.getUserData();
    return userData.length == 8;
  }
 catch (  IOException e) {
    return false;
  }
 finally {
    DataPolice.setKey(null);
  }
}

Fixed version (ground truth):
@Override public boolean contains(Key key){
  checkActive();
  try {
    DataPolice.setKey(key);
    TreeNode node=find(key);
    if (node == null) {
      return false;
    }
    byte[] userData=node.getUserData();
    return userData.length == 8;
  }
 catch (  IOException e) {
    return false;
  }
 finally {
    DataPolice.setKey(null);
  }
}
Program: 101499
Project: 101499
Buggy source:
/** 
 * Build's a SWORD conf file as a string. The result is not identical to the original, cleaning up problems in the original and re-arranging the entries into a predictable order.
 * @return the well-formed conf.
 */
public String toConf(){
  StringBuffer buf=new StringBuffer();
  if (value != null) {
    buf.append(getName());
    buf.append('=');
    if (allowsContinuation()) {
      String text=value.toString();
      String[] lines=StringUtil.splitAll(text,'\n');
      for (int i=0; i < lines.length; i++) {
        if (i > 0) {
          buf.append("String_Node_Str");
        }
        buf.append(lines[i]);
      }
      buf.append('\n');
    }
 else {
      buf.append(value.toString());
      buf.append('\n');
    }
  }
 else   if (type.equals(ConfigEntryType.CIPHER_KEY)) {
    buf.append(getName());
    buf.append('=');
  }
  if (values != null) {
    if (type.equals(ConfigEntryType.HISTORY)) {
      Iterator iter=values.iterator();
      while (iter.hasNext()) {
        String text=(String)iter.next();
        buf.append(getName());
        buf.append('_');
        buf.append(text.replaceFirst("String_Node_Str","String_Node_Str"));
        buf.append('\n');
      }
    }
 else {
      Iterator iter=values.iterator();
      while (iter.hasNext()) {
        String text=(String)iter.next();
        buf.append(getName());
        buf.append('=');
        buf.append(text);
        buf.append('\n');
      }
    }
  }
  return buf.toString();
}

Fixed version (ground truth):
/** 
 * Build's a SWORD conf file as a string. The result is not identical to the original, cleaning up problems in the original and re-arranging the entries into a predictable order.
 * @return the well-formed conf.
 */
public String toConf(){
  StringBuffer buf=new StringBuffer();
  if (value != null) {
    buf.append(getName());
    buf.append('=');
    if (allowsContinuation()) {
      String text=getConfValue(value);
      String[] lines=StringUtil.splitAll(text,'\n');
      for (int i=0; i < lines.length; i++) {
        if (i > 0) {
          buf.append("String_Node_Str");
        }
        buf.append(lines[i]);
      }
      buf.append('\n');
    }
 else {
      buf.append(getConfValue(value));
      buf.append('\n');
    }
  }
 else   if (type.equals(ConfigEntryType.CIPHER_KEY)) {
    buf.append(getName());
    buf.append('=');
  }
  if (values != null) {
    if (type.equals(ConfigEntryType.HISTORY)) {
      Iterator iter=values.iterator();
      while (iter.hasNext()) {
        String text=(String)iter.next();
        buf.append(getName());
        buf.append('_');
        buf.append(text.replaceFirst("String_Node_Str","String_Node_Str"));
        buf.append('\n');
      }
    }
 else {
      Iterator iter=values.iterator();
      while (iter.hasNext()) {
        buf.append(getName());
        buf.append('=');
        buf.append(getConfValue(iter.next()));
        buf.append('\n');
      }
    }
  }
  return buf.toString();
}
Program: 101500
Project: 101500
Buggy source:
public abstract boolean contains(Key key);

Fixed version (ground truth):
/** 
 * Determine whether this Book contains the key in question
 * @param key The key whose presense is desired.
 * @return true if the Book contains the key
 */
public abstract boolean contains(Key key);
Program: 101501
Project: 101501
Buggy source:
public void create() throws IOException, BookException {
  File dataPath=new File(getExpandedDataPath());
  if (!dataPath.exists()) {
    if (!dataPath.mkdirs()) {
      throw new IOException("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * Create the directory to hold the Book if it does not exist.
 * @throws IOException
 * @throws BookException
 */
public void create() throws IOException, BookException {
  File dataPath=new File(getExpandedDataPath());
  if (!dataPath.exists()) {
    if (!dataPath.mkdirs()) {
      throw new IOException("String_Node_Str");
    }
  }
}
Program: 101502
Project: 101502
Buggy source:
private byte[] readTextDataFile(File dataFile) throws IOException {
  try {
    byte[] textData=new byte[(int)dataFile.length()];
    BufferedInputStream inStream=new BufferedInputStream(new FileInputStream(dataFile));
    inStream.read(textData);
    inStream.close();
    return textData;
  }
 catch (  FileNotFoundException ex) {
    log.error(ex.getMessage());
    throw new IOException("String_Node_Str" + dataFile.getName());
  }
}

Fixed version (ground truth):
private byte[] readTextDataFile(File dataFile) throws IOException {
  BufferedInputStream inStream=null;
  try {
    int len=(int)dataFile.length();
    byte[] textData=new byte[len];
    inStream=new BufferedInputStream(new FileInputStream(dataFile));
    if (inStream.read(textData) != len) {
      log.error("String_Node_Str" + len + "String_Node_Str");
      throw new IOException("String_Node_Str" + len + "String_Node_Str");
    }
    return textData;
  }
 catch (  FileNotFoundException ex) {
    log.error(ex.getMessage());
    throw new IOException("String_Node_Str" + dataFile.getName());
  }
 finally {
    if (inStream != null) {
      inStream.close();
    }
  }
}