nus-yam/ex-repair huggingface dataset:
Program: 101658
Project: 101658
Buggy source:
/** 
 * Get a map of known implementors of some interface or abstract class. This is currently done by looking up a properties file by the name of the given class, and assuming that values are implementors of said class. Those that are not are warned, but ignored. The reply is in the form of a map of keys=strings, and values=classes in case you need to get at the names given to the classes in the properties file.
 * @see ClassUtil#getImplementors(Class)
 * @param clazz The class or interface to find implementors of.
 * @return The map of implementing classes.
 */
public static Map getImplementorsMap(Class clazz){
  Map matches=new HashMap();
  try {
    Properties props=ResourceUtil.getProperties(clazz);
    Iterator it=props.keySet().iterator();
    while (it.hasNext()) {
      try {
        String key=(String)it.next();
        String value=props.getProperty(key);
        Class impl=Class.forName(value);
        if (clazz.isAssignableFrom(impl)) {
          matches.put(key,impl);
        }
 else {
          log.warn("String_Node_Str" + impl.getName() + "String_Node_Str"+ clazz.getName()+ "String_Node_Str");
        }
      }
 catch (      Exception ex) {
        log.warn("String_Node_Str" + clazz.getName(),ex);
      }
    }
    log.debug("String_Node_Str" + matches.size() + "String_Node_Str"+ clazz.getName());
  }
 catch (  Exception ex) {
    log.error("String_Node_Str",ex);
  }
  return matches;
}

Fixed version (ground truth):
/** 
 * Get a map of known implementors of some interface or abstract class. This is currently done by looking up a properties file by the name of the given class, and assuming that values are implementors of said class. Those that are not are warned, but ignored. The reply is in the form of a map of keys=strings, and values=classes in case you need to get at the names given to the classes in the properties file.
 * @see ClassUtil#getImplementors(Class)
 * @param clazz The class or interface to find implementors of.
 * @return The map of implementing classes.
 */
public static Map getImplementorsMap(Class clazz){
  Map matches=new HashMap();
  try {
    Properties props=ResourceUtil.getProperties(clazz);
    Iterator it=props.keySet().iterator();
    while (it.hasNext()) {
      try {
        String key=(String)it.next();
        String value=props.getProperty(key);
        Class impl=Class.forName(value);
        if (clazz.isAssignableFrom(impl)) {
          matches.put(key,impl);
        }
 else {
          log.warn("String_Node_Str" + impl.getName() + "String_Node_Str"+ clazz.getName()+ "String_Node_Str");
        }
      }
 catch (      ClassNotFoundException ex) {
        log.warn("String_Node_Str" + clazz.getName(),ex);
      }
    }
    log.debug("String_Node_Str" + matches.size() + "String_Node_Str"+ clazz.getName());
  }
 catch (  IOException ex) {
    log.error("String_Node_Str",ex);
  }
  return matches;
}
Program: 101659
Project: 101659
Buggy source:
/** 
 * Get the known implementors of some interface or abstract class. This is currently done by looking up a properties file by the name of the given class, and assuming that values are implementors of said class. Those that are not are warned, but ignored.
 * @param clazz The class or interface to find implementors of.
 * @return The list of implementing classes.
 */
public static Class[] getImplementors(Class clazz){
  try {
    List matches=new ArrayList();
    Properties props=ResourceUtil.getProperties(clazz);
    Iterator it=props.values().iterator();
    while (it.hasNext()) {
      try {
        String name=(String)it.next();
        Class impl=Class.forName(name);
        if (clazz.isAssignableFrom(impl)) {
          matches.add(impl);
        }
 else {
          log.warn("String_Node_Str" + impl.getName() + "String_Node_Str"+ clazz.getName()+ "String_Node_Str");
        }
      }
 catch (      Exception ex) {
        log.warn("String_Node_Str" + clazz.getName(),ex);
      }
    }
    log.debug("String_Node_Str" + matches.size() + "String_Node_Str"+ clazz.getName());
    return (Class[])matches.toArray(new Class[matches.size()]);
  }
 catch (  Exception ex) {
    log.error("String_Node_Str",ex);
    return new Class[0];
  }
}

Fixed version (ground truth):
/** 
 * Get the known implementors of some interface or abstract class. This is currently done by looking up a properties file by the name of the given class, and assuming that values are implementors of said class. Those that are not are warned, but ignored.
 * @param clazz The class or interface to find implementors of.
 * @return The list of implementing classes.
 */
public static Class[] getImplementors(Class clazz){
  try {
    List matches=new ArrayList();
    Properties props=ResourceUtil.getProperties(clazz);
    Iterator it=props.values().iterator();
    while (it.hasNext()) {
      try {
        String name=(String)it.next();
        Class impl=Class.forName(name);
        if (clazz.isAssignableFrom(impl)) {
          matches.add(impl);
        }
 else {
          log.warn("String_Node_Str" + impl.getName() + "String_Node_Str"+ clazz.getName()+ "String_Node_Str");
        }
      }
 catch (      ClassNotFoundException ex) {
        log.warn("String_Node_Str" + clazz.getName(),ex);
      }
    }
    log.debug("String_Node_Str" + matches.size() + "String_Node_Str"+ clazz.getName());
    return (Class[])matches.toArray(new Class[matches.size()]);
  }
 catch (  IOException ex) {
    log.error("String_Node_Str",ex);
    return new Class[0];
  }
}
Program: 101660
Project: 101660
Buggy source:
/** 
 * Creates a class loader that finds resources for the calling class that may not be in the class' package. Use this only within classes that are directly looking up their resources.
 */
public CWClassLoader(){
  owner=CallContext.getCallingClass();
}

Fixed version (ground truth):
/** 
 * Creates a class loader that finds resources for the calling class that may not be in the class' package. Use this only within classes that are directly looking up their resources.
 */
CWClassLoader(){
  owner=CallContext.getCallingClass();
}
Program: 101661
Project: 101661
Buggy source:
/** 
 * Initialise any resource bundles
 */
protected final void loadResources(){
  Class implementingClass=getClass();
  String className=implementingClass.getName();
synchronized (MsgBase.class) {
    resources=(ResourceBundle)resourceMap.get(className);
    if (resources == null) {
      Locale defaultLocale=Locale.getDefault();
      try {
        resources=ResourceBundle.getBundle(className,defaultLocale,new CWClassLoader(implementingClass));
        resourceMap.put(className,resources);
      }
 catch (      MissingResourceException ex) {
        log.warn("String_Node_Str" + className + "String_Node_Str"+ name);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Initialise any resource bundles
 */
protected final void loadResources(){
  Class implementingClass=getClass();
  String className=implementingClass.getName();
synchronized (MsgBase.class) {
    resources=(ResourceBundle)resourceMap.get(className);
    if (resources == null) {
      Locale defaultLocale=Locale.getDefault();
      try {
        resources=ResourceBundle.getBundle(className,defaultLocale,CWClassLoader.instance(implementingClass));
        resourceMap.put(className,resources);
      }
 catch (      MissingResourceException ex) {
        log.warn("String_Node_Str" + className + "String_Node_Str"+ name);
      }
    }
  }
}
Program: 101662
Project: 101662
Buggy source:
/** 
 * Generic resource URL fetcher. One way or the other we'll find it! Either as a relative or an absolute reference.
 * @param clazz The resource to find
 * @return The requested resource
 * @throws MissingResourceException if the resource can not be found
 */
public static URL getResource(Class clazz,String resourceName) throws MissingResourceException {
  URL resource=new CWClassLoader(clazz).findResource(resourceName);
  if (resource == null) {
    throw new MissingResourceException(Msg.NO_RESOURCE.toString(resourceName),clazz.getName(),resourceName);
  }
  return resource;
}

Fixed version (ground truth):
/** 
 * Generic resource URL fetcher. One way or the other we'll find it! Either as a relative or an absolute reference.
 * @param clazz The resource to find
 * @return The requested resource
 * @throws MissingResourceException if the resource can not be found
 */
public static URL getResource(Class clazz,String resourceName) throws MissingResourceException {
  URL resource=CWClassLoader.instance(clazz).findResource(resourceName);
  if (resource == null) {
    throw new MissingResourceException(Msg.NO_RESOURCE.toString(resourceName),clazz.getName(),resourceName);
  }
  return resource;
}
Program: 101663
Project: 101663
Buggy source:
public List toOSIS(Key key,String plain){
  DataPolice.setKey(key);
  Element ele=null;
  Exception ex=null;
  try {
    ele=parse(XMLUtil.cleanAllEntities(plain));
  }
 catch (  JDOMException e) {
    ex=e;
  }
catch (  IOException e) {
    ex=e;
  }
 finally {
    if (ex != null) {
      DataPolice.report("String_Node_Str" + ex.getMessage() + "String_Node_Str"+ plain);
    }
    DataPolice.setKey(null);
  }
  if (ex != null) {
    ele=cleanTags(plain);
  }
  if (ele == null) {
    ele=OSISUtil.factory().createP();
  }
  return ele.removeContent();
}

Fixed version (ground truth):
public List toOSIS(Key key,String plain){
  DataPolice.setKey(key);
  Element ele=null;
  Exception ex=null;
  try {
    ele=parse(XMLUtil.cleanAllEntities(plain));
  }
 catch (  JDOMException e) {
    ex=e;
  }
catch (  IOException e) {
    ex=e;
  }
 finally {
    DataPolice.setKey(null);
  }
  if (ex != null) {
    DataPolice.report("String_Node_Str" + ex.getMessage() + "String_Node_Str"+ plain);
    ele=cleanTags(plain);
  }
  if (ele == null) {
    ele=OSISUtil.factory().createP();
  }
  return ele.removeContent();
}
Program: 101664
Project: 101664
Buggy source:
public List toOSIS(Key key,String plain){
  DataPolice.setKey(key);
  Element ele=null;
  Exception ex=null;
  try {
    ele=parse(XMLUtil.cleanAllEntities(plain));
  }
 catch (  SAXException e) {
    ex=e;
  }
catch (  IOException e) {
    ex=e;
  }
catch (  ParserConfigurationException e) {
    ex=e;
  }
 finally {
    if (ex != null) {
      DataPolice.report("String_Node_Str" + ex.getMessage() + "String_Node_Str"+ plain);
    }
    DataPolice.setKey(null);
  }
  if (ex != null) {
    ele=cleanTags(plain);
  }
  if (ele == null) {
    ele=OSISUtil.factory().createP();
  }
  return ele.removeContent();
}

Fixed version (ground truth):
public List toOSIS(Key key,String plain){
  DataPolice.setKey(key);
  Element ele=null;
  Exception ex=null;
  try {
    ele=parse(XMLUtil.cleanAllEntities(plain));
  }
 catch (  SAXException e) {
    ex=e;
  }
catch (  IOException e) {
    ex=e;
  }
catch (  ParserConfigurationException e) {
    ex=e;
  }
 finally {
    DataPolice.setKey(null);
  }
  if (ex != null) {
    DataPolice.report("String_Node_Str" + ex.getMessage() + "String_Node_Str"+ plain);
    ele=cleanTags(plain);
  }
  if (ele == null) {
    ele=OSISUtil.factory().createP();
  }
  return ele.removeContent();
}
Program: 101665
Project: 101665
Buggy source:
/** 
 * Constructor for ReadingsBook.
 */
public ReadingsBook(ReadingsBookDriver driver,BookCategory type){
  super(null);
  String setname=ReadingsBookDriver.getReadingsSet();
  Locale defaultLocale=Locale.getDefault();
  ResourceBundle prop=ResourceBundle.getBundle(setname,defaultLocale,new CWClassLoader(ReadingsBookDriver.class));
  String name=Msg.TITLE.toString();
  try {
    name=prop.getString("String_Node_Str");
  }
 catch (  MissingResourceException e) {
    log.warn("String_Node_Str" + setname);
  }
  DefaultBookMetaData bmd=new DefaultBookMetaData(driver,name,type);
  bmd.setInitials(setname);
  setBookMetaData(bmd);
  Calendar greg=new GregorianCalendar(1972,Calendar.JANUARY,1);
  while (greg.get(Calendar.YEAR) == 1972) {
    String internalKey=ReadingsKey.external2internal(greg);
    String readings="String_Node_Str";
    try {
      readings=prop.getString(internalKey);
    }
 catch (    MissingResourceException e) {
      log.warn("String_Node_Str" + internalKey + "String_Node_Str"+ setname);
    }
    hash.put(new ReadingsKey(greg.getTime()),readings);
    greg.add(Calendar.DATE,1);
  }
  global=new SetKeyList(hash.keySet(),getName());
}

Fixed version (ground truth):
/** 
 * Constructor for ReadingsBook.
 */
public ReadingsBook(ReadingsBookDriver driver,BookCategory type){
  super(null);
  String setname=ReadingsBookDriver.getReadingsSet();
  Locale defaultLocale=Locale.getDefault();
  ResourceBundle prop=ResourceBundle.getBundle(setname,defaultLocale,CWClassLoader.instance(ReadingsBookDriver.class));
  String name=Msg.TITLE.toString();
  try {
    name=prop.getString("String_Node_Str");
  }
 catch (  MissingResourceException e) {
    log.warn("String_Node_Str" + setname);
  }
  DefaultBookMetaData bmd=new DefaultBookMetaData(driver,name,type);
  bmd.setInitials(setname);
  setBookMetaData(bmd);
  Calendar greg=new GregorianCalendar(1972,Calendar.JANUARY,1);
  while (greg.get(Calendar.YEAR) == 1972) {
    String internalKey=ReadingsKey.external2internal(greg);
    String readings="String_Node_Str";
    try {
      readings=prop.getString(internalKey);
    }
 catch (    MissingResourceException e) {
      log.warn("String_Node_Str" + internalKey + "String_Node_Str"+ setname);
    }
    hash.put(new ReadingsKey(greg.getTime()),readings);
    greg.add(Calendar.DATE,1);
  }
  global=new SetKeyList(hash.keySet(),getName());
}
Program: 101666
Project: 101666
Buggy source:
public String getRawText(Key key) throws BookException {
  checkActive();
  String charset=getBookMetaData().getBookCharset();
  if (!(key instanceof IndexKey)) {
    throw new BookException(Msg.BAD_KEY,new Object[]{ClassUtil.getShortClassName(key.getClass()),key.getName()});
  }
  IndexKey ikey=(IndexKey)key;
  try {
    byte[] data=SwordUtil.readRAF(datRaf,ikey.offset,ikey.size);
    int keyend=SwordUtil.findByte(data,SEPARATOR);
    if (keyend == -1) {
      throw new BookException(Msg.READ_FAIL);
    }
    int remainder=data.length - (keyend + 1);
    byte[] reply=new byte[remainder];
    System.arraycopy(data,keyend + 1,reply,0,remainder);
    return SwordUtil.decode(key,reply,charset).trim();
  }
 catch (  IOException ex) {
    throw new BookException(Msg.READ_FAIL,ex);
  }
}

Fixed version (ground truth):
public String getRawText(Key key) throws BookException {
  checkActive();
  String charset=getBookMetaData().getBookCharset();
  if (!(key instanceof IndexKey)) {
    throw new BookException(Msg.BAD_KEY,new Object[]{ClassUtil.getShortClassName(key.getClass()),key.getName()});
  }
  IndexKey ikey=(IndexKey)key;
  try {
    byte[] data=SwordUtil.readRAF(datRaf,ikey.getOffset(),ikey.getSize());
    int keyend=SwordUtil.findByte(data,SEPARATOR);
    if (keyend == -1) {
      throw new BookException(Msg.READ_FAIL);
    }
    int remainder=data.length - (keyend + 1);
    byte[] reply=new byte[remainder];
    System.arraycopy(data,keyend + 1,reply,0,remainder);
    return SwordUtil.decode(key,reply,charset).trim();
  }
 catch (  IOException ex) {
    throw new BookException(Msg.READ_FAIL,ex);
  }
}
Program: 101668
Project: 101668
Buggy source:
public Key getKey(String name) throws NoSuchKeyException {
  return createPassage(name);
}

Fixed version (ground truth):
public Key getKey(String name) throws NoSuchKeyException {
  try {
    return defaultType.createPassage(name);
  }
 catch (  Exception e) {
    return defaultType.createPassage(normalize(name));
  }
}
Program: 101669
Project: 101669
Buggy source:
/** 
 * Set the default reference type. Must be one of:<ul> <li>PassageFactory.SPEED <li>PassageFactory.WRITE_SPEED <li>PassageFactory.SIZE <li>PassageFactory.MIX <li>PassageFactory.TALLY </ul>
 * @param defaultType The new default type.
 */
public static void setDefaultPassage(int defaultType){
  PassageKeyFactory.defaultType=defaultType;
}

Fixed version (ground truth):
/** 
 * Set the default reference type. Must be one of:<ul> <li>PassageType.SPEED <li>PassageType.WRITE_SPEED <li>PassageType.SIZE <li>PassageType.MIX <li>PassageType.TALLY </ul>
 * @param newDefaultType The new default type.
 */
public static void setDefaultPassage(int newDefaultType){
  PassageKeyFactory.defaultType=PassageType.fromInteger(newDefaultType);
}
Program: 101671
Project: 101671
Buggy source:
public Key createEmptyKeyList(){
  return createPassage();
}

Fixed version (ground truth):
public Key createEmptyKeyList(){
  return defaultType.createEmptyPassage();
}
Program: 101672
Project: 101672
Buggy source:
/** 
 * Get the default reference type.
 * @return default_type The new default type.
 * @see PassageKeyFactory#setDefaultPassage
 */
public static int getDefaultPassage(){
  return defaultType;
}

Fixed version (ground truth):
/** 
 * Get the default reference type.
 * @return default_type The new default type.
 * @see PassageKeyFactory#setDefaultPassage
 */
public static int getDefaultPassage(){
  return PassageType.toInteger(defaultType);
}
Program: 101673
Project: 101673
Buggy source:
public void run(){
  URL predicturl=Project.instance().getWritablePropertiesURL("String_Node_Str");
  Job job=JobManager.createJob(Msg.INSTALLING.toString(sbmd.getName()),predicturl,this,true);
  yield();
  try {
    job.setProgress(Msg.JOB_INIT.toString());
    URL temp=NetUtil.getTemporaryURL("String_Node_Str",ZIP_SUFFIX);
    download(job,directory + '/' + PACKAGE_DIR,sbmd.getInitials() + ZIP_SUFFIX,temp);
    job.setInterruptable(false);
    File dldir=SwordBookPath.getDownloadDir();
    if (!job.isFinished()) {
      IOUtil.unpackZip(NetUtil.getAsFile(temp),dldir);
      job.setProgress(Msg.JOB_CONFIG.toString());
      SwordBookDriver.registerNewBook(sbmd);
    }
  }
 catch (  IOException e) {
    Reporter.informUser(this,e);
    job.ignoreTimings();
  }
catch (  InstallException e) {
    Reporter.informUser(this,e);
    job.ignoreTimings();
  }
catch (  BookException e) {
    Reporter.informUser(this,e);
    job.ignoreTimings();
  }
 finally {
    job.done();
  }
}

Fixed version (ground truth):
public void run(){
  URL predicturl=Project.instance().getWritablePropertiesURL("String_Node_Str");
  Job job=JobManager.createJob(Msg.INSTALLING.toString(sbmd.getName()),predicturl,this,true);
  yield();
  try {
    job.setProgress(Msg.JOB_INIT.toString());
    URL temp=NetUtil.getTemporaryURL("String_Node_Str",ZIP_SUFFIX);
    download(job,directory + '/' + PACKAGE_DIR,sbmd.getInitials() + ZIP_SUFFIX,temp);
    job.setInterruptable(false);
    if (!job.isFinished()) {
      File dldir=SwordBookPath.getDownloadDir();
      IOUtil.unpackZip(NetUtil.getAsFile(temp),dldir);
      job.setProgress(Msg.JOB_CONFIG.toString());
      sbmd.setLibrary(NetUtil.getURL(dldir));
      SwordBookDriver.registerNewBook(sbmd);
    }
  }
 catch (  IOException e) {
    Reporter.informUser(this,e);
    job.ignoreTimings();
  }
catch (  InstallException e) {
    Reporter.informUser(this,e);
    job.ignoreTimings();
  }
catch (  BookException e) {
    Reporter.informUser(this,e);
    job.ignoreTimings();
  }
 finally {
    job.done();
  }
}
Program: 101674
Project: 101674
Buggy source:
public void install(Book book){
  if (Books.installed().getBook(book.getName()) != null) {
    return;
  }
  final SwordBookMetaData sbmd=(SwordBookMetaData)book.getBookMetaData();
  final Thread worker=new Thread("String_Node_Str"){
    public void run(){
      URL predicturl=Project.instance().getWritablePropertiesURL("String_Node_Str");
      Job job=JobManager.createJob(Msg.INSTALLING.toString(sbmd.getName()),predicturl,this,true);
      yield();
      try {
        job.setProgress(Msg.JOB_INIT.toString());
        URL temp=NetUtil.getTemporaryURL("String_Node_Str",ZIP_SUFFIX);
        download(job,directory + '/' + PACKAGE_DIR,sbmd.getInitials() + ZIP_SUFFIX,temp);
        job.setInterruptable(false);
        File dldir=SwordBookPath.getDownloadDir();
        if (!job.isFinished()) {
          IOUtil.unpackZip(NetUtil.getAsFile(temp),dldir);
          job.setProgress(Msg.JOB_CONFIG.toString());
          SwordBookDriver.registerNewBook(sbmd);
        }
      }
 catch (      IOException e) {
        Reporter.informUser(this,e);
        job.ignoreTimings();
      }
catch (      InstallException e) {
        Reporter.informUser(this,e);
        job.ignoreTimings();
      }
catch (      BookException e) {
        Reporter.informUser(this,e);
        job.ignoreTimings();
      }
 finally {
        job.done();
      }
    }
  }
;
  worker.setPriority(Thread.MIN_PRIORITY);
  worker.start();
}

Fixed version (ground truth):
public void install(Book book){
  if (Books.installed().getBook(book.getName()) != null) {
    return;
  }
  final SwordBookMetaData sbmd=(SwordBookMetaData)book.getBookMetaData();
  final Thread worker=new Thread("String_Node_Str"){
    public void run(){
      URL predicturl=Project.instance().getWritablePropertiesURL("String_Node_Str");
      Job job=JobManager.createJob(Msg.INSTALLING.toString(sbmd.getName()),predicturl,this,true);
      yield();
      try {
        job.setProgress(Msg.JOB_INIT.toString());
        URL temp=NetUtil.getTemporaryURL("String_Node_Str",ZIP_SUFFIX);
        download(job,directory + '/' + PACKAGE_DIR,sbmd.getInitials() + ZIP_SUFFIX,temp);
        job.setInterruptable(false);
        if (!job.isFinished()) {
          File dldir=SwordBookPath.getDownloadDir();
          IOUtil.unpackZip(NetUtil.getAsFile(temp),dldir);
          job.setProgress(Msg.JOB_CONFIG.toString());
          sbmd.setLibrary(NetUtil.getURL(dldir));
          SwordBookDriver.registerNewBook(sbmd);
        }
      }
 catch (      IOException e) {
        Reporter.informUser(this,e);
        job.ignoreTimings();
      }
catch (      InstallException e) {
        Reporter.informUser(this,e);
        job.ignoreTimings();
      }
catch (      BookException e) {
        Reporter.informUser(this,e);
        job.ignoreTimings();
      }
 finally {
        job.done();
      }
    }
  }
;
  worker.setPriority(Thread.MIN_PRIORITY);
  worker.start();
}
Program: 101677
Project: 101677
Buggy source:
/** 
 * Loads a sword config from a given Reader. The returned BookMetaData object will not be associated with a Book so setBook() should be called before getBook() is expected to return anything other than null.
 */
public SwordBookMetaData(Reader in,String internal) throws IOException {
  cet=new ConfigEntryTable(in,internal);
  buildProperties();
}

Fixed version (ground truth):
/** 
 * Loads a sword config from a buffer. The returned BookMetaData object will not be associated with a Book so setBook() should be called before getBook() is expected to return anything other than null.
 * @param buffer
 * @param internal
 * @throws IOException
 */
public SwordBookMetaData(byte[] buffer,String internal) throws IOException {
  Reader in=new InputStreamReader(new ByteArrayInputStream(buffer),ENCODING_LATIN1);
  cet=new ConfigEntryTable(in,internal);
  if (!ENCODING_LATIN1.equals(getBookCharset())) {
    in=new InputStreamReader(new ByteArrayInputStream(buffer),ENCODING_UTF8);
    cet=new ConfigEntryTable(in,internal);
  }
  buildProperties();
}
Program: 101678
Project: 101678
Buggy source:
private int keyrand(int limit,byte[] key){
  int u;
  if (limit == 0) {
    return 0;
  }
  int retry_limiter=0;
  int mask=1;
  while (mask < limit) {
    mask=(mask << 1) + 1;
  }
  do {
    rsum=(cards[rsum] + (key[keypos++] & 0xFF)) & 0xFF;
    if (keypos >= key.length) {
      keypos=0;
      rsum+=key.length;
    }
    u=mask & rsum;
    if (++retry_limiter > 11) {
      u%=limit;
    }
  }
 while (u > limit);
  return u;
}

Fixed version (ground truth):
private int keyrand(int limit,byte[] key){
  int u;
  if (limit == 0) {
    return 0;
  }
  int retry_limiter=0;
  int mask=1;
  while (mask < limit) {
    mask=(mask << 1) + 1;
  }
  do {
    rsum=(cards[rsum] + (key[keypos++] & 0xFF)) & 0xFF;
    if (keypos >= key.length) {
      keypos=0;
      rsum+=key.length;
      rsum&=0xFF;
    }
    u=mask & rsum;
    if (++retry_limiter > 11) {
      u%=limit;
    }
  }
 while (u > limit);
  return u;
}
Program: 101679
Project: 101679
Buggy source:
public Element processTag(Element ele,Attributes attrs){
  Element q=OSISUtil.factory().createQ();
  ele.addContent(q);
  return q;
}

Fixed version (ground truth):
public Element processTag(Element ele,Attributes attrs){
  Element q=OSISUtil.factory().createQ();
  ele.setAttribute(OSISUtil.ATTRIBUTE_Q_TYPE,OSISUtil.Q_BLOCK);
  ele.addContent(q);
  return q;
}
Program: 101680
Project: 101680
Buggy source:
public Element processTag(Element ele,Attributes attrs){
  Element p=OSISUtil.factory().createP();
  ele.addContent(p);
  return p;
}

Fixed version (ground truth):
public Element processTag(Element ele,Attributes attrs){
  Element lb=OSISUtil.factory().createLB();
  ele.addContent(lb);
  return lb;
}
Program: 101681
Project: 101681
Buggy source:
public Element processTag(Element ele,Attributes attrs){
  Element q=OSISUtil.factory().createQ();
  ele.addContent(q);
  return q;
}

Fixed version (ground truth):
public Element processTag(Element ele,Attributes attrs){
  Element q=OSISUtil.factory().createQ();
  ele.setAttribute(OSISUtil.ATTRIBUTE_Q_TYPE,OSISUtil.Q_BLOCK);
  ele.addContent(q);
  return q;
}
Program: 101682
Project: 101682
Buggy source:
public void endElement(String uri,String localname,String qname){
  Element finished=(Element)stack.removeFirst();
  if (stack.size() == 0) {
    rootElement=finished;
  }
}

Fixed version (ground truth):
public void endElement(String uri,String localname,String qname){
  Element finished=(Element)stack.removeFirst();
  Tag t=getTag(localname,qname);
  t.processContent(finished);
  if (stack.size() == 0) {
    rootElement=finished;
  }
}
Program: 101683
Project: 101683
Buggy source:
public void startElement(String uri,String localname,String qname,Attributes attrs) throws SAXException {
  Element ele=null;
  if (stack.size() > 0) {
    ele=(Element)stack.getFirst();
    if (ele == null) {
      return;
    }
  }
  Tag t=(Tag)TAG_MAP.get(qname);
  if (t == null) {
    t=(Tag)TAG_MAP.get(qname.toLowerCase());
    if (t == null) {
      log.warn("String_Node_Str" + localname + "String_Node_Str"+ qname);
      return;
    }
    DataPolice.report("String_Node_Str" + qname);
  }
  stack.addFirst(t.processTag(ele,attrs));
}

Fixed version (ground truth):
public void startElement(String uri,String localname,String qname,Attributes attrs) throws SAXException {
  Element ele=null;
  if (stack.size() > 0) {
    ele=(Element)stack.getFirst();
    if (ele == null) {
      return;
    }
  }
  Tag t=getTag(localname,qname);
  stack.addFirst(t.processTag(ele,attrs));
}
Program: 101684
Project: 101684
Buggy source:
public Element processTag(Element ele,Attributes attrs){
  Element list=OSISUtil.factory().createList();
  ele.addContent(list);
  return list;
}

Fixed version (ground truth):
public Element processTag(Element ele,Attributes attrs){
  Element list=OSISUtil.factory().createList();
  ele.setAttribute(OSISUtil.ATTRIBUTE_LIST_TYPE,OSISUtil.LIST_ORDERED);
  ele.addContent(list);
  return list;
}
Program: 101685
Project: 101685
Buggy source:
public void provideSAXEvents(ContentHandler handler) throws SAXException {
  try {
    Source src_in=new SAXSource(new SAXEventProviderXMLReader(xmlsep),new SAXEventProviderInputSource());
    TemplateInfo tinfo=getTemplateInfo();
    SAXResult res_out=new SAXResult(handler);
    Transformer transformer=tinfo.getTemplates().newTransformer();
    for (Iterator it=outputs.keySet().iterator(); it.hasNext(); ) {
      String key=(String)it.next();
      String val=getOutputProperty(key);
      transformer.setOutputProperty(key,val);
    }
    for (Iterator it=params.keySet().iterator(); it.hasNext(); ) {
      String key=(String)it.next();
      Object val=params.get(key);
      transformer.setParameter(key,val);
    }
    if (errors != null) {
      transformer.setErrorListener(errors);
    }
    if (resolver != null) {
      transformer.setURIResolver(resolver);
    }
    transformer.transform(src_in,res_out);
  }
 catch (  IOException ex) {
    throw new SAXException(ex);
  }
catch (  TransformerConfigurationException ex) {
    throw new SAXException(ex);
  }
catch (  TransformerException ex) {
    throw new SAXException(ex);
  }
}

Fixed version (ground truth):
public void provideSAXEvents(ContentHandler handler) throws SAXException {
  try {
    Source xmlSource=new SAXSource(new SAXEventProviderXMLReader(xmlsep),new SAXEventProviderInputSource());
    SAXResult outputTarget=new SAXResult(handler);
    transform(xmlSource,outputTarget);
  }
 catch (  TransformerException ex) {
    throw new SAXException(ex);
  }
}
Program: 101686
Project: 101686
Buggy source:
/** 
 * @param antiAliasing The new anti aliasing status.
 */
public static void setAntiAliasing(boolean antiAliasing){
  AntiAliasedTextPane.antiAliasing=antiAliasing;
}

Fixed version (ground truth):
/** 
 * @param antiAliasing The new anti aliasing status.
 */
public static void setAntiAliasing(boolean antiAliasing){
  AntiAliasedTextPane.antiAliasing=antiAliasing;
  System.setProperty("String_Node_Str",Boolean.toString(antiAliasing));
}
Program: 101687
Project: 101687
Buggy source:
/** 
 * Install Windows platform specific UI defaults.
 */
protected void initPlatformUIDefaults(){
  Border tabbedPanePanelBorder=null;
  Color standardBorderColor=null;
  Object windowsScrollPaneborder=UIManager.get("String_Node_Str");
  if (windowsScrollPaneborder != null) {
    standardBorderColor=((LineBorder)windowsScrollPaneborder).getLineColor();
    tabbedPanePanelBorder=new LineBorder(standardBorderColor);
  }
  Border panelSelectBorder=BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(1,1,0,1,standardBorderColor),BorderFactory.createEmptyBorder(5,5,5,5));
  Object[] windowsUIDefaults=new Object[]{"String_Node_Str",WindowsBorderlessTabbedPaneUI.createUI(null),"String_Node_Str",tabbedPanePanelBorder,"String_Node_Str",standardBorderColor,"String_Node_Str",panelSelectBorder};
  UIManager.getDefaults().putDefaults(windowsUIDefaults);
}

Fixed version (ground truth):
/** 
 * Install Windows platform specific UI defaults.
 */
protected void initPlatformUIDefaults(){
  Border tabbedPanePanelBorder=null;
  Color standardBorderColor=null;
  Object windowsScrollPaneborder=UIManager.get("String_Node_Str");
  if (windowsScrollPaneborder != null) {
    if (windowsScrollPaneborder instanceof LineBorder) {
      standardBorderColor=((LineBorder)windowsScrollPaneborder).getLineColor();
      tabbedPanePanelBorder=new LineBorder(standardBorderColor);
    }
 else {
      tabbedPanePanelBorder=BorderFactory.createEmptyBorder(1,1,1,1);
    }
  }
  Border panelSelectBorder=BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(1,1,0,1,standardBorderColor),BorderFactory.createEmptyBorder(5,5,5,5));
  Object[] windowsUIDefaults=new Object[]{"String_Node_Str",WindowsBorderlessTabbedPaneUI.createUI(null),"String_Node_Str",tabbedPanePanelBorder,"String_Node_Str",standardBorderColor,"String_Node_Str",panelSelectBorder};
  UIManager.getDefaults().putDefaults(windowsUIDefaults);
}
Program: 101688
Project: 101688
Buggy source:
/** 
 * Copy this WebResource to the destination.
 * @param dest
 * @throws LucidException
 */
public void copy(URL dest) throws LucidException {
  InputStream in=null;
  OutputStream out=null;
  HttpMethod method=new GetMethod(url.getPath());
  try {
    if (client.executeMethod(method) == HttpStatus.SC_OK) {
      in=method.getResponseBodyAsStream();
      out=NetUtil.getOutputStream(dest);
      byte[] buf=new byte[4096];
      for (int count=0; -1 != (count=in.read(buf)); ) {
        out.write(buf,0,count);
      }
    }
  }
 catch (  Exception e) {
    throw new LucidException(Msg.MISSING_FILE,e);
  }
 finally {
    method.releaseConnection();
    IOUtil.close(in);
    IOUtil.close(out);
  }
}

Fixed version (ground truth):
/** 
 * Copy this WebResource to the destination.
 * @param dest
 * @throws LucidException
 */
public void copy(URL dest) throws LucidException {
  InputStream in=null;
  OutputStream out=null;
  HttpMethod method=new GetMethod(url.getPath());
  try {
    if (client.executeMethod(method) == HttpStatus.SC_OK) {
      in=method.getResponseBodyAsStream();
      out=NetUtil.getOutputStream(dest);
      byte[] buf=new byte[4096];
      int count=in.read(buf);
      while (-1 != count) {
        out.write(buf,0,count);
        count=in.read(buf);
      }
    }
  }
 catch (  Exception e) {
    throw new LucidException(Msg.MISSING_FILE,e);
  }
 finally {
    method.releaseConnection();
    IOUtil.close(in);
    IOUtil.close(out);
  }
}
Program: 101690
Project: 101690
Buggy source:
/** 
 * Cause a component to refresh its contents when it is changed by the program and needs to be redrawn.
 * @param c the component to refresh
 */
public static void refresh(Component c){
  c.invalidate();
  c.validate();
  c.repaint();
}

Fixed version (ground truth):
/** 
 * Cause a component to refresh its contents when it is changed by the program and needs to be redrawn.
 * @param c the component to refresh
 */
public static void refresh(Component c){
  c.invalidate();
  c.validate();
  c.repaint();
  if (c instanceof JComponent) {
    ((JComponent)c).revalidate();
  }
}
Program: 101691
Project: 101691
Buggy source:
/** 
 * Create a stack trace of the code at this point
 * @param ex The Throwable containing the Stack Trace
 * @param disgard The number of uppermost stack frames to ignore
 */
private void init(Throwable ex,int disgard){
  StringWriter sout=new StringWriter();
  ex.printStackTrace(new PrintWriter(sout));
  String msg=new String(sout.getBuffer());
  String[] calls=StringUtil.split(msg,"String_Node_Str");
  classNames=new String[calls.length - disgard];
  methodNames=new String[calls.length - disgard];
  fileNames=new String[calls.length - disgard];
  lineNumbers=new int[calls.length - disgard];
  for (int i=0; i < classNames.length; i++) {
    String call=calls[i + disgard];
    try {
      int spcIndex=call.indexOf(' ');
      int lhsIndex=call.indexOf('(');
      int clnIndex=call.indexOf(':');
      int rhsIndex=call.indexOf(')');
      String fullFn=call.substring(spcIndex + 1,lhsIndex).trim();
      int lastDot=fullFn.lastIndexOf('.');
      classNames[i]=fullFn.substring(0,lastDot).replace('/','.');
      methodNames[i]=fullFn.substring(lastDot + 1);
      if (clnIndex != -1) {
        fileNames[i]=call.substring(lhsIndex + 1,clnIndex);
        lineNumbers[i]=Integer.parseInt(call.substring(clnIndex + 1,rhsIndex));
      }
 else {
        fileNames[i]=call.substring(lhsIndex + 1,rhsIndex);
        lineNumbers[i]=0;
      }
    }
 catch (    Exception ex2) {
      classNames[i]="String_Node_Str";
      methodNames[i]=call;
      fileNames[i]="String_Node_Str";
      lineNumbers[i]=0;
    }
  }
}

Fixed version (ground truth):
/** 
 * Create a stack trace of the code at this point
 * @param ex The Throwable containing the Stack Trace
 * @param discard The number of uppermost stack frames to ignore
 */
private void init(Throwable ex,int discard){
  StringWriter sout=new StringWriter();
  ex.printStackTrace(new PrintWriter(sout));
  String msg=new String(sout.getBuffer());
  String[] calls=StringUtil.split(msg,"String_Node_Str");
  classNames=new String[calls.length - discard];
  methodNames=new String[calls.length - discard];
  fileNames=new String[calls.length - discard];
  lineNumbers=new int[calls.length - discard];
  for (int i=0; i < classNames.length; i++) {
    String call=calls[i + discard];
    try {
      int spcIndex=call.indexOf(' ');
      int lhsIndex=call.indexOf('(');
      int clnIndex=call.indexOf(':');
      int rhsIndex=call.indexOf(')');
      String fullFn=call.substring(spcIndex + 1,lhsIndex).trim();
      int lastDot=fullFn.lastIndexOf('.');
      classNames[i]=fullFn.substring(0,lastDot).replace('/','.');
      methodNames[i]=fullFn.substring(lastDot + 1);
      if (clnIndex != -1) {
        fileNames[i]=call.substring(lhsIndex + 1,clnIndex);
        lineNumbers[i]=Integer.parseInt(call.substring(clnIndex + 1,rhsIndex));
      }
 else {
        fileNames[i]=call.substring(lhsIndex + 1,rhsIndex);
        lineNumbers[i]=0;
      }
    }
 catch (    Exception ex2) {
      classNames[i]="String_Node_Str";
      methodNames[i]=call;
      fileNames[i]="String_Node_Str";
      lineNumbers[i]=0;
    }
  }
}
Program: 101692
Project: 101692
Buggy source:
/** 
 * A parse has failed so we can try to kill the broken entities and then have another go.
 */
public static String cleanAllEntities(String broken){
  if (broken == null) {
    return null;
  }
  String working=broken;
  int cleanfrom=0;
  allEntities:   while (true) {
    int amp=working.indexOf('&',cleanfrom);
    if (amp == -1) {
      break allEntities;
    }
    int i=amp + 1;
    singleEntity:     while (true) {
      if (i >= working.length()) {
        String entity=working.substring(amp);
        String replace=guessEntity(entity);
        working=working.substring(0,amp) + replace;
        break singleEntity;
      }
      char c=working.charAt(i);
      if (c == ';') {
        String entity=working.substring(amp,i + 1);
        String replace=guessEntity(entity);
        working=working.substring(0,amp) + replace + working.substring(i + 1);
        break singleEntity;
      }
      if (!Character.isLetterOrDigit(c) && c != '-') {
        String entity=working.substring(amp,i);
        String replace=guessEntity(entity);
        working=working.substring(0,amp) + replace + working.substring(i);
        break singleEntity;
      }
      i++;
    }
    cleanfrom=amp + 1;
  }
  return working;
}

Fixed version (ground truth):
/** 
 * A parse has failed so we can try to kill the broken entities and then have another go.
 */
public static String cleanAllEntities(String broken){
  if (broken == null) {
    return null;
  }
  String working=broken;
  int cleanfrom=0;
  while (true) {
    int amp=working.indexOf('&',cleanfrom);
    if (amp == -1) {
      break;
    }
    if (validCharacterEntityPattern.matcher(working.substring(amp)).find()) {
      cleanfrom=working.indexOf(';',amp) + 1;
      continue;
    }
    int i=amp + 1;
    while (true) {
      if (i >= working.length()) {
        String entity=working.substring(amp);
        String replace=guessEntity(entity);
        working=working.substring(0,amp) + replace;
        break;
      }
      char c=working.charAt(i);
      if (c == ';') {
        String entity=working.substring(amp,i + 1);
        String replace=guessEntity(entity);
        working=working.substring(0,amp) + replace + working.substring(i + 1);
        break;
      }
      if (!Character.isLetterOrDigit(c) && c != '-') {
        String entity=working.substring(amp,i);
        String replace=guessEntity(entity);
        working=working.substring(0,amp) + replace + working.substring(i);
        break;
      }
      i++;
    }
    cleanfrom=amp + 1;
  }
  return working;
}
Program: 101693
Project: 101693
Buggy source:
/** 
 * Take a string and tokenize it using " " and "--" as delimiters into an Array of Strings. There is a question mark over what to do with initial spaces. This algorithm disgards them, I'm not sure if this is the right thing to do.
 * @param sentence The string to parse.
 * @return The string array
 */
public static String[] tokenize(String sentence){
  List tokens=new ArrayList();
  int pos=0;
  String temp;
  boolean alive=true;
  while (alive) {
    int nextSpace=sentence.indexOf("String_Node_Str",pos);
    int nextDDash=sentence.indexOf("String_Node_Str",pos);
    if (nextSpace == nextDDash + 2) {
      nextDDash=-1;
    }
    if (nextDDash == nextSpace + 1) {
      nextSpace=-1;
    }
    if (nextSpace == -1 && nextDDash == -1) {
      temp=sentence.substring(pos);
      alive=false;
    }
 else     if ((nextSpace != -1 && nextSpace < nextDDash) || (nextDDash == -1)) {
      temp=sentence.substring(pos,nextSpace) + ' ';
      pos=nextSpace + 1;
    }
 else {
      temp=sentence.substring(pos,nextDDash) + "String_Node_Str";
      pos=nextDDash + 2;
    }
    if (temp != null && !temp.trim().equals("String_Node_Str")) {
      tokens.add(temp);
    }
  }
  String[] retcode=new String[tokens.size()];
  int i=0;
  for (Iterator it=tokens.iterator(); it.hasNext(); ) {
    retcode[i++]=(String)it.next();
  }
  return retcode;
}

Fixed version (ground truth):
/** 
 * Take a string and tokenize it using " " and "--" as delimiters into an Array of Strings. There is a question mark over what to do with initial spaces. This algorithm discards them, I'm not sure if this is the right thing to do.
 * @param sentence The string to parse.
 * @return The string array
 */
public static String[] tokenize(String sentence){
  List tokens=new ArrayList();
  int pos=0;
  String temp;
  boolean alive=true;
  while (alive) {
    int nextSpace=sentence.indexOf("String_Node_Str",pos);
    int nextDDash=sentence.indexOf("String_Node_Str",pos);
    if (nextSpace == nextDDash + 2) {
      nextDDash=-1;
    }
    if (nextDDash == nextSpace + 1) {
      nextSpace=-1;
    }
    if (nextSpace == -1 && nextDDash == -1) {
      temp=sentence.substring(pos);
      alive=false;
    }
 else     if ((nextSpace != -1 && nextSpace < nextDDash) || (nextDDash == -1)) {
      temp=sentence.substring(pos,nextSpace) + ' ';
      pos=nextSpace + 1;
    }
 else {
      temp=sentence.substring(pos,nextDDash) + "String_Node_Str";
      pos=nextDDash + 2;
    }
    if (temp != null && !temp.trim().equals("String_Node_Str")) {
      tokens.add(temp);
    }
  }
  String[] retcode=new String[tokens.size()];
  int i=0;
  for (Iterator it=tokens.iterator(); it.hasNext(); ) {
    retcode[i++]=(String)it.next();
  }
  return retcode;
}
Program: 101694
Project: 101694
Buggy source:
public List toOSIS(Key key,String plain) throws FilterException {
  DataPolice.setKey(key);
  Element ele=null;
  try {
    ele=parse(plain);
  }
 catch (  Exception ex1) {
    DataPolice.report("String_Node_Str" + ex1.getMessage() + "String_Node_Str"+ plain);
    String cropped=XMLUtil.cleanAllEntities(plain);
    try {
      ele=parse(cropped);
    }
 catch (    Exception ex2) {
      log.warn("String_Node_Str" + ex2.getMessage());
      String shawn=XMLUtil.cleanAllTags(cropped);
      try {
        ele=parse(shawn);
      }
 catch (      Exception ex3) {
        log.warn("String_Node_Str" + ex3.getMessage());
        try {
          ele=OSISUtil.factory().createP();
          ele.addContent(plain);
        }
 catch (        Exception ex4) {
          log.warn("String_Node_Str" + ex4.getMessage());
        }
      }
    }
  }
 finally {
    if (ele == null) {
      ele=OSISUtil.factory().createP();
    }
    DataPolice.setKey(null);
  }
  return ele.removeContent();
}

Fixed version (ground truth):
public List toOSIS(Key key,String plain){
  DataPolice.setKey(key);
  Element ele=null;
  try {
    ele=parse(XMLUtil.cleanAllEntities(plain));
  }
 catch (  Exception ex1) {
    DataPolice.report("String_Node_Str" + ex1.getMessage() + "String_Node_Str"+ plain);
    String shawn=XMLUtil.cleanAllTags(plain);
    try {
      ele=parse(shawn);
    }
 catch (    Exception ex2) {
      log.warn("String_Node_Str" + ex2.getMessage());
      try {
        ele=OSISUtil.factory().createP();
        ele.addContent(plain);
      }
 catch (      Exception ex4) {
        log.warn("String_Node_Str" + ex4.getMessage());
      }
    }
  }
 finally {
    if (ele == null) {
      ele=OSISUtil.factory().createP();
    }
    DataPolice.setKey(null);
  }
  return ele.removeContent();
}
Program: 101695
Project: 101695
Buggy source:
public List toOSIS(Key key,String plain){
  DataPolice.setKey(key);
  Element ele=null;
  try {
    ele=parse(plain);
  }
 catch (  Exception ex1) {
    DataPolice.report("String_Node_Str" + ex1.getMessage() + "String_Node_Str"+ plain);
    String cropped=XMLUtil.cleanAllEntities(plain);
    try {
      ele=parse(cropped);
    }
 catch (    Exception ex2) {
      log.warn("String_Node_Str" + ex2.getMessage());
      String shawn=XMLUtil.cleanAllTags(cropped);
      try {
        ele=parse(shawn);
      }
 catch (      Exception ex3) {
        log.warn("String_Node_Str" + ex3.getMessage());
        ele=OSISUtil.factory().createP();
        ele.addContent(plain);
      }
    }
  }
 finally {
    if (ele == null) {
      ele=OSISUtil.factory().createP();
      ele.addContent(plain);
    }
    DataPolice.setKey(null);
  }
  return ele.removeContent();
}

Fixed version (ground truth):
public List toOSIS(Key key,String plain){
  DataPolice.setKey(key);
  Element ele=null;
  try {
    ele=parse(XMLUtil.cleanAllEntities(plain));
  }
 catch (  Exception ex1) {
    DataPolice.report("String_Node_Str" + ex1.getMessage() + "String_Node_Str"+ plain);
    String shawn=XMLUtil.cleanAllTags(plain);
    try {
      ele=parse(shawn);
    }
 catch (    Exception ex2) {
      log.warn("String_Node_Str" + ex2.getMessage());
      try {
        ele=OSISUtil.factory().createP();
        ele.addContent(plain);
      }
 catch (      Exception ex4) {
        log.warn("String_Node_Str" + ex4.getMessage());
      }
    }
  }
 finally {
    if (ele == null) {
      ele=OSISUtil.factory().createP();
    }
    DataPolice.setKey(null);
  }
  return ele.removeContent();
}
Program: 101697
Project: 101697
Buggy source:
public String getRawText(Key key) throws BookException {
  checkActive();
  String charset=getBookMetaData().getModuleCharset();
  Verse verse=KeyUtil.getVerse(key);
  try {
    int testament=SwordConstants.getTestament(verse);
    long index=SwordConstants.getIndex(verse);
    if (idxRaf[testament] == null) {
      return "String_Node_Str";
    }
    byte[] read=SwordUtil.readRAF(idxRaf[testament],index * ENTRY_SIZE,ENTRY_SIZE);
    if (read == null || read.length == 0) {
      return "String_Node_Str";
    }
    long start=SwordUtil.decodeLittleEndian32(read,0);
    int size=SwordUtil.decodeLittleEndian16(read,4);
    byte[] data=SwordUtil.readRAF(txtRaf[testament],start,size);
    decipher(data);
    return SwordUtil.decode(key,data,charset);
  }
 catch (  IOException ex) {
    throw new BookException(Msg.READ_FAIL,ex,new Object[]{verse.getName()});
  }
}

Fixed version (ground truth):
public String getRawText(Key key) throws BookException {
  checkActive();
  String charset=getBookMetaData().getModuleCharset();
  Verse verse=KeyUtil.getVerse(key);
  try {
    int testament=SwordConstants.getTestament(verse);
    int index=SwordConstants.getIndex(verse);
    if (idxRaf[testament] == null) {
      return "String_Node_Str";
    }
    byte[] read=SwordUtil.readRAF(idxRaf[testament],index * ENTRY_SIZE,ENTRY_SIZE);
    if (read == null || read.length == 0) {
      return "String_Node_Str";
    }
    int start=SwordUtil.decodeLittleEndian32(read,0);
    int size=SwordUtil.decodeLittleEndian16(read,4);
    if (size < 1) {
      log.error("String_Node_Str" + verse.getName() + "String_Node_Str"+ size);
    }
    byte[] data=SwordUtil.readRAF(txtRaf[testament],start,size);
    decipher(data);
    return SwordUtil.decode(key,data,charset);
  }
 catch (  IOException ex) {
    throw new BookException(Msg.READ_FAIL,ex,new Object[]{verse.getName()});
  }
}
Program: 101698
Project: 101698
Buggy source:
/** 
 * Setup with the key name and positions of data in the file
 */
protected IndexKey(String text,long offset,int size,Key parent){
  super(text,text,parent);
  this.offset=offset;
  this.size=size;
}

Fixed version (ground truth):
/** 
 * Setup with the key name and positions of data in the file
 */
protected IndexKey(String text,int offset,int size,Key parent){
  super(text,text,parent);
  this.offset=offset;
  this.size=size;
}