nus-yam/ex-repair huggingface dataset:
Program: 101431
Project: 101431
Buggy source:
/** 
 * Get the text allotted for the given entry
 * @param key The key to fetch
 * @param processor processor that executes before/after the content is read from disk or another kind of backend
 * @return String The data for the verse in question
 * @throws BookException If the data can not be read.
 */
public List<Content> readToOsis(Key key,RawTextToXmlProcessor processor) throws BookException {
  final List<Content> content=new ArrayList<Content>();
  T openFileState=null;
  try {
    openFileState=initState();
switch (this.bmd.getKeyType()) {
case LIST:
case TREE:
      readNormalOsis(key,processor,content,openFileState);
    break;
case VERSE:
  readPassageOsis(key,processor,content,openFileState);
break;
default :
throw new BookException("String_Node_Str");
}
return content;
}
  finally {
IOUtil.close(openFileState);
}
}

Fixed version (ground truth):
/** 
 * Get the text allotted for the given entry
 * @param key       The key to fetch
 * @param processor processor that executes before/after the content is read fromdisk or another kind of backend
 * @return String The data for the verse in question
 * @throws BookException If the data can not be read.
 */
public List<Content> readToOsis(Key key,RawTextToXmlProcessor processor) throws BookException {
  final List<Content> content=new ArrayList<Content>();
  T openFileState=null;
  try {
    openFileState=initState();
switch (this.bmd.getKeyType()) {
case LIST:
case TREE:
      readNormalOsis(key,processor,content,openFileState);
    break;
case VERSE:
  readPassageOsis(key,processor,content,openFileState);
break;
default :
throw new BookException("String_Node_Str");
}
return content;
}
  finally {
IOUtil.close(openFileState);
}
}
Program: 101432
Project: 101432
Buggy source:
@Override public boolean contains(Key key){
  ZVerseBackendState rafBook=null;
  try {
    rafBook=initState();
    String v11nName=getBookMetaData().getProperty(ConfigEntryType.VERSIFICATION).toString();
    Versification v11n=Versifications.instance().getVersification(v11nName);
    Verse verse=KeyUtil.getVerse(key);
    int index=verse.getOrdinal();
    Testament testament=v11n.getTestament(index);
    index=v11n.getTestamentOrdinal(index);
    RandomAccessFile compRaf=testament == Testament.NEW ? rafBook.getNtCompRaf() : rafBook.getOtCompRaf();
    if (compRaf == null) {
      return false;
    }
    byte[] temp=SwordUtil.readRAF(compRaf,1L * index * COMP_ENTRY_SIZE,COMP_ENTRY_SIZE);
    if (temp == null || temp.length == 0) {
      return false;
    }
    int verseSize=SwordUtil.decodeLittleEndian16(temp,8);
    return verseSize > 0;
  }
 catch (  IOException e) {
    return false;
  }
catch (  BookException e) {
    log.error("String_Node_Str",e);
    return false;
  }
 finally {
    IOUtil.close(rafBook);
  }
}

Fixed version (ground truth):
@Override public boolean contains(Key key){
  ZVerseBackendState rafBook=null;
  try {
    rafBook=initState();
    String v11nName=getBookMetaData().getProperty(ConfigEntryType.VERSIFICATION).toString();
    Versification v11n=Versifications.instance().getVersification(v11nName);
    Verse verse=KeyUtil.getVerse(key);
    int index=verse.getOrdinal();
    Testament testament=v11n.getTestament(index);
    index=v11n.getTestamentOrdinal(index);
    RandomAccessFile idxRaf=testament == Testament.NEW ? rafBook.getNtIdxRaf() : rafBook.getOtIdxRaf();
    if (idxRaf == null) {
      return false;
    }
    byte[] temp=SwordUtil.readRAF(idxRaf,1L * index * IDX_ENTRY_SIZE,IDX_ENTRY_SIZE);
    if (temp == null || temp.length == 0) {
      return false;
    }
    int verseSize=SwordUtil.decodeLittleEndian16(temp,8);
    return verseSize > 0;
  }
 catch (  IOException e) {
    return false;
  }
catch (  BookException e) {
    log.error("String_Node_Str",e);
    return false;
  }
 finally {
    IOUtil.close(rafBook);
  }
}
Program: 101433
Project: 101433
Buggy source:
@Override public Key getGlobalKeyList() throws BookException {
  ZVerseBackendState rafBook=null;
  try {
    rafBook=initState();
    String v11nName=getBookMetaData().getProperty(ConfigEntryType.VERSIFICATION).toString();
    Versification v11n=Versifications.instance().getVersification(v11nName);
    Testament[] testaments=new Testament[]{Testament.OLD,Testament.NEW};
    BitwisePassage passage=new RocketPassage(v11n);
    passage.raiseEventSuppresion();
    passage.raiseNormalizeProtection();
    for (    Testament currentTestament : testaments) {
      RandomAccessFile compRaf=currentTestament == Testament.NEW ? rafBook.getNtCompRaf() : rafBook.getOtCompRaf();
      if (compRaf == null) {
        continue;
      }
      int maxIndex=v11n.getCount(currentTestament) - 1;
      byte[] temp=SwordUtil.readRAF(compRaf,0,COMP_ENTRY_SIZE * maxIndex);
      for (int ii=0; ii < temp.length; ii+=COMP_ENTRY_SIZE) {
        int verseSize=SwordUtil.decodeLittleEndian16(temp,ii + 8);
        if (verseSize > 0) {
          int ordinal=ii / COMP_ENTRY_SIZE;
          passage.addVersifiedOrdinal(ordinal);
        }
      }
    }
    passage.lowerNormalizeProtection();
    passage.lowerEventSuppressionAndTest();
    return passage;
  }
 catch (  IOException e) {
    throw new BookException(JSMsg.gettext("String_Node_Str"));
  }
 finally {
    IOUtil.close(rafBook);
  }
}

Fixed version (ground truth):
@Override public Key getGlobalKeyList() throws BookException {
  ZVerseBackendState rafBook=null;
  try {
    rafBook=initState();
    String v11nName=getBookMetaData().getProperty(ConfigEntryType.VERSIFICATION).toString();
    Versification v11n=Versifications.instance().getVersification(v11nName);
    Testament[] testaments=new Testament[]{Testament.OLD,Testament.NEW};
    BitwisePassage passage=new RocketPassage(v11n);
    passage.raiseEventSuppresion();
    passage.raiseNormalizeProtection();
    for (    Testament currentTestament : testaments) {
      RandomAccessFile idxRaf=currentTestament == Testament.NEW ? rafBook.getNtIdxRaf() : rafBook.getOtIdxRaf();
      if (idxRaf == null) {
        continue;
      }
      int maxIndex=v11n.getCount(currentTestament) - 1;
      byte[] temp=SwordUtil.readRAF(idxRaf,0,IDX_ENTRY_SIZE * maxIndex);
      for (int ii=0; ii < temp.length; ii+=IDX_ENTRY_SIZE) {
        if (temp[ii + 8] != 0 || temp[ii + 9] != 0) {
          int ordinal=ii / IDX_ENTRY_SIZE;
          passage.addVersifiedOrdinal(v11n.getOrdinal(currentTestament,ordinal));
        }
      }
    }
    passage.lowerNormalizeProtection();
    passage.lowerEventSuppressionAndTest();
    return passage;
  }
 catch (  IOException e) {
    throw new BookException(JSMsg.gettext("String_Node_Str"));
  }
 finally {
    IOUtil.close(rafBook);
  }
}
Program: 101434
Project: 101434
Buggy source:
/** 
 * Experimental code.
 * @param raf
 */
public void dumpIdxRaf(RandomAccessFile raf){
  long end=-1;
  try {
    end=raf.length();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  int blockNum=0;
  StringBuilder buf=new StringBuilder();
  System.out.println("String_Node_Str");
  for (long offset=0; offset < end; offset+=IDX_ENTRY_SIZE) {
    byte[] temp=null;
    try {
      temp=SwordUtil.readRAF(raf,offset,IDX_ENTRY_SIZE);
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
    int blockStart=-1;
    int blockSize=-1;
    int uncompressedSize=-1;
    if (temp != null && temp.length > 0) {
      blockStart=SwordUtil.decodeLittleEndian32(temp,0);
      blockSize=SwordUtil.decodeLittleEndian32(temp,4);
      uncompressedSize=SwordUtil.decodeLittleEndian32(temp,8);
    }
    buf.setLength(0);
    buf.append(blockNum);
    buf.append('\t');
    buf.append(blockStart);
    buf.append('\t');
    buf.append(blockSize);
    buf.append('\t');
    buf.append(uncompressedSize);
    System.out.println(buf.toString());
  }
}

Fixed version (ground truth):
/** 
 * Experimental code.
 * @param v11n
 * @param ordinalStart
 * @param raf
 */
public void dumpIdxRaf(Versification v11n,int ordinalStart,RandomAccessFile raf){
  long end=-1;
  try {
    end=raf.length();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  int i=ordinalStart;
  StringBuilder buf=new StringBuilder();
  System.out.println("String_Node_Str");
  for (long offset=0; offset < end; offset+=IDX_ENTRY_SIZE) {
    byte[] temp=null;
    try {
      temp=SwordUtil.readRAF(raf,offset,IDX_ENTRY_SIZE);
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
    long blockNum=-1;
    int verseStart=-1;
    int verseSize=-1;
    if (temp != null && temp.length > 0) {
      blockNum=SwordUtil.decodeLittleEndian32(temp,0);
      verseStart=SwordUtil.decodeLittleEndian32(temp,4);
      verseSize=SwordUtil.decodeLittleEndian16(temp,8);
    }
    buf.setLength(0);
    buf.append(v11n.decodeOrdinal(i++).getOsisID());
    buf.append('\t');
    buf.append(blockNum);
    buf.append('\t');
    buf.append(verseStart);
    buf.append('\t');
    buf.append(verseSize);
    System.out.println(buf.toString());
  }
}
Program: 101435
Project: 101435
Buggy source:
/** 
 * Experimental code.
 * @param v11n
 * @param ordinalStart
 * @param raf
 */
public void dumpCompRaf(Versification v11n,int ordinalStart,RandomAccessFile raf){
  long end=-1;
  try {
    end=raf.length();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  int i=ordinalStart;
  StringBuilder buf=new StringBuilder();
  System.out.println("String_Node_Str");
  for (long offset=0; offset < end; offset+=COMP_ENTRY_SIZE) {
    byte[] temp=null;
    try {
      temp=SwordUtil.readRAF(raf,offset,COMP_ENTRY_SIZE);
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
    long blockNum=-1;
    int verseStart=-1;
    int verseSize=-1;
    if (temp != null && temp.length > 0) {
      blockNum=SwordUtil.decodeLittleEndian32(temp,0);
      verseStart=SwordUtil.decodeLittleEndian32(temp,4);
      verseSize=SwordUtil.decodeLittleEndian16(temp,8);
    }
    buf.setLength(0);
    buf.append(v11n.decodeOrdinal(i++).getOsisID());
    buf.append('\t');
    buf.append(blockNum);
    buf.append('\t');
    buf.append(verseStart);
    buf.append('\t');
    buf.append(verseSize);
    System.out.println(buf.toString());
  }
}

Fixed version (ground truth):
/** 
 * Experimental code.
 * @param raf
 */
public void dumpCompRaf(RandomAccessFile raf){
  long end=-1;
  try {
    end=raf.length();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  int blockNum=0;
  StringBuilder buf=new StringBuilder();
  System.out.println("String_Node_Str");
  for (long offset=0; offset < end; offset+=COMP_ENTRY_SIZE) {
    byte[] temp=null;
    try {
      temp=SwordUtil.readRAF(raf,offset,COMP_ENTRY_SIZE);
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
    int blockStart=-1;
    int blockSize=-1;
    int uncompressedSize=-1;
    if (temp != null && temp.length > 0) {
      blockStart=SwordUtil.decodeLittleEndian32(temp,0);
      blockSize=SwordUtil.decodeLittleEndian32(temp,4);
      uncompressedSize=SwordUtil.decodeLittleEndian32(temp,8);
    }
    buf.setLength(0);
    buf.append(blockNum);
    buf.append('\t');
    buf.append(blockStart);
    buf.append('\t');
    buf.append(blockSize);
    buf.append('\t');
    buf.append(uncompressedSize);
    System.out.println(buf.toString());
  }
}
Program: 101437
Project: 101437
Buggy source:
/** 
 * Where does this verse come in the Bible. The value that this returns should be treated as opaque, useful for a bit set. The introductions to the Book, OT/NT Testaments, Bible books and chapters are included here. <ul> <li>0 - INTRO_BIBLE 0:0 - The Book introduction</li> <li>1 - INTRO_OT 0:0 - The OT Testament introduction</li> <li>2 - Gen 0:0 - The introduction to the book of Genesis</li> <li>3 - Gen 1:0 - The introduction to Genesis chapter 1</li> <li>4 - Gen 1:1</li> <li>...</li> <li>35 - Gen 1:31</li> <li>36 - Gen 2:0 - The introduction to Genesis chapter 2</li> <li>37 - Gen 2:1</li> <li>...</li> <li>n - last verse in the OT</li> <li>n + 1 - INTRO_NT, 0, 0 - The New Testament introduction</li> <li>n + 2 - Matt 0:0 - The introduction to Matt</li> <li>n + 3 - Matt 1:0 - The introduction to Matt 1</li> <li>n + 4 - Matt 1:1</li> <li>...</li> </ul> If the verse is not in this versification, return 0.
 * @param verse The verse to convert
 * @return The ordinal number of verses
 */
public int getOrdinal(Verse verse){
  try {
    return chapterStarts[bookList.getOrdinal(verse.getBook())][verse.getChapter()] + verse.getVerse();
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    return 0;
  }
}

Fixed version (ground truth):
/** 
 * Determine the ordinal value for this versification given the ordinal value in a testament. If the ordinal is out of bounds it is constrained to be within the boundaries of the testament. This unwinds getTestamentOrdinal.
 * @param testament the testament in which the ordinal value pertains
 * @param testamentOrdinal the ordinal value within the testament
 * @return the ordinal value for the versification as a whole
 */
public int getOrdinal(Testament testament,int testamentOrdinal){
  int ordinal=testamentOrdinal >= 0 ? testamentOrdinal : 0;
  if (Testament.NEW == testament) {
    ordinal=otMaxOrdinal + testamentOrdinal;
    return ordinal <= ntMaxOrdinal ? ordinal : ntMaxOrdinal;
  }
  return ordinal <= otMaxOrdinal ? ordinal : otMaxOrdinal;
}
Program: 101439
Project: 101439
Buggy source:
@Override public Element processTag(Book book,Key key,Element ele,Attributes attrs){
  Element reference=null;
  String refstr=attrs.getValue("String_Node_Str");
  if (refstr != null) {
    Passage ref=null;
    try {
      ref=(Passage)book.getKey(refstr);
    }
 catch (    NoSuchKeyException ex) {
      DataPolice.report(book,key,"String_Node_Str" + refstr + "String_Node_Str"+ ex.getMessage());
    }
    String osisname=ref != null ? ref.getOsisRef() : refstr;
    reference=OSISUtil.factory().createReference();
    reference.setAttribute(OSISUtil.OSIS_ATTR_REF,osisname);
  }
 else {
    reference=OSISUtil.factory().createReference();
  }
  if (ele != null) {
    ele.addContent(reference);
  }
  return reference;
}

Fixed version (ground truth):
@Override public Element processTag(Book book,Key key,Element ele,Attributes attrs){
  Element reference=null;
  String refstr=attrs.getValue("String_Node_Str");
  if (refstr != null) {
    Passage ref=null;
    try {
      ref=(Passage)PassageKeyFactory.instance().getKey(Versifications.instance().getDefaultVersification(),refstr);
    }
 catch (    NoSuchKeyException ex) {
      DataPolice.report(book,key,"String_Node_Str" + refstr + "String_Node_Str"+ ex.getMessage());
    }
    String osisname=ref != null ? ref.getOsisRef() : refstr;
    reference=OSISUtil.factory().createReference();
    reference.setAttribute(OSISUtil.OSIS_ATTR_REF,osisname);
  }
 else {
    reference=OSISUtil.factory().createReference();
  }
  if (ele != null) {
    ele.addContent(reference);
  }
  return reference;
}
Program: 101440
Project: 101440
Buggy source:
@Override public void processContent(Book book,Key key,Element ele){
  String refstr=ele.getValue();
  try {
    if (ele.getAttribute(OSISUtil.OSIS_ATTR_REF) == null) {
      Passage ref=(Passage)book.getKey(refstr);
      String osisname=ref.getOsisRef();
      ele.setAttribute(OSISUtil.OSIS_ATTR_REF,osisname);
    }
  }
 catch (  NoSuchKeyException ex) {
    DataPolice.report(book,key,"String_Node_Str" + refstr + "String_Node_Str"+ ex.getMessage());
  }
}

Fixed version (ground truth):
@Override public void processContent(Book book,Key key,Element ele){
  String refstr=ele.getValue();
  try {
    if (ele.getAttribute(OSISUtil.OSIS_ATTR_REF) == null) {
      Key refKey=PassageKeyFactory.instance().getKey(Versifications.instance().getDefaultVersification(),refstr);
      if (refKey instanceof Passage) {
        Passage ref=(Passage)refKey;
        String osisname=ref.getOsisRef();
        ele.setAttribute(OSISUtil.OSIS_ATTR_REF,osisname);
      }
 else {
        DataPolice.report(book,key,"String_Node_Str");
      }
    }
  }
 catch (  NoSuchKeyException ex) {
    DataPolice.report(book,key,"String_Node_Str" + refstr + "String_Node_Str"+ ex.getMessage());
  }
}
Program: 101441
Project: 101441
Buggy source:
/** 
 * Reads a passage as OSIS
 * @param key the given key
 * @param processor a processor for which to do things with
 * @param content a list of content to be appended to (i.e. the OSIS data)
 * @param openFileState the open file state, from which we read things
 * @throws BookException a book exception if we failed to read the book
 */
private Verse readPassageOsis(Key key,RawTextToXmlProcessor processor,final List<Content> content,T openFileState) throws BookException {
  Verse currentVerse=null;
  try {
    final Passage ref=KeyUtil.getPassage(key);
    final Iterator<Key> rit=ref.rangeIterator(RestrictionType.CHAPTER);
    while (rit.hasNext()) {
      VerseRange range=(VerseRange)rit.next();
      processor.preRange(range,content);
      for (      Key verseInRange : range) {
        currentVerse=KeyUtil.getVerse(verseInRange);
        final String keyName=verseInRange.getName();
        String rawText=readRawContent(openFileState,currentVerse,keyName);
        processor.postVerse(verseInRange,content,rawText);
      }
    }
  }
 catch (  IOException e) {
    throwFailedKeyException(key,currentVerse,e);
  }
  return currentVerse;
}

Fixed version (ground truth):
/** 
 * Reads a passage as OSIS
 * @param key the given key
 * @param processor a processor for which to do things with
 * @param content a list of content to be appended to (i.e. the OSIS data)
 * @param openFileState the open file state, from which we read things
 * @throws BookException a book exception if we failed to read the book
 */
private Verse readPassageOsis(Key key,RawTextToXmlProcessor processor,final List<Content> content,T openFileState) throws BookException {
  Verse currentVerse=null;
  try {
    final Passage ref=KeyUtil.getPassage(key);
    final Iterator<Key> rit=ref.rangeIterator(RestrictionType.CHAPTER);
    while (rit.hasNext()) {
      VerseRange range=(VerseRange)rit.next();
      processor.preRange(range,content);
      for (      Key verseInRange : range) {
        currentVerse=KeyUtil.getVerse(verseInRange);
        String rawText=readRawContent(openFileState,currentVerse);
        processor.postVerse(verseInRange,content,rawText);
      }
    }
  }
 catch (  IOException e) {
    throwFailedKeyException(key,currentVerse,e);
  }
  return currentVerse;
}
Program: 101442
Project: 101442
Buggy source:
private void readNormalOsis(Key key,RawTextToXmlProcessor processor,List<Content> content,T openFileState) throws BookException {
  Iterator<Key> iterator=key.iterator();
  while (iterator.hasNext()) {
    Key next=iterator.next();
    String rawText;
    try {
      rawText=readRawContent(openFileState,next,next.getName());
      processor.postVerse(next,content,rawText);
    }
 catch (    IOException e) {
      throwFailedKeyException(key,next,e);
    }
  }
}

Fixed version (ground truth):
private void readNormalOsis(Key key,RawTextToXmlProcessor processor,List<Content> content,T openFileState) throws BookException {
  Iterator<Key> iterator=key.iterator();
  while (iterator.hasNext()) {
    Key next=iterator.next();
    String rawText;
    try {
      rawText=readRawContent(openFileState,next);
      processor.postVerse(next,content,rawText);
    }
 catch (    IOException e) {
      throwFailedKeyException(key,next,e);
    }
  }
}
Program: 101443
Project: 101443
Buggy source:
/** 
 * Construct a data entry.
 * @param name A name used for diagnostics.
 * @param data The data for this entry.
 * @param charset The character encoding for this entry.
 */
public DataEntry(String name,byte[] data,String charset){
  this.name=name;
  this.data=data.clone();
  this.charset=charset;
}

Fixed version (ground truth):
/** 
 * Construct a data entry.
 * @param name A name used for diagnostics.
 * @param data The data for this entry.
 * @param charset The character encoding for this entry.
 */
public DataEntry(String name,byte[] data,String charset){
  this.name=name;
  this.data=data.clone();
  this.charset=charset;
  this.keyEnd=SwordUtil.findByte(this.data,SEPARATOR);
}
Program: 101444
Project: 101444
Buggy source:
/** 
 * Get the key from this DataEntry.
 * @return the key
 */
public String getKey(){
  if (key == null) {
    keyEnd=SwordUtil.findByte(data,SEPARATOR);
    if (keyEnd < 0) {
      log.error("String_Node_Str" + name + "String_Node_Str");
      return "String_Node_Str";
    }
    key=SwordUtil.decode(name,data,keyEnd,charset).trim();
    if (key.endsWith("String_Node_Str")) {
      key=key.substring(0,key.length() - 1);
    }
  }
  return key;
}

Fixed version (ground truth):
/** 
 * Get the key from this DataEntry.
 * @return the key
 */
public String getKey(){
  if (key == null) {
    if (keyEnd < 0) {
      log.error("String_Node_Str" + name + "String_Node_Str");
      return "String_Node_Str";
    }
    key=SwordUtil.decode(name,data,keyEnd,charset).trim();
    if (key.endsWith("String_Node_Str")) {
      key=key.substring(0,key.length() - 1);
    }
  }
  return key;
}
Program: 101445
Project: 101445
Buggy source:
/** 
 * Get the raw text from this entry.
 * @param cipherKey the key, if any, to (un)lock the text
 * @return the raw text
 */
public String getRawText(byte[] cipherKey){
  int textStart=getKeyEnd() + 1;
  cipher(cipherKey,textStart);
  return SwordUtil.decode(name,data,textStart,data.length - textStart,charset).trim();
}

Fixed version (ground truth):
/** 
 * Get the raw text from this entry.
 * @param cipherKey the key, if any, to (un)lock the text
 * @return the raw text
 */
public String getRawText(byte[] cipherKey){
  int textStart=keyEnd + 1;
  cipher(cipherKey,textStart);
  return SwordUtil.decode(name,data,textStart,data.length - textStart,charset).trim();
}
Program: 101446
Project: 101446
Buggy source:
/** 
 * Get the position of the second \n in the data. This represents the end of the link and the start of the rest of the data.
 * @return the end of the link or -1 if not found.
 */
private int getLinkEnd(){
  if (linkEnd == 0) {
    linkEnd=SwordUtil.findByte(data,getKeyEnd() + 1,SEPARATOR);
  }
  return linkEnd;
}

Fixed version (ground truth):
/** 
 * Get the position of the second \n in the data. This represents the end of the link and the start of the rest of the data.
 * @return the end of the link or -1 if not found.
 */
private int getLinkEnd(){
  if (linkEnd == 0) {
    linkEnd=SwordUtil.findByte(data,keyEnd + 1,SEPARATOR);
    if (linkEnd == -1) {
      linkEnd=data.length - 1;
    }
  }
  return linkEnd;
}
Program: 101447
Project: 101447
Buggy source:
/** 
 * 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;
}

Fixed version (ground truth):
/** 
 * Determine whether this entry is an alias for another.
 * @return whether this is an alias entry
 */
public boolean isLinkEntry(){
  return keyEnd + 6 < data.length && data[keyEnd + 1] == '@' && data[keyEnd + 2] == 'L' && data[keyEnd + 3] == 'I' && data[keyEnd + 4] == 'N' && data[keyEnd + 5] == 'K';
}
Program: 101448
Project: 101448
Buggy source:
/** 
 * Get the link target for this entry. One entry can be chained to another. If the entry is not linked then it is an error to call this method.
 * @return the key to look up
 * @see #isLinkEntry()
 */
public String getLinkTarget(){
  int linkStart=getKeyEnd() + 6;
  int len=getLinkEnd() - linkStart + 1;
  return SwordUtil.decode(name,data,linkStart,len,charset).trim();
}

Fixed version (ground truth):
/** 
 * Get the link target for this entry. One entry can be chained to another. If the entry is not linked then it is an error to call this method.
 * @return the key to look up
 * @see #isLinkEntry()
 */
public String getLinkTarget(){
  int linkStart=keyEnd + 6;
  int len=getLinkEnd() - linkStart + 1;
  return SwordUtil.decode(name,data,linkStart,len,charset).trim();
}
Program: 101449
Project: 101449
Buggy source:
/** 
 * Get the block start and entry position.
 * @return the index of the block
 */
public DataIndex getBlockIndex(){
  int start=getKeyEnd() + 1;
  return new DataIndex(SwordUtil.decodeLittleEndian32(data,start),SwordUtil.decodeLittleEndian32(data,start + 4));
}

Fixed version (ground truth):
/** 
 * Get the block start and entry position.
 * @return the index of the block
 */
public DataIndex getBlockIndex(){
  int start=keyEnd + 1;
  return new DataIndex(SwordUtil.decodeLittleEndian32(data,start),SwordUtil.decodeLittleEndian32(data,start + 4));
}
Program: 101450
Project: 101450
Buggy source:
public String readRawContent(GenBookBackendState state,Key key,String keyName) throws IOException, BookException {
  TreeNode node=find(key);
  if (node == null) {
    throw new BookException(JSMsg.gettext("String_Node_Str",keyName,getBookMetaData().getInitials()));
  }
  byte[] userData=node.getUserData();
  if (userData.length == 8) {
    int start=SwordUtil.decodeLittleEndian32(userData,0);
    int size=SwordUtil.decodeLittleEndian32(userData,4);
    byte[] data=SwordUtil.readRAF(state.getBdtRaf(),start,size);
    decipher(data);
    return SwordUtil.decode(keyName,data,getBookMetaData().getBookCharset());
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
public String readRawContent(GenBookBackendState state,Key key) throws IOException, BookException {
  TreeNode node=find(key);
  if (node == null) {
    throw new BookException(JSMsg.gettext("String_Node_Str",key.getName(),getBookMetaData().getInitials()));
  }
  byte[] userData=node.getUserData();
  if (userData.length == 8) {
    int start=SwordUtil.decodeLittleEndian32(userData,0);
    int size=SwordUtil.decodeLittleEndian32(userData,4);
    byte[] data=SwordUtil.readRAF(state.getBdtRaf(),start,size);
    decipher(data);
    return SwordUtil.decode(key.getName(),data,getBookMetaData().getBookCharset());
  }
  return "String_Node_Str";
}
Program: 101451
Project: 101451
Buggy source:
public String getRawText(RawBackendState state,Key key) throws IOException {
  return readRawContent(state,key,key.getName());
}

Fixed version (ground truth):
public String getRawText(RawBackendState state,Key key) throws IOException {
  return readRawContent(state,key);
}
Program: 101452
Project: 101452
Buggy source:
public String readRawContent(RawBackendState state,Key key,String keyName) throws IOException {
  String v11nName=getBookMetaData().getProperty(ConfigEntryType.VERSIFICATION).toString();
  Versification v11n=Versifications.instance().getVersification(v11nName);
  Verse verse=KeyUtil.getVerse(key);
  int index=verse.getOrdinal();
  Testament testament=v11n.getTestament(index);
  index=v11n.getTestamentOrdinal(index);
  RawBackendState initState=null;
  try {
    initState=initState();
    RandomAccessFile idxRaf=testament == Testament.NEW ? state.getNtIdxRaf() : state.getOtIdxRaf();
    if (idxRaf == null) {
      return "String_Node_Str";
    }
    return getEntry(state,verse.getName(),testament,index);
  }
 catch (  BookException e) {
    return "String_Node_Str";
  }
 finally {
    OpenFileStateManager.release(initState);
  }
}

Fixed version (ground truth):
public String readRawContent(RawBackendState state,Key key) throws IOException {
  String v11nName=getBookMetaData().getProperty(ConfigEntryType.VERSIFICATION).toString();
  Versification v11n=Versifications.instance().getVersification(v11nName);
  Verse verse=KeyUtil.getVerse(key);
  int index=verse.getOrdinal();
  Testament testament=v11n.getTestament(index);
  index=v11n.getTestamentOrdinal(index);
  RawBackendState initState=null;
  try {
    initState=initState();
    RandomAccessFile idxRaf=testament == Testament.NEW ? state.getNtIdxRaf() : state.getOtIdxRaf();
    if (idxRaf == null) {
      return "String_Node_Str";
    }
    return getEntry(state,verse.getName(),testament,index);
  }
 catch (  BookException e) {
    return "String_Node_Str";
  }
 finally {
    OpenFileStateManager.release(initState);
  }
}
Program: 101453
Project: 101453
Buggy source:
/** 
 * Gets the resource bundle for a particular class
 * @param implementingClass the implementing class
 * @param className the class name
 * @param shortClassName the short class name
 * @param currentUserLocale the current user locale
 * @param localisedResourceMap the localised resource map
 * @return the resource bundle for class
 */
private ResourceBundle getResourceBundleForClass(Class<? extends MsgBase> implementingClass,String className,String shortClassName,Locale currentUserLocale,Map<String,ResourceBundle> localisedResourceMap){
  ResourceBundle resourceBundle;
synchronized (getClass()) {
    resourceBundle=localisedResourceMap.get(className);
    if (resourceBundle == null) {
      try {
        resourceBundle=ResourceBundle.getBundle(shortClassName,currentUserLocale,CWClassLoader.instance(implementingClass));
        localisedResourceMap.put(className,resourceBundle);
      }
 catch (      MissingResourceException ex) {
        log.warn("String_Node_Str" + className);
      }
    }
  }
  return resourceBundle;
}

Fixed version (ground truth):
/** 
 * Gets the resource bundle for a particular class
 * @param implementingClass the implementing class
 * @param className the class name
 * @param shortClassName the short class name
 * @param currentUserLocale the current user locale
 * @param localisedResourceMap the localised resource map
 * @return the resource bundle for class
 */
private ResourceBundle getResourceBundleForClass(Class<? extends MsgBase> implementingClass,String className,String shortClassName,Locale currentUserLocale,Map<String,ResourceBundle> localisedResourceMap){
  ResourceBundle resourceBundle;
synchronized (MsgBase.class) {
    resourceBundle=localisedResourceMap.get(className);
    if (resourceBundle == null) {
      try {
        resourceBundle=ResourceBundle.getBundle(shortClassName,currentUserLocale,CWClassLoader.instance(implementingClass));
        localisedResourceMap.put(className,resourceBundle);
      }
 catch (      MissingResourceException ex) {
        log.warn("String_Node_Str" + className);
      }
    }
  }
  return resourceBundle;
}
Program: 101454
Project: 101454
Buggy source:
public Iterator<Content> getOsisIterator(Key key,final boolean allowEmpty) throws BookException {
  final Filter filter=getFilter();
  Passage ref=KeyUtil.getPassage(getVersification(),key);
  final boolean showTitles=ref.hasRanges(RestrictionType.CHAPTER) || !allowEmpty;
  RawTextToXmlProcessor processor=new RawTextToXmlProcessor(){
    public void preRange(    VerseRange range,    List<Content> partialDom){
      if (showTitles) {
        Element title=OSISUtil.factory().createTitle();
        title.setAttribute(OSISUtil.OSIS_ATTR_TYPE,OSISUtil.GENERATED_CONTENT);
        title.addContent(range.getName());
        partialDom.add(title);
      }
    }
    public void postVerse(    Key verse,    List<Content> partialDom,    String rawText){
      if (allowEmpty || rawText.length() > 0) {
        List<Content> osisContent=filter.toOSIS(AbstractPassageBook.this,verse,rawText);
        addOSIS(verse,partialDom,osisContent);
      }
    }
    public void init(    List<Content> partialDom){
    }
  }
;
  return getOsis(ref,processor).iterator();
}

Fixed version (ground truth):
public Iterator<Content> getOsisIterator(Key key,final boolean allowEmpty) throws BookException {
  final Filter filter=getFilter();
  Passage ref=KeyUtil.getPassage(key);
  final boolean showTitles=ref.hasRanges(RestrictionType.CHAPTER) || !allowEmpty;
  RawTextToXmlProcessor processor=new RawTextToXmlProcessor(){
    public void preRange(    VerseRange range,    List<Content> partialDom){
      if (showTitles) {
        Element title=OSISUtil.factory().createTitle();
        title.setAttribute(OSISUtil.OSIS_ATTR_TYPE,OSISUtil.GENERATED_CONTENT);
        title.addContent(range.getName());
        partialDom.add(title);
      }
    }
    public void postVerse(    Key verse,    List<Content> partialDom,    String rawText){
      if (allowEmpty || rawText.length() > 0) {
        List<Content> osisContent=filter.toOSIS(AbstractPassageBook.this,verse,rawText);
        addOSIS(verse,partialDom,osisContent);
      }
    }
    public void init(    List<Content> partialDom){
    }
  }
;
  return getOsis(ref,processor).iterator();
}
Program: 101455
Project: 101455
Buggy source:
/** 
 * Reads a passage as OSIS
 * @param key the given key
 * @param processor a processor for which to do things with
 * @param content a list of content to be appended to (i.e. the OSIS data)
 * @param openFileState the open file state, from which we read things
 * @throws BookException a book exception if we failed to read the book
 */
private Verse readPassageOsis(Key key,RawTextToXmlProcessor processor,final List<Content> content,T openFileState) throws BookException {
  Verse currentVerse=null;
  try {
    final Passage ref=key instanceof Passage ? (Passage)key : KeyUtil.getPassage(getVersification(),key);
    final Iterator<Key> rit=ref.rangeIterator(RestrictionType.CHAPTER);
    while (rit.hasNext()) {
      VerseRange range=(VerseRange)rit.next();
      processor.preRange(range,content);
      for (      Key verseInRange : range) {
        currentVerse=KeyUtil.getVerse(getVersification(),verseInRange);
        final String keyName=verseInRange.getName();
        String rawText=readRawContent(openFileState,currentVerse,keyName);
        processor.postVerse(verseInRange,content,rawText);
      }
    }
  }
 catch (  IOException e) {
    throwFailedKeyException(key,currentVerse,e);
  }
  return currentVerse;
}

Fixed version (ground truth):
/** 
 * Reads a passage as OSIS
 * @param key the given key
 * @param processor a processor for which to do things with
 * @param content a list of content to be appended to (i.e. the OSIS data)
 * @param openFileState the open file state, from which we read things
 * @throws BookException a book exception if we failed to read the book
 */
private Verse readPassageOsis(Key key,RawTextToXmlProcessor processor,final List<Content> content,T openFileState) throws BookException {
  Verse currentVerse=null;
  try {
    final Passage ref=KeyUtil.getPassage(key);
    final Iterator<Key> rit=ref.rangeIterator(RestrictionType.CHAPTER);
    while (rit.hasNext()) {
      VerseRange range=(VerseRange)rit.next();
      processor.preRange(range,content);
      for (      Key verseInRange : range) {
        currentVerse=KeyUtil.getVerse(verseInRange);
        final String keyName=verseInRange.getName();
        String rawText=readRawContent(openFileState,currentVerse,keyName);
        processor.postVerse(verseInRange,content,rawText);
      }
    }
  }
 catch (  IOException e) {
    throwFailedKeyException(key,currentVerse,e);
  }
  return currentVerse;
}
Program: 101456
Project: 101456
Buggy source:
@Override public boolean contains(Key key){
  String v11nName=getBookMetaData().getProperty(ConfigEntryType.VERSIFICATION).toString();
  Versification v11n=Versifications.instance().getVersification(v11nName);
  Verse verse=KeyUtil.getVerse(v11n,key);
  RawBackendState initState=null;
  try {
    int index=verse.getOrdinal();
    Testament testament=v11n.getTestament(index);
    index=v11n.getTestamentOrdinal(index);
    initState=initState();
    RandomAccessFile idxRaf=testament == Testament.NEW ? initState.getNtIdxRaf() : initState.getOtIdxRaf();
    if (idxRaf == null) {
      return false;
    }
    DataIndex dataIndex=getIndex(idxRaf,index);
    return dataIndex.getSize() > 0;
  }
 catch (  IOException ex) {
    return false;
  }
catch (  BookException e) {
    return false;
  }
 finally {
    OpenFileStateManager.release(initState);
  }
}

Fixed version (ground truth):
@Override public boolean contains(Key key){
  String v11nName=getBookMetaData().getProperty(ConfigEntryType.VERSIFICATION).toString();
  Versification v11n=Versifications.instance().getVersification(v11nName);
  Verse verse=KeyUtil.getVerse(key);
  RawBackendState initState=null;
  try {
    int index=verse.getOrdinal();
    Testament testament=v11n.getTestament(index);
    index=v11n.getTestamentOrdinal(index);
    initState=initState();
    RandomAccessFile idxRaf=testament == Testament.NEW ? initState.getNtIdxRaf() : initState.getOtIdxRaf();
    if (idxRaf == null) {
      return false;
    }
    DataIndex dataIndex=getIndex(idxRaf,index);
    return dataIndex.getSize() > 0;
  }
 catch (  IOException ex) {
    return false;
  }
catch (  BookException e) {
    return false;
  }
 finally {
    OpenFileStateManager.release(initState);
  }
}
Program: 101457
Project: 101457
Buggy source:
public String readRawContent(RawBackendState state,Key key,String keyName) throws IOException {
  String v11nName=getBookMetaData().getProperty(ConfigEntryType.VERSIFICATION).toString();
  Versification v11n=Versifications.instance().getVersification(v11nName);
  Verse verse=KeyUtil.getVerse(v11n,key);
  int index=verse.getOrdinal();
  Testament testament=v11n.getTestament(index);
  index=v11n.getTestamentOrdinal(index);
  RandomAccessFile idxRaf=testament == Testament.NEW ? state.getNtIdxRaf() : state.getOtIdxRaf();
  if (idxRaf == null) {
    return "String_Node_Str";
  }
  return getEntry(state,verse.getName(),testament,index);
}

Fixed version (ground truth):
public String readRawContent(RawBackendState state,Key key,String keyName) throws IOException {
  String v11nName=getBookMetaData().getProperty(ConfigEntryType.VERSIFICATION).toString();
  Versification v11n=Versifications.instance().getVersification(v11nName);
  Verse verse=KeyUtil.getVerse(key);
  int index=verse.getOrdinal();
  Testament testament=v11n.getTestament(index);
  index=v11n.getTestamentOrdinal(index);
  RandomAccessFile idxRaf=testament == Testament.NEW ? state.getNtIdxRaf() : state.getOtIdxRaf();
  if (idxRaf == null) {
    return "String_Node_Str";
  }
  return getEntry(state,verse.getName(),testament,index);
}
Program: 101458
Project: 101458
Buggy source:
public void setRawText(RawFileBackendState state,Key key,String text) throws BookException, IOException {
  String v11nName=getBookMetaData().getProperty(ConfigEntryType.VERSIFICATION).toString();
  Versification v11n=Versifications.instance().getVersification(v11nName);
  Verse verse=KeyUtil.getVerse(v11n,key);
  int index=verse.getOrdinal();
  Testament testament=v11n.getTestament(index);
  index=v11n.getTestamentOrdinal(index);
  RandomAccessFile idxRaf;
  RandomAccessFile txtRaf;
  File txtFile;
  if (testament == Testament.NEW) {
    idxRaf=state.getNtIdxRaf();
    txtRaf=state.getNtTextRaf();
    txtFile=state.getNtTextFile();
  }
 else {
    idxRaf=state.getOtIdxRaf();
    txtRaf=state.getOtTextRaf();
    txtFile=state.getOtTextFile();
  }
  DataIndex dataIndex=getIndex(idxRaf,index);
  File dataFile;
  if (dataIndex.getSize() == 0) {
    dataFile=createDataTextFile(state.getIncfileValue());
    updateIndexFile(idxRaf,index,txtRaf.length());
    updateDataFile(state.getIncfileValue(),txtFile);
    checkAndIncrementIncfile(state,state.getIncfileValue());
  }
 else {
    dataFile=getDataTextFile(txtRaf,dataIndex);
  }
  byte[] textData=text.getBytes("String_Node_Str");
  encipher(textData);
  writeTextDataFile(dataFile,textData);
}

Fixed version (ground truth):
public void setRawText(RawFileBackendState state,Key key,String text) throws BookException, IOException {
  String v11nName=getBookMetaData().getProperty(ConfigEntryType.VERSIFICATION).toString();
  Versification v11n=Versifications.instance().getVersification(v11nName);
  Verse verse=KeyUtil.getVerse(key);
  int index=verse.getOrdinal();
  Testament testament=v11n.getTestament(index);
  index=v11n.getTestamentOrdinal(index);
  RandomAccessFile idxRaf;
  RandomAccessFile txtRaf;
  File txtFile;
  if (testament == Testament.NEW) {
    idxRaf=state.getNtIdxRaf();
    txtRaf=state.getNtTextRaf();
    txtFile=state.getNtTextFile();
  }
 else {
    idxRaf=state.getOtIdxRaf();
    txtRaf=state.getOtTextRaf();
    txtFile=state.getOtTextFile();
  }
  DataIndex dataIndex=getIndex(idxRaf,index);
  File dataFile;
  if (dataIndex.getSize() == 0) {
    dataFile=createDataTextFile(state.getIncfileValue());
    updateIndexFile(idxRaf,index,txtRaf.length());
    updateDataFile(state.getIncfileValue(),txtFile);
    checkAndIncrementIncfile(state,state.getIncfileValue());
  }
 else {
    dataFile=getDataTextFile(txtRaf,dataIndex);
  }
  byte[] textData=text.getBytes("String_Node_Str");
  encipher(textData);
  writeTextDataFile(dataFile,textData);
}
Program: 101459
Project: 101459
Buggy source:
public void setAliasKey(RawFileBackendState state,Key alias,Key source) throws IOException {
  String v11nName=getBookMetaData().getProperty(ConfigEntryType.VERSIFICATION).toString();
  Versification v11n=Versifications.instance().getVersification(v11nName);
  Verse aliasVerse=KeyUtil.getVerse(v11n,alias);
  Verse sourceVerse=KeyUtil.getVerse(v11n,source);
  int aliasIndex=aliasVerse.getOrdinal();
  Testament testament=v11n.getTestament(aliasIndex);
  aliasIndex=v11n.getTestamentOrdinal(aliasIndex);
  RandomAccessFile idxRaf=testament == Testament.NEW ? state.getNtIdxRaf() : state.getOtIdxRaf();
  int sourceOIndex=sourceVerse.getOrdinal();
  sourceOIndex=v11n.getTestamentOrdinal(sourceOIndex);
  DataIndex dataIndex=getIndex(idxRaf,sourceOIndex);
  updateIndexFile(idxRaf,aliasIndex,dataIndex.getOffset());
}

Fixed version (ground truth):
public void setAliasKey(RawFileBackendState state,Key alias,Key source) throws IOException {
  String v11nName=getBookMetaData().getProperty(ConfigEntryType.VERSIFICATION).toString();
  Versification v11n=Versifications.instance().getVersification(v11nName);
  Verse aliasVerse=KeyUtil.getVerse(alias);
  Verse sourceVerse=KeyUtil.getVerse(source);
  int aliasIndex=aliasVerse.getOrdinal();
  Testament testament=v11n.getTestament(aliasIndex);
  aliasIndex=v11n.getTestamentOrdinal(aliasIndex);
  RandomAccessFile idxRaf=testament == Testament.NEW ? state.getNtIdxRaf() : state.getOtIdxRaf();
  int sourceOIndex=sourceVerse.getOrdinal();
  sourceOIndex=v11n.getTestamentOrdinal(sourceOIndex);
  DataIndex dataIndex=getIndex(idxRaf,sourceOIndex);
  updateIndexFile(idxRaf,aliasIndex,dataIndex.getOffset());
}
Program: 101460
Project: 101460
Buggy source:
private void createIncfile(RawFileBackendState state) throws IOException, BookException {
  File tempIncfile=new File(SwordUtil.getExpandedDataPath(getBookMetaData()).getPath() + File.separator + INCFILE);
  if (!tempIncfile.exists() && !tempIncfile.createNewFile()) {
    throw new IOException("String_Node_Str");
  }
  state.setIncfile(tempIncfile);
}

Fixed version (ground truth):
private void createIncfile(RawFileBackendState state) throws IOException, BookException {
  File tempIncfile=new File(SwordUtil.getExpandedDataPath(getBookMetaData()).getPath() + File.separator + RawFileBackendState.INCFILE);
  if (!tempIncfile.exists() && !tempIncfile.createNewFile()) {
    throw new IOException("String_Node_Str");
  }
  state.setIncfile(tempIncfile);
}
Program: 101461
Project: 101461
Buggy source:
@Override public void addOSIS(Key key,List<Content> contentList,List<Content> osisContent){
  for (  Content content : osisContent) {
    if (content instanceof Element) {
      Element ele=(Element)content;
      if (ele.getName().equals(OSISUtil.OSIS_ELEMENT_VERSE)) {
        super.addOSIS(key,contentList,osisContent);
        return;
      }
    }
  }
  if (KeyUtil.getPassage(getVersification(),key).getVerseAt(0).getVerse() == 0) {
    super.addOSIS(key,contentList,osisContent);
  }
 else {
    Element everse=OSISUtil.factory().createVerse();
    everse.setAttribute(OSISUtil.OSIS_ATTR_OSISID,key.getOsisID());
    super.addOSIS(key,everse,osisContent);
    contentList.add(everse);
  }
}

Fixed version (ground truth):
@Override public void addOSIS(Key key,List<Content> contentList,List<Content> osisContent){
  for (  Content content : osisContent) {
    if (content instanceof Element) {
      Element ele=(Element)content;
      if (ele.getName().equals(OSISUtil.OSIS_ELEMENT_VERSE)) {
        super.addOSIS(key,contentList,osisContent);
        return;
      }
    }
  }
  if (KeyUtil.getVerse(key).getVerse() == 0) {
    super.addOSIS(key,contentList,osisContent);
  }
 else {
    Element everse=OSISUtil.factory().createVerse();
    everse.setAttribute(OSISUtil.OSIS_ATTR_OSISID,key.getOsisID());
    super.addOSIS(key,everse,osisContent);
    contentList.add(everse);
  }
}
Program: 101462
Project: 101462
Buggy source:
@Override public boolean contains(Key key){
  ZVerseBackendState rafBook=null;
  try {
    rafBook=initState();
    String v11nName=getBookMetaData().getProperty(ConfigEntryType.VERSIFICATION).toString();
    Versification v11n=Versifications.instance().getVersification(v11nName);
    Verse verse=KeyUtil.getVerse(v11n,key);
    int index=verse.getOrdinal();
    Testament testament=v11n.getTestament(index);
    index=v11n.getTestamentOrdinal(index);
    RandomAccessFile compRaf=testament == Testament.NEW ? rafBook.getNtCompRaf() : rafBook.getOtCompRaf();
    if (compRaf == null) {
      return false;
    }
    byte[] temp=SwordUtil.readRAF(compRaf,1L * index * COMP_ENTRY_SIZE,COMP_ENTRY_SIZE);
    if (temp == null || temp.length == 0) {
      return false;
    }
    int verseSize=SwordUtil.decodeLittleEndian16(temp,8);
    return verseSize > 0;
  }
 catch (  IOException e) {
    return false;
  }
catch (  BookException e) {
    log.fatal("String_Node_Str",e);
    return false;
  }
 finally {
    IOUtil.close(rafBook);
  }
}

Fixed version (ground truth):
@Override public boolean contains(Key key){
  ZVerseBackendState rafBook=null;
  try {
    rafBook=initState();
    String v11nName=getBookMetaData().getProperty(ConfigEntryType.VERSIFICATION).toString();
    Versification v11n=Versifications.instance().getVersification(v11nName);
    Verse verse=KeyUtil.getVerse(key);
    int index=verse.getOrdinal();
    Testament testament=v11n.getTestament(index);
    index=v11n.getTestamentOrdinal(index);
    RandomAccessFile compRaf=testament == Testament.NEW ? rafBook.getNtCompRaf() : rafBook.getOtCompRaf();
    if (compRaf == null) {
      return false;
    }
    byte[] temp=SwordUtil.readRAF(compRaf,1L * index * COMP_ENTRY_SIZE,COMP_ENTRY_SIZE);
    if (temp == null || temp.length == 0) {
      return false;
    }
    int verseSize=SwordUtil.decodeLittleEndian16(temp,8);
    return verseSize > 0;
  }
 catch (  IOException e) {
    return false;
  }
catch (  BookException e) {
    log.fatal("String_Node_Str",e);
    return false;
  }
 finally {
    IOUtil.close(rafBook);
  }
}