nus-yam/ex-repair huggingface dataset:
Program: 101699
Project: 101699
Buggy source:
/** 
 * Get the sword index of the given verse
 */
static long getIndex(Verse v){
  int ord=v.getOrdinal();
  int book=v.getBook();
  int chapter=v.getChapter();
  int verse=v.getVerse();
  int testament=-1;
  if (ord >= SwordConstants.ORDINAL_MAT11) {
    testament=SwordConstants.TESTAMENT_NEW;
    book=book - BibleInfo.Names.MALACHI;
  }
 else {
    testament=SwordConstants.TESTAMENT_OLD;
  }
  int bookOffset=SwordConstants.bks[testament][book];
  long chapOffset=SwordConstants.cps[testament][bookOffset + chapter];
  return verse + chapOffset;
}

Fixed version (ground truth):
/** 
 * Get the sword index of the given verse
 */
static int getIndex(Verse v){
  int ord=v.getOrdinal();
  int book=v.getBook();
  int chapter=v.getChapter();
  int verse=v.getVerse();
  int testament=-1;
  if (ord >= SwordConstants.ORDINAL_MAT11) {
    testament=SwordConstants.TESTAMENT_NEW;
    book=book - BibleInfo.Names.MALACHI;
  }
 else {
    testament=SwordConstants.TESTAMENT_OLD;
  }
  short bookOffset=SwordConstants.bks[testament][book];
  short chapOffset=SwordConstants.cps[testament][bookOffset + chapter];
  return verse + chapOffset;
}
Program: 101700
Project: 101700
Buggy source:
/** 
 * Read a RandomAccessFile
 * @param raf The file to read
 * @param offset The record to read
 * @param size The number of bytes to read
 * @return the read data
 */
protected static byte[] readRAF(RandomAccessFile raf,long offset,int size) throws IOException {
  if (offset + size > raf.length()) {
    DataPolice.report("String_Node_Str" + offset + "String_Node_Str"+ size+ "String_Node_Str"+ raf.length());
    size=(int)(raf.length() - offset);
  }
  if (size < 1) {
    DataPolice.report("String_Node_Str" + size);
    return new byte[0];
  }
  raf.seek(offset);
  byte[] read=new byte[size];
  raf.readFully(read);
  return read;
}

Fixed version (ground truth):
/** 
 * Read a RandomAccessFile
 * @param raf The file to read
 * @param offset The record to read
 * @param size The number of bytes to read
 * @return the read data
 */
protected static byte[] readRAF(RandomAccessFile raf,int offset,int size) throws IOException {
  if (offset + size > raf.length()) {
    DataPolice.report("String_Node_Str" + offset + "String_Node_Str"+ size+ "String_Node_Str"+ raf.length());
    size=(int)(raf.length() - offset);
  }
  if (size < 1) {
    DataPolice.report("String_Node_Str" + offset + "String_Node_Str"+ size);
    return new byte[0];
  }
  raf.seek(offset);
  byte[] read=new byte[size];
  raf.readFully(read);
  return read;
}
Program: 101701
Project: 101701
Buggy source:
/** 
 * Decode little endian data from a byte array
 * @param data the byte[] from which to read 4 bytes
 * @param offset the offset into the array
 * @return The decoded data
 */
protected static long decodeLittleEndian32(byte[] data,int offset){
  long byte1=data[0 + offset] & 0xFF;
  long byte2=(data[1 + offset] & 0xFF) << 8;
  long byte3=(data[2 + offset] & 0xFF) << 16;
  long byte4=(data[3 + offset] & 0xFF) << 24;
  return byte4 | byte3 | byte2| byte1;
}

Fixed version (ground truth):
/** 
 * Decode little endian data from a byte array. This assumes that the high order bit is not set as this is used solely for an offset in a file in bytes. For a practical limit, 2**31 is way bigger than any document that we can have.
 * @param data the byte[] from which to read 4 bytes
 * @param offset the offset into the array
 * @return The decoded data
 */
protected static int decodeLittleEndian32(byte[] data,int offset){
  int byte1=data[0 + offset] & 0xFF;
  int byte2=(data[1 + offset] & 0xFF) << 8;
  int byte3=(data[2 + offset] & 0xFF) << 16;
  int byte4=(data[3 + offset] & 0xFF) << 24;
  return byte4 | byte3 | byte2| byte1;
}
Program: 101702
Project: 101702
Buggy source:
public Element processTag(Element ele,Attributes attrs){
  Element div=OSISUtil.factory().createDiv();
  ele.addContent(div);
  return div;
}

Fixed version (ground truth):
public Element processTag(Element ele,Attributes attrs){
  String typeAttr=attrs.getValue("String_Node_Str");
  if ("String_Node_Str".equals(typeAttr)) {
    Element seg=OSISUtil.factory().createSeg();
    seg.setAttribute(OSISUtil.ATTRIBUTE_SEG_TYPE,OSISUtil.VARIANT_TYPE);
    String classAttr=attrs.getValue("String_Node_Str");
    if (classAttr != null) {
      seg.setAttribute(OSISUtil.ATTRIBUTE_SEG_SUBTYPE,OSISUtil.VARIANT_CLASS + classAttr);
    }
    ele.addContent(seg);
    return seg;
  }
  Element div=OSISUtil.factory().createDiv();
  ele.addContent(div);
  return div;
}
Program: 101704
Project: 101704
Buggy source:
public Key find(String search) throws BookException {
  checkActive();
  SearchModifier modifier=getSearchModifier();
  Key results=null;
  if (search != null) {
    try {
      Analyzer analyzer=new SimpleAnalyzer();
      Query query=QueryParser.parse(search,LuceneIndex.FIELD_BODY,analyzer);
      Hits hits=searcher.search(query);
      if (modifier != null && modifier.isRanked()) {
        PassageTally tally=new PassageTally();
        results=tally;
        for (int i=0; i < hits.length(); i++) {
          Verse verse=VerseFactory.fromString(hits.doc(i).get(LuceneIndex.FIELD_NAME));
          int score=(int)(hits.score(i) * 100);
          tally.add(verse,score);
        }
      }
 else {
        results=book.createEmptyKeyList();
        for (int i=0; i < hits.length(); i++) {
          Verse verse=VerseFactory.fromString(hits.doc(i).get(LuceneIndex.FIELD_NAME));
          results.addAll(verse);
        }
      }
    }
 catch (    Exception ex) {
      throw new BookException(Msg.SEARCH_FAILED,ex);
    }
 finally {
      Activator.deactivate(this);
    }
  }
  if (results == null) {
    if (modifier != null && modifier.isRanked()) {
      results=new PassageTally();
    }
 else {
      results=book.createEmptyKeyList();
    }
  }
  return results;
}

Fixed version (ground truth):
public Key find(String search) throws BookException {
  checkActive();
  SearchModifier modifier=getSearchModifier();
  Key results=null;
  if (search != null) {
    try {
      Analyzer analyzer=new SimpleAnalyzer();
      Query query=QueryParser.parse(search,LuceneIndex.FIELD_BODY,analyzer);
      Hits hits=searcher.search(query);
      if (modifier != null && modifier.isRanked()) {
        PassageTally tally=new PassageTally();
        results=tally;
        for (int i=0; i < hits.length(); i++) {
          Verse verse=VerseFactory.fromString(hits.doc(i).get(LuceneIndex.FIELD_NAME));
          int score=(int)(hits.score(i) * 100 + 1);
          tally.add(verse,score);
        }
      }
 else {
        results=book.createEmptyKeyList();
        for (int i=0; i < hits.length(); i++) {
          Verse verse=VerseFactory.fromString(hits.doc(i).get(LuceneIndex.FIELD_NAME));
          results.addAll(verse);
        }
      }
    }
 catch (    Exception ex) {
      throw new BookException(Msg.SEARCH_FAILED,ex);
    }
 finally {
      Activator.deactivate(this);
    }
  }
  if (results == null) {
    if (modifier != null && modifier.isRanked()) {
      results=new PassageTally();
    }
 else {
      results=book.createEmptyKeyList();
    }
  }
  return results;
}
Program: 101705
Project: 101705
Buggy source:
/** 
 * A simplified plain text version of the data in this document with all the markup stripped out.
 * @return The Bible text without markup
 */
public String getPlainText(){
  StringBuffer buffer=new StringBuffer();
  Element osisText=getOsis().getChild(OSISUtil.OSIS_ELEMENT_OSISTEXT);
  List divs=osisText.getChildren(OSISUtil.OSIS_ELEMENT_DIV);
  for (Iterator oit=divs.iterator(); oit.hasNext(); ) {
    Element div=(Element)oit.next();
    Iterator dit=div.getContent().iterator();
    while (dit.hasNext()) {
      Object data=dit.next();
      if (data instanceof Element) {
        Element ele=(Element)data;
        if (ele.getName().equals(OSISUtil.OSIS_ELEMENT_VERSE)) {
          String txt=OSISUtil.getPlainText((Element)data);
          buffer.append(txt);
        }
      }
    }
  }
  return buffer.toString().trim();
}

Fixed version (ground truth):
/** 
 * A simplified plain text version of the data in this document with all the markup stripped out. This is not as simple as it seems. TODO(DMS): push this into OSISUtil
 * @return The text without markup
 */
public String getPlainText(){
  return OSISUtil.getPlainText(getOsis());
}
Program: 101706
Project: 101706
Buggy source:
/** 
 * A simplified plain text version of the data in this Element with all the markup stripped out.
 * @return The Bible text without markup
 */
public static String getPlainText(Element ele){
  StringBuffer buffer=new StringBuffer();
  List content=ele.getContent();
  for (Iterator it=content.iterator(); it.hasNext(); ) {
    Object next=it.next();
    recurseElement(next,buffer);
  }
  return buffer.toString();
}

Fixed version (ground truth):
/** 
 * A simplified plain text version of the data in this Element with all the markup stripped out.
 * @return The Bible text without markup
 */
public static String getPlainText(Element root){
  StringBuffer buffer=new StringBuffer();
  Element osisText=root.getChild(OSISUtil.OSIS_ELEMENT_OSISTEXT);
  List divs=osisText.getChildren(OSISUtil.OSIS_ELEMENT_DIV);
  for (Iterator oit=divs.iterator(); oit.hasNext(); ) {
    Element div=(Element)oit.next();
    Iterator dit=div.getContent().iterator();
    while (dit.hasNext()) {
      Object data=dit.next();
      if (data instanceof Element) {
        Element ele=(Element)data;
        if (ele.getName().equals(OSISUtil.OSIS_ELEMENT_VERSE)) {
          String txt=OSISUtil.getTextContent((Element)data);
          buffer.append(txt);
        }
      }
    }
  }
  return buffer.toString().trim();
}
Program: 101707
Project: 101707
Buggy source:
public void endElement(String uri,String localname,String qname){
  depth--;
  if (formatting.isClassic()) {
    emitWhitespace(depth);
  }
  write(getEndTagStart());
  write(decorateTagName(localname));
  if (formatting.isAnalytic()) {
    emitWhitespace(depth);
  }
  write(getTagEnd());
  pendingEndTag=false;
  lookingForChars=false;
}

Fixed version (ground truth):
public void endElement(String uri,String localname,String qname){
  depth--;
  if (pendingEndTag) {
    if (formatting.isAnalytic() && depth > 0) {
      emitWhitespace(depth - 1);
    }
    write(getTagEnd());
  }
  if (formatting.isClassic()) {
    emitWhitespace(depth);
  }
  write(getEndTagStart());
  write(decorateTagName(localname));
  if (formatting.isAnalytic()) {
    emitWhitespace(depth);
  }
  write(getTagEnd());
  pendingEndTag=false;
  lookingForChars=false;
}
Program: 101708
Project: 101708
Buggy source:
/** 
 * Create a new set of components for the new Job
 */
protected synchronized void addJob(Job job){
  job.addPropertyChangeListener(this);
  int i=findEmptyPosition();
  log.debug("String_Node_Str" + i + "String_Node_Str"+ job.getJobDescription());
  JProgressBar progress=new JProgressBar();
  progress.setStringPainted(true);
  progress.setToolTipText(job.getJobDescription());
  progress.setBorder(null);
  progress.setBackground(getBackground());
  progress.setForeground(getForeground());
  if (font != null) {
    progress.setFont(font);
  }
  JobData jobdata=new JobData(job,i,progress);
  jobs.put(job,jobdata);
  if (i >= positions.size()) {
    positions.add(jobdata);
  }
 else {
    positions.set(i,jobdata);
  }
  this.add(jobdata.getComponent(),i);
  this.revalidate();
}

Fixed version (ground truth):
/** 
 * Create a new set of components for the new Job
 */
protected synchronized void addJob(Job job){
  job.addPropertyChangeListener(this);
  int i=findEmptyPosition();
  log.debug("String_Node_Str" + i + "String_Node_Str"+ job.getJobDescription());
  JProgressBar progress=new JProgressBar();
  progress.setStringPainted(true);
  progress.setToolTipText(job.getJobDescription());
  progress.setBorder(null);
  progress.setBackground(getBackground());
  progress.setForeground(getForeground());
  if (font != null) {
    progress.setFont(font);
  }
  JobData jobdata=new JobData(job,i,progress);
  jobs.put(job,jobdata);
  if (i >= positions.size()) {
    positions.add(jobdata);
  }
 else {
    positions.set(i,jobdata);
  }
  this.add(jobdata.getComponent(),i);
  GuiUtil.refresh(this);
}
Program: 101709
Project: 101709
Buggy source:
/** 
 * Remove the set of components from the panel
 */
protected synchronized void removeJob(Job job){
  job.addPropertyChangeListener(this);
  JobData jobdata=(JobData)jobs.get(job);
  positions.set(jobdata.getIndex(),null);
  jobs.remove(job);
  log.debug("String_Node_Str" + jobdata.getJob().getJobDescription());
  this.remove(jobdata.getComponent());
  this.revalidate();
  jobdata.invalidate();
}

Fixed version (ground truth):
/** 
 * Remove the set of components from the panel
 */
protected synchronized void removeJob(Job job){
  job.addPropertyChangeListener(this);
  JobData jobdata=(JobData)jobs.get(job);
  positions.set(jobdata.getIndex(),null);
  jobs.remove(job);
  log.debug("String_Node_Str" + jobdata.getJob().getJobDescription());
  this.remove(jobdata.getComponent());
  GuiUtil.refresh(this);
  jobdata.invalidate();
}
Program: 101710
Project: 101710
Buggy source:
/** 
 * Create a new set of components for the new Job
 */
protected void addJob(final Job job){
  int i=findEmptyPosition();
  log.debug("String_Node_Str" + i + "String_Node_Str"+ job.getJobDescription());
  JProgressBar progress=new JProgressBar();
  progress.setStringPainted(true);
  progress.setString("String_Node_Str");
  progress.setToolTipText(job.getJobDescription());
  progress.setValue(0);
  JLabel label=new JLabel(job.getJobDescription() + "String_Node_Str");
  JButton cancel=new JButton(Msg.CANCEL.toString());
  if (!job.isInterruptable()) {
    cancel.setEnabled(false);
  }
  cancel.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent ev){
      job.interrupt();
    }
  }
);
  jobsPanel.add(label,new GridBagConstraints(0,i,1,1,0.0,0.0,GridBagConstraints.EAST,GridBagConstraints.BOTH,new Insets(5,5,5,5),0,0));
  jobsPanel.add(progress,new GridBagConstraints(1,i,1,1,1.0,0.0,GridBagConstraints.CENTER,GridBagConstraints.HORIZONTAL,new Insets(0,0,0,0),0,0));
  jobsPanel.add(cancel,new GridBagConstraints(2,i,1,1,0.0,0.0,GridBagConstraints.CENTER,GridBagConstraints.NONE,new Insets(5,5,5,5),0,0));
  this.revalidate();
  JobData jobdata=new JobData(job,i,label,progress,cancel);
  jobs.put(job,jobdata);
  if (i >= positions.size()) {
    positions.add(jobdata);
  }
 else {
    positions.set(i,jobdata);
  }
}

Fixed version (ground truth):
/** 
 * Create a new set of components for the new Job
 */
protected void addJob(final Job job){
  int i=findEmptyPosition();
  log.debug("String_Node_Str" + i + "String_Node_Str"+ job.getJobDescription());
  JProgressBar progress=new JProgressBar();
  progress.setStringPainted(true);
  progress.setString("String_Node_Str");
  progress.setToolTipText(job.getJobDescription());
  progress.setValue(0);
  JLabel label=new JLabel(job.getJobDescription() + "String_Node_Str");
  JButton cancel=new JButton(Msg.CANCEL.toString());
  if (!job.isInterruptable()) {
    cancel.setEnabled(false);
  }
  cancel.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent ev){
      job.interrupt();
    }
  }
);
  jobsPanel.add(label,new GridBagConstraints(0,i,1,1,0.0,0.0,GridBagConstraints.EAST,GridBagConstraints.BOTH,new Insets(5,5,5,5),0,0));
  jobsPanel.add(progress,new GridBagConstraints(1,i,1,1,1.0,0.0,GridBagConstraints.CENTER,GridBagConstraints.HORIZONTAL,new Insets(0,0,0,0),0,0));
  jobsPanel.add(cancel,new GridBagConstraints(2,i,1,1,0.0,0.0,GridBagConstraints.CENTER,GridBagConstraints.NONE,new Insets(5,5,5,5),0,0));
  GuiUtil.refresh(this);
  JobData jobdata=new JobData(job,i,label,progress,cancel);
  jobs.put(job,jobdata);
  if (i >= positions.size()) {
    positions.add(jobdata);
  }
 else {
    positions.set(i,jobdata);
  }
}
Program: 101711
Project: 101711
Buggy source:
/** 
 * Add the "no jobs" label
 */
protected void addEmptyLabel(){
  jobsPanel.add(noJobLabel,new GridBagConstraints(0,0,3,1,0.0,0.0,GridBagConstraints.EAST,GridBagConstraints.BOTH,new Insets(5,5,5,5),0,0));
  this.revalidate();
}

Fixed version (ground truth):
/** 
 * Add the "no jobs" label
 */
protected void addEmptyLabel(){
  jobsPanel.add(noJobLabel,new GridBagConstraints(0,0,3,1,0.0,0.0,GridBagConstraints.EAST,GridBagConstraints.BOTH,new Insets(5,5,5,5),0,0));
  GuiUtil.refresh(this);
}
Program: 101712
Project: 101712
Buggy source:
/** 
 * Remove the set of components from the panel
 */
protected void removeJob(Job job){
  JobData jobdata=(JobData)jobs.get(job);
  log.debug("String_Node_Str" + jobdata.getIndex() + "String_Node_Str"+ job.getJobDescription());
  positions.set(jobdata.getIndex(),null);
  jobs.remove(job);
  jobsPanel.remove(jobdata.getLabel());
  jobsPanel.remove(jobdata.getProgress());
  jobsPanel.remove(jobdata.getCancel());
  this.revalidate();
  jobdata.invalidate();
}

Fixed version (ground truth):
/** 
 * Remove the set of components from the panel
 */
protected void removeJob(Job job){
  JobData jobdata=(JobData)jobs.get(job);
  log.debug("String_Node_Str" + jobdata.getIndex() + "String_Node_Str"+ job.getJobDescription());
  positions.set(jobdata.getIndex(),null);
  jobs.remove(job);
  jobsPanel.remove(jobdata.getLabel());
  jobsPanel.remove(jobdata.getProgress());
  jobsPanel.remove(jobdata.getCancel());
  GuiUtil.refresh(this);
  jobdata.invalidate();
}
Program: 101713
Project: 101713
Buggy source:
/** 
 * Get rid of the "no jobs" label
 */
protected void removeEmptyLabel(){
  jobsPanel.remove(noJobLabel);
  this.revalidate();
}

Fixed version (ground truth):
/** 
 * Get rid of the "no jobs" label
 */
protected void removeEmptyLabel(){
  jobsPanel.remove(noJobLabel);
  GuiUtil.refresh(this);
}
Program: 101715
Project: 101715
Buggy source:
/** 
 * A more restricted version of pack() for component responding to live component tweaks. Assuming that the window already has a sensible on screen size, do a pack, but don't let the window grow or shrink by more than 10%.
 * @param win The window to be packed
 */
public static void restrainedRePack(Window win){
  Dimension orig=win.getSize();
  Dimension max=new Dimension((int)(orig.width * 1.1),(int)(orig.height * 1.1));
  Dimension min=new Dimension((int)(orig.width / 1.1),(int)(orig.height / 1.1));
  win.pack();
  if (win.getSize().width > max.width) {
    win.setSize(max.width,win.getSize().height);
  }
  if (win.getSize().height > max.height) {
    win.setSize(win.getSize().width,max.height);
  }
  if (win.getSize().width < min.width) {
    win.setSize(min.width,win.getSize().height);
  }
  if (win.getSize().height < min.height) {
    win.setSize(win.getSize().width,min.height);
  }
  Dimension screenDim=Toolkit.getDefaultToolkit().getScreenSize();
  if (screenDim.width < win.getSize().width) {
    win.setSize(screenDim.width,win.getSize().height);
  }
  if (screenDim.height < win.getSize().height) {
    win.setSize(win.getSize().width,screenDim.height);
  }
  win.invalidate();
  win.validate();
}

Fixed version (ground truth):
/** 
 * A more restricted version of pack() for component responding to live component tweaks. Assuming that the window already has a sensible on screen size, do a pack, but don't let the window grow or shrink by more than 10%.
 * @param win The window to be packed
 */
public static void restrainedRePack(Window win){
  Dimension orig=win.getSize();
  Dimension max=new Dimension((int)(orig.width * 1.1),(int)(orig.height * 1.1));
  Dimension min=new Dimension((int)(orig.width / 1.1),(int)(orig.height / 1.1));
  win.pack();
  if (win.getSize().width > max.width) {
    win.setSize(max.width,win.getSize().height);
  }
  if (win.getSize().height > max.height) {
    win.setSize(win.getSize().width,max.height);
  }
  if (win.getSize().width < min.width) {
    win.setSize(min.width,win.getSize().height);
  }
  if (win.getSize().height < min.height) {
    win.setSize(win.getSize().width,min.height);
  }
  Dimension screenDim=Toolkit.getDefaultToolkit().getScreenSize();
  if (screenDim.width < win.getSize().width) {
    win.setSize(screenDim.width,win.getSize().height);
  }
  if (screenDim.height < win.getSize().height) {
    win.setSize(win.getSize().width,screenDim.height);
  }
  refresh(win);
}
Program: 101716
Project: 101716
Buggy source:
/** 
 * A more restricted version of pack() when the component is being pack()ed for the first time. Since this is a 'first time only' pack we are only concerned with screen size, and not any growths/shrinkages like restrainedRePack(Window).
 * @param win The window to be packed
 * @param maxx The maximum fraction (0.0 to 1.0) of the screen to be takenup horizontally (-1 means no restrictions to the horizontal alterations)
 * @param maxy The maximum fraction (0.0 to 1.0) of the screen to be takenup vertically (-1 means no restrictions to the vertical alterations)
 * @see GuiUtil#restrainedRePack(Window)
 */
public static void restrainedPack(Window win,float maxx,float maxy){
  win.pack();
  Dimension screen_dim=Toolkit.getDefaultToolkit().getScreenSize();
  if (maxx != -1 && win.getSize().width > (screen_dim.width * maxx)) {
    win.setSize((int)(screen_dim.width * maxx),win.getSize().height);
  }
  if (maxy != -1 && win.getSize().height > (screen_dim.height * maxy)) {
    win.setSize(win.getSize().width,(int)(screen_dim.height * maxy));
  }
  win.invalidate();
  win.validate();
}

Fixed version (ground truth):
/** 
 * A more restricted version of pack() when the component is being pack()ed for the first time. Since this is a 'first time only' pack we are only concerned with screen size, and not any growths/shrinkages like restrainedRePack(Window).
 * @param win The window to be packed
 * @param maxx The maximum fraction (0.0 to 1.0) of the screen to be takenup horizontally (-1 means no restrictions to the horizontal alterations)
 * @param maxy The maximum fraction (0.0 to 1.0) of the screen to be takenup vertically (-1 means no restrictions to the vertical alterations)
 * @see GuiUtil#restrainedRePack(Window)
 */
public static void restrainedPack(Window win,float maxx,float maxy){
  win.pack();
  Dimension screen_dim=Toolkit.getDefaultToolkit().getScreenSize();
  if (maxx != -1 && win.getSize().width > (screen_dim.width * maxx)) {
    win.setSize((int)(screen_dim.width * maxx),win.getSize().height);
  }
  if (maxy != -1 && win.getSize().height > (screen_dim.height * maxy)) {
    win.setSize(win.getSize().width,(int)(screen_dim.height * maxy));
  }
  refresh(win);
}
Program: 101720
Project: 101720
Buggy source:
/** 
 * Generate an index to use, telling the job about progress as you go.
 * @throws BookException If we fail to read the index files
 */
public LuceneIndex(Book book,URL storage,boolean create) throws BookException {
  assert create;
  this.book=book;
  File finalPath=null;
  try {
    finalPath=NetUtil.getAsFile(storage);
    this.path=finalPath.getCanonicalPath();
  }
 catch (  IOException ex) {
    throw new BookException(Msg.LUCENE_INIT,ex);
  }
  Job job=JobManager.createJob(Msg.INDEX_START.toString(),Thread.currentThread(),false);
  IndexStatus finalStatus=IndexStatus.UNDONE;
  try {
synchronized (CREATING) {
      book.setIndexStatus(IndexStatus.CREATING);
      File tempPath=new File(path + '.' + IndexStatus.CREATING.toString());
      IndexWriter writer=new IndexWriter(tempPath.getCanonicalPath(),new SimpleAnalyzer(),true);
      generateSearchIndexImpl(job,writer,book.getGlobalKeyList());
      job.setProgress(95,Msg.OPTIMIZING.toString());
      writer.optimize();
      writer.close();
      job.setInterruptable(false);
      if (!job.isFinished()) {
        tempPath.renameTo(finalPath);
      }
      if (finalPath.exists()) {
        finalStatus=IndexStatus.DONE;
      }
    }
  }
 catch (  Exception ex) {
    job.ignoreTimings();
    throw new BookException(Msg.LUCENE_INIT,ex);
  }
 finally {
    book.setIndexStatus(finalStatus);
    job.done();
  }
}

Fixed version (ground truth):
/** 
 * Generate an index to use, telling the job about progress as you go.
 * @throws BookException If we fail to read the index files
 */
public LuceneIndex(Book book,URL storage,boolean create) throws BookException {
  assert create;
  this.book=book;
  File finalPath=null;
  try {
    finalPath=NetUtil.getAsFile(storage);
    this.path=finalPath.getCanonicalPath();
  }
 catch (  IOException ex) {
    throw new BookException(Msg.LUCENE_INIT,ex);
  }
  Job job=JobManager.createJob(Msg.INDEX_START.toString(),Thread.currentThread(),false);
  IndexStatus finalStatus=IndexStatus.UNDONE;
  try {
synchronized (CREATING) {
      book.setIndexStatus(IndexStatus.CREATING);
      File tempPath=new File(path + '.' + IndexStatus.CREATING.toString());
      IndexWriter writer=new IndexWriter(tempPath.getCanonicalPath(),new SimpleAnalyzer(),true);
      List errors=new ArrayList();
      generateSearchIndexImpl(job,errors,writer,book.getGlobalKeyList());
      job.setProgress(95,Msg.OPTIMIZING.toString());
      writer.optimize();
      writer.close();
      job.setInterruptable(false);
      if (!job.isFinished()) {
        tempPath.renameTo(finalPath);
      }
      if (finalPath.exists()) {
        finalStatus=IndexStatus.DONE;
      }
      if (errors.size() > 0) {
        StringBuffer buf=new StringBuffer();
        Iterator iter=errors.iterator();
        while (iter.hasNext()) {
          buf.append(iter.next());
          buf.append('\n');
        }
        Reporter.informUser(this,Msg.BAD_VERSE,buf);
      }
    }
  }
 catch (  Exception ex) {
    job.ignoreTimings();
    throw new BookException(Msg.LUCENE_INIT,ex);
  }
 finally {
    book.setIndexStatus(finalStatus);
    job.done();
  }
}
Program: 101721
Project: 101721
Buggy source:
/** 
 * Dig down into a Key indexing as we go.
 */
private void generateSearchIndexImpl(Job job,IndexWriter writer,Key key) throws BookException, IOException {
}

Fixed version (ground truth):
/** 
 * Dig down into a Key indexing as we go.
 */
private void generateSearchIndexImpl(Job job,List errors,IndexWriter writer,Key key) throws BookException, IOException {
}
Program: 101722
Project: 101722
Buggy source:
/** 
 * Get the full name of a book (e.g. "Genesis"). Altered by the case setting (see setBookCase())
 * @param book The book number (1-66)
 * @return The full name of the book
 * @exception NoSuchVerseException If the book number is not valid
 */
public static final String getLongBookName(int book) throws NoSuchVerseException {
  try {
    if (bookCase.equals(CaseType.LOWER)) {
      return fullBooksLower[book - 1];
    }
    if (bookCase.equals(CaseType.UPPER)) {
      return fullBooksUpper[book - 1];
    }
    return fullBooks[book - 1];
  }
 catch (  ArrayIndexOutOfBoundsException ex) {
    throw new NoSuchVerseException(Msg.BOOKS_BOOK,new Object[]{new Integer(book)});
  }
}

Fixed version (ground truth):
/** 
 * Get the full name of a book (e.g. "Genesis"). Altered by the case setting (see setBookCase())
 * @param book The book number (1-66)
 * @return The full name of the book
 * @exception NoSuchVerseException If the book number is not valid
 */
public static final String getLongBookName(int book) throws NoSuchVerseException {
  try {
    if (bookCase == CaseType.LOWER) {
      return fullBooksLower[book - 1];
    }
    if (bookCase == CaseType.UPPER) {
      return fullBooksUpper[book - 1];
    }
    return fullBooks[book - 1];
  }
 catch (  ArrayIndexOutOfBoundsException ex) {
    throw new NoSuchVerseException(Msg.BOOKS_BOOK,new Object[]{new Integer(book)});
  }
}
Program: 101723
Project: 101723
Buggy source:
/** 
 * All LucidExceptions are constructed with references to resources in an i18n properties file. This version allows us to add parameters
 * @param msg The resource id to read
 * @param params An array of parameters
 */
public LucidException(MsgBase msg,Throwable cause,Object[] params){
  super(msg.toString(),cause);
  this.deprecated=false;
  this.params=(Object[])params.clone();
}

Fixed version (ground truth):
/** 
 * All LucidExceptions are constructed with references to resources in an i18n properties file. This version allows us to add parameters
 * @param msg The resource id to read
 * @param params An array of parameters
 */
public LucidException(MsgBase msg,Throwable cause,Object[] params){
  super(msg.toString(),cause);
  this.deprecated=false;
  if (params != null) {
    this.params=(Object[])params.clone();
  }
 else {
    this.params=null;
  }
}
Program: 101724
Project: 101724
Buggy source:
/** 
 * Gets a short HTML description of an Exception for display in a window
 */
public static String getHTMLDescription(Throwable ex){
  StringBuffer retcode=new StringBuffer();
  String msg=ex.getMessage();
  if (msg == null || msg.equals("String_Node_Str")) {
    msg=Msg.NO_DESC.toString();
  }
  String orig=msg;
  msg=orig.replaceAll("String_Node_Str","String_Node_Str");
  retcode.append("String_Node_Str");
  retcode.append(msg);
  Throwable nex=ex.getCause();
  if (nex != null) {
    retcode.append("String_Node_Str" + Msg.CAUSED_BY + "String_Node_Str");
    retcode.append(getHTMLDescription(nex));
  }
  return retcode.toString();
}

Fixed version (ground truth):
/** 
 * Gets a short HTML description of an Exception for display in a window
 */
public static String getHTMLDescription(Throwable ex){
  StringBuffer retcode=new StringBuffer();
  String msg=ex.getMessage();
  if (msg == null || msg.equals("String_Node_Str")) {
    msg=Msg.NO_DESC.toString();
  }
  String orig=XMLUtil.escape(msg);
  msg=orig.replaceAll("String_Node_Str","String_Node_Str");
  retcode.append("String_Node_Str");
  retcode.append(msg);
  Throwable nex=ex.getCause();
  if (nex != null) {
    retcode.append("String_Node_Str" + Msg.CAUSED_BY + "String_Node_Str");
    retcode.append(getHTMLDescription(nex));
  }
  return retcode.toString();
}
Program: 101726
Project: 101726
Buggy source:
public void endElement(String uri,String localname,String qname){
  depth--;
  if (pendingEndTag) {
    if (formatting.isAnalytic() && depth > 0) {
      emitWhitespace(depth - 1);
    }
    if (localname.equalsIgnoreCase("String_Node_Str")) {
      write(getTagEnd());
    }
 else {
      write(getEmptyTagEnd());
    }
  }
 else {
    if (formatting.isClassic()) {
      emitWhitespace(depth);
    }
    write(getEndTagStart());
    write(decorateTagName(localname));
    if (formatting.isAnalytic()) {
      emitWhitespace(depth);
    }
    write(getTagEnd());
  }
  pendingEndTag=false;
  lookingForChars=false;
}

Fixed version (ground truth):
public void endElement(String uri,String localname,String qname){
  depth--;
  if (formatting.isClassic()) {
    emitWhitespace(depth);
  }
  write(getEndTagStart());
  write(decorateTagName(localname));
  if (formatting.isAnalytic()) {
    emitWhitespace(depth);
  }
  write(getTagEnd());
  pendingEndTag=false;
  lookingForChars=false;
}
Program: 101727
Project: 101727
Buggy source:
protected void download(Job job,String dir,String file,URL dest) throws InstallException {
  try {
    URL url=new URL("String_Node_Str" + host + dir+ '/'+ file);
    copy(job,dest,url);
  }
 catch (  IOException ex) {
    throw new InstallException(Msg.UNKNOWN_ERROR,ex);
  }
}

Fixed version (ground truth):
protected void download(Job job,String dir,String file,URL dest) throws InstallException {
  try {
    URL url=new URL("String_Node_Str" + host + dir+ '/'+ file);
    copy(job,url,dest);
  }
 catch (  IOException ex) {
    throw new InstallException(Msg.UNKNOWN_ERROR,ex);
  }
}
Program: 101728
Project: 101728
Buggy source:
/** 
 */
public void save(){
}

Fixed version (ground truth):
/** 
 * Save all properties to the user's local area. Uses the same property name so as to override it.
 */
public void save(){
  Properties props=new Properties();
  for (Iterator it=installers.keySet().iterator(); it.hasNext(); ) {
    String name=(String)it.next();
    Installer installer=(Installer)installers.get(name);
    props.setProperty(name,installer.getURL());
  }
  URL outputURL=Project.instance().getWritablePropertiesURL(getClass().getName());
  try {
    OutputStream out=NetUtil.getOutputStream(outputURL);
    props.store(out,"String_Node_Str");
  }
 catch (  IOException e) {
    log.error("String_Node_Str",e);
  }
}
Program: 101729
Project: 101729
Buggy source:
/** 
 * Load the cached index file into memory
 */
private void loadCachedIndex() throws InstallException {
  entries.clear();
  URL cache=getCachedIndexFile();
  if (!NetUtil.isFile(cache)) {
    reloadBookList();
  }
  try {
    InputStream in=cache.openStream();
    GZIPInputStream gin=new GZIPInputStream(in);
    TarInputStream tin=new TarInputStream(gin);
    while (true) {
      TarEntry entry=tin.getNextEntry();
      if (entry == null) {
        break;
      }
      String internal=entry.getName();
      if (!entry.isDirectory()) {
        try {
          int size=(int)entry.getSize();
          byte[] buffer=new byte[size];
          tin.read(buffer);
          if (internal.endsWith(SwordConstants.EXTENSION_CONF)) {
            internal=internal.substring(0,internal.length() - 5);
          }
          if (internal.startsWith(SwordConstants.DIR_CONF + '/')) {
            internal=internal.substring(7);
          }
          Reader rin=new InputStreamReader(new ByteArrayInputStream(buffer));
          SwordBookMetaData sbmd=new SwordBookMetaData(rin,internal);
          if (sbmd.isSupported()) {
            entries.put(sbmd.getName(),sbmd);
          }
        }
 catch (        Exception ex) {
          log.warn("String_Node_Str" + internal,ex);
        }
      }
    }
    IOUtil.close(tin);
    IOUtil.close(gin);
    IOUtil.close(in);
    loaded=true;
  }
 catch (  IOException ex) {
    throw new InstallException(Msg.CACHE_ERROR,ex);
  }
}

Fixed version (ground truth):
/** 
 * Load the cached index file into memory
 */
private void loadCachedIndex() throws InstallException {
  BookDriver fake=new SwordBookDriver();
  entries.clear();
  URL cache=getCachedIndexFile();
  if (!NetUtil.isFile(cache)) {
    reloadBookList();
  }
  try {
    InputStream in=cache.openStream();
    GZIPInputStream gin=new GZIPInputStream(in);
    TarInputStream tin=new TarInputStream(gin);
    while (true) {
      TarEntry entry=tin.getNextEntry();
      if (entry == null) {
        break;
      }
      String internal=entry.getName();
      if (!entry.isDirectory()) {
        try {
          int size=(int)entry.getSize();
          byte[] buffer=new byte[size];
          tin.read(buffer);
          if (internal.endsWith(SwordConstants.EXTENSION_CONF)) {
            internal=internal.substring(0,internal.length() - 5);
          }
          if (internal.startsWith(SwordConstants.DIR_CONF + '/')) {
            internal=internal.substring(7);
          }
          Reader rin=new InputStreamReader(new ByteArrayInputStream(buffer));
          SwordBookMetaData sbmd=new SwordBookMetaData(rin,internal);
          sbmd.setDriver(fake);
          if (sbmd.isSupported()) {
            entries.put(sbmd.getName(),sbmd);
          }
        }
 catch (        Exception ex) {
          log.warn("String_Node_Str" + internal,ex);
        }
      }
    }
    IOUtil.close(tin);
    IOUtil.close(gin);
    IOUtil.close(in);
    loaded=true;
  }
 catch (  IOException ex) {
    throw new InstallException(Msg.CACHE_ERROR,ex);
  }
}
Program: 101730
Project: 101730
Buggy source:
/** 
 * @param driver The driver to set.
 */
protected void setDriver(BookDriver driver){
  this.driver=driver;
}

Fixed version (ground truth):
/** 
 * This setter is public because access is needed from *SwordInstallers as well as the normal sword drivers. Where is C++ friend when you need it!
 * @param driver The driver to set.
 */
public void setDriver(BookDriver driver){
  this.driver=driver;
}
Program: 101731
Project: 101731
Buggy source:
/** 
 * Unpack a zip file to a given directory
 * @param file The zip file to download
 * @param destdir The directory to unpack up
 * @throws IOException If there is an file error
 */
public static void unpackZip(File file,URL destdir) throws IOException {
  byte[] dbuf=new byte[4096];
  ZipFile zf=new ZipFile(file);
  Enumeration entries=zf.entries();
  while (entries.hasMoreElements()) {
    ZipEntry entry=(ZipEntry)entries.nextElement();
    String entrypath=entry.getName();
    String filename=entrypath.substring(entrypath.lastIndexOf('/') + 1);
    URL child=NetUtil.lengthenURL(destdir,filename);
    OutputStream dataOut=NetUtil.getOutputStream(child);
    InputStream dataIn=zf.getInputStream(entry);
    while (true) {
      int count=dataIn.read(dbuf);
      if (count == -1) {
        break;
      }
      dataOut.write(dbuf,0,count);
    }
    dataOut.close();
  }
}

Fixed version (ground truth):
/** 
 * Unpack a zip file to a given directory. Honor the paths as given in the zip file.
 * @param file The zip file to download
 * @param destdir The directory to unpack up
 * @throws IOException If there is an file error
 */
public static void unpackZip(File file,File destdir) throws IOException {
  byte[] dbuf=new byte[4096];
  ZipFile zf=new ZipFile(file);
  Enumeration entries=zf.entries();
  while (entries.hasMoreElements()) {
    ZipEntry entry=(ZipEntry)entries.nextElement();
    String entrypath=entry.getName();
    File entryFile=new File(destdir,entrypath);
    File parentDir=entryFile.getParentFile();
    if (!parentDir.isDirectory()) {
      parentDir.mkdirs();
      if (!parentDir.isDirectory()) {
        throw new MalformedURLException(Msg.CREATE_DIR_FAIL.toString(parentDir.toString()));
      }
    }
    URL child=NetUtil.getURL(entryFile);
    OutputStream dataOut=NetUtil.getOutputStream(child);
    InputStream dataIn=zf.getInputStream(entry);
    while (true) {
      int count=dataIn.read(dbuf);
      if (count == -1) {
        break;
      }
      dataOut.write(dbuf,0,count);
    }
    dataOut.close();
  }
}
Program: 101732
Project: 101732
Buggy source:
public boolean isNewer(BookMetaData bmd){
  URL local=toLocalURL(bmd);
  SwordBookMetaData sbmd=(SwordBookMetaData)bmd;
  URL conf=NetUtil.lengthenURL(local,sbmd.getDiskName() + SwordConstants.EXTENSION_CONF);
  URL remote=toRemoteURL(bmd);
  return NetUtil.isNewer(remote,conf);
}

Fixed version (ground truth):
public boolean isNewer(BookMetaData bmd){
}
Program: 101733
Project: 101733
Buggy source:
/** 
 * The URL for the cached index file for this installer
 */
protected URL getCachedIndexFile() throws InstallException {
  try {
    URL scratchdir=Project.instance().getTempScratchSpace(getTempFileExtension(host,directory),false);
    return NetUtil.lengthenURL(scratchdir,FILE_LIST_GZ);
  }
 catch (  IOException ex) {
    throw new InstallException(Msg.URL_FAILED,ex);
  }
}

Fixed version (ground truth):
/** 
 * The URL for the cached index file for this installer
 */
protected URL getCachedIndexFile() throws InstallException {
  try {
    URL scratchdir=Project.instance().getTempScratchSpace(getTempFileExtension(host,directory),true);
    return NetUtil.lengthenURL(scratchdir,FILE_LIST_GZ);
  }
 catch (  IOException ex) {
    throw new InstallException(Msg.URL_FAILED,ex);
  }
}
Program: 101734
Project: 101734
Buggy source:
public void reloadBookList() throws InstallException {
  Job job=JobManager.createJob(Msg.JOB_DOWNLOADING.toString(),Thread.currentThread(),false);
  try {
    URL scratchfile=getCachedIndexFile();
    download(job,LIST_DIR + '/' + directory,FILE_LIST_GZ,scratchfile);
    loaded=false;
  }
 catch (  InstallException ex) {
    job.ignoreTimings();
    throw ex;
  }
 finally {
    job.done();
  }
}

Fixed version (ground truth):
public void reloadBookList() throws InstallException {
  Job job=JobManager.createJob(Msg.JOB_DOWNLOADING.toString(),Thread.currentThread(),false);
  try {
    URL scratchfile=getCachedIndexFile();
    download(job,directory + '/' + LIST_DIR,FILE_LIST_GZ,scratchfile);
    loaded=false;
  }
 catch (  InstallException ex) {
    job.ignoreTimings();
    throw ex;
  }
 finally {
    job.done();
  }
}
Program: 101735
Project: 101735
Buggy source:
protected void download(Job job,String dir,String file,URL dest) throws InstallException {
  try {
    URL url=new URL("String_Node_Str" + host + dir+ '/'+ file);
    copy(job,url,dest);
  }
 catch (  IOException ex) {
    throw new InstallException(Msg.UNKNOWN_ERROR,ex);
  }
}

Fixed version (ground truth):
protected void download(Job job,String dir,String file,URL dest) throws InstallException {
  try {
    URL url=new URL(NetUtil.PROTOCOL_HTTP,host,dir + '/' + file);
    copy(job,url,dest);
  }
 catch (  IOException ex) {
    throw new InstallException(Msg.UNKNOWN_ERROR,ex);
  }
}
Program: 101736
Project: 101736
Buggy source:
public void installDownloadedIndex(BookMetaData bmd,URL tempDest) throws BookException {
  try {
    URL storage=getStorageArea(bmd);
    File zip=NetUtil.getAsFile(tempDest);
    IOUtil.unpackZip(zip,storage);
  }
 catch (  IOException ex) {
    throw new BookException(Msg.INSTALL_FAIL,ex);
  }
}

Fixed version (ground truth):
public void installDownloadedIndex(BookMetaData bmd,URL tempDest) throws BookException {
  try {
    URL storage=getStorageArea(bmd);
    File zip=NetUtil.getAsFile(tempDest);
    IOUtil.unpackZip(zip,NetUtil.getAsFile(storage));
  }
 catch (  IOException ex) {
    throw new BookException(Msg.INSTALL_FAIL,ex);
  }
}
Program: 101737
Project: 101737
Buggy source:
/** 
 * If the application has set the home, it will return the application's home directory, otherwise it returns null.
 * @return Returns the home.
 */
public static synchronized URL getHome(){
  return home;
}

Fixed version (ground truth):
/** 
 * If the application has set the home, it will return the application's home directory, otherwise it returns null.
 * @return Returns the home.
 */
public static synchronized URL getHome(){
}
Program: 101738
Project: 101738
Buggy source:
/** 
 * Look for the resource in the home directory
 * @param search must be non-null, non-empty
 */
public static URL findHomeResource(String search){
  URL reply=null;
  if (home != null) {
    String ssearch=null;
    if (search.charAt(0) == '/') {
      ssearch=search;
    }
 else {
      ssearch='/' + search;
    }
    URL override=null;
synchronized (CWClassLoader.class) {
      override=NetUtil.lengthenURL(home,ssearch);
    }
    File f=new File(override.getFile());
    if (f.canRead()) {
      reply=override;
    }
  }
  return reply;
}

Fixed version (ground truth):
/** 
 * Look for the resource in the home directory
 * @param search must be non-null, non-empty
 */
public static URL findHomeResource(String search){
  URL reply=null;
  URL homeURL=getHome();
  if (homeURL != null) {
    URL override=NetUtil.lengthenURL(homeURL,search);
    File f=new File(override.getFile());
    if (f.canRead()) {
      reply=override;
    }
  }
  return reply;
}
Program: 101739
Project: 101739
Buggy source:
/** 
 * Utility to strip a string from the end of a URL.
 * @param orig The URL to strip
 * @param strip The text to strip from the end of the URL
 * @return The stripped URL
 * @exception MalformedURLException If the URL does not end in the given text
 */
public static URL shortenURL(URL orig,String strip) throws MalformedURLException {
  String file=orig.getFile();
  if (file.endsWith(SEPARATOR)) {
    file=file.substring(0,file.length() - 1);
  }
  if (file.endsWith("String_Node_Str")) {
    file=file.substring(0,file.length() - 1);
  }
  String test=file.substring(file.length() - strip.length());
  if (!test.equals(strip)) {
    throw new MalformedURLException(Msg.CANT_STRIP.toString(new Object[]{orig,strip}));
  }
  String newFile=file.substring(0,file.length() - strip.length());
  return new URL(orig.getProtocol(),orig.getHost(),orig.getPort(),newFile);
}

Fixed version (ground truth):
/** 
 * Utility to strip a string from the end of a URL.
 * @param orig The URL to strip
 * @param strip The text to strip from the end of the URL
 * @return The stripped URL
 * @exception MalformedURLException If the URL does not end in the given text
 */
public static URL shortenURL(URL orig,String strip) throws MalformedURLException {
  String file=orig.getFile();
  char lastChar=file.charAt(file.length() - 1);
  if (isSeparator(lastChar)) {
    file=file.substring(0,file.length() - 1);
  }
  String test=file.substring(file.length() - strip.length());
  if (!test.equals(strip)) {
    throw new MalformedURLException(Msg.CANT_STRIP.toString(new Object[]{orig,strip}));
  }
  String newFile=file.substring(0,file.length() - strip.length());
  return new URL(orig.getProtocol(),orig.getHost(),orig.getPort(),newFile);
}
Program: 101740
Project: 101740
Buggy source:
/** 
 * Utility to add a string to the end of a URL.
 * @param orig The URL to strip
 * @param extra1 The text to add to the end of the URL
 * @param extra2 The next bit of text to add to the end of the URL
 * @param extra3 The next bit of text to add to the end of the URL
 * @return The stripped URL
 */
public static URL lengthenURL(URL orig,String extra1,String extra2,String extra3){
}

Fixed version (ground truth):
/** 
 * Utility to add a string to the end of a URL.
 * @param orig The URL to strip
 * @param extra The text to add to the end of the URL
 * @return The stripped URL
 */
public static URL lengthenURL(URL orig,String extra){
}
Program: 101741
Project: 101741
Buggy source:
/** 
 * Compile the XSL or retrieve it from the cache
 */
private TemplateInfo getTemplateInfo() throws IOException, TransformerConfigurationException {
  long modtime=NetUtil.getLastModified(xslurl);
  TemplateInfo tinfo=null;
  if (cache) {
    tinfo=(TemplateInfo)txers.get(xslurl);
    if (tinfo != null) {
      if (modtime > tinfo.getModtime()) {
        txers.remove(xslurl);
        tinfo=null;
        log.debug("String_Node_Str" + xslurl.toExternalForm());
      }
    }
  }
  if (tinfo == null) {
    log.debug("String_Node_Str" + xslurl.toExternalForm());
    InputStream xsl_in=xslurl.openStream();
    Templates templates=transfact.newTemplates(new StreamSource(xsl_in));
    tinfo=new TemplateInfo(templates,modtime);
    if (cache) {
      txers.put(xslurl,tinfo);
    }
  }
  return tinfo;
}

Fixed version (ground truth):
/** 
 * Compile the XSL or retrieve it from the cache
 */
private TemplateInfo getTemplateInfo() throws IOException, TransformerConfigurationException {
  long modtime=NetUtil.getLastModified(xslurl);
  TemplateInfo tinfo=(TemplateInfo)txers.get(xslurl);
  if (tinfo != null) {
    if (modtime > tinfo.getModtime()) {
      txers.remove(xslurl);
      tinfo=null;
      log.debug("String_Node_Str" + xslurl.toExternalForm());
    }
  }
  if (tinfo == null) {
    log.debug("String_Node_Str" + xslurl.toExternalForm());
    InputStream xsl_in=xslurl.openStream();
    Templates templates=transfact.newTemplates(new StreamSource(xsl_in));
    tinfo=new TemplateInfo(templates,modtime);
    txers.put(xslurl,tinfo);
  }
  return tinfo;
}
Program: 101742
Project: 101742
Buggy source:
/** 
 * Simple ctor
 */
public ModuleType(String name,String install,BookType type,boolean compressed){
  super(name);
  this.install=install;
  this.type=type;
  this.compressed=compressed;
}

Fixed version (ground truth):
/** 
 * Simple ctor
 */
public ModuleType(String name,String install,BookType type){
  this.name=name;
  this.install=install;
  this.type=type;
}
Program: 101743
Project: 101743
Buggy source:
/** 
 * Find a ModuleType from a name.
 * @param name The name of the ModuleType to look up
 * @return The found ModuleType or null if the name is not found
 */
public static ModuleType getModuleType(String name){
  return (ModuleType)Enum.getEnum(ModuleType.class,name);
}

Fixed version (ground truth):
/** 
 * Find a ModuleType from a name.
 * @param name The name of the ModuleType to look up
 * @return The found ModuleType or null if the name is not found
 */
public static ModuleType getModuleType(String name){
  for (int i=0; i < VALUES.length; i++) {
    ModuleType obj=VALUES[i];
    if (obj.name.equalsIgnoreCase(name)) {
      return obj;
    }
  }
  throw new IllegalArgumentException("String_Node_Str" + name + "String_Node_Str");
}