nus-yam/ex-repair huggingface dataset:
Program: 101604
Project: 101604
Buggy source:
/** 
 * Determine where an index should be stored
 * @param book The book to be indexed
 * @return A URL to store stuff in
 * @throws IOException If there is a problem in finding where to store stuff
 */
protected URI getStorageArea(Book book) throws IOException {
}

Fixed version (ground truth):
/** 
 * Determine where an index should be stored
 * @param book The book to be indexed
 * @return A URI to store stuff in
 * @throws IOException If there is a problem in finding where to store stuff
 */
protected URI getStorageArea(Book book) throws IOException {
}
Program: 101605
Project: 101605
Buggy source:
/** 
 * Prevent Instansiation. <p>The biggest job is trying to work out which resource bundle to load to work out where the config and data files are stored. We construct a name from the projectname, hostname and any other info and then try to use that.
 */
private Project(){
  CWClassLoader.setHome(getUserProjectDir());
  try {
    URI urlcache=getTempScratchSpace(DIR_NETCACHE,true);
    File filecache=new File(urlcache.getPath());
    NetUtil.setURICacheDir(filecache);
  }
 catch (  IOException ex) {
    log.warn("String_Node_Str",ex);
  }
}

Fixed version (ground truth):
/** 
 * Prevent Instansiation. <p>The biggest job is trying to work out which resource bundle to load to work out where the config and data files are stored. We construct a name from the projectname, hostname and any other info and then try to use that.
 */
private Project(){
  CWClassLoader.setHome(getUserProjectDir());
  try {
    URI uricache=getTempScratchSpace(DIR_NETCACHE,true);
    File filecache=new File(uricache.getPath());
    NetUtil.setURICacheDir(filecache);
  }
 catch (  IOException ex) {
    log.warn("String_Node_Str",ex);
  }
}
Program: 101606
Project: 101606
Buggy source:
/** 
 * Create a new Job. This will automatically fire a workProgressed event to all WorkListeners, with the work property of this job set to 0.
 * @param description Short description of this job
 * @param predicturl Optional URI to save/load prediction times from
 * @param worker Optional thread to use in request to stop worker
 * @param totalWork the size of the work to do
 */
protected Job(String description,URI predicturl,Thread worker,int totalWork){
  this.predictURI=predicturl;
  this.workerThread=worker;
  this.listeners=new ArrayList();
  this.start=-1;
  this.predictedLength=-1;
  beginJob(description,totalWork);
}

Fixed version (ground truth):
/** 
 * Create a new Job. This will automatically fire a workProgressed event to all WorkListeners, with the work property of this job set to 0.
 * @param description Short description of this job
 * @param predictURI Optional URI to save/load prediction times from
 * @param worker Optional thread to use in request to stop worker
 * @param totalWork the size of the work to do
 */
protected Job(String description,URI predictURI,Thread worker,int totalWork){
  this.predictURI=predictURI;
  this.workerThread=worker;
  this.listeners=new ArrayList();
  this.start=-1;
  this.predictedLength=-1;
  beginJob(description,totalWork);
}
Program: 101607
Project: 101607
Buggy source:
/** 
 * Get and instansiate the preferred implementor of some interface or abstract class.
 * @param clazz The class or interface to find an implementation of.
 * @return The configured implementing class.
 * @throws MalformedURLException if the properties file can not be found
 * @throws IOException if there is a problem reading the found file
 * @throws ClassNotFoundException if the read contents are not found
 * @throws ClassCastException if the read contents are not valid
 * @throws InstantiationException if the new object can not be instansiated
 * @throws IllegalAccessException if the new object can not be instansiated
 * @see ClassUtil#getImplementors(Class)
 */
public static Object getImplementation(Class clazz) throws MalformedURLException, ClassCastException, IOException, ClassNotFoundException, InstantiationException, IllegalAccessException {
  return getImplementor(clazz).newInstance();
}

Fixed version (ground truth):
/** 
 * Get and instantiate the preferred implementor of some interface or abstract class.
 * @param clazz The class or interface to find an implementation of.
 * @return The configured implementing class.
 * @throws MalformedURLException if the properties file can not be found
 * @throws IOException if there is a problem reading the found file
 * @throws ClassNotFoundException if the read contents are not found
 * @throws ClassCastException if the read contents are not valid
 * @throws InstantiationException if the new object can not be instantiated
 * @throws IllegalAccessException if the new object can not be instantiated
 * @see ClassUtil#getImplementors(Class)
 */
public static Object getImplementation(Class clazz) throws MalformedURLException, ClassCastException, IOException, ClassNotFoundException, InstantiationException, IllegalAccessException {
  return getImplementor(clazz).newInstance();
}
Program: 101609
Project: 101609
Buggy source:
/** 
 * Compute and return the score for a match with e errors and x location.
 * @param e Number of errors in match
 * @param x Location of match
 * @return Overall score for match
 */
private double bitapScore(int e,int x){
  int d=Math.abs(loc - x);
  return (e / (float)pattern.length() / Bitap.BALANCE) + (d / (float)scoreTextLength / (1.0 - Bitap.BALANCE));
}

Fixed version (ground truth):
/** 
 * Compute and return the score for a match with e errors and x location.
 * @param e Number of errors in match
 * @param x Location of match
 * @return Overall score for match
 */
private double bitapScore(int e,int x){
  int d=Math.abs(loc - x);
  return (e / (float)pattern.length() / Bitap.balance) + (d / (float)scoreTextLength / (1.0 - Bitap.balance));
}
Program: 101610
Project: 101610
Buggy source:
public int hashCode(){
  final int PRIME=31;
  int result=1;
  result=PRIME * result + ((commonality == null) ? 0 : commonality.hashCode());
  result=PRIME * result + ((sourceEnd == null) ? 0 : sourceEnd.hashCode());
  result=PRIME * result + ((sourceStart == null) ? 0 : sourceStart.hashCode());
  result=PRIME * result + ((targetEnd == null) ? 0 : targetEnd.hashCode());
  result=PRIME * result + ((targetStart == null) ? 0 : targetStart.hashCode());
  return result;
}

Fixed version (ground truth):
public int hashCode(){
  final int PRIME=31;
  int result=1;
  result=PRIME * result + ((sourcePrefix == null) ? 0 : sourcePrefix.hashCode());
  result=PRIME * result + ((sourceSuffix == null) ? 0 : sourceSuffix.hashCode());
  result=PRIME * result + ((targetPrefix == null) ? 0 : targetPrefix.hashCode());
  result=PRIME * result + ((targetSuffix == null) ? 0 : targetSuffix.hashCode());
  result=PRIME * result + ((commonality == null) ? 0 : commonality.hashCode());
  return result;
}
Program: 101611
Project: 101611
Buggy source:
public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null || getClass() != obj.getClass()) {
    return false;
  }
  final CommonMiddle other=(CommonMiddle)obj;
  return commonality.equals(other.commonality) && sourceEnd.equals(other.sourceEnd) && sourceStart.equals(other.sourceStart)&& targetEnd.equals(other.targetEnd)&& targetStart.equals(other.targetStart);
}

Fixed version (ground truth):
public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null || getClass() != obj.getClass()) {
    return false;
  }
  final CommonMiddle other=(CommonMiddle)obj;
  return sourcePrefix.equals(other.sourcePrefix) && sourceSuffix.equals(other.sourceSuffix) && targetPrefix.equals(other.targetPrefix)&& targetSuffix.equals(other.targetSuffix)&& commonality.equals(other.commonality);
}
Program: 101612
Project: 101612
Buggy source:
public String toString(){
  StringBuffer buf=new StringBuffer();
  buf.append(sourceStart);
  buf.append(',');
  buf.append(targetStart);
  buf.append(',');
  buf.append(commonality);
  buf.append(',');
  buf.append(sourceEnd);
  buf.append(',');
  buf.append(targetEnd);
  return buf.toString();
}

Fixed version (ground truth):
public String toString(){
  StringBuffer buf=new StringBuffer();
  buf.append(sourcePrefix);
  buf.append(',');
  buf.append(sourceSuffix);
  buf.append(',');
  buf.append(targetPrefix);
  buf.append(',');
  buf.append(targetSuffix);
  buf.append(',');
  buf.append(commonality);
  return buf.toString();
}
Program: 101613
Project: 101613
Buggy source:
/** 
 * A CommonMiddle represents an overlap between a baseline/source text and a changed/target text.
 * @param sourceStart The text before the commonality form the source
 * @param targetStart The text before the commonality form the target
 * @param commonality The text in common
 * @param sourceEnd The text after the commonality form the source
 * @param targetEnd The text after the commonality form the target
 */
public CommonMiddle(String sourceStart,String targetStart,String commonality,String sourceEnd,String targetEnd){
}

Fixed version (ground truth):
/** 
 * A CommonMiddle represents an overlap between a baseline/source text and a changed/target text.
 * @param sourcePrefix The text before the commonality form the source
 * @param sourceSuffix The text after the commonality form the source
 * @param targetPrefix The text before the commonality form the target
 * @param targetSuffix The text after the commonality form the target
 * @param commonality The text in common
 */
public CommonMiddle(String sourcePrefix,String sourceSuffix,String targetPrefix,String targetSuffix,String commonality){
}
Program: 101618
Project: 101618
Buggy source:
public int compareTo(Object obj){
  Key that=(Key)obj;
  int ret=this.getName().compareTo(that.getName());
  if (ret != 0) {
    return ret;
  }
  Iterator thisIter=this.iterator();
  Iterator thatIter=that.iterator();
  Key thisfirst=null;
  Key thatfirst=null;
  if (thisIter.hasNext()) {
    thisfirst=(Key)thisIter.next();
  }
  if (thatIter.hasNext()) {
    thatfirst=(Key)thatIter.next();
  }
  if (thisfirst == null) {
    if (thatfirst == null) {
      return 0;
    }
    return 1;
  }
  if (thatfirst == null) {
    return -1;
  }
  return thisfirst.compareTo(thatfirst);
}

Fixed version (ground truth):
public int compareTo(Object obj){
  Key that=(Key)obj;
  if (this == that) {
    return 0;
  }
  if (that == null) {
    return -1;
  }
  int ret=this.getName().compareTo(that.getName());
  if (ret != 0) {
    return ret;
  }
  Iterator thisIter=this.iterator();
  Iterator thatIter=that.iterator();
  Key thisfirst=null;
  Key thatfirst=null;
  if (thisIter.hasNext()) {
    thisfirst=(Key)thisIter.next();
  }
  if (thatIter.hasNext()) {
    thatfirst=(Key)thatIter.next();
  }
  if (thisfirst == null) {
    if (thatfirst == null) {
      return 0;
    }
    return 1;
  }
  if (thatfirst == null) {
    return -1;
  }
  return thisfirst.getName().compareTo(thatfirst.getName());
}
Program: 101619
Project: 101619
Buggy source:
/** 
 * Output a minimum of stuff
 */
public static void outputInfoMinimum(){
  java.util.logging.Logger.getLogger(ROOT_LOGGER).setLevel(Level.WARNING);
}

Fixed version (ground truth):
/** 
 * Output a minimum of stuff
 */
public static void outputInfoMinimum(){
  level=Level.WARNING;
}
Program: 101620
Project: 101620
Buggy source:
/** 
 * Log a message object with the DEBUG level.
 * @param message the message object to log.
 */
public void debug(String message){
  logger.fine(message);
}

Fixed version (ground truth):
/** 
 * Log a message object with the DEBUG level.
 * @param message the message object to log.
 */
public void debug(String message){
  initialize();
  logger.fine(message);
}
Program: 101621
Project: 101621
Buggy source:
/** 
 * Output everything
 */
public static void outputEverything(){
  java.util.logging.Logger.getLogger(ROOT_LOGGER).setLevel(Level.FINEST);
}

Fixed version (ground truth):
/** 
 * Output everything
 */
public static void outputEverything(){
  level=Level.FINEST;
}
Program: 101622
Project: 101622
Buggy source:
/** 
 * Stop all logging output
 */
public static void outputNothing(){
  java.util.logging.Logger.getLogger(ROOT_LOGGER).setLevel(Level.OFF);
}

Fixed version (ground truth):
/** 
 * Stop all logging output
 */
public static void outputNothing(){
  level=Level.OFF;
}
Program: 101623
Project: 101623
Buggy source:
private void doLogging(Level level,String message,Throwable th){
  String className=null;
  String methodName=null;
  int lineNumber=-1;
  StackTraceElement[] stack=(new Throwable()).getStackTrace();
  int ix=0;
  while (ix < stack.length) {
    StackTraceElement frame=stack[ix];
    String cname=frame.getClassName();
    if (cname.equals(CLASS_NAME)) {
      break;
    }
    ix++;
  }
  while (ix < stack.length) {
    StackTraceElement frame=stack[ix];
    String cname=frame.getClassName();
    if (!cname.equals(CLASS_NAME)) {
      className=cname;
      methodName=frame.getMethodName();
      lineNumber=frame.getLineNumber();
      break;
    }
    ix++;
  }
  LogRecord logRecord=new LogRecord(level,message);
  logRecord.setLoggerName(logger.getName());
  logRecord.setSourceClassName(className);
  logRecord.setSourceMethodName(methodName);
  logRecord.setThrown(th);
  logRecord.setSequenceNumber(lineNumber);
  logger.log(logRecord);
}

Fixed version (ground truth):
private void doLogging(Level theLevel,String message,Throwable th){
  initialize();
  String className=null;
  String methodName=null;
  int lineNumber=-1;
  StackTraceElement[] stack=(new Throwable()).getStackTrace();
  int ix=0;
  while (ix < stack.length) {
    StackTraceElement frame=stack[ix];
    String cname=frame.getClassName();
    if (cname.equals(CLASS_NAME)) {
      break;
    }
    ix++;
  }
  while (ix < stack.length) {
    StackTraceElement frame=stack[ix];
    String cname=frame.getClassName();
    if (!cname.equals(CLASS_NAME)) {
      className=cname;
      methodName=frame.getMethodName();
      lineNumber=frame.getLineNumber();
      break;
    }
    ix++;
  }
  LogRecord logRecord=new LogRecord(theLevel,message);
  logRecord.setLoggerName(logger.getName());
  logRecord.setSourceClassName(className);
  logRecord.setSourceMethodName(methodName);
  logRecord.setThrown(th);
  logRecord.setSequenceNumber(lineNumber);
  logger.log(logRecord);
}
Program: 101624
Project: 101624
Buggy source:
/** 
 * Simple ctor
 */
private Logger(Class id){
  logger=java.util.logging.Logger.getLogger(id.getName());
}

Fixed version (ground truth):
/** 
 * Simple ctor
 */
private Logger(Class id){
  clazz=id;
}
Program: 101625
Project: 101625
Buggy source:
/** 
 * Constructor for ReadingsBook.
 */
public ReadingsBook(ReadingsBookDriver driver,BookCategory type){
  super(null);
  hash=new TreeMap();
  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());
}

Fixed version (ground truth):
/** 
 * Constructor for ReadingsBook.
 */
public ReadingsBook(ReadingsBookDriver driver,String setname,BookCategory type){
  super(null);
  hash=new TreeMap();
  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: 101626
Project: 101626
Buggy source:
/** 
 * Setup the array of BookMetaDatas
 */
public ReadingsBookDriver(){
  books=new Book[]{new ReadingsBook(this,BookCategory.DAILY_DEVOTIONS)};
}

Fixed version (ground truth):
/** 
 * Setup the array of BookMetaDatas
 */
public ReadingsBookDriver(){
  List bookList=new ArrayList();
  String[] installedBooks=getInstalledReadingsSets();
  for (int i=0; i < installedBooks.length; i++) {
    bookList.add(new ReadingsBook(this,installedBooks[i],BookCategory.DAILY_DEVOTIONS));
  }
  books=(Book[])bookList.toArray(new Book[bookList.size()]);
}
Program: 101627
Project: 101627
Buggy source:
/** 
 * Get a list of the available readings sets
 */
public static String[] getInstalledReadingsSets(){
  try {
    URL index=ResourceUtil.getResource(ReadingsBookDriver.class,"String_Node_Str");
    return NetUtil.listByIndexFile(index,new URLFilter(){
      public boolean accept(      String name){
        return true;
      }
    }
);
  }
 catch (  IOException ex) {
    return new String[0];
  }
}

Fixed version (ground truth):
/** 
 * Get a list of the available readings sets
 */
public String[] getInstalledReadingsSets(){
  try {
    URL index=ResourceUtil.getResource(ReadingsBookDriver.class,"String_Node_Str");
    return NetUtil.listByIndexFile(index,new URLFilter(){
      public boolean accept(      String name){
        return true;
      }
    }
);
  }
 catch (  IOException ex) {
    return new String[0];
  }
}
Program: 101628
Project: 101628
Buggy source:
/** 
 * Migrates the user's project dir, if necessary and possible.
 * @param oldPath the path to the old, deprecated location
 * @param newPath the path to the new location
 * @return newPath if the migration was possible or not needed.
 */
private URL migrateUserProjectDir(URL oldPath,URL newPath){
  if (oldPath.toExternalForm().equals(newPath.toExternalForm())) {
    return newPath;
  }
  if (NetUtil.isDirectory(oldPath)) {
    File oldDir=new File(oldPath.getFile());
    File newDir=new File(newPath.getFile());
    if (oldDir.renameTo(newDir)) {
      return newPath;
    }
    return oldPath;
  }
  return newPath;
}

Fixed version (ground truth):
/** 
 * Migrates the user's project dir, if necessary and possible.
 * @param oldPath the path to the old, deprecated location
 * @param newPath the path to the new location
 * @return newPath if the migration was possible or not needed.
 */
private URL migrateUserProjectDir(URL oldPath,URL newPath){
  if (oldPath.toExternalForm().equals(newPath.toExternalForm())) {
    return newPath;
  }
  if (NetUtil.isDirectory(oldPath)) {
    File oldDir=new File(oldPath.getFile());
    File newDir=new File(newPath.getFile());
    oldDir.renameTo(newDir);
    if (NetUtil.isDirectory(newPath)) {
      return newPath;
    }
    return oldPath;
  }
  return newPath;
}
Program: 101630
Project: 101630
Buggy source:
public Element processTag(Element ele,Attributes attrs){
  Element seg=OSISUtil.factory().createSeg();
  StringBuffer buf=new StringBuffer();
  String color=attrs.getValue("String_Node_Str");
  if (color != null) {
    buf.append(OSISUtil.SEG_COLORPREFIX);
    buf.append(color);
    buf.append(';');
  }
  String size=attrs.getValue("String_Node_Str");
  if (size != null) {
    buf.append(OSISUtil.SEG_SIZEPREFIX);
    buf.append(size);
    buf.append(';');
  }
  String type=buf.toString();
  if (type != null) {
    seg.setAttribute(OSISUtil.OSIS_ATTR_TYPE,type);
  }
 else {
    DataPolice.report("String_Node_Str");
    XMLUtil.debugSAXAttributes(attrs);
  }
  if (ele != null) {
    ele.addContent(seg);
  }
  return seg;
}

Fixed version (ground truth):
public Element processTag(Element ele,Attributes attrs){
  Element seg=OSISUtil.factory().createSeg();
  StringBuffer buf=new StringBuffer();
  String color=attrs.getValue("String_Node_Str");
  if (color != null) {
    buf.append(OSISUtil.SEG_COLORPREFIX);
    buf.append(color);
    buf.append(';');
  }
  String size=attrs.getValue("String_Node_Str");
  if (size != null) {
    buf.append(OSISUtil.SEG_SIZEPREFIX);
    buf.append(size);
    buf.append(';');
  }
  String type=buf.toString();
  if (type.length() > 0) {
    seg.setAttribute(OSISUtil.OSIS_ATTR_TYPE,type);
  }
 else {
    DataPolice.report("String_Node_Str");
    XMLUtil.debugSAXAttributes(attrs);
  }
  if (ele != null) {
    ele.addContent(seg);
  }
  return seg;
}
Program: 101631
Project: 101631
Buggy source:
/** 
 * Migrates the user's project dir, if necessary and possible.
 * @param oldPath the path to the old, deprecated location
 * @param newPath the path to the new location
 * @return newPath if the migration was possible or not needed.
 */
private URL migrateUserProjectDir(URL oldPath,URL newPath){
  if (oldPath.equals(newPath)) {
    return newPath;
  }
  if (NetUtil.isDirectory(oldPath)) {
    File oldDir=new File(oldPath.getFile());
    File newDir=new File(newPath.getFile());
    if (oldDir.renameTo(newDir)) {
      return newPath;
    }
    return oldPath;
  }
  return newPath;
}

Fixed version (ground truth):
/** 
 * Migrates the user's project dir, if necessary and possible.
 * @param oldPath the path to the old, deprecated location
 * @param newPath the path to the new location
 * @return newPath if the migration was possible or not needed.
 */
private URL migrateUserProjectDir(URL oldPath,URL newPath){
  if (oldPath.toExternalForm().equals(newPath.toExternalForm())) {
    return newPath;
  }
  if (NetUtil.isDirectory(oldPath)) {
    File oldDir=new File(oldPath.getFile());
    File newDir=new File(newPath.getFile());
    if (oldDir.renameTo(newDir)) {
      return newPath;
    }
    return oldPath;
  }
  return newPath;
}
Program: 101633
Project: 101633
Buggy source:
public void setFeatureStates(String[] argv){
  for (int i=0; i < argv.length; i++) {
    String arg=argv[i];
    if (arg.charAt(0) == '=') {
      String option=arg.substring(1);
      String key=option.toLowerCase(Locale.ENGLISH);
      XMLFeatureState feature=(XMLFeatureState)features.get(key);
      if (feature != null) {
        feature.setState(option.equals(key));
      }
    }
  }
}

Fixed version (ground truth):
public void setFeatureStates(String[] argv){
  for (int i=0; i < argv.length; i++) {
    String arg=argv[i];
    if (arg.charAt(0) == '-') {
      String option=arg.substring(1);
      String key=option.toLowerCase(Locale.ENGLISH);
      XMLFeatureState feature=(XMLFeatureState)features.get(key);
      if (feature != null) {
        feature.setState(option.equals(key));
      }
    }
  }
}
Program: 101634
Project: 101634
Buggy source:
private void createAdapter(String adapterName){
  if (adapter != null) {
    return;
  }
  try {
    adapter=(XMLHandlerAdapter)Class.forName(adapterName).newInstance();
  }
 catch (  ClassNotFoundException e) {
    System.err.println("String_Node_Str" + adapterName + "String_Node_Str");
  }
catch (  InstantiationException e) {
    System.err.println("String_Node_Str" + adapterName + "String_Node_Str");
  }
catch (  IllegalAccessException e) {
    System.err.println("String_Node_Str" + adapterName + "String_Node_Str");
  }
}

Fixed version (ground truth):
private void createAdapter(){
  if (adapter != null) {
    return;
  }
  try {
    adapter=(XMLHandlerAdapter)Class.forName(adapterName).newInstance();
  }
 catch (  ClassNotFoundException e) {
    System.err.println("String_Node_Str" + adapterName + "String_Node_Str");
  }
catch (  InstantiationException e) {
    System.err.println("String_Node_Str" + adapterName + "String_Node_Str");
  }
catch (  IllegalAccessException e) {
    System.err.println("String_Node_Str" + adapterName + "String_Node_Str");
  }
}
Program: 101635
Project: 101635
Buggy source:
private void bind(){
  createParser(DEFAULT_PARSER_NAME);
  createAdapter(DEFAULT_HANDLER_NAME);
  setHandlers();
  features.setFeatures(parser);
}

Fixed version (ground truth):
private void bind(){
  createParser();
  createAdapter();
  setHandlers();
  features.setFeatures(parser);
}
Program: 101636
Project: 101636
Buggy source:
private void initialize(String[] argv){
  int i=0;
  for (i=0; i < argv.length; i++) {
    String arg=argv[i];
    if (arg.charAt(0) == '-') {
      String option=arg.substring(1);
      if ("String_Node_Str".equals(option)) {
        if (++i == argv.length) {
          System.err.println("String_Node_Str");
        }
        String parserName=argv[i];
        createParser(parserName);
        continue;
      }
      if ("String_Node_Str".equals(option)) {
        if (++i == argv.length) {
          System.err.println("String_Node_Str");
        }
        String adapterName=argv[i];
        createAdapter(adapterName);
        continue;
      }
    }
  }
  features.setFeatureStates(argv);
}

Fixed version (ground truth):
private void initialize(String[] argv){
  int i=0;
  for (i=0; i < argv.length; i++) {
    String arg=argv[i];
    if (arg.charAt(0) == '-') {
      String option=arg.substring(1);
      if ("String_Node_Str".equals(option)) {
        if (++i == argv.length) {
          System.err.println("String_Node_Str");
        }
        parserName=argv[i];
        createParser();
        continue;
      }
      if ("String_Node_Str".equals(option)) {
        if (++i == argv.length) {
          System.err.println("String_Node_Str");
        }
        adapterName=argv[i];
        createAdapter();
        continue;
      }
    }
  }
  features.setFeatureStates(argv);
}
Program: 101637
Project: 101637
Buggy source:
private void createParser(String parserName){
  if (parser != null) {
    return;
  }
  try {
    parser=XMLReaderFactory.createXMLReader(parserName);
  }
 catch (  SAXException e) {
    System.err.println("String_Node_Str" + parserName + "String_Node_Str");
  }
}

Fixed version (ground truth):
private void createParser(){
  if (parser != null) {
    return;
  }
  try {
    parser=XMLReaderFactory.createXMLReader(parserName);
  }
 catch (  SAXException e) {
    System.err.println("String_Node_Str" + parserName + "String_Node_Str");
  }
}
Program: 101638
Project: 101638
Buggy source:
public void parse(String xmlFile){
  bind();
  try {
    parser.parse(xmlFile);
  }
 catch (  SAXException e) {
    System.err.println("String_Node_Str" + e.getMessage());
    Exception nested=e.getException();
    if (nested != null) {
      nested.printStackTrace(System.err);
    }
 else {
      e.printStackTrace(System.err);
    }
  }
catch (  IOException e) {
    e.printStackTrace(System.err);
  }
}

Fixed version (ground truth):
public void parse(String xmlFile){
  bind();
  try {
    System.out.println("String_Node_Str");
    parser.parse(xmlFile);
    System.out.println("String_Node_Str");
  }
 catch (  SAXException e) {
    System.err.println("String_Node_Str" + e.getMessage());
    Exception nested=e.getException();
    if (nested != null) {
      nested.printStackTrace(System.err);
    }
 else {
      e.printStackTrace(System.err);
    }
  }
catch (  IOException e) {
    e.printStackTrace(System.err);
  }
}
Program: 101639
Project: 101639
Buggy source:
/** 
 * Reports bound property changes. If <code>oldValue</code> and <code>newValue</code> are not equal and the <code>PropertyChangeEvent</code> listener list isn't empty, then fire a <code>PropertyChange</code> event to each listener.
 * @param oldStatus the old value of the property (as an Object)
 * @param newStatus the new value of the property (as an Object)
 */
protected void firePropertyChange(IndexStatus oldStatus,IndexStatus newStatus){
  if (listeners != null) {
    if (oldStatus != null && newStatus != null && oldStatus.equals(newStatus)) {
      return;
    }
    Object[] listenerList=listeners.getListenerList();
    for (int i=0; i <= listenerList.length - 2; i+=2) {
      if (listenerList[i] == PropertyChangeListener.class) {
        IndexStatusEvent ev=new IndexStatusEvent(this,newStatus);
        IndexStatusListener li=(IndexStatusListener)listenerList[i + 1];
        li.statusChanged(ev);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Reports bound property changes. If <code>oldValue</code> and <code>newValue</code> are not equal and the <code>PropertyChangeEvent</code> listener list isn't empty, then fire a <code>PropertyChange</code> event to each listener.
 * @param oldStatus the old value of the property (as an Object)
 * @param newStatus the new value of the property (as an Object)
 */
protected void firePropertyChange(IndexStatus oldStatus,IndexStatus newStatus){
  if (listeners != null) {
    if (oldStatus != null && newStatus != null && oldStatus.equals(newStatus)) {
      return;
    }
    Object[] listenerList=listeners.getListenerList();
    for (int i=0; i <= listenerList.length - 2; i+=2) {
      if (listenerList[i] == IndexStatusListener.class) {
        IndexStatusEvent ev=new IndexStatusEvent(this,newStatus);
        IndexStatusListener li=(IndexStatusListener)listenerList[i + 1];
        li.statusChanged(ev);
      }
    }
  }
}
Program: 101640
Project: 101640
Buggy source:
public boolean equals(Object obj){
  if (obj == null) {
    return false;
  }
  if (!obj.getClass().equals(this.getClass())) {
    return false;
  }
  DefaultLeafKeyList that=(DefaultLeafKeyList)obj;
  return name.equals(that.name) && osisName.equals(that.osisName);
}

Fixed version (ground truth):
public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (!obj.getClass().equals(this.getClass())) {
    return false;
  }
  DefaultLeafKeyList that=(DefaultLeafKeyList)obj;
  return name.equals(that.name);
}
Program: 101641
Project: 101641
Buggy source:
public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (!obj.getClass().equals(this.getClass())) {
    return false;
  }
  ReadingsKey that=(ReadingsKey)obj;
  return date.equals(that.date);
}

Fixed version (ground truth):
public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (!obj.getClass().equals(this.getClass())) {
    return false;
  }
  ReadingsKey that=(ReadingsKey)obj;
  return getName().equals(that.getName());
}
Program: 101642
Project: 101642
Buggy source:
/** 
 * Create a new Job. This will automatically fire a workProgressed event to all WorkListeners, with the work property of this job set to 0.
 * @param description Short description of this job
 * @param predictURL Optional URL to save/load prediction times from
 * @param workerThread Optional thread to use in request to stop workerThread
 */
protected Job(String description,URL predicturl,Thread worker,int totalWork){
  this.predictURL=predicturl;
  this.workerThread=worker;
  this.listeners=new ArrayList();
  this.start=-1;
  this.predictedLength=-1;
  beginJob(description,totalWork);
}

Fixed version (ground truth):
/** 
 * Create a new Job. This will automatically fire a workProgressed event to all WorkListeners, with the work property of this job set to 0.
 * @param description Short description of this job
 * @param predicturl Optional URL to save/load prediction times from
 * @param worker Optional thread to use in request to stop worker
 * @param totalwork the size of the work to do
 */
protected Job(String description,URL predicturl,Thread worker,int totalWork){
  this.predictURL=predicturl;
  this.workerThread=worker;
  this.listeners=new ArrayList();
  this.start=-1;
  this.predictedLength=-1;
  beginJob(description,totalWork);
}
Program: 101643
Project: 101643
Buggy source:
/** 
 * Loads a sword config from a given buffer. This is used to load conf entries from the mods.d.tar.gz file.
 * @throws IOException
 */
public ConfigEntryTable(byte[] buffer,String bookName) throws IOException {
  internal=bookName;
  supported=true;
  table=new HashMap();
  BufferedReader in=new BufferedReader(new InputStreamReader(new ByteArrayInputStream(buffer),ENCODING_LATIN1));
  loadInitials(in);
  loadContents(in);
  in.close();
  if (getValue(ConfigEntryType.ENCODING).equals(ENCODING_UTF8)) {
    supported=true;
    bookType=null;
    questionable=false;
    readahead=null;
    table.clear();
    in=new BufferedReader(new InputStreamReader(new ByteArrayInputStream(buffer),ENCODING_UTF8));
    loadInitials(in);
    loadContents(in);
    in.close();
  }
  adjustDataPath();
  adjustLanguage();
  adjustBookType();
  adjustName();
  validate();
}

Fixed version (ground truth):
/** 
 * Create an empty Sword config for the named book.
 * @param bookName the name of the book
 */
public ConfigEntryTable(String bookName){
  table=new HashMap();
  internal=bookName;
  supported=true;
}
Program: 101644
Project: 101644
Buggy source:
/** 
 * 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 {
  cet=new ConfigEntryTable(buffer,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 {
  cet=new ConfigEntryTable(internal);
  cet.load(buffer);
  buildProperties();
}
Program: 101645
Project: 101645
Buggy source:
public void setFeatureStates(String[] argv){
  for (int i=0; i < argv.length; i++) {
    String arg=argv[i];
    if (arg.startsWith("String_Node_Str")) {
      String option=arg.substring(1);
      String key=option.toLowerCase();
      XMLFeatureState feature=(XMLFeatureState)features.get(key);
      if (feature != null) {
        feature.setState(option.equals(key));
      }
    }
  }
}

Fixed version (ground truth):
public void setFeatureStates(String[] argv){
  for (int i=0; i < argv.length; i++) {
    String arg=argv[i];
    if (arg.startsWith("String_Node_Str")) {
      String option=arg.substring(1);
      String key=option.toLowerCase(Locale.ENGLISH);
      XMLFeatureState feature=(XMLFeatureState)features.get(key);
      if (feature != null) {
        feature.setState(option.equals(key));
      }
    }
  }
}
Program: 101646
Project: 101646
Buggy source:
/** 
 * From a sentence get a list of words (in original order) without any punctuation, and all in lower case.
 * @param aSentence The string to parse.
 * @return The words split up as an array
 */
public static String[] getWords(String aSentence){
  String sentence=aSentence;
  sentence=sentence.replaceAll("String_Node_Str","String_Node_Str");
  sentence=sentence.replace('.',' ');
  sentence=sentence.replace('!',' ');
  sentence=sentence.replace('?',' ');
  sentence=sentence.replace(':',' ');
  sentence=sentence.replace(';',' ');
  sentence=sentence.replace('"',' ');
  sentence=sentence.replace('\'',' ');
  sentence=sentence.replace('(',' ');
  sentence=sentence.replace(')',' ');
  String[] words=StringUtil.split(sentence,"String_Node_Str");
  String[] retcode=new String[words.length];
  for (int i=0; i < words.length; i++) {
    retcode[i]=stripPunctuationWord(words[i]).toLowerCase();
  }
  return retcode;
}

Fixed version (ground truth):
/** 
 * From a sentence get a list of words (in original order) without any punctuation, and all in lower case.
 * @param aSentence The string to parse.
 * @return The words split up as an array
 */
public static String[] getWords(String aSentence){
  String sentence=aSentence;
  sentence=sentence.replaceAll("String_Node_Str","String_Node_Str");
  sentence=sentence.replace('.',' ');
  sentence=sentence.replace('!',' ');
  sentence=sentence.replace('?',' ');
  sentence=sentence.replace(':',' ');
  sentence=sentence.replace(';',' ');
  sentence=sentence.replace('"',' ');
  sentence=sentence.replace('\'',' ');
  sentence=sentence.replace('(',' ');
  sentence=sentence.replace(')',' ');
  String[] words=StringUtil.split(sentence,"String_Node_Str");
  String[] retcode=new String[words.length];
  for (int i=0; i < words.length; i++) {
    retcode[i]=stripPunctuationWord(words[i]).toLowerCase(Locale.ENGLISH);
  }
  return retcode;
}
Program: 101647
Project: 101647
Buggy source:
private Tag getTag(String localname,String qname){
  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 t;
    }
    DataPolice.report("String_Node_Str" + qname);
  }
  return t;
}

Fixed version (ground truth):
private Tag getTag(String localname,String qname){
  Tag t=(Tag)TAG_MAP.get(qname);
  if (t == null) {
    t=(Tag)TAG_MAP.get(qname.toLowerCase(Locale.ENGLISH));
    if (t == null) {
      log.warn("String_Node_Str" + localname + "String_Node_Str"+ qname);
      return t;
    }
    DataPolice.report("String_Node_Str" + qname);
  }
  return t;
}
Program: 101648
Project: 101648
Buggy source:
/** 
 * @return Returns the relative path of the book's conf.
 */
public String getConfPath(){
  return SwordConstants.DIR_CONF + '/' + getInitials().toLowerCase()+ SwordConstants.EXTENSION_CONF;
}

Fixed version (ground truth):
/** 
 * @return Returns the relative path of the book's conf.
 */
public String getConfPath(){
  return SwordConstants.DIR_CONF + '/' + getInitials().toLowerCase(Locale.ENGLISH)+ SwordConstants.EXTENSION_CONF;
}
Program: 101649
Project: 101649
Buggy source:
public Element processTag(Element ele,Attributes attrs){
  Element hi=OSISUtil.factory().createHI();
  hi.setAttribute(OSISUtil.OSIS_ATTR_TYPE,OSISUtil.HI_SMALL_CAPS);
  ele.addContent(hi);
  return hi;
}

Fixed version (ground truth):
public Element processTag(Element ele,Attributes attrs){
  Element hi=OSISUtil.factory().createHI();
  hi.setAttribute(OSISUtil.OSIS_ATTR_TYPE,OSISUtil.HI_X_SMALL);
  ele.addContent(hi);
  return hi;
}
Program: 101650
Project: 101650
Buggy source:
public void setString(String value) throws Exception {
  try {
    Object object=convertToObject(value);
    setter.invoke(null,new Object[]{object});
  }
 catch (  InvocationTargetException ex) {
    log.info("String_Node_Str" + setter.toString());
    Throwable orig=ex.getTargetException();
    if (orig instanceof Exception) {
      throw (Exception)orig;
    }
    throw ex;
  }
catch (  Exception ex) {
    log.info("String_Node_Str" + setter.toString());
    throw ex;
  }
}

Fixed version (ground truth):
public void setString(String value) throws ConfigException {
  Exception ex=null;
  try {
    Object object=convertToObject(value);
    setter.invoke(null,new Object[]{object});
  }
 catch (  InvocationTargetException e) {
    ex=e;
  }
catch (  IllegalArgumentException e) {
    ex=e;
  }
catch (  IllegalAccessException e) {
    ex=e;
  }
  if (ex != null) {
    log.info("String_Node_Str" + setter.toString());
    throw new ConfigException(Msg.CONFIG_SETFAIL,ex,new Object[]{setter});
  }
}
Program: 101651
Project: 101651
Buggy source:
/** 
 * String value to associate with this Field. This method can throw any Exception since almost anything could go wrong at this point. The Config dialog ought to cope with any errors.
 * @param value The new value for this Choice
 */
void setString(String value) throws Exception ;

Fixed version (ground truth):
/** 
 * String value to associate with this Field. This method can throw any Exception since almost anything could go wrong at this point. The Config dialog ought to cope with any errors.
 * @param value The new value for this Choice
 */
void setString(String value) throws ConfigException ;
Program: 101652
Project: 101652
Buggy source:
/** 
 * Add the set of configuration options specified in the xml file.
 * @param xmlconfig The JDOM document to read.
 * @param configResources contains the user level text for this config
 */
public void add(Document xmlconfig,ResourceBundle configResources){
  Element root=xmlconfig.getRootElement();
  Iterator iter=root.getChildren().iterator();
  while (iter.hasNext()) {
    Element element=(Element)iter.next();
    String key=element.getAttributeValue("String_Node_Str");
    try {
      Choice choice=ChoiceFactory.getChoice(element,configResources);
      add(key,choice);
    }
 catch (    Exception ex) {
      log.warn("String_Node_Str" + key,ex);
    }
  }
}

Fixed version (ground truth):
/** 
 * Add the set of configuration options specified in the xml file.
 * @param xmlconfig The JDOM document to read.
 * @param configResources contains the user level text for this config
 */
public void add(Document xmlconfig,ResourceBundle configResources){
  Element root=xmlconfig.getRootElement();
  Iterator iter=root.getChildren().iterator();
  while (iter.hasNext()) {
    Element element=(Element)iter.next();
    String key=element.getAttributeValue("String_Node_Str");
    Exception ex=null;
    try {
      Choice choice=ChoiceFactory.getChoice(element,configResources);
      add(key,choice);
    }
 catch (    StartupException e) {
      ex=e;
    }
catch (    ClassNotFoundException e) {
      ex=e;
    }
catch (    IllegalAccessException e) {
      ex=e;
    }
catch (    InstantiationException e) {
      ex=e;
    }
    if (ex != null) {
      log.warn("String_Node_Str" + key,ex);
    }
  }
}
Program: 101653
Project: 101653
Buggy source:
/** 
 * Take the data in the local storage area and copy it to the application.
 */
public void localToApplication(){
  Iterator iter=keys.iterator();
  while (iter.hasNext()) {
    String key=(String)iter.next();
    Choice choice=getChoice(key);
    String oldValue=choice.getString();
    String newValue=local.getProperty(key);
    if (newValue == null || newValue.length() == 0) {
      if (oldValue == null) {
        continue;
      }
      local.setProperty(key,oldValue);
      newValue=oldValue;
    }
    try {
      if (!newValue.equals(oldValue)) {
        log.info("String_Node_Str" + key + "String_Node_Str"+ newValue+ "String_Node_Str"+ oldValue+ "String_Node_Str");
        choice.setString(newValue);
      }
    }
 catch (    Exception ex) {
      log.warn("String_Node_Str" + key + "String_Node_Str"+ newValue,ex);
      Reporter.informUser(this,new ConfigException(Msg.CONFIG_SETFAIL,ex,new Object[]{choice.getFullPath()}));
    }
  }
}

Fixed version (ground truth):
/** 
 * Take the data in the local storage area and copy it to the application.
 */
public void localToApplication(){
  Iterator iter=keys.iterator();
  while (iter.hasNext()) {
    String key=(String)iter.next();
    Choice choice=getChoice(key);
    String oldValue=choice.getString();
    String newValue=local.getProperty(key);
    if (newValue == null || newValue.length() == 0) {
      if (oldValue == null) {
        continue;
      }
      local.setProperty(key,oldValue);
      newValue=oldValue;
    }
    if (!newValue.equals(oldValue)) {
      log.info("String_Node_Str" + key + "String_Node_Str"+ newValue+ "String_Node_Str"+ oldValue+ "String_Node_Str");
      try {
        choice.setString(newValue);
      }
 catch (      LucidException ex) {
        log.warn("String_Node_Str" + key + "String_Node_Str"+ newValue,ex);
        Reporter.informUser(this,new ConfigException(Msg.CONFIG_SETFAIL,ex,new Object[]{choice.getFullPath()}));
      }
    }
  }
}
Program: 101654
Project: 101654
Buggy source:
/** 
 * Take the data in the application and copy it to the local storage area.
 */
public void applicationToLocal(){
  Iterator iter=keys.iterator();
  while (iter.hasNext()) {
    String key=(String)iter.next();
    try {
      Choice model=getChoice(key);
      String value=model.getString();
      local.put(key,value);
    }
 catch (    Exception ex) {
      log.warn("String_Node_Str" + key);
      Reporter.informUser(this,ex);
    }
  }
}

Fixed version (ground truth):
/** 
 * Take the data in the application and copy it to the local storage area.
 */
public void applicationToLocal(){
  Iterator iter=keys.iterator();
  while (iter.hasNext()) {
    String key=(String)iter.next();
    Choice model=getChoice(key);
    String value=model.getString();
    local.put(key,value);
  }
}
Program: 101655
Project: 101655
Buggy source:
protected void fireStateChanged(){
  final WorkEvent ev=new WorkEvent(this);
  final List temp=new ArrayList();
synchronized (this) {
    temp.addAll(listeners);
  }
  if (listeners != null) {
    int count=temp.size();
    for (int i=0; i < count; i++) {
      ((WorkListener)temp.get(i)).workStateChanged(ev);
    }
  }
}

Fixed version (ground truth):
protected void fireStateChanged(){
  final WorkEvent ev=new WorkEvent(this);
  final List temp=new ArrayList();
synchronized (this) {
    if (listeners != null) {
      temp.addAll(listeners);
    }
  }
  int count=temp.size();
  for (int i=0; i < count; i++) {
    ((WorkListener)temp.get(i)).workStateChanged(ev);
  }
}
Program: 101656
Project: 101656
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.instance().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.
 */
public CWClassLoader(){
  owner=CallContext.getCallingClass();
}
Program: 101657
Project: 101657
Buggy source:
/** 
 * When called from a method it will return the i-th class calling that method, up the call chain. If used with a -1 it will return the class making the call -2 and -3 will return this class
 * @throws ArrayIndexOutOfBoundsException if the index is not valid
 */
public Class getCallingClass(int i){
  return resolver.getClassContext()[CALL_CONTEXT_OFFSET + i];
}

Fixed version (ground truth):
/** 
 * When called from a method it will return the i-th class calling that method, up the call chain. If used with a -1 it will return the class making the call -2 and -3 will return this class
 * @throws ArrayIndexOutOfBoundsException if the index is not valid
 */
public static Class getCallingClass(int i){
  return instance().getClassContext()[CALL_CONTEXT_OFFSET + i];
}