nus-yam/ex-repair huggingface dataset:
Program: 83252
Project: 83252
Buggy source:
public void testSelection(){
  ListBox box=new ListBox();
  box.addItem("String_Node_Str");
  box.setSelectedIndex(-1);
  assertEquals(-1,box.getSelectedIndex());
  box.setSelectedIndex(0);
  assertEquals("String_Node_Str",box.getItemText(box.getSelectedIndex()));
}

Fixed version (ground truth):
public void testSelection(){
{
    ListBox box=new ListBox();
    box.addItem("String_Node_Str");
    box.setSelectedIndex(-1);
    assertEquals(-1,box.getSelectedIndex());
    box.setSelectedIndex(0);
    assertEquals("String_Node_Str",box.getItemText(box.getSelectedIndex()));
  }
{
    ListBox box=new ListBox(true);
    box.setMultipleSelect(true);
    box.addItem("String_Node_Str");
    box.addItem("String_Node_Str");
    box.addItem("String_Node_Str");
    for (int j=0; j < box.getItemCount(); j++) {
      box.setItemSelected(j,true);
    }
    for (int j=0; j < box.getItemCount(); j++) {
      assertTrue(box.isItemSelected(j));
    }
  }
}
Program: 83253
Project: 83253
Buggy source:
/** 
 * Adds a widget to the tab panel.
 * @param w the widget to be added
 * @param tabWidget the widget to be shown in the tab
 */
public void add(Widget w,Widget tabWidget){
  insert(w,tabWidget,getWidgetCount());
}

Fixed version (ground truth):
/** 
 * Adds a widget to the tab panel.  If the Widget is already attached to the TabPanel, it will be moved to the right-most index.
 * @param w the widget to be added
 * @param tabWidget the widget to be shown in the tab
 */
public void add(Widget w,Widget tabWidget){
  insert(w,tabWidget,getWidgetCount());
}
Program: 83254
Project: 83254
Buggy source:
public int getWidgetIndex(Widget widget){
  return children.indexOf(widget);
}

Fixed version (ground truth):
public int getWidgetIndex(Widget widget){
  return deck.getWidgetIndex(widget);
}
Program: 83255
Project: 83255
Buggy source:
public Widget getWidget(int index){
  return children.get(index);
}

Fixed version (ground truth):
public Widget getWidget(int index){
  return deck.getWidget(index);
}
Program: 83256
Project: 83256
Buggy source:
/** 
 * Inserts a widget into the tab panel.
 * @param widget the widget to be inserted
 * @param tabText the text to be shown on its tab
 * @param beforeIndex the index before which it will be inserted
 */
public void insert(Widget widget,String tabText,int beforeIndex){
  insert(widget,tabText,false,beforeIndex);
}

Fixed version (ground truth):
/** 
 * Inserts a widget into the tab panel.  If the Widget is already attached to the TabPanel, it will be moved to the requested index.
 * @param widget the widget to be inserted
 * @param tabText the text to be shown on its tab
 * @param beforeIndex the index before which it will be inserted
 */
public void insert(Widget widget,String tabText,int beforeIndex){
  insert(widget,tabText,false,beforeIndex);
}
Program: 83257
Project: 83257
Buggy source:
/** 
 * Removes the given widget, and its associated tab.
 * @param widget the widget to be removed
 */
public boolean remove(Widget widget){
  int index=getWidgetIndex(widget);
  if (index == -1) {
    return false;
  }
  children.remove(widget);
  tabBar.removeTab(index);
  deck.remove(widget);
  return true;
}

Fixed version (ground truth):
/** 
 * Removes the given widget, and its associated tab.
 * @param widget the widget to be removed
 */
public boolean remove(Widget widget){
  return deck.remove(widget);
}
Program: 83258
Project: 83258
Buggy source:
public int getWidgetCount(){
  return children.size();
}

Fixed version (ground truth):
public int getWidgetCount(){
  return deck.getWidgetCount();
}
Program: 83259
Project: 83259
Buggy source:
/** 
 * Gets the deck panel within this tab panel.
 * @return the deck panel
 */
public DeckPanel getDeckPanel(){
  return deck;
}

Fixed version (ground truth):
/** 
 * Gets the deck panel within this tab panel.  Adding or removing Widgets from the DeckPanel is not supported and will throw UnsupportedOperationExceptions.
 * @return the deck panel
 */
public DeckPanel getDeckPanel(){
  return deck;
}
Program: 83260
Project: 83260
Buggy source:
public Iterator iterator(){
  return children.iterator();
}

Fixed version (ground truth):
public Iterator iterator(){
  return deck.iterator();
}
Program: 83261
Project: 83261
Buggy source:
/** 
 * Gets the tab bar within this tab panel.
 * @return the tab bar
 */
public TabBar getTabBar(){
  return tabBar;
}

Fixed version (ground truth):
/** 
 * Gets the tab bar within this tab panel.  Adding or removing tabs from from the TabBar is not supported and will throw UnsupportedOperationExceptions.
 * @return the tab bar
 */
public TabBar getTabBar(){
  return tabBar;
}
Program: 83262
Project: 83262
Buggy source:
/** 
 * A helper for widgets that source mouse events.
 * @param sender the widget sending the event
 * @param event the {@link Event} received by the widget
 */
public void fireMouseEvent(Widget sender,Event event){
  int x=DOM.eventGetClientX(event) - DOM.getAbsoluteLeft(sender.getElement());
  int y=DOM.eventGetClientY(event) - DOM.getAbsoluteTop(sender.getElement());
switch (DOM.eventGetType(event)) {
case Event.ONMOUSEDOWN:
    fireMouseDown(sender,x,y);
  break;
case Event.ONMOUSEUP:
fireMouseUp(sender,x,y);
break;
case Event.ONMOUSEMOVE:
fireMouseMove(sender,x,y);
break;
case Event.ONMOUSEOVER:
Element from=DOM.eventGetFromElement(event);
if (!DOM.isOrHasChild(sender.getElement(),from)) {
fireMouseEnter(sender);
}
break;
case Event.ONMOUSEOUT:
Element to=DOM.eventGetToElement(event);
if (!DOM.isOrHasChild(sender.getElement(),to)) {
fireMouseLeave(sender);
}
break;
}
}

Fixed version (ground truth):
/** 
 * A helper for widgets that source mouse events.
 * @param sender the widget sending the event
 * @param event the {@link Event} received by the widget
 */
public void fireMouseEvent(Widget sender,Event event){
  final Element senderElem=sender.getElement();
  int x=DOM.eventGetClientX(event) - DOM.getAbsoluteLeft(sender.getElement()) + DOM.getElementPropertyInt(senderElem,"String_Node_Str") + Window.getScrollLeft();
  int y=DOM.eventGetClientY(event) - DOM.getAbsoluteTop(sender.getElement()) + DOM.getElementPropertyInt(senderElem,"String_Node_Str") + Window.getScrollTop();
switch (DOM.eventGetType(event)) {
case Event.ONMOUSEDOWN:
    fireMouseDown(sender,x,y);
  break;
case Event.ONMOUSEUP:
fireMouseUp(sender,x,y);
break;
case Event.ONMOUSEMOVE:
fireMouseMove(sender,x,y);
break;
case Event.ONMOUSEOVER:
Element from=DOM.eventGetFromElement(event);
if (!DOM.isOrHasChild(sender.getElement(),from)) {
fireMouseEnter(sender);
}
break;
case Event.ONMOUSEOUT:
Element to=DOM.eventGetToElement(event);
if (!DOM.isOrHasChild(sender.getElement(),to)) {
fireMouseLeave(sender);
}
break;
}
}
Program: 83263
Project: 83263
Buggy source:
/** 
 * A helper for widgets that source mouse events.
 * @param sender the widget sending the event
 * @param event the {@link Event} received by the widget
 */
public void fireMouseWheelEvent(Widget sender,Event event){
  if (DOM.eventGetType(event) == Event.ONMOUSEWHEEL) {
    int x=DOM.eventGetClientX(event) - DOM.getAbsoluteLeft(sender.getElement());
    int y=DOM.eventGetClientY(event) - DOM.getAbsoluteTop(sender.getElement());
    MouseWheelVelocity velocity=new MouseWheelVelocity(event);
    fireMouseWheel(sender,x,y,velocity);
  }
}

Fixed version (ground truth):
/** 
 * A helper for widgets that source mouse events.
 * @param sender the widget sending the event
 * @param event the {@link Event} received by the widget
 */
public void fireMouseWheelEvent(Widget sender,Event event){
  if (DOM.eventGetType(event) == Event.ONMOUSEWHEEL) {
    final Element senderElem=sender.getElement();
    int x=DOM.eventGetClientX(event) - DOM.getAbsoluteLeft(sender.getElement()) + DOM.getElementPropertyInt(senderElem,"String_Node_Str") + Window.getScrollLeft();
    int y=DOM.eventGetClientY(event) - DOM.getAbsoluteTop(sender.getElement()) + DOM.getElementPropertyInt(senderElem,"String_Node_Str") + Window.getScrollTop();
    MouseWheelVelocity velocity=new MouseWheelVelocity(event);
    fireMouseWheel(sender,x,y,velocity);
  }
}
Program: 83264
Project: 83264
Buggy source:
public String getParameterizedQualifiedSourceName(){
  StringBuffer sb=new StringBuffer();
  sb.append(parameterized.getQualifiedSourceName());
  sb.append('<');
  boolean needComma=false;
  for (Iterator iter=typeArgs.iterator(); iter.hasNext(); ) {
    JType typeArg=(JType)iter.next();
    if (needComma) {
      sb.append("String_Node_Str");
    }
 else {
      needComma=true;
    }
    sb.append(typeArg.getQualifiedSourceName());
  }
  sb.append('>');
  return sb.toString();
}

Fixed version (ground truth):
public String getParameterizedQualifiedSourceName(){
  StringBuffer sb=new StringBuffer();
  sb.append(parameterized.getQualifiedSourceName());
  sb.append('<');
  boolean needComma=false;
  for (Iterator iter=typeArgs.iterator(); iter.hasNext(); ) {
    JType typeArg=(JType)iter.next();
    if (needComma) {
      sb.append("String_Node_Str");
    }
 else {
      needComma=true;
    }
    sb.append(typeArg.getParameterizedQualifiedSourceName());
  }
  sb.append('>');
  return sb.toString();
}
Program: 83265
Project: 83265
Buggy source:
private JType parseImpl(String type) throws NotFoundException, ParseException, BadTypeArgsException {
  if (type.endsWith("String_Node_Str")) {
    String remainder=type.substring(0,type.length() - 2);
    JType componentType=parseImpl(remainder);
    return getArrayType(componentType);
  }
  if (type.endsWith("String_Node_Str")) {
    int bracket=type.indexOf('<');
    if (bracket == -1) {
      throw new ParseException("String_Node_Str");
    }
    String rawTypeName=type.substring(0,bracket);
    JType rawType=parseImpl(rawTypeName);
    if (rawType.isParameterized() != null) {
      throw new BadTypeArgsException("String_Node_Str");
    }
 else     if (rawType.isClassOrInterface() == null) {
      throw new BadTypeArgsException("String_Node_Str" + rawType.getQualifiedSourceName() + "String_Node_Str");
    }
    String typeArgGuts=type.substring(bracket + 1,type.length() - 1);
    String[] typeArgNames=typeArgGuts.split("String_Node_Str");
    JType[] typeArgs=new JType[typeArgNames.length];
    for (int i=0; i < typeArgNames.length; i++) {
      typeArgs[i]=parseImpl(typeArgNames[i]);
      if (typeArgs[i].isPrimitive() != null) {
        throw new BadTypeArgsException("String_Node_Str" + typeArgs[i].getQualifiedSourceName() + "String_Node_Str");
      }
    }
    return getParameterizedType(rawType.isClassOrInterface(),typeArgs);
  }
  JType result=JPrimitiveType.valueOf(type);
  if (result != null) {
    return result;
  }
  result=findType(type);
  if (result != null) {
    return result;
  }
  throw new NotFoundException(type);
}

Fixed version (ground truth):
private JType parseImpl(String type) throws NotFoundException, ParseException, BadTypeArgsException {
  if (type.endsWith("String_Node_Str")) {
    String remainder=type.substring(0,type.length() - 2);
    JType componentType=parseImpl(remainder);
    return getArrayType(componentType);
  }
  if (type.endsWith("String_Node_Str")) {
    int bracket=type.indexOf('<');
    if (bracket == -1) {
      throw new ParseException("String_Node_Str");
    }
    String rawTypeName=type.substring(0,bracket);
    JType rawType=parseImpl(rawTypeName);
    if (rawType.isParameterized() != null) {
      throw new BadTypeArgsException("String_Node_Str");
    }
 else     if (rawType.isClassOrInterface() == null) {
      throw new BadTypeArgsException("String_Node_Str" + rawType.getQualifiedSourceName() + "String_Node_Str");
    }
    String typeArgContents=type.substring(bracket + 1,type.length() - 1);
    JType[] typeArgs=parseTypeArgContents(typeArgContents);
    return getParameterizedType(rawType.isClassOrInterface(),typeArgs);
  }
  JType result=JPrimitiveType.valueOf(type);
  if (result != null) {
    return result;
  }
  result=findType(type);
  if (result != null) {
    return result;
  }
  throw new NotFoundException(type);
}
Program: 83266
Project: 83266
Buggy source:
/** 
 * Gets the parameterized type object that represents the combination of a specified raw type and a set of type arguments. The returned type always has a stable identity so as to guarantee that all calls to this method with the same arguments return the same object.
 * @param rawType the raw type of the array, which must be a class orinterface type and cannot be a primitive, array, or another parameterized type
 * @param typeArgs the type arguments bound to the specified raw type
 * @return a type object representing this particular binding of typearguments to the specified raw type
 */
public JType getParameterizedType(JClassType rawType,JType[] typeArgs){
  JParameterizedType parameterized=new JParameterizedType(rawType);
  for (int i=0; i < typeArgs.length; i++) {
    parameterized.addTypeArg(typeArgs[i]);
  }
  String sig=parameterized.getQualifiedSourceName();
  JParameterizedType existing=(JParameterizedType)parameterizedTypes.get(sig);
  if (existing == null) {
    parameterizedTypes.put(sig,parameterized);
    existing=parameterized;
  }
  return existing;
}

Fixed version (ground truth):
/** 
 * Gets the parameterized type object that represents the combination of a specified raw type and a set of type arguments. The returned type always has a stable identity so as to guarantee that all calls to this method with the same arguments return the same object.
 * @param rawType the raw type of the array, which must be a class orinterface type and cannot be a primitive, array, or another parameterized type
 * @param typeArgs the type arguments bound to the specified raw type
 * @return a type object representing this particular binding of typearguments to the specified raw type
 */
public JType getParameterizedType(JClassType rawType,JType[] typeArgs){
  JParameterizedType parameterized=new JParameterizedType(rawType);
  for (int i=0; i < typeArgs.length; i++) {
    parameterized.addTypeArg(typeArgs[i]);
  }
  String sig=parameterized.getParameterizedQualifiedSourceName();
  JParameterizedType existing=(JParameterizedType)parameterizedTypes.get(sig);
  if (existing == null) {
    parameterizedTypes.put(sig,parameterized);
    existing=parameterized;
  }
  return existing;
}
Program: 83267
Project: 83267
Buggy source:
/** 
 * Adapted from  {@link com.google.javascript.jscomp.rhino.ScriptRuntime#escapeString(String)}. The difference is that we quote with either &quot; or &apos; depending on which one is used less inside the string.
 */
private void printStringLiteral(String value){
  char[] chars=value.toCharArray();
  final int n=chars.length;
  int quoteCount=0;
  int aposCount=0;
  for (int i=0; i < n; ++i) {
switch (chars[i]) {
case '"':
      ++quoteCount;
    break;
case '\'':
  ++aposCount;
break;
}
}
char quoteChar=(quoteCount < aposCount) ? '"' : '\'';
p.print(quoteChar);
for (int i=0; i < n; ++i) {
char c=chars[i];
if (' ' <= c && c <= '~' && c != quoteChar && c != '\\') {
p.print(c);
continue;
}
int escape=-1;
switch (c) {
case 0:
escape='0';
break;
case '\b':
escape='b';
break;
case '\f':
escape='f';
break;
case '\n':
escape='n';
break;
case '\r':
escape='r';
break;
case '\t':
escape='t';
break;
case '"':
escape='"';
break;
case '\'':
escape='\'';
break;
case '\\':
escape='\\';
break;
}
if (escape >= 0) {
p.print('\\');
p.print((char)escape);
}
 else {
int hexSize;
if (c < 256) {
p.print("String_Node_Str");
hexSize=2;
}
 else {
p.print("String_Node_Str");
hexSize=4;
}
for (int shift=(hexSize - 1) * 4; shift >= 0; shift-=4) {
int digit=0xf & (c >> shift);
p.print(HEX_DIGITS[digit]);
}
}
}
p.print(quoteChar);
}

Fixed version (ground truth):
/** 
 * Adapted from  {@link com.google.gwt.dev.js.rhino.ScriptRuntime#escapeString(String)}. The difference is that we quote with either &quot; or &apos; depending on which one is used less inside the string.
 */
private void printStringLiteral(String value){
  char[] chars=value.toCharArray();
  final int n=chars.length;
  int quoteCount=0;
  int aposCount=0;
  for (int i=0; i < n; ++i) {
switch (chars[i]) {
case '"':
      ++quoteCount;
    break;
case '\'':
  ++aposCount;
break;
}
}
StringBuffer result=new StringBuffer(value.length() + 16);
char quoteChar=(quoteCount < aposCount) ? '"' : '\'';
p.print(quoteChar);
for (int i=0; i < n; ++i) {
char c=chars[i];
if (' ' <= c && c <= '~' && c != quoteChar && c != '\\') {
result.append(c);
continue;
}
int escape=-1;
switch (c) {
case 0:
escape='0';
break;
case '\b':
escape='b';
break;
case '\f':
escape='f';
break;
case '\n':
escape='n';
break;
case '\r':
escape='r';
break;
case '\t':
escape='t';
break;
case '"':
escape='"';
break;
case '\'':
escape='\'';
break;
case '\\':
escape='\\';
break;
}
if (escape >= 0) {
result.append('\\');
result.append((char)escape);
}
 else {
int hexSize;
if (c < 256) {
result.append("String_Node_Str");
hexSize=2;
}
 else {
result.append("String_Node_Str");
hexSize=4;
}
for (int shift=(hexSize - 1) * 4; shift >= 0; shift-=4) {
int digit=0xf & (c >> shift);
result.append(HEX_DIGITS[digit]);
}
}
}
result.append(quoteChar);
escapeClosingTags(result);
p.print(result.toString());
}
Program: 83268
Project: 83268
Buggy source:
/** 
 * This method is called when a widget is attached to the browser's document. It must not be overridden, except by   {@link Panel}. To receive notification when a widget is attached to the document, override the  {@link #onLoad} method.
 * @throws IllegalStateException if this widget is already attached
 */
protected void onAttach(){
  if (attached) {
    throw new IllegalStateException("String_Node_Str");
  }
  attached=true;
  DOM.setEventListener(getElement(),this);
  onLoad();
}

Fixed version (ground truth):
/** 
 * This method is called when a widget is attached to the browser's document. To receive notification after a Widget has been added from the document, override the   {@link #onLoad} method.<p> Subclasses that override this method must call <code>super.onAttach()</code> to ensure that the Widget has been attached to the underlying Element. </p>
 * @throws IllegalStateException if this widget is already attached
 */
protected void onAttach(){
  if (attached) {
    throw new IllegalStateException("String_Node_Str");
  }
  attached=true;
  DOM.setEventListener(getElement(),this);
  onLoad();
}
Program: 83269
Project: 83269
Buggy source:
/** 
 * This method is called when the widget becomes attached to the browser's document.
 */
protected void onLoad(){
}

Fixed version (ground truth):
/** 
 * This method is called immediately after a widget becomes attached to the browser's document.
 */
protected void onLoad(){
}
Program: 83270
Project: 83270
Buggy source:
/** 
 * Sets this widget's parent. This method should only be called by  {@link Panel} and {@link Composite}.
 * @param parent the widget's new parent
 */
void setParent(Widget parent){
  Widget oldParent=this.parent;
  this.parent=parent;
  if (parent == null) {
    if (oldParent != null && oldParent.isAttached()) {
      onDetach();
    }
  }
 else   if (parent.isAttached()) {
    onAttach();
  }
}

Fixed version (ground truth):
/** 
 * Sets this widget's parent. This method should only be called by  {@link Panel} and {@link Composite}.
 * @param parent the widget's new parent
 */
void setParent(Widget parent){
}
Program: 83271
Project: 83271
Buggy source:
/** 
 * This method is called when a widget is detached from the browser's document. It must not be overridden, except by   {@link Panel}.
 * @throws IllegalStateException if this widget is already detached
 */
protected void onDetach(){
  if (!attached) {
    throw new IllegalStateException("String_Node_Str");
  }
  attached=false;
  DOM.setEventListener(getElement(),null);
}

Fixed version (ground truth):
/** 
 * This method is called when a widget is detached from the browser's document. To receive notification before a Widget is removed from the document, override the   {@link #onUnload} method.<p> Subclasses that override this method must call <code>super.onDetach()</code> to ensure that the Widget has been detached from the underlying Element.  Failure to do so will result in application memeroy leaks due to circular references between DOM Elements and JavaScript objects. </p>
 * @throws IllegalStateException if this widget is already detached
 */
protected void onDetach(){
  if (!attached) {
    throw new IllegalStateException("String_Node_Str");
  }
  try {
    onUnload();
  }
  finally {
    attached=false;
    DOM.setEventListener(getElement(),null);
  }
}
Program: 83272
Project: 83272
Buggy source:
public void onBrowserEvent(Event event){
  if (DOM.eventGetType(event) == Event.ONCLICK) {
    Element target=DOM.eventGetTarget(event);
    if (isDividerOwn(target)) {
      int index=getDividerIndex(target);
      if (index != -1) {
        showStack(index);
      }
    }
  }
}

Fixed version (ground truth):
public void onBrowserEvent(Event event){
  if (DOM.eventGetType(event) == Event.ONCLICK) {
    Element target=DOM.eventGetTarget(event);
    int index=findDividerIndex(target);
    if (index != -1) {
      showStack(index);
    }
  }
}
Program: 83273
Project: 83273
Buggy source:
/** 
 * Adds a widget to the panel at the specified position.
 * @param w the widget to be added
 * @param left the widget's left position
 * @param top the widget's top position
 */
public void add(Widget w,int left,int top){
  add(w);
  setWidgetPosition(w,left,top);
}

Fixed version (ground truth):
/** 
 * Adds a widget to the panel at the specified position. Setting a position of <code>(-1, -1)</code> will cause the child widget to be positioned statically.
 * @param w the widget to be added
 * @param left the widget's left position
 * @param top the widget's top position
 */
public void add(Widget w,int left,int top){
  w.removeFromParent();
  setWidgetPositionImpl(w,left,top);
  add(w);
}
Program: 83274
Project: 83274
Buggy source:
/** 
 * Sets the position of the specified child widget. Setting a position of <code>(-1, -1)</code> will cause the child widget to be positioned statically.
 * @param w the child widget to be positioned
 * @param left the widget's left position
 * @param top the widget's top position
 */
public void setWidgetPosition(Widget w,int left,int top){
  checkWidgetParent(w);
  Element h=w.getElement();
  if ((left == -1) && (top == -1)) {
    changeToStaticPositioning(h);
  }
 else {
    DOM.setStyleAttribute(h,"String_Node_Str","String_Node_Str");
    DOM.setStyleAttribute(h,"String_Node_Str",left + "String_Node_Str");
    DOM.setStyleAttribute(h,"String_Node_Str",top + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Sets the position of the specified child widget. Setting a position of <code>(-1, -1)</code> will cause the child widget to be positioned statically.
 * @param w the child widget to be positioned
 * @param left the widget's left position
 * @param top the widget's top position
 */
public void setWidgetPosition(Widget w,int left,int top){
  checkWidgetParent(w);
  setWidgetPositionImpl(w,left,top);
}
Program: 83275
Project: 83275
Buggy source:
public static void insertListItem(Element select,String item,String value,int index){
  impl.insertListItem(select,item,value,index);
}

Fixed version (ground truth):
/** 
 * Creates an <code>&lt;option&gt;</code> element and inserts it as a child of the specified <code>&lt;select&gt;</code> element.
 * @param select the <code>&lt;select&gt;</code> element
 * @param item the text of the new item; cannot be <code>null</code>
 * @param value the <code>value</code> attribute for the new<code>&lt;option&gt;</code>; cannot be <code>null</code>
 * @param index the index at which to insert the child
 */
public static void insertListItem(Element select,String item,String value,int index){
  impl.insertListItem(select,item,value,index);
}
Program: 83276
Project: 83276
Buggy source:
public void insertListItem(Element select,String item,String value,int index){
  Element option=DOM.createElement("String_Node_Str");
  DOM.setInnerText(option,item);
  if (value != null) {
    DOM.setElementProperty(option,"String_Node_Str",value);
  }
  if (index == -1) {
    DOM.appendChild(select,option);
  }
 else {
    DOM.insertChild(select,option,index);
  }
}

Fixed version (ground truth):
/** 
 * @see DOM#insertListItem(Element,String,String,int)
 */
public void insertListItem(Element select,String item,String value,int index){
  Element option=DOM.createElement("String_Node_Str");
  DOM.setInnerText(option,item);
  DOM.setElementProperty(option,"String_Node_Str",value);
  if (index == -1) {
    DOM.appendChild(select,option);
  }
 else {
    DOM.insertChild(select,option,index);
  }
}
Program: 83277
Project: 83277
Buggy source:
/** 
 * Adds an item to the list box.
 * @param item the text of the item to be added
 * @param value the item's value, to be submitted if it is part of a{@link FormPanel}.
 */
public void addItem(String item,String value){
  insertItem(item,value,INSERT_AT_END);
}

Fixed version (ground truth):
/** 
 * Adds an item to the list box, specifying an initial value for the item.
 * @param item the text of the item to be added
 * @param value the item's value, to be submitted if it is part of a{@link FormPanel}; cannot be <code>null</code>
 */
public void addItem(String item,String value){
  insertItem(item,value,INSERT_AT_END);
}
Program: 83278
Project: 83278
Buggy source:
/** 
 * Gets the value associated with the item at a given index.
 * @param index the index of the item to be retrieved
 * @return the item's associated value
 * @throws IndexOutOfBoundsException if the index is out of range
 */
public String getValue(int index){
  checkIndex(index);
  Element option=DOM.getChild(getElement(),index);
  return DOM.getElementProperty(option,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Gets the value associated with the item at a given index. 
 * @param index the index of the item to be retrieved
 * @return the item's associated value
 * @throws IndexOutOfBoundsException if the index is out of range
 */
public String getValue(int index){
  checkIndex(index);
  Element option=DOM.getChild(getElement(),index);
  return DOM.getElementProperty(option,"String_Node_Str");
}
Program: 83279
Project: 83279
Buggy source:
/** 
 * Sets the value associated with the item at a given index. This value can be used for any purpose, but is also what is passed to the server when the ListBox is submitted as part of a   {@link FormPanel}.
 * @param index the index of the item to be set
 * @param value the item's new value
 * @throws IndexOutOfBoundsException if the index is out of range
 */
public void setValue(int index,String value){
  checkIndex(index);
  Element option=DOM.getChild(getElement(),index);
  DOM.setElementProperty(option,"String_Node_Str",value);
}

Fixed version (ground truth):
/** 
 * Sets the value associated with the item at a given index. This value can be used for any purpose, but is also what is passed to the server when the list box is submitted as part of a   {@link FormPanel}.
 * @param index the index of the item to be set
 * @param value the item's new value; cannot be <code>null</code>
 * @throws IndexOutOfBoundsException if the index is out of range
 */
public void setValue(int index,String value){
  checkIndex(index);
  Element option=DOM.getChild(getElement(),index);
  DOM.setElementProperty(option,"String_Node_Str",value);
}
Program: 83280
Project: 83280
Buggy source:
/** 
 * Inserts an item into the list box.
 * @param item the text of the item to be inserted
 * @param value the item's value, to be submitted if it is part of a{@link FormPanel}.
 * @param index the index at which to insert it
 */
public void insertItem(String item,String value,int index){
  DOM.insertListItem(getElement(),item,value,index);
}

Fixed version (ground truth):
/** 
 * Inserts an item into the list box, specifying an initial value for the item.
 * @param item the text of the item to be inserted
 * @param value the item's value, to be submitted if it is part of a{@link FormPanel}.
 * @param index the index at which to insert it
 */
public void insertItem(String item,String value,int index){
  DOM.insertListItem(getElement(),item,value,index);
}
Program: 83281
Project: 83281
Buggy source:
public void testLocalRefs(){
  final String foo=cannotOptimize() ? "String_Node_Str" : "String_Node_Str";
  final String bar=cannotOptimize() ? "String_Node_Str" : "String_Node_Str";
  String result=new Object(){
    private String a=foo;
{
      a=foo;
    }
    public String toString(){
      return new Object(){
        private static final String constantString="String_Node_Str";
        private String ai=foo;
{
          ai=foo;
        }
        public String toString(){
          bar.valueOf(false);
          assertEquals("String_Node_Str",constantString);
          return foo + a + ai;
        }
      }
.toString() + a;
    }
  }
.toString();
  assertEquals(result,"String_Node_Str");
}

Fixed version (ground truth):
public void testLocalRefs(){
  final String foo=noOptimizeTrue() ? "String_Node_Str" : "String_Node_Str";
  final String bar=noOptimizeTrue() ? "String_Node_Str" : "String_Node_Str";
  String result=new Object(){
    private String a=foo;
{
      a=foo;
    }
    public String toString(){
      return new Object(){
        private static final String constantString="String_Node_Str";
        private String ai=foo;
{
          ai=foo;
        }
        public String toString(){
          bar.valueOf(false);
          assertEquals("String_Node_Str",constantString);
          return foo + a + ai;
        }
      }
.toString() + a;
    }
  }
.toString();
  assertEquals(result,"String_Node_Str");
}
Program: 83282
Project: 83282
Buggy source:
public void testJavaScriptReservedWords(){
  boolean delete=cannotOptimize();
  for (int in=0; in < 10; ++in) {
    assertTrue(in < 10);
    assertTrue(delete);
  }
}

Fixed version (ground truth):
public void testJavaScriptReservedWords(){
  boolean delete=noOptimizeTrue();
  for (int in=0; in < 10; ++in) {
    assertTrue(in < 10);
    assertTrue(delete);
  }
}
Program: 83283
Project: 83283
Buggy source:
public void testArrayStore(){
  Object[][] oaa;
  oaa=new Object[4][4];
  oaa[0][0]="String_Node_Str";
  assertEquals(oaa[0][0],"String_Node_Str");
  oaa=new Object[4][];
  oaa[0]=new Object[4];
  oaa[0][0]="String_Node_Str";
  assertEquals(oaa[0][0],"String_Node_Str");
  Apple[] apple=cannotOptimize() ? new Granny[3] : new Apple[3];
  Apple g=cannotOptimize() ? (Apple)new Granny() : (Apple)new Fuji();
  Apple a=apple[0]=g;
  assertEquals(g,a);
}

Fixed version (ground truth):
public void testArrayStore(){
  Object[][] oaa;
  oaa=new Object[4][4];
  oaa[0][0]="String_Node_Str";
  assertEquals(oaa[0][0],"String_Node_Str");
  oaa=new Object[4][];
  oaa[0]=new Object[4];
  oaa[0][0]="String_Node_Str";
  assertEquals(oaa[0][0],"String_Node_Str");
  Apple[] apple=noOptimizeTrue() ? new Granny[3] : new Apple[3];
  Apple g=noOptimizeTrue() ? (Apple)new Granny() : (Apple)new Fuji();
  Apple a=apple[0]=g;
  assertEquals(g,a);
}
Program: 83284
Project: 83284
Buggy source:
/** 
 * Immediately logs or ignores the specified messages, based on the specified message type and this logger's settings. If the message is loggable, then parent branches may be lazily created before the log can take place.
 */
public final synchronized void log(TreeLogger.Type type,String msg,Throwable caught){
  if (msg == null) {
    msg="String_Node_Str";
  }
  int childIndex=allocateNextChildIndex();
  if (isLoggable(type)) {
    commitMyBranchEntryInMyParentLogger();
    doLog(childIndex,type,msg,caught);
  }
}

Fixed version (ground truth):
/** 
 * Immediately logs or ignores the specified messages, based on the specified message type and this logger's settings. If the message is loggable, then parent branches may be lazily created before the log can take place.
 */
public final synchronized void log(TreeLogger.Type type,String msg,Throwable caught){
  if (msg == null) {
    msg="String_Node_Str";
  }
  if (causedByOutOfMemory(caught)) {
    branch(TreeLogger.ERROR,msg,caught);
    return;
  }
  int childIndex=allocateNextChildIndex();
  if (isLoggable(type)) {
    commitMyBranchEntryInMyParentLogger();
    doLog(childIndex,type,msg,caught);
  }
}
Program: 83285
Project: 83285
Buggy source:
/** 
 * Implements branching behavior that supports lazy logging for low-priority branched loggers.
 */
public final synchronized TreeLogger branch(TreeLogger.Type type,String msg,Throwable caught){
  if (msg == null) {
    msg="String_Node_Str";
  }
  int childIndex=allocateNextChildIndex();
  AbstractTreeLogger childLogger=doBranch();
  childLogger.logLevel=logLevel;
  childLogger.indexWithinMyParent=childIndex;
  childLogger.parent=this;
  childLogger.uncommitted=new UncommittedBranchData(type,msg,caught);
  if (isLoggable(type)) {
    childLogger.commitMyBranchEntryInMyParentLogger();
  }
  return childLogger;
}

Fixed version (ground truth):
/** 
 * Implements branching behavior that supports lazy logging for low-priority branched loggers.
 */
public final synchronized TreeLogger branch(TreeLogger.Type type,String msg,Throwable caught){
  if (msg == null) {
    msg="String_Node_Str";
  }
  int childIndex=allocateNextChildIndex();
  AbstractTreeLogger childLogger=doBranch();
  childLogger.logLevel=logLevel;
  childLogger.indexWithinMyParent=childIndex;
  childLogger.parent=this;
  childLogger.uncommitted=new UncommittedBranchData(type,msg,caught);
  if (causedByOutOfMemory(caught)) {
    type=TreeLogger.ERROR;
    childLogger.log(type,OUT_OF_MEMORY_MSG,null);
  }
  if (isLoggable(type)) {
    childLogger.commitMyBranchEntryInMyParentLogger();
  }
  return childLogger;
}
Program: 83286
Project: 83286
Buggy source:
public static Byte decode(String s) throws NumberFormatException {
  long x=__parseLongInfer(s);
  if (__isLongNaN(x)) {
    throw new NumberFormatException(s);
  }
 else {
    return new Byte((byte)x);
  }
}

Fixed version (ground truth):
public static Byte decode(String s) throws NumberFormatException {
  return new Byte((byte)__decodeAndValidateLong(s,MIN_VALUE,MAX_VALUE));
}
Program: 83287
Project: 83287
Buggy source:
public static byte parseByte(String s,int radix) throws NumberFormatException {
  long x=__parseLongRadix(s,radix);
  if (__isLongNaN(x)) {
    throw new NumberFormatException(s);
  }
 else {
    return (byte)x;
  }
}

Fixed version (ground truth):
public static byte parseByte(String s,int radix) throws NumberFormatException {
  return (byte)__parseAndValidateLong(s,radix,MIN_VALUE,MAX_VALUE);
}
Program: 83288
Project: 83288
Buggy source:
public static double parseDouble(String s) throws NumberFormatException {
  double x=__parseDouble(s);
  if (isNaN(x)) {
    throw new NumberFormatException(s);
  }
 else {
    return x;
  }
}

Fixed version (ground truth):
public static double parseDouble(String s) throws NumberFormatException {
  return __parseAndValidateDouble(s);
}
Program: 83289
Project: 83289
Buggy source:
public static float parseFloat(String s) throws NumberFormatException {
  float x=__parseFloat(s);
  if (isNaN(x)) {
    throw new NumberFormatException(s);
  }
 else {
    return x;
  }
}

Fixed version (ground truth):
public static float parseFloat(String s) throws NumberFormatException {
  return (float)__parseAndValidateDouble(s);
}
Program: 83290
Project: 83290
Buggy source:
public static Integer decode(String s) throws NumberFormatException {
  long x=__parseLongInfer(s);
  if (__isLongNaN(x)) {
    throw new NumberFormatException(s);
  }
 else {
    return new Integer((int)x);
  }
}

Fixed version (ground truth):
public static Integer decode(String s) throws NumberFormatException {
  return new Integer((int)__decodeAndValidateLong(s,MIN_VALUE,MAX_VALUE));
}
Program: 83291
Project: 83291
Buggy source:
public static int parseInt(String s,int radix) throws NumberFormatException {
  long x=__parseLongRadix(s,radix);
  if (__isLongNaN(x)) {
    throw new NumberFormatException(s);
  }
 else {
    return (int)x;
  }
}

Fixed version (ground truth):
public static int parseInt(String s,int radix) throws NumberFormatException {
  return (int)__parseAndValidateLong(s,radix,MIN_VALUE,MAX_VALUE);
}
Program: 83292
Project: 83292
Buggy source:
public static Long decode(String s) throws NumberFormatException {
  long x=__parseLongInfer(s);
  if (__isLongNaN(x)) {
    throw new NumberFormatException(s);
  }
 else {
    return new Long(x);
  }
}

Fixed version (ground truth):
public static Long decode(String s) throws NumberFormatException {
  return new Long(__decodeAndValidateLong(s,MIN_VALUE,MAX_VALUE));
}
Program: 83293
Project: 83293
Buggy source:
public static long parseLong(String s,int radix) throws NumberFormatException {
  long x=__parseLongRadix(s,radix);
  if (__isLongNaN(x)) {
    throw new NumberFormatException(s);
  }
 else {
    return x;
  }
}

Fixed version (ground truth):
public static long parseLong(String s,int radix) throws NumberFormatException {
  return __parseAndValidateLong(s,radix,MIN_VALUE,MAX_VALUE);
}
Program: 83294
Project: 83294
Buggy source:
/** 
 * @skip
 */
protected static native double __parseDouble(String str);

Fixed version (ground truth):
/** 
 * @skip
 * @return The floating-point representation of <code>str</code> or<code>Number.NaN</code> if the string does not match {@link floatRegex}.
 */
private static native double __parseDouble(String str);
Program: 83295
Project: 83295
Buggy source:
/** 
 * @skip
 */
protected static native boolean __isLongNaN(long x);

Fixed version (ground truth):
/** 
 * @skip
 */
private static native boolean __isLongNaN(long x);
Program: 83296
Project: 83296
Buggy source:
public CompilingClassLoader(TreeLogger logger,ByteCodeCompiler compiler) throws UnableToCompleteException {
  super(null);
  this.logger=logger;
  this.compiler=compiler;
  for (int i=0; i < CacheManager.BOOTSTRAP_CLASSES.length; i++) {
    Class clazz=CacheManager.BOOTSTRAP_CLASSES[i];
    String className=clazz.getName();
    try {
      String path=clazz.getName().replace('.','/').concat("String_Node_Str");
      ClassLoader cl=Thread.currentThread().getContextClassLoader();
      URL url=cl.getResource(path);
      if (url != null) {
        byte classBytes[]=getClassBytesFromStream(url.openStream());
        String loc=url.toExternalForm();
        compiler.putClassBytes(logger,className,classBytes,loc);
      }
 else {
        logger.log(TreeLogger.ERROR,"String_Node_Str" + className + "String_Node_Str",null);
        throw new UnableToCompleteException();
      }
    }
 catch (    IOException e) {
      logger.log(TreeLogger.ERROR,"String_Node_Str" + className,e);
      throw new UnableToCompleteException();
    }
  }
  compiler.removeStaleByteCode(logger);
}

Fixed version (ground truth):
public CompilingClassLoader(TreeLogger logger,ByteCodeCompiler compiler,TypeOracle typeOracle) throws UnableToCompleteException {
  super(null);
  this.logger=logger;
  this.compiler=compiler;
  this.typeOracle=typeOracle;
  for (int i=0; i < CacheManager.BOOTSTRAP_CLASSES.length; i++) {
    Class clazz=CacheManager.BOOTSTRAP_CLASSES[i];
    String className=clazz.getName();
    try {
      String path=clazz.getName().replace('.','/').concat("String_Node_Str");
      ClassLoader cl=Thread.currentThread().getContextClassLoader();
      URL url=cl.getResource(path);
      if (url != null) {
        byte classBytes[]=getClassBytesFromStream(url.openStream());
        String loc=url.toExternalForm();
        compiler.putClassBytes(logger,className,classBytes,loc);
      }
 else {
        logger.log(TreeLogger.ERROR,"String_Node_Str" + className + "String_Node_Str",null);
        throw new UnableToCompleteException();
      }
    }
 catch (    IOException e) {
      logger.log(TreeLogger.ERROR,"String_Node_Str" + className,e);
      throw new UnableToCompleteException();
    }
  }
  compiler.removeStaleByteCode(logger);
}
Program: 83297
Project: 83297
Buggy source:
/** 
 * Returns the   {@link java.lang.Class} object for a class that matches thesource or binary name given.
 * @param className binary or source name
 * @return {@link java.lang.Class} instance, if found, or null
 */
private Class getClassFromBinaryOrSourceName(String className){
  int fromIndex=className.length();
  while (fromIndex > 0) {
    String enclosingClassName=className.substring(0,fromIndex);
    Class cls=getClassFromBinaryName(enclosingClassName);
    if (cls != null) {
      if (fromIndex < className.length()) {
        String binaryClassName=enclosingClassName + className.substring(fromIndex).replace('.','$');
        return getClassFromBinaryName(binaryClassName);
      }
 else {
        return cls;
      }
    }
 else {
      fromIndex=enclosingClassName.lastIndexOf('.',fromIndex);
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the   {@link java.lang.Class} object for a class that matches thesource or binary name given.
 * @param className binary or source name
 * @return {@link java.lang.Class} instance, if found, or null
 */
private Class getClassFromBinaryOrSourceName(String className){
  JClassType type=typeOracle.findType(className.replace('$','.'));
  if (type != null) {
    String jniSig=type.getJNISignature();
    jniSig=jniSig.substring(1,jniSig.length() - 1);
    className=jniSig.replace('/','.');
  }
  return getClassFromBinaryName(className);
}
Program: 83298
Project: 83298
Buggy source:
public void onModuleReady(ModuleSpace readySpace) throws UnableToCompleteException {
  this.space=readySpace;
  SourceOracle srcOracle=new HostedModeSourceOracle(typeOracle,module.getName());
  ByteCodeCompiler compiler=getOrCreateByteCodeCompiler(srcOracle);
  ModuleSpacePropertyOracle propOracle=new ModuleSpacePropertyOracle(module.getProperties(),readySpace);
  Rules rules=module.getRules();
  rebindOracle=new StandardRebindOracle(typeOracle,propOracle,rules,genDir,outDir,module.getCacheManager());
  classLoader=new CompilingClassLoader(logger,compiler);
}

Fixed version (ground truth):
public void onModuleReady(ModuleSpace readySpace) throws UnableToCompleteException {
  this.space=readySpace;
  SourceOracle srcOracle=new HostedModeSourceOracle(typeOracle,module.getName());
  ByteCodeCompiler compiler=getOrCreateByteCodeCompiler(srcOracle);
  ModuleSpacePropertyOracle propOracle=new ModuleSpacePropertyOracle(module.getProperties(),readySpace);
  Rules rules=module.getRules();
  rebindOracle=new StandardRebindOracle(typeOracle,propOracle,rules,genDir,outDir,module.getCacheManager());
  classLoader=new CompilingClassLoader(logger,compiler,typeOracle);
}
Program: 83299
Project: 83299
Buggy source:
/** 
 * Gets a boolean attribute on the given element.
 * @param elem the element whose attribute is to be set
 * @param attr the name of the attribute to be set
 * @return the attribute's value as a boolean
 * @deprecated Use the more appropriately named {@link #getElementPropertyBoolean(Element,String)} instead.
 */
public static boolean getBooleanAttribute(Element elem,String attr){
  return getElementPropertyBoolean(elem,attr);
}

Fixed version (ground truth):
/** 
 * Gets a boolean attribute on the given element.
 * @param elem the element whose attribute is to be set
 * @param attr the name of the attribute to be set
 * @return the attribute's value as a boolean
 * @deprecated Use the more appropriately named{@link #getElementPropertyBoolean(Element,String)} instead.
 */
public static boolean getBooleanAttribute(Element elem,String attr){
  return getElementPropertyBoolean(elem,attr);
}
Program: 83300
Project: 83300
Buggy source:
/** 
 * Sets a boolean attribute on the given element.
 * @param elem the element whose attribute is to be set
 * @param attr the name of the attribute to be set
 * @param value the attribute's new boolean value
 * @deprecated Use the more appropriately named {@link #setElementPropertyBoolean(Element,String,boolean)} instead.
 */
public static void setBooleanAttribute(Element elem,String attr,boolean value){
  setElementPropertyBoolean(elem,attr,value);
}

Fixed version (ground truth):
/** 
 * Sets a boolean attribute on the given element.
 * @param elem the element whose attribute is to be set
 * @param attr the name of the attribute to be set
 * @param value the attribute's new boolean value
 * @deprecated Use the more appropriately named{@link #setElementPropertyBoolean(Element,String,boolean)} instead.
 */
public static void setBooleanAttribute(Element elem,String attr,boolean value){
  setElementPropertyBoolean(elem,attr,value);
}
Program: 83301
Project: 83301
Buggy source:
/** 
 * Sets an integer attribute on the given element.
 * @param elem the element whose attribute is to be set
 * @param attr the name of the attribute to be set
 * @param value the attribute's new integer value
 * @deprecated Use the more appropriately named {@link #setElementPropertyInt(Element,String,int)} instead.
 */
public static void setIntAttribute(Element elem,String attr,int value){
  setElementPropertyInt(elem,attr,value);
}

Fixed version (ground truth):
/** 
 * Sets an integer attribute on the given element.
 * @param elem the element whose attribute is to be set
 * @param attr the name of the attribute to be set
 * @param value the attribute's new integer value
 * @deprecated Use the more appropriately named{@link #setElementPropertyInt(Element,String,int)} instead.
 */
public static void setIntAttribute(Element elem,String attr,int value){
  setElementPropertyInt(elem,attr,value);
}
Program: 83302
Project: 83302
Buggy source:
/** 
 * Removes the named attribute from the given element.
 * @param elem the element whose attribute is to be removed
 * @param attr the name of the element to remove
 * @return true if the element was removed, false if the element did not exist
 */
public static void removeElementAttribute(Element elem,String attr){
  impl.removeElementAttribute(elem,attr);
}

Fixed version (ground truth):
/** 
 * Removes the named attribute from the given element.
 * @param elem the element whose attribute is to be removed
 * @param attr the name of the element to remove
 */
public static void removeElementAttribute(Element elem,String attr){
  impl.removeElementAttribute(elem,attr);
}
Program: 83303
Project: 83303
Buggy source:
/** 
 * Gets an integer attribute on a given element.
 * @param elem the element whose attribute is to be retrieved
 * @param attr the name of the attribute to be retrieved
 * @return the attribute's value as an integer
 * @deprecated Use the more appropriately named {@link #getElementPropertyInt(Element,String)} instead.
 */
public static int getIntAttribute(Element elem,String attr){
  return getElementPropertyInt(elem,attr);
}

Fixed version (ground truth):
/** 
 * Gets an integer attribute on a given element.
 * @param elem the element whose attribute is to be retrieved
 * @param attr the name of the attribute to be retrieved
 * @return the attribute's value as an integer
 * @deprecated Use the more appropriately named{@link #getElementPropertyInt(Element,String)} instead.
 */
public static int getIntAttribute(Element elem,String attr){
  return getElementPropertyInt(elem,attr);
}
Program: 83304
Project: 83304
Buggy source:
/** 
 * Sets an attribute on the given element.
 * @param elem the element whose attribute is to be set
 * @param attr the name of the attribute to be set
 * @param value the new attribute value
 * @deprecated Use the more appropriately named {@link #setElementProperty(Element,String,String)} instead.
 */
public static void setAttribute(Element elem,String attr,String value){
  setElementProperty(elem,attr,value);
}

Fixed version (ground truth):
/** 
 * Sets an attribute on the given element.
 * @param elem the element whose attribute is to be set
 * @param attr the name of the attribute to be set
 * @param value the new attribute value
 * @deprecated Use the more appropriately named{@link #setElementProperty(Element,String,String)} instead.
 */
public static void setAttribute(Element elem,String attr,String value){
  setElementProperty(elem,attr,value);
}