nus-yam/ex-repair huggingface dataset:
Program: 78905
Project: 78905
Buggy source:
/** 
 * Sets the <code>borderPainted</code> property. If <code>true</code> and the button has a border, the border is painted. The default value for the <code>borderPainted</code> property is <code>true</code>. <p/> Some look and feels might not support the <code>borderPainted</code> property, in which case they ignore this.
 * @param b if true and border property is not <code>null</code>,the border is painted
 * @see #isBorderPainted
 * @beaninfo bound: true attribute: visualUpdate true description: Whether the border should be painted.
 */
public void setBorderPainted(boolean b){
  boolean oldValue=paintBorder;
  paintBorder=b;
  borderPaintedSet=true;
  firePropertyChange(BORDER_PAINTED_CHANGED_PROPERTY,oldValue,paintBorder);
  if (b != oldValue) {
    revalidate();
    repaint();
  }
}

Fixed version (ground truth):
/** 
 * Sets the <code>borderPainted</code> property. If <code>true</code> and the button has a border, the border is painted. The default value for the <code>borderPainted</code> property is <code>true</code>. <p> Some look and feels might not support the <code>borderPainted</code> property, in which case they ignore this.
 * @param b if true and border property is not <code>null</code>,the border is painted
 * @see #isBorderPainted
 * @beaninfo bound: true attribute: visualUpdate true description: Whether the border should be painted.
 */
public void setBorderPainted(boolean b){
  boolean oldValue=paintBorder;
  paintBorder=b;
  borderPaintedSet=true;
  firePropertyChange(BORDER_PAINTED_CHANGED_PROPERTY,oldValue,paintBorder);
  if (b != oldValue) {
    revalidate();
    repaint();
  }
}
Program: 78906
Project: 78906
Buggy source:
/** 
 * Sets the L&F object that renders this component.
 * @param ui the <code>ButtonUI</code> L&F object
 * @see #getUI
 * @beaninfo bound: true hidden: true attribute: visualUpdate true description: The UI object that implements the LookAndFeel.
 */
public void setUI(ButtonUI ui){
  super.setUI(ui);
  if (disabledIcon instanceof UIResource) {
    setDisabledIcon(null);
  }
  if (disabledSelectedIcon instanceof UIResource) {
    setDisabledSelectedIcon(null);
  }
}

Fixed version (ground truth):
/** 
 * Sets the L&amp;F object that renders this component.
 * @param ui the <code>ButtonUI</code> L&amp;F object
 * @see #getUI
 * @beaninfo bound: true hidden: true attribute: visualUpdate true description: The UI object that implements the LookAndFeel.
 */
public void setUI(ButtonUI ui){
  super.setUI(ui);
  if (disabledIcon instanceof UIResource) {
    setDisabledIcon(null);
  }
  if (disabledSelectedIcon instanceof UIResource) {
    setDisabledSelectedIcon(null);
  }
}
Program: 78907
Project: 78907
Buggy source:
/** 
 * Creates an invisible, fixed-height component. In a vertical box, you typically use this method to force a certain amount of space between two components. In a horizontal box, you might use this method to force the box to be at least the specified height. The invisible component has no width unless excess space is available, in which case it takes its share of available space, just like any other component that has no maximum width.
 * @param height the height of the invisible component, in pixels >= 0
 * @return the component
 * @see #createHorizontalStrut
 * @see #createGlue
 * @see #createRigidArea
 */
public static Component createVerticalStrut(int height){
  return new Filler(new Dimension(0,height),new Dimension(0,height),new Dimension(Short.MAX_VALUE,height));
}

Fixed version (ground truth):
/** 
 * Creates an invisible, fixed-height component. In a vertical box, you typically use this method to force a certain amount of space between two components. In a horizontal box, you might use this method to force the box to be at least the specified height. The invisible component has no width unless excess space is available, in which case it takes its share of available space, just like any other component that has no maximum width.
 * @param height the height of the invisible component, in pixels &gt;= 0
 * @return the component
 * @see #createHorizontalStrut
 * @see #createGlue
 * @see #createRigidArea
 */
public static Component createVerticalStrut(int height){
  return new Filler(new Dimension(0,height),new Dimension(0,height),new Dimension(Short.MAX_VALUE,height));
}
Program: 78908
Project: 78908
Buggy source:
/** 
 * Creates an invisible, fixed-width component. In a horizontal box, you typically use this method to force a certain amount of space between two components. In a vertical box, you might use this method to force the box to be at least the specified width. The invisible component has no height unless excess space is available, in which case it takes its share of available space, just like any other component that has no maximum height.
 * @param width the width of the invisible component, in pixels >= 0
 * @return the component
 * @see #createVerticalStrut
 * @see #createGlue
 * @see #createRigidArea
 */
public static Component createHorizontalStrut(int width){
  return new Filler(new Dimension(width,0),new Dimension(width,0),new Dimension(width,Short.MAX_VALUE));
}

Fixed version (ground truth):
/** 
 * Creates an invisible, fixed-width component. In a horizontal box, you typically use this method to force a certain amount of space between two components. In a vertical box, you might use this method to force the box to be at least the specified width. The invisible component has no height unless excess space is available, in which case it takes its share of available space, just like any other component that has no maximum height.
 * @param width the width of the invisible component, in pixels &gt;= 0
 * @return the component
 * @see #createVerticalStrut
 * @see #createGlue
 * @see #createRigidArea
 */
public static Component createHorizontalStrut(int width){
  return new Filler(new Dimension(width,0),new Dimension(width,0),new Dimension(width,Short.MAX_VALUE));
}
Program: 78909
Project: 78909
Buggy source:
/** 
 * Returns the preferred dimensions for this layout, given the components in the specified target container.
 * @param target  the container that needs to be laid out
 * @return the dimensions >= 0 && <= Integer.MAX_VALUE
 * @exception AWTError  if the target isn't the container specified to theBoxLayout constructor
 * @see Container
 * @see #minimumLayoutSize
 * @see #maximumLayoutSize
 */
public Dimension preferredLayoutSize(Container target){
  Dimension size;
synchronized (this) {
    checkContainer(target);
    checkRequests();
    size=new Dimension(xTotal.preferred,yTotal.preferred);
  }
  Insets insets=target.getInsets();
  size.width=(int)Math.min((long)size.width + (long)insets.left + (long)insets.right,Integer.MAX_VALUE);
  size.height=(int)Math.min((long)size.height + (long)insets.top + (long)insets.bottom,Integer.MAX_VALUE);
  return size;
}

Fixed version (ground truth):
/** 
 * Returns the preferred dimensions for this layout, given the components in the specified target container.
 * @param target  the container that needs to be laid out
 * @return the dimensions &gt;= 0 &amp;&amp; &lt;= Integer.MAX_VALUE
 * @exception AWTError  if the target isn't the container specified to theBoxLayout constructor
 * @see Container
 * @see #minimumLayoutSize
 * @see #maximumLayoutSize
 */
public Dimension preferredLayoutSize(Container target){
  Dimension size;
synchronized (this) {
    checkContainer(target);
    checkRequests();
    size=new Dimension(xTotal.preferred,yTotal.preferred);
  }
  Insets insets=target.getInsets();
  size.width=(int)Math.min((long)size.width + (long)insets.left + (long)insets.right,Integer.MAX_VALUE);
  size.height=(int)Math.min((long)size.height + (long)insets.top + (long)insets.bottom,Integer.MAX_VALUE);
  return size;
}
Program: 78910
Project: 78910
Buggy source:
/** 
 * Returns the alignment along the X axis for the container. If the box is horizontal, the default alignment will be returned. Otherwise, the alignment needed to place the children along the X axis will be returned.
 * @param target  the container
 * @return the alignment >= 0.0f && <= 1.0f
 * @exception AWTError  if the target isn't the container specified to theBoxLayout constructor
 */
public synchronized float getLayoutAlignmentX(Container target){
  checkContainer(target);
  checkRequests();
  return xTotal.alignment;
}

Fixed version (ground truth):
/** 
 * Returns the alignment along the X axis for the container. If the box is horizontal, the default alignment will be returned. Otherwise, the alignment needed to place the children along the X axis will be returned.
 * @param target  the container
 * @return the alignment &gt;= 0.0f &amp;&amp; &lt;= 1.0f
 * @exception AWTError  if the target isn't the container specified to theBoxLayout constructor
 */
public synchronized float getLayoutAlignmentX(Container target){
  checkContainer(target);
  checkRequests();
  return xTotal.alignment;
}
Program: 78911
Project: 78911
Buggy source:
/** 
 * Returns the minimum dimensions needed to lay out the components contained in the specified target container.
 * @param target  the container that needs to be laid out
 * @return the dimensions >= 0 && <= Integer.MAX_VALUE
 * @exception AWTError  if the target isn't the container specified to theBoxLayout constructor
 * @see #preferredLayoutSize
 * @see #maximumLayoutSize
 */
public Dimension minimumLayoutSize(Container target){
  Dimension size;
synchronized (this) {
    checkContainer(target);
    checkRequests();
    size=new Dimension(xTotal.minimum,yTotal.minimum);
  }
  Insets insets=target.getInsets();
  size.width=(int)Math.min((long)size.width + (long)insets.left + (long)insets.right,Integer.MAX_VALUE);
  size.height=(int)Math.min((long)size.height + (long)insets.top + (long)insets.bottom,Integer.MAX_VALUE);
  return size;
}

Fixed version (ground truth):
/** 
 * Returns the minimum dimensions needed to lay out the components contained in the specified target container.
 * @param target  the container that needs to be laid out
 * @return the dimensions &gt;= 0 &amp;&amp; &lt;= Integer.MAX_VALUE
 * @exception AWTError  if the target isn't the container specified to theBoxLayout constructor
 * @see #preferredLayoutSize
 * @see #maximumLayoutSize
 */
public Dimension minimumLayoutSize(Container target){
  Dimension size;
synchronized (this) {
    checkContainer(target);
    checkRequests();
    size=new Dimension(xTotal.minimum,yTotal.minimum);
  }
  Insets insets=target.getInsets();
  size.width=(int)Math.min((long)size.width + (long)insets.left + (long)insets.right,Integer.MAX_VALUE);
  size.height=(int)Math.min((long)size.height + (long)insets.top + (long)insets.bottom,Integer.MAX_VALUE);
  return size;
}
Program: 78912
Project: 78912
Buggy source:
/** 
 * Returns the alignment along the Y axis for the container. If the box is vertical, the default alignment will be returned. Otherwise, the alignment needed to place the children along the Y axis will be returned.
 * @param target  the container
 * @return the alignment >= 0.0f && <= 1.0f
 * @exception AWTError  if the target isn't the container specified to theBoxLayout constructor
 */
public synchronized float getLayoutAlignmentY(Container target){
  checkContainer(target);
  checkRequests();
  return yTotal.alignment;
}

Fixed version (ground truth):
/** 
 * Returns the alignment along the Y axis for the container. If the box is vertical, the default alignment will be returned. Otherwise, the alignment needed to place the children along the Y axis will be returned.
 * @param target  the container
 * @return the alignment &gt;= 0.0f &amp;&amp; &lt;= 1.0f
 * @exception AWTError  if the target isn't the container specified to theBoxLayout constructor
 */
public synchronized float getLayoutAlignmentY(Container target){
  checkContainer(target);
  checkRequests();
  return yTotal.alignment;
}
Program: 78913
Project: 78913
Buggy source:
/** 
 * Returns the maximum dimensions the target container can use to lay out the components it contains.
 * @param target  the container that needs to be laid out
 * @return the dimensions >= 0 && <= Integer.MAX_VALUE
 * @exception AWTError  if the target isn't the container specified to theBoxLayout constructor
 * @see #preferredLayoutSize
 * @see #minimumLayoutSize
 */
public Dimension maximumLayoutSize(Container target){
  Dimension size;
synchronized (this) {
    checkContainer(target);
    checkRequests();
    size=new Dimension(xTotal.maximum,yTotal.maximum);
  }
  Insets insets=target.getInsets();
  size.width=(int)Math.min((long)size.width + (long)insets.left + (long)insets.right,Integer.MAX_VALUE);
  size.height=(int)Math.min((long)size.height + (long)insets.top + (long)insets.bottom,Integer.MAX_VALUE);
  return size;
}

Fixed version (ground truth):
/** 
 * Returns the maximum dimensions the target container can use to lay out the components it contains.
 * @param target  the container that needs to be laid out
 * @return the dimensions &gt;= 0 &amp;&amp; &lt;= Integer.MAX_VALUE
 * @exception AWTError  if the target isn't the container specified to theBoxLayout constructor
 * @see #preferredLayoutSize
 * @see #minimumLayoutSize
 */
public Dimension maximumLayoutSize(Container target){
  Dimension size;
synchronized (this) {
    checkContainer(target);
    checkRequests();
    size=new Dimension(xTotal.maximum,yTotal.maximum);
  }
  Insets insets=target.getInsets();
  size.width=(int)Math.min((long)size.width + (long)insets.left + (long)insets.right,Integer.MAX_VALUE);
  size.height=(int)Math.min((long)size.height + (long)insets.top + (long)insets.bottom,Integer.MAX_VALUE);
  return size;
}
Program: 78914
Project: 78914
Buggy source:
/** 
 * If the specified component is already a child of this then we don't bother doing anything - stacking order doesn't matter for cell renderer components (CellRendererPane doesn't paint anyway).<
 */
protected void addImpl(Component x,Object constraints,int index){
  if (x.getParent() == this) {
    return;
  }
 else {
    super.addImpl(x,constraints,index);
  }
}

Fixed version (ground truth):
/** 
 * If the specified component is already a child of this then we don't bother doing anything - stacking order doesn't matter for cell renderer components (CellRendererPane doesn't paint anyway).
 */
protected void addImpl(Component x,Object constraints,int index){
  if (x.getParent() == this) {
    return;
  }
 else {
    super.addImpl(x,constraints,index);
  }
}
Program: 78915
Project: 78915
Buggy source:
/** 
 * Remove the indices in the interval index0,index1 (inclusive) from the selection model.  This is typically called to sync the selection model width a corresponding change in the data model.  Note that (as always) index0 need not be <= index1.
 */
public void removeIndexInterval(int index0,int index1){
  int rmMinIndex=Math.min(index0,index1);
  int rmMaxIndex=Math.max(index0,index1);
  int gapLength=(rmMaxIndex - rmMinIndex) + 1;
  for (int i=rmMinIndex; i <= maxIndex; i++) {
    setState(i,value.get(i + gapLength));
  }
  int leadIndex=this.leadIndex;
  if (leadIndex == 0 && rmMinIndex == 0) {
  }
 else   if (leadIndex > rmMaxIndex) {
    leadIndex=this.leadIndex - gapLength;
  }
 else   if (leadIndex >= rmMinIndex) {
    leadIndex=rmMinIndex - 1;
  }
  int anchorIndex=this.anchorIndex;
  if (anchorIndex == 0 && rmMinIndex == 0) {
  }
 else   if (anchorIndex > rmMaxIndex) {
    anchorIndex=this.anchorIndex - gapLength;
  }
 else   if (anchorIndex >= rmMinIndex) {
    anchorIndex=rmMinIndex - 1;
  }
  if (leadIndex != this.leadIndex || anchorIndex != this.anchorIndex) {
    updateLeadAnchorIndices(anchorIndex,leadIndex);
  }
  fireValueChanged();
}

Fixed version (ground truth):
/** 
 * Remove the indices in the interval index0,index1 (inclusive) from the selection model.  This is typically called to sync the selection model width a corresponding change in the data model.  Note that (as always) index0 need not be &lt;= index1.
 */
public void removeIndexInterval(int index0,int index1){
  int rmMinIndex=Math.min(index0,index1);
  int rmMaxIndex=Math.max(index0,index1);
  int gapLength=(rmMaxIndex - rmMinIndex) + 1;
  for (int i=rmMinIndex; i <= maxIndex; i++) {
    setState(i,value.get(i + gapLength));
  }
  int leadIndex=this.leadIndex;
  if (leadIndex == 0 && rmMinIndex == 0) {
  }
 else   if (leadIndex > rmMaxIndex) {
    leadIndex=this.leadIndex - gapLength;
  }
 else   if (leadIndex >= rmMinIndex) {
    leadIndex=rmMinIndex - 1;
  }
  int anchorIndex=this.anchorIndex;
  if (anchorIndex == 0 && rmMinIndex == 0) {
  }
 else   if (anchorIndex > rmMaxIndex) {
    anchorIndex=this.anchorIndex - gapLength;
  }
 else   if (anchorIndex >= rmMinIndex) {
    anchorIndex=rmMinIndex - 1;
  }
  if (leadIndex != this.leadIndex || anchorIndex != this.anchorIndex) {
    updateLeadAnchorIndices(anchorIndex,leadIndex);
  }
  fireValueChanged();
}
Program: 78916
Project: 78916
Buggy source:
/** 
 * Returns   {@code true} if a paint triggered on a child component should causepainting to originate from this Component, or one of its ancestors. <p/> Calling  {@link #repaint} or {@link #paintImmediately(int,int,int,int)}on a Swing component will result in calling the   {@link JComponent#paintImmediately(int,int,int,int)} method ofthe first ancestor which  {@code isPaintingOrigin()} returns {@code true}, if there are any. <p/>  {@code JComponent} subclasses that need to be painted when any of theirchildren are repainted should override this method to return  {@code true}.
 * @return always returns {@code false}
 * @see #paintImmediately(int,int,int,int)
 */
protected boolean isPaintingOrigin(){
  return false;
}

Fixed version (ground truth):
/** 
 * Returns   {@code true} if a paint triggered on a child component should causepainting to originate from this Component, or one of its ancestors. <p> Calling  {@link #repaint} or {@link #paintImmediately(int,int,int,int)}on a Swing component will result in calling the   {@link JComponent#paintImmediately(int,int,int,int)} method ofthe first ancestor which  {@code isPaintingOrigin()} returns {@code true}, if there are any. <p>  {@code JComponent} subclasses that need to be painted when any of theirchildren are repainted should override this method to return  {@code true}.
 * @return always returns {@code false}
 * @see #paintImmediately(int,int,int,int)
 */
protected boolean isPaintingOrigin(){
  return false;
}
Program: 78917
Project: 78917
Buggy source:
/** 
 * Pops up an "Open File" file chooser dialog. Note that the text that appears in the approve button is determined by the L&F.
 * @param parent  the parent component of the dialog,can be <code>null</code>; see <code>showDialog</code> for details
 * @return   the return state of the file chooser on popdown:<ul> <li>JFileChooser.CANCEL_OPTION <li>JFileChooser.APPROVE_OPTION <li>JFileChooser.ERROR_OPTION if an error occurs or the dialog is dismissed </ul>
 * @exception HeadlessException if GraphicsEnvironment.isHeadless()returns true.
 * @see java.awt.GraphicsEnvironment#isHeadless
 * @see #showDialog
 */
public int showOpenDialog(Component parent) throws HeadlessException {
  setDialogType(OPEN_DIALOG);
  return showDialog(parent,null);
}

Fixed version (ground truth):
/** 
 * Pops up an "Open File" file chooser dialog. Note that the text that appears in the approve button is determined by the L&amp;F.
 * @param parent  the parent component of the dialog,can be <code>null</code>; see <code>showDialog</code> for details
 * @return   the return state of the file chooser on popdown:<ul> <li>JFileChooser.CANCEL_OPTION <li>JFileChooser.APPROVE_OPTION <li>JFileChooser.ERROR_OPTION if an error occurs or the dialog is dismissed </ul>
 * @exception HeadlessException if GraphicsEnvironment.isHeadless()returns true.
 * @see java.awt.GraphicsEnvironment#isHeadless
 * @see #showDialog
 */
public int showOpenDialog(Component parent) throws HeadlessException {
  setDialogType(OPEN_DIALOG);
  return showDialog(parent,null);
}
Program: 78918
Project: 78918
Buggy source:
/** 
 * Pops up a "Save File" file chooser dialog. Note that the text that appears in the approve button is determined by the L&F.
 * @param parent  the parent component of the dialog,can be <code>null</code>; see <code>showDialog</code> for details
 * @return   the return state of the file chooser on popdown:<ul> <li>JFileChooser.CANCEL_OPTION <li>JFileChooser.APPROVE_OPTION <li>JFileChooser.ERROR_OPTION if an error occurs or the dialog is dismissed </ul>
 * @exception HeadlessException if GraphicsEnvironment.isHeadless()returns true.
 * @see java.awt.GraphicsEnvironment#isHeadless
 * @see #showDialog
 */
public int showSaveDialog(Component parent) throws HeadlessException {
  setDialogType(SAVE_DIALOG);
  return showDialog(parent,null);
}

Fixed version (ground truth):
/** 
 * Pops up a "Save File" file chooser dialog. Note that the text that appears in the approve button is determined by the L&amp;F.
 * @param parent  the parent component of the dialog,can be <code>null</code>; see <code>showDialog</code> for details
 * @return   the return state of the file chooser on popdown:<ul> <li>JFileChooser.CANCEL_OPTION <li>JFileChooser.APPROVE_OPTION <li>JFileChooser.ERROR_OPTION if an error occurs or the dialog is dismissed </ul>
 * @exception HeadlessException if GraphicsEnvironment.isHeadless()returns true.
 * @see java.awt.GraphicsEnvironment#isHeadless
 * @see #showDialog
 */
public int showSaveDialog(Component parent) throws HeadlessException {
  setDialogType(SAVE_DIALOG);
  return showDialog(parent,null);
}
Program: 78919
Project: 78919
Buggy source:
/** 
 * Sets the property that indicates whether the <i>approve</i> and <i>cancel</i> buttons are shown in the file chooser.  This property is <code>true</code> by default.  Look and feels that always show these buttons will ignore the value of this property. This method fires a property-changed event, using the string value of <code>CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY</code> as the name of the property.
 * @param b <code>false</code> if control buttons should not beshown; otherwise, <code>true</code>
 * @beaninfo preferred: true bound: true description: Sets whether the approve & cancel buttons are shown.
 * @see #getControlButtonsAreShown
 * @see #CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY
 * @since 1.3
 */
public void setControlButtonsAreShown(boolean b){
  if (controlsShown == b) {
    return;
  }
  boolean oldValue=controlsShown;
  controlsShown=b;
  firePropertyChange(CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY,oldValue,controlsShown);
}

Fixed version (ground truth):
/** 
 * Sets the property that indicates whether the <i>approve</i> and <i>cancel</i> buttons are shown in the file chooser.  This property is <code>true</code> by default.  Look and feels that always show these buttons will ignore the value of this property. This method fires a property-changed event, using the string value of <code>CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY</code> as the name of the property.
 * @param b <code>false</code> if control buttons should not beshown; otherwise, <code>true</code>
 * @beaninfo preferred: true bound: true description: Sets whether the approve &amp; cancel buttons are shown.
 * @see #getControlButtonsAreShown
 * @see #CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY
 * @since 1.3
 */
public void setControlButtonsAreShown(boolean b){
  if (controlsShown == b) {
    return;
  }
  boolean oldValue=controlsShown;
  controlsShown=b;
  firePropertyChange(CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY,oldValue,controlsShown);
}
Program: 78920
Project: 78920
Buggy source:
/** 
 * Gets the UI object which implements the L&F for this component.
 * @return the FileChooserUI object that implements the FileChooserUI L&F
 */
public FileChooserUI getUI(){
  return (FileChooserUI)ui;
}

Fixed version (ground truth):
/** 
 * Gets the UI object which implements the L&amp;F for this component.
 * @return the FileChooserUI object that implements the FileChooserUI L&amp;F
 */
public FileChooserUI getUI(){
  return (FileChooserUI)ui;
}
Program: 78921
Project: 78921
Buggy source:
/** 
 * Returns a string that specifies the name of the L&F class that renders this component.
 * @return the string "FileChooserUI"
 * @see JComponent#getUIClassID
 * @see UIDefaults#getUI
 * @beaninfo expert: true description: A string that specifies the name of the L&F class.
 */
public String getUIClassID(){
  return uiClassID;
}

Fixed version (ground truth):
/** 
 * Returns a string that specifies the name of the L&amp;F class that renders this component.
 * @return the string "FileChooserUI"
 * @see JComponent#getUIClassID
 * @see UIDefaults#getUI
 * @beaninfo expert: true description: A string that specifies the name of the L&amp;F class.
 */
public String getUIClassID(){
  return uiClassID;
}
Program: 78922
Project: 78922
Buggy source:
/** 
 * Returns the String before a given index.
 * @param part the AccessibleText.CHARACTER, AccessibleText.WORD,or AccessibleText.SENTENCE to retrieve
 * @param index an index within the text >= 0
 * @return the letter, word, or sentence, null for an invalid indexor part
 * @since 1.3
 */
public String getBeforeIndex(int part,int index){
  if (index < 0 || index > getCharCount() - 1) {
    return null;
  }
switch (part) {
case AccessibleText.CHARACTER:
    if (index == 0) {
      return null;
    }
  try {
    return getText(index - 1,1);
  }
 catch (  BadLocationException e) {
    return null;
  }
case AccessibleText.WORD:
try {
  String s=getText(0,getCharCount());
  BreakIterator words=BreakIterator.getWordInstance(getLocale());
  words.setText(s);
  int end=words.following(index);
  end=words.previous();
  int start=words.previous();
  if (start == BreakIterator.DONE) {
    return null;
  }
  return s.substring(start,end);
}
 catch (BadLocationException e) {
  return null;
}
case AccessibleText.SENTENCE:
try {
String s=getText(0,getCharCount());
BreakIterator sentence=BreakIterator.getSentenceInstance(getLocale());
sentence.setText(s);
int end=sentence.following(index);
end=sentence.previous();
int start=sentence.previous();
if (start == BreakIterator.DONE) {
  return null;
}
return s.substring(start,end);
}
 catch (BadLocationException e) {
return null;
}
default :
return null;
}
}

Fixed version (ground truth):
/** 
 * Returns the String before a given index.
 * @param part the AccessibleText.CHARACTER, AccessibleText.WORD,or AccessibleText.SENTENCE to retrieve
 * @param index an index within the text &gt;= 0
 * @return the letter, word, or sentence, null for an invalid indexor part
 * @since 1.3
 */
public String getBeforeIndex(int part,int index){
  if (index < 0 || index > getCharCount() - 1) {
    return null;
  }
switch (part) {
case AccessibleText.CHARACTER:
    if (index == 0) {
      return null;
    }
  try {
    return getText(index - 1,1);
  }
 catch (  BadLocationException e) {
    return null;
  }
case AccessibleText.WORD:
try {
  String s=getText(0,getCharCount());
  BreakIterator words=BreakIterator.getWordInstance(getLocale());
  words.setText(s);
  int end=words.following(index);
  end=words.previous();
  int start=words.previous();
  if (start == BreakIterator.DONE) {
    return null;
  }
  return s.substring(start,end);
}
 catch (BadLocationException e) {
  return null;
}
case AccessibleText.SENTENCE:
try {
String s=getText(0,getCharCount());
BreakIterator sentence=BreakIterator.getSentenceInstance(getLocale());
sentence.setText(s);
int end=sentence.following(index);
end=sentence.previous();
int start=sentence.previous();
if (start == BreakIterator.DONE) {
  return null;
}
return s.substring(start,end);
}
 catch (BadLocationException e) {
return null;
}
default :
return null;
}
}
Program: 78923
Project: 78923
Buggy source:
/** 
 * Returns the String at a given index.
 * @param part the AccessibleText.CHARACTER, AccessibleText.WORD,or AccessibleText.SENTENCE to retrieve
 * @param index an index within the text >= 0
 * @return the letter, word, or sentence,null for an invalid index or part
 * @since 1.3
 */
public String getAtIndex(int part,int index){
  if (index < 0 || index >= getCharCount()) {
    return null;
  }
switch (part) {
case AccessibleText.CHARACTER:
    try {
      return getText(index,1);
    }
 catch (    BadLocationException e) {
      return null;
    }
case AccessibleText.WORD:
  try {
    String s=getText(0,getCharCount());
    BreakIterator words=BreakIterator.getWordInstance(getLocale());
    words.setText(s);
    int end=words.following(index);
    return s.substring(words.previous(),end);
  }
 catch (  BadLocationException e) {
    return null;
  }
case AccessibleText.SENTENCE:
try {
  String s=getText(0,getCharCount());
  BreakIterator sentence=BreakIterator.getSentenceInstance(getLocale());
  sentence.setText(s);
  int end=sentence.following(index);
  return s.substring(sentence.previous(),end);
}
 catch (BadLocationException e) {
  return null;
}
default :
return null;
}
}

Fixed version (ground truth):
/** 
 * Returns the String at a given index.
 * @param part the AccessibleText.CHARACTER, AccessibleText.WORD,or AccessibleText.SENTENCE to retrieve
 * @param index an index within the text &gt;= 0
 * @return the letter, word, or sentence,null for an invalid index or part
 * @since 1.3
 */
public String getAtIndex(int part,int index){
  if (index < 0 || index >= getCharCount()) {
    return null;
  }
switch (part) {
case AccessibleText.CHARACTER:
    try {
      return getText(index,1);
    }
 catch (    BadLocationException e) {
      return null;
    }
case AccessibleText.WORD:
  try {
    String s=getText(0,getCharCount());
    BreakIterator words=BreakIterator.getWordInstance(getLocale());
    words.setText(s);
    int end=words.following(index);
    return s.substring(words.previous(),end);
  }
 catch (  BadLocationException e) {
    return null;
  }
case AccessibleText.SENTENCE:
try {
  String s=getText(0,getCharCount());
  BreakIterator sentence=BreakIterator.getSentenceInstance(getLocale());
  sentence.setText(s);
  int end=sentence.following(index);
  return s.substring(sentence.previous(),end);
}
 catch (BadLocationException e) {
  return null;
}
default :
return null;
}
}
Program: 78924
Project: 78924
Buggy source:
/** 
 * Returns the L&F object that renders this component.
 * @return LabelUI object
 */
public LabelUI getUI(){
  return (LabelUI)ui;
}

Fixed version (ground truth):
/** 
 * Returns the L&amp;F object that renders this component.
 * @return LabelUI object
 */
public LabelUI getUI(){
  return (LabelUI)ui;
}
Program: 78927
Project: 78927
Buggy source:
/** 
 * Returns a string that specifies the name of the l&f class that renders this component.
 * @return String "LabelUI"
 * @see JComponent#getUIClassID
 * @see UIDefaults#getUI
 */
public String getUIClassID(){
  return uiClassID;
}

Fixed version (ground truth):
/** 
 * Returns a string that specifies the name of the l&amp;f class that renders this component.
 * @return String "LabelUI"
 * @see JComponent#getUIClassID
 * @see UIDefaults#getUI
 */
public String getUIClassID(){
  return uiClassID;
}
Program: 78928
Project: 78928
Buggy source:
/** 
 * Sets the L&F object that renders this component.
 * @param ui  the LabelUI L&F object
 * @see UIDefaults#getUI
 * @beaninfo bound: true hidden: true attribute: visualUpdate true description: The UI object that implements the Component's LookAndFeel.
 */
public void setUI(LabelUI ui){
  super.setUI(ui);
  if (!disabledIconSet && disabledIcon != null) {
    setDisabledIcon(null);
  }
}

Fixed version (ground truth):
/** 
 * Sets the L&amp;F object that renders this component.
 * @param ui  the LabelUI L&amp;F object
 * @see UIDefaults#getUI
 * @beaninfo bound: true hidden: true attribute: visualUpdate true description: The UI object that implements the Component's LookAndFeel.
 */
public void setUI(LabelUI ui){
  super.setUI(ui);
  if (!disabledIconSet && disabledIcon != null) {
    setDisabledIcon(null);
  }
}
Program: 78930
Project: 78930
Buggy source:
private JCBlock makeLambdaExpressionBody(JCExpression expr,JCMethodDecl lambdaMethodDecl){
  Type restype=lambdaMethodDecl.type.getReturnType();
  boolean isLambda_void=expr.type.hasTag(VOID);
  boolean isTarget_void=restype.hasTag(VOID);
  boolean isTarget_Void=types.isSameType(restype,types.boxedClass(syms.voidType).type);
  int prevPos=make.pos;
  try {
    if (isTarget_void) {
      JCStatement stat=make.at(expr).Exec(expr);
      return make.Block(0,List.<JCStatement>of(stat));
    }
 else     if (isLambda_void && isTarget_Void) {
      ListBuffer<JCStatement> stats=new ListBuffer<>();
      stats.append(make.at(expr).Exec(expr));
      stats.append(make.Return(make.Literal(BOT,null).setType(syms.botType)));
      return make.Block(0,stats.toList());
    }
 else {
      JCExpression retExpr=transTypes.coerce(attrEnv,expr,restype);
      return make.at(retExpr).Block(0,List.<JCStatement>of(make.Return(retExpr)));
    }
  }
  finally {
    make.at(prevPos);
  }
}

Fixed version (ground truth):
private JCBlock makeLambdaExpressionBody(JCExpression expr,JCMethodDecl lambdaMethodDecl){
  Type restype=lambdaMethodDecl.type.getReturnType();
  boolean isLambda_void=expr.type.hasTag(VOID);
  boolean isTarget_void=restype.hasTag(VOID);
  boolean isTarget_Void=types.isSameType(restype,types.boxedClass(syms.voidType).type);
  if (isTarget_void) {
    JCStatement stat=make.Exec(expr);
    return make.Block(0,List.<JCStatement>of(stat));
  }
 else   if (isLambda_void && isTarget_Void) {
    ListBuffer<JCStatement> stats=new ListBuffer<>();
    stats.append(make.Exec(expr));
    stats.append(make.Return(make.Literal(BOT,null).setType(syms.botType)));
    return make.Block(0,stats.toList());
  }
 else {
    JCExpression retExpr=transTypes.coerce(attrEnv,expr,restype);
    return make.at(retExpr).Block(0,List.<JCStatement>of(make.Return(retExpr)));
  }
}
Program: 78931
Project: 78931
Buggy source:
private KlassInfo(JCClassDecl clazz){
  this.clazz=clazz;
  appendedMethodList=new ListBuffer<>();
  deserializeCases=new HashMap<String,ListBuffer<JCStatement>>();
  MethodType type=new MethodType(List.of(syms.serializedLambdaType),syms.objectType,List.<Type>nil(),syms.methodClass);
  deserMethodSym=makePrivateSyntheticMethod(STATIC,names.deserializeLambda,type,clazz.sym);
  deserParamSym=new VarSymbol(FINAL,names.fromString("String_Node_Str"),syms.serializedLambdaType,deserMethodSym);
}

Fixed version (ground truth):
private KlassInfo(Symbol kSym){
  appendedMethodList=new ListBuffer<>();
  deserializeCases=new HashMap<String,ListBuffer<JCStatement>>();
  MethodType type=new MethodType(List.of(syms.serializedLambdaType),syms.objectType,List.<Type>nil(),syms.methodClass);
  deserMethodSym=makePrivateSyntheticMethod(STATIC,names.deserializeLambda,type,kSym);
  deserParamSym=new VarSymbol(FINAL,names.fromString("String_Node_Str"),syms.serializedLambdaType,deserMethodSym);
}
Program: 78932
Project: 78932
Buggy source:
/** 
 * Returns the names of the annotation types supported by this processor.  An element of the result may be the canonical (fully qualified) name of a supported annotation type. Alternately it may be of the form &quot;<tt><i>name</i>.*</tt>&quot; representing the set of all annotation types with canonical names beginning with &quot;<tt><i>name.</i></tt>&quot;.  Finally,   {@code "*"} by itself represents the set of all annotation types,including the empty set.  Note that a processor should not claim  {@code "*"} unless it is actually processing all files;claiming unnecessary annotations may cause a performance slowdown in some environments. <p>Each string returned in the set must be accepted by the following grammar: <blockquote> <dl> <dt><i>SupportedAnnotationTypeString:</i> <dd><i>TypeName</i> <i>DotStar</i><sub><i>opt</i></sub> <dd><tt>*</tt> <p> <dt><i>DotStar:</i> <dd><tt>.</tt> <tt>*</tt> </dl> </blockquote> where <i>TypeName</i> is as defined in <cite>The Java&trade; Language Specification</cite>.
 * @return the names of the annotation types supported by this processor
 * @see javax.annotation.processing.SupportedAnnotationTypes
 * @jls 3.8 Identifiers
 * @jls 6.5.5 Meaning of Type Names
 */
Set<String> getSupportedAnnotationTypes();

Fixed version (ground truth):
/** 
 * Returns the names of the annotation types supported by this processor.  An element of the result may be the canonical (fully qualified) name of a supported annotation type. Alternately it may be of the form &quot;<tt><i>name</i>.*</tt>&quot; representing the set of all annotation types with canonical names beginning with &quot;<tt><i>name.</i></tt>&quot;.  Finally,   {@code "*"} by itself represents the set of all annotation types,including the empty set.  Note that a processor should not claim  {@code "*"} unless it is actually processing all files;claiming unnecessary annotations may cause a performance slowdown in some environments. <p>Each string returned in the set must be accepted by the following grammar: <blockquote> <dl> <dt><i>SupportedAnnotationTypeString:</i> <dd><i>TypeName</i> <i>DotStar</i><sub><i>opt</i></sub> <dd><tt>*</tt> <dt><i>DotStar:</i> <dd><tt>.</tt> <tt>*</tt> </dl> </blockquote> where <i>TypeName</i> is as defined in <cite>The Java&trade; Language Specification</cite>.
 * @return the names of the annotation types supported by this processor
 * @see javax.annotation.processing.SupportedAnnotationTypes
 * @jls 3.8 Identifiers
 * @jls 6.5.5 Meaning of Type Names
 */
Set<String> getSupportedAnnotationTypes();
Program: 78933
Project: 78933
Buggy source:
/** 
 * Returns the options recognized by this processor.  An implementation of the processing tool must provide a way to pass processor-specific options distinctly from options passed to the tool itself, see   {@link ProcessingEnvironment#getOptions getOptions}. <p>Each string returned in the set must be a period separated sequence of   {@linkplain javax.lang.model.SourceVersion#isIdentifier identifiers}: <blockquote> <dl> <dt><i>SupportedOptionString:</i> <dd><i>Identifiers</i> <p> <dt><i>Identifiers:</i> <dd> <i>Identifier</i> <dd> <i>Identifier</i>   {@code .} <i>Identifiers</i><p> <dt><i>Identifier:</i> <dd>Syntactic identifier, including keywords and literals </dl> </blockquote> <p> A tool might use this information to determine if any options provided by a user are unrecognized by any processor, in which case it may wish to report a warning.
 * @return the options recognized by this processor or anempty collection if none
 * @see javax.annotation.processing.SupportedOptions
 */
Set<String> getSupportedOptions();

Fixed version (ground truth):
/** 
 * Returns the options recognized by this processor.  An implementation of the processing tool must provide a way to pass processor-specific options distinctly from options passed to the tool itself, see   {@link ProcessingEnvironment#getOptions getOptions}. <p>Each string returned in the set must be a period separated sequence of   {@linkplain javax.lang.model.SourceVersion#isIdentifier identifiers}: <blockquote> <dl> <dt><i>SupportedOptionString:</i> <dd><i>Identifiers</i> <dt><i>Identifiers:</i> <dd> <i>Identifier</i> <dd> <i>Identifier</i>   {@code .} <i>Identifiers</i><dt><i>Identifier:</i> <dd>Syntactic identifier, including keywords and literals </dl> </blockquote> <p> A tool might use this information to determine if any options provided by a user are unrecognized by any processor, in which case it may wish to report a warning.
 * @return the options recognized by this processor or anempty collection if none
 * @see javax.annotation.processing.SupportedOptions
 */
Set<String> getSupportedOptions();
Program: 78935
Project: 78935
Buggy source:
/** 
 * Discards the referral about to be processed. A call to this method should be followed by a call to <code>getReferralContext</code> to allow the processing of other referrals to continue. The following code fragment shows a typical usage pattern. <p><blockquote><pre> } catch (ReferralException e) { if (!shallIFollow(e.getReferralInfo())) { if (!e.skipReferral()) { return; } } ctx = e.getReferralContext(); } </pre></blockquote>
 * @return true If more referral processing is pending; false otherwise.
 */
public abstract boolean skipReferral();

Fixed version (ground truth):
/** 
 * Discards the referral about to be processed. A call to this method should be followed by a call to <code>getReferralContext</code> to allow the processing of other referrals to continue. The following code fragment shows a typical usage pattern. <blockquote><pre> } catch (ReferralException e) { if (!shallIFollow(e.getReferralInfo())) { if (!e.skipReferral()) { return; } } ctx = e.getReferralContext(); } </pre></blockquote>
 * @return true If more referral processing is pending; false otherwise.
 */
public abstract boolean skipReferral();
Program: 78936
Project: 78936
Buggy source:
/** 
 * Retries the referral currently being processed. A call to this method should be followed by a call to <code>getReferralContext</code> to allow the current referral to be retried. The following code fragment shows a typical usage pattern. <p><blockquote><pre> } catch (ReferralException e) { while (true) { try { ctx = e.getReferralContext(env); break; } catch (NamingException ne) { if (! shallIRetry()) { return; } // modify environment properties (env), if necessary e.retryReferral(); } } } </pre></blockquote>
 */
public abstract void retryReferral();

Fixed version (ground truth):
/** 
 * Retries the referral currently being processed. A call to this method should be followed by a call to <code>getReferralContext</code> to allow the current referral to be retried. The following code fragment shows a typical usage pattern. <blockquote><pre> } catch (ReferralException e) { while (true) { try { ctx = e.getReferralContext(env); break; } catch (NamingException ne) { if (! shallIRetry()) { return; } // modify environment properties (env), if necessary e.retryReferral(); } } } </pre></blockquote>
 */
public abstract void retryReferral();
Program: 78937
Project: 78937
Buggy source:
private void checkPackageAccess(Class<?> cls,ProtectionDomain pd){
  final SecurityManager sm=System.getSecurityManager();
  if (sm != null) {
    if (ReflectUtil.isNonPublicProxyClass(cls)) {
      for (      Class intf : cls.getInterfaces()) {
        checkPackageAccess(intf,pd);
      }
      return;
    }
    final String name=cls.getName();
    final int i=name.lastIndexOf('.');
    if (i != -1) {
      AccessController.doPrivileged(new PrivilegedAction<Void>(){
        public Void run(){
          sm.checkPackageAccess(name.substring(0,i));
          return null;
        }
      }
,new AccessControlContext(new ProtectionDomain[]{pd}));
    }
  }
  domains.add(pd);
}

Fixed version (ground truth):
private void checkPackageAccess(Class<?> cls,ProtectionDomain pd){
  final SecurityManager sm=System.getSecurityManager();
  if (sm != null) {
    if (ReflectUtil.isNonPublicProxyClass(cls)) {
      for (      Class<?> intf : cls.getInterfaces()) {
        checkPackageAccess(intf,pd);
      }
      return;
    }
    final String name=cls.getName();
    final int i=name.lastIndexOf('.');
    if (i != -1) {
      AccessController.doPrivileged(new PrivilegedAction<Void>(){
        public Void run(){
          sm.checkPackageAccess(name.substring(0,i));
          return null;
        }
      }
,new AccessControlContext(new ProtectionDomain[]{pd}));
    }
  }
  domains.add(pd);
}
Program: 78939
Project: 78939
Buggy source:
/** 
 * Remove all stale entries, everywhere. 
 */
private void removeStaleEntries(){
  Entry[] cache=getCache();
  removeStaleEntries(cache,0,cache.length + PROBE_LIMIT - 1);
}

Fixed version (ground truth):
/** 
 * Remove all stale entries, everywhere. 
 */
private void removeStaleEntries(){
  Entry<?>[] cache=getCache();
  removeStaleEntries(cache,0,cache.length + PROBE_LIMIT - 1);
}
Program: 78940
Project: 78940
Buggy source:
/** 
 * Returns the stack depth of the most recently executing method from a class defined using a non-system class loader.  A non-system class loader is defined as being a class loader that is not equal to the system class loader (as returned by   {@link ClassLoader#getSystemClassLoader}) or one of its ancestors. <p> This method will return -1 in the following three cases:<p> <ol> <li>All methods on the execution stack are from classes defined using the system class loader or one of its ancestors. <li>All methods on the execution stack up to the first "privileged" caller (see   {@link java.security.AccessController#doPrivileged}) are from classes defined using the system class loader or one of its ancestors. <li> A call to <code>checkPermission</code> with <code>java.security.AllPermission</code> does not result in a SecurityException. </ol>
 * @return the depth on the stack frame of the most recent occurrence ofa method from a class defined using a non-system class loader.
 * @deprecated This type of security checking is not recommended.It is recommended that the <code>checkPermission</code> call be used instead.
 * @see java.lang.ClassLoader#getSystemClassLoader() getSystemClassLoader
 * @see #checkPermission(java.security.Permission) checkPermission
 */
@Deprecated protected int classLoaderDepth(){
  int depth=classLoaderDepth0();
  if (depth != -1) {
    if (hasAllPermission())     depth=-1;
 else     depth--;
  }
  return depth;
}

Fixed version (ground truth):
/** 
 * Returns the stack depth of the most recently executing method from a class defined using a non-system class loader.  A non-system class loader is defined as being a class loader that is not equal to the system class loader (as returned by   {@link ClassLoader#getSystemClassLoader}) or one of its ancestors. <p> This method will return -1 in the following three cases: <ol> <li>All methods on the execution stack are from classes defined using the system class loader or one of its ancestors. <li>All methods on the execution stack up to the first "privileged" caller (see   {@link java.security.AccessController#doPrivileged}) are from classes defined using the system class loader or one of its ancestors. <li> A call to <code>checkPermission</code> with <code>java.security.AllPermission</code> does not result in a SecurityException. </ol>
 * @return the depth on the stack frame of the most recent occurrence ofa method from a class defined using a non-system class loader.
 * @deprecated This type of security checking is not recommended.It is recommended that the <code>checkPermission</code> call be used instead.
 * @see java.lang.ClassLoader#getSystemClassLoader() getSystemClassLoader
 * @see #checkPermission(java.security.Permission) checkPermission
 */
@Deprecated protected int classLoaderDepth(){
  int depth=classLoaderDepth0();
  if (depth != -1) {
    if (hasAllPermission())     depth=-1;
 else     depth--;
  }
  return depth;
}