nus-yam/ex-repair huggingface dataset:
Program: 54115
Project: 54115
Buggy source:
/** 
 * Failed in all modes due to HtmlUnit bug:
 */
@DoNotRunWith({Platform.HtmlUnitBug}) public void testValueChangeEvent(){
  TextBoxBase tb=createTextBoxBase();
  RootPanel.get().add(tb);
  Handler h=new Handler();
  tb.addValueChangeHandler(h);
  tb.setValue(null);
  assertEquals("String_Node_Str",tb.getValue());
  assertNull(h.received);
  tb.setText("String_Node_Str");
  assertEquals("String_Node_Str",tb.getValue());
  assertNull(h.received);
  tb.setValue("String_Node_Str");
  assertEquals("String_Node_Str",tb.getValue());
  assertNull(h.received);
  tb.setValue("String_Node_Str");
  assertNull(h.received);
  tb.setValue("String_Node_Str",true);
  assertEquals("String_Node_Str",tb.getValue());
  assertNull(h.received);
  tb.setValue("String_Node_Str",true);
  assertEquals("String_Node_Str",h.received);
  tb.setValue("String_Node_Str",true);
  assertEquals("String_Node_Str",h.received);
}

Fixed version (ground truth):
/** 
 * Failed in all modes due to HtmlUnit bug.
 */
@DoNotRunWith({Platform.HtmlUnitBug}) public void testValueChangeEvent(){
  TextBoxBase tb=createTextBoxBase();
  RootPanel.get().add(tb);
  Handler h=new Handler();
  tb.addValueChangeHandler(h);
  tb.setValue(null);
  assertEquals("String_Node_Str",tb.getValue());
  assertNull(h.received);
  tb.setText("String_Node_Str");
  assertEquals("String_Node_Str",tb.getValue());
  assertNull(h.received);
  tb.setValue("String_Node_Str");
  assertEquals("String_Node_Str",tb.getValue());
  assertNull(h.received);
  tb.setValue("String_Node_Str");
  assertNull(h.received);
  tb.setValue("String_Node_Str",true);
  assertEquals("String_Node_Str",tb.getValue());
  assertNull(h.received);
  tb.setValue("String_Node_Str",true);
  assertEquals("String_Node_Str",h.received);
  tb.setValue("String_Node_Str",true);
  assertEquals("String_Node_Str",h.received);
}
Program: 54116
Project: 54116
Buggy source:
/** 
 * 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();
  int beforeIndex=getWidgetCount();
  setWidgetPositionImpl(w,left,top);
  insert(w,beforeIndex);
}

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();
  int beforeIndex=getWidgetCount();
  setWidgetPositionImpl(w,left,top);
  insert(w,beforeIndex);
  verifyPositionNotStatic(w);
}
Program: 54117
Project: 54117
Buggy source:
/** 
 * Inserts a child widget at the specified position before the specified index. Setting a position of <code>(-1, -1)</code> will cause the child widget to be positioned statically. If the widget is already a child of this panel, it will be moved to the specified index.
 * @param w the child widget to be inserted
 * @param left the widget's left position
 * @param top the widget's top position
 * @param beforeIndex the index before which it will be inserted
 * @throws IndexOutOfBoundsException if <code>beforeIndex</code> is out ofrange
 */
public void insert(Widget w,int left,int top,int beforeIndex){
  w.removeFromParent();
  setWidgetPositionImpl(w,left,top);
  insert(w,beforeIndex);
}

Fixed version (ground truth):
/** 
 * Inserts a child widget at the specified position before the specified index. Setting a position of <code>(-1, -1)</code> will cause the child widget to be positioned statically. If the widget is already a child of this panel, it will be moved to the specified index.
 * @param w the child widget to be inserted
 * @param left the widget's left position
 * @param top the widget's top position
 * @param beforeIndex the index before which it will be inserted
 * @throws IndexOutOfBoundsException if <code>beforeIndex</code> is out ofrange
 */
public void insert(Widget w,int left,int top,int beforeIndex){
  w.removeFromParent();
  setWidgetPositionImpl(w,left,top);
  insert(w,beforeIndex);
  verifyPositionNotStatic(w);
}
Program: 54118
Project: 54118
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);
  setWidgetPositionImpl(w,left,top);
}

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);
  verifyPositionNotStatic(w);
}
Program: 54119
Project: 54119
Buggy source:
public void configureClientSideLogging(){
  Logger root=Logger.getLogger("String_Node_Str");
  setLevels(root);
  setDefaultHandlers(root);
}

Fixed version (ground truth):
public void configureClientSideLogging(){
  root=Logger.getLogger("String_Node_Str");
  setLevels(root);
  setDefaultHandlers(root);
}
Program: 54120
Project: 54120
Buggy source:
public void removeView(ListView<T> view){
  if (!views.contains(view)) {
    throw new IllegalStateException("String_Node_Str");
  }
  views.remove(view);
  view.setDelegate(null);
}

Fixed version (ground truth):
public void removeView(ListView<T> view){
  if (!views.contains(view)) {
    throw new IllegalStateException("String_Node_Str");
  }
  views.remove(view);
  view.setDataProvider(null);
}
Program: 54121
Project: 54121
Buggy source:
/** 
 * Inform the views of the total number of items that are available.
 * @param size the new size
 * @param exact true if the size is exact, false if it is a guess
 */
protected void updateDataSize(int size,boolean exact){
  for (  ListView<T> view : views) {
    view.setDataSize(size,exact);
  }
}

Fixed version (ground truth):
/** 
 * Inform the views of the total number of items that are available.
 * @param size the new size
 * @param exact true if the size is exact, false if it is a guess
 */
protected void updateDataSize(int size,boolean exact){
  lastDataSize=size;
  lastDataSizeExact=exact;
  for (  ListView<T> view : views) {
    view.setDataSize(size,exact);
  }
}
Program: 54122
Project: 54122
Buggy source:
/** 
 * Adds a view to this adapter. The current range of interest of the view will be populated with data.
 * @param view a {@link ListView}.
 */
public void addView(ListView<T> view){
  if (views.contains(view)) {
    throw new IllegalStateException("String_Node_Str");
  }
  views.add(view);
  view.setDelegate(delegate);
  delegate.onRangeChanged(view);
}

Fixed version (ground truth):
/** 
 * Adds a view to this adapter. The current range of interest of the view will be populated with data.
 * @param view a {@link ListView}.
 */
public void addView(ListView<T> view){
  if (views.contains(view)) {
    throw new IllegalStateException("String_Node_Str");
  }
  views.add(view);
  view.setDataProvider(dataProvider,false);
  if (lastDataSize >= 0) {
    view.setDataSize(lastDataSize,lastDataSizeExact);
  }
  dataProvider.onRangeChanged(view);
}
Program: 54124
Project: 54124
Buggy source:
/** 
 * Formats Fractional seconds field according to pattern specified.
 * @param buf where formatted string will be appended to
 * @param count number of time pattern char repeats; this controls how a fieldshould be formatted
 * @param date hold the date object to be formatted
 */
private void formatFractionalSeconds(StringBuffer buf,int count,Date date){
  long time=date.getTime();
  int value;
  if (time < 0) {
    value=1000 - (int)(-time % 1000);
  }
 else {
    value=(int)(time % 1000);
  }
  if (count == 1) {
    value=Math.min((value + 50) / 100,9);
    buf.append((char)('0' + value));
  }
 else   if (count == 2) {
    value=Math.min((value + 5) / 10,99);
    zeroPaddingNumber(buf,value,2);
  }
 else {
    zeroPaddingNumber(buf,value,3);
    if (count > 3) {
      zeroPaddingNumber(buf,0,count - 3);
    }
  }
}

Fixed version (ground truth):
/** 
 * Formats Fractional seconds field according to pattern specified.
 * @param buf where formatted string will be appended to
 * @param count number of time pattern char repeats; this controls how a fieldshould be formatted
 * @param date hold the date object to be formatted
 */
private void formatFractionalSeconds(StringBuffer buf,int count,Date date){
  long time=date.getTime();
  int value;
  if (time < 0) {
    value=1000 - (int)(-time % 1000);
    if (value == 1000) {
      value=0;
    }
  }
 else {
    value=(int)(time % 1000);
  }
  if (count == 1) {
    value=Math.min((value + 50) / 100,9);
    buf.append((char)('0' + value));
  }
 else   if (count == 2) {
    value=Math.min((value + 5) / 10,99);
    zeroPaddingNumber(buf,value,2);
  }
 else {
    zeroPaddingNumber(buf,value,3);
    if (count > 3) {
      zeroPaddingNumber(buf,0,count - 3);
    }
  }
}
Program: 54125
Project: 54125
Buggy source:
public void testPre1970Milliseconds(){
  Date date=new Date(-631151998945L);
  long midnight=Date.UTC(1950 - 1900,0,1,0,0,1);
  assertEquals(-631151998945L,midnight + 55);
  TimeZone utc=TimeZone.createTimeZone(0);
  assertEquals("String_Node_Str",DateTimeFormat.getFormat("String_Node_Str").format(date,utc));
  assertEquals("String_Node_Str",DateTimeFormat.getFormat("String_Node_Str").format(date,utc));
  assertEquals("String_Node_Str",DateTimeFormat.getFormat("String_Node_Str").format(date,utc));
}

Fixed version (ground truth):
public void testPre1970Milliseconds(){
  Date date=new Date(-631151998945L);
  long midnight=Date.UTC(1950 - 1900,0,1,0,0,1);
  assertEquals(-631151998945L,midnight + 55);
  TimeZone utc=TimeZone.createTimeZone(0);
  assertEquals("String_Node_Str",DateTimeFormat.getFormat("String_Node_Str").format(date,utc));
  assertEquals("String_Node_Str",DateTimeFormat.getFormat("String_Node_Str").format(date,utc));
  assertEquals("String_Node_Str",DateTimeFormat.getFormat("String_Node_Str").format(date,utc));
  date=new Date(midnight);
  assertEquals("String_Node_Str",DateTimeFormat.getFormat("String_Node_Str").format(date,utc));
}
Program: 54126
Project: 54126
Buggy source:
/** 
 * Create an ActivityManager. Next call   {@link #setDisplay} and{@link #activate}.
 * @param mapper finds the {@link Activity} for a given {@link Place}
 * @param eventBus source of {@link PlaceChangeEvent} and{@link PlaceChangeRequestedEvent} events.
 */
public ActivityManager(ActivityMapper<P> mapper,HandlerManager eventBus){
  this.mapper=mapper;
  this.eventBus=eventBus;
}

Fixed version (ground truth):
/** 
 * Create an ActivityManager. Next call   {@link #setDisplay}.
 * @param mapper finds the {@link Activity} for a given {@link Place}
 * @param eventBus source of {@link PlaceChangeEvent} and{@link PlaceChangeRequestedEvent} events.
 */
public ActivityManager(ActivityMapper<P> mapper,HandlerManager eventBus){
  this.mapper=mapper;
  this.eventBus=eventBus;
}
Program: 54127
Project: 54127
Buggy source:
public int compare(JMethod m1,JMethod m2){
  String name1=m1.getName();
  String name2=m2.getName();
  return name1.compareTo(name2);
}

Fixed version (ground truth):
public int compare(JClassType o1,JClassType o2){
  return o1.getQualifiedSourceName().compareTo(o2.getQualifiedSourceName());
}
Program: 54128
Project: 54128
Buggy source:
/** 
 * Gets all types, both top-level and nested.
 * @return an array of types, possibly of zero length
 */
public JClassType[] getTypes(){
  Collection<JRealClassType> values=allTypes.values();
  return values.toArray(new JClassType[values.size()]);
}

Fixed version (ground truth):
/** 
 * Gets all types, both top-level and nested.
 * @return an array of types, possibly of zero length
 */
public JClassType[] getTypes(){
  Collection<JRealClassType> values=allTypes.values();
  JClassType[] result=values.toArray(new JClassType[values.size()]);
  Arrays.sort(result,new Comparator<JClassType>(){
    public int compare(    JClassType o1,    JClassType o2){
      return o1.getQualifiedSourceName().compareTo(o2.getQualifiedSourceName());
    }
  }
);
  return result;
}
Program: 54130
Project: 54130
Buggy source:
/** 
 * Timestamps have some non-obvious comparison semantics when compared to dates.
 */
public void testDateComparison(){
  long now=System.currentTimeMillis();
  Date d=new Date(now);
  Timestamp t=new Timestamp(d.getTime());
  if (now % 1000 == 0) {
    t.setNanos(1000001);
  }
 else {
    t.setNanos(1);
  }
  Date d2=new Date(t.getTime());
  assertFalse("String_Node_Str",d.equals(t));
  assertEquals("String_Node_Str",d2,t);
  assertEquals("String_Node_Str",d2.hashCode(),t.hashCode());
  assertFalse("String_Node_Str",t.equals(d2));
  if (GWT.isScript()) {
    try {
      t.compareTo(d2);
      fail("String_Node_Str");
    }
 catch (    ClassCastException e) {
    }
  }
  Timestamp t2=new Timestamp(d.getTime());
  t2.setNanos(t.getNanos() + 1);
  assertFalse("String_Node_Str",t.equals(t2));
  assertEquals("String_Node_Str",t.hashCode(),t2.hashCode());
}

Fixed version (ground truth):
/** 
 * Timestamps have some non-obvious comparison semantics when compared to dates.
 */
public void testDateComparison(){
  long now=System.currentTimeMillis();
  Date d=new Date(now);
  Timestamp t=new Timestamp(d.getTime());
  if (now % 1000 == 0) {
    t.setNanos(1000001);
  }
 else {
    t.setNanos(1);
  }
  Date d2=new Date(t.getTime());
  assertFalse("String_Node_Str",d.equals(t));
  assertEquals("String_Node_Str",d2,t);
  assertEquals("String_Node_Str",d2.hashCode(),t.hashCode());
  assertFalse("String_Node_Str",t.equals(d2));
  assertEquals(1,t.compareTo(d2));
  Timestamp t2=new Timestamp(d.getTime());
  t2.setNanos(t.getNanos() + 1);
  assertFalse("String_Node_Str",t.equals(t2));
  assertEquals("String_Node_Str",t.hashCode(),t2.hashCode());
}
Program: 54131
Project: 54131
Buggy source:
public void traverse(JVisitor visitor,Context ctx){
  if (visitor.visit(this,ctx)) {
    lhs=visitor.accept(lhs);
    rhs=visitor.accept(rhs);
  }
  visitor.endVisit(this,ctx);
}

Fixed version (ground truth):
public void traverse(JVisitor visitor,Context ctx){
  if (visitor.visit(this,ctx)) {
    if (isAssignment()) {
      lhs=visitor.acceptLvalue(lhs);
    }
 else {
      lhs=visitor.accept(lhs);
    }
    rhs=visitor.accept(rhs);
  }
  visitor.endVisit(this,ctx);
}
Program: 54132
Project: 54132
Buggy source:
public void traverse(JVisitor visitor,Context ctx){
  if (visitor.visit(this,ctx)) {
    variableRef=(JVariableRef)visitor.accept(variableRef);
    if (initializer != null) {
      initializer=visitor.accept(initializer);
    }
  }
  visitor.endVisit(this,ctx);
}

Fixed version (ground truth):
public void traverse(JVisitor visitor,Context ctx){
  if (visitor.visit(this,ctx)) {
    variableRef=(JVariableRef)visitor.acceptLvalue(variableRef);
    if (initializer != null) {
      initializer=visitor.accept(initializer);
    }
  }
  visitor.endVisit(this,ctx);
}
Program: 54133
Project: 54133
Buggy source:
public void traverse(JVisitor visitor,Context ctx){
  arg=visitor.accept(arg);
}

Fixed version (ground truth):
public void traverse(JVisitor visitor,Context ctx){
  if (getOp().isModifying()) {
    arg=visitor.acceptLvalue(arg);
  }
 else {
    arg=visitor.accept(arg);
  }
}
Program: 54134
Project: 54134
Buggy source:
@Override public final boolean visit(JStatement x,Context ctx){
  if (ctx.canInsert()) {
    insertionStack.push(ctx);
  }
  return super.visit(x,ctx);
}

Fixed version (ground truth):
@Override public final boolean visit(JStatement x,Context ctx){
  if (ctx.canInsert() && !banList.contains(x)) {
    insertionStack.push(ctx);
  }
  if (x instanceof JForStatement) {
    JForStatement forStmt=(JForStatement)x;
    banList.addAll(forStmt.getIncrements());
  }
  return super.visit(x,ctx);
}
Program: 54135
Project: 54135
Buggy source:
@Override public void endVisit(JExpression x,Context ctx){
  SourceInfo info=x.getSourceInfo();
  JType type=x.getType();
  JLocal local=createTempLocal(info,type);
  local.getDeclarationStatement().initializer=x;
  ctx.replaceMe(new JLocalRef(info,local));
}

Fixed version (ground truth):
@Override public void endVisit(JExpression x,Context ctx){
  if (x != dontBother && !ctx.isLvalue()) {
    SourceInfo info=x.getSourceInfo();
    JType type=x.getType();
    JLocal local=createTempLocal(info,type);
    local.getDeclarationStatement().initializer=x;
    ctx.replaceMe(new JLocalRef(info,local));
  }
}
Program: 54136
Project: 54136
Buggy source:
@Override public boolean visit(JPrefixOperation x,Context ctx){
  if (x.getOp().isModifying()) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean visit(JExpressionStatement x,Context ctx){
  dontBother=x.getExpr();
  return super.visit(x,ctx);
}
Program: 54137
Project: 54137
Buggy source:
public void testForStatement() throws Exception {
  StringBuilder original=new StringBuilder();
  original.append("String_Node_Str");
  StringBuilder expected=new StringBuilder();
  expected.append("String_Node_Str");
  expected.append("String_Node_Str");
  assertTransform(original.toString()).into(expected.toString());
}

Fixed version (ground truth):
public void testForStatement() throws Exception {
  StringBuilder original=new StringBuilder();
  original.append("String_Node_Str");
  StringBuilder expected=new StringBuilder();
  expected.append("String_Node_Str");
  expected.append("String_Node_Str");
  expected.append("String_Node_Str");
  assertTransform(original.toString()).into(expected.toString());
}
Program: 54138
Project: 54138
Buggy source:
/** 
 * Method parses GMT type timezone.
 * @param text the time text to be parsed
 * @param start from where parse start
 * @param pos Parse position
 * @param cal DateRecord object that holds parsed value
 * @return <code>true</code> if parsing successful, otherwise<code>false</code>
 */
private boolean subParseTimeZoneInGMT(String text,int start,int[] pos,DateRecord cal){
  if (text.startsWith(GMT,start)) {
    pos[0]=start + GMT.length();
    return parseTimeZoneOffset(text,pos,cal);
  }
  return parseTimeZoneOffset(text,pos,cal);
}

Fixed version (ground truth):
/** 
 * Method parses GMT type timezone.
 * @param text the time text to be parsed
 * @param start from where parse start
 * @param pos Parse position
 * @param cal DateRecord object that holds parsed value
 * @return <code>true</code> if parsing successful, otherwise<code>false</code>
 */
private boolean subParseTimeZoneInGMT(String text,int start,int[] pos,DateRecord cal){
  if (text.startsWith(GMT,start)) {
    pos[0]=start + GMT.length();
    return parseTimeZoneOffset(text,pos,cal);
  }
  if (text.startsWith(UTC,start)) {
    pos[0]=start + UTC.length();
    return parseTimeZoneOffset(text,pos,cal);
  }
  return parseTimeZoneOffset(text,pos,cal);
}
Program: 54139
Project: 54139
Buggy source:
public void test_timezonez(){
  TimeZoneConstants timeZoneData=GWT.create(TimeZoneConstants.class);
  String str=timeZoneData.americaLosAngeles();
  TimeZone usPacific=TimeZone.createTimeZone(str);
  Date date=new Date();
  date.setTime(Date.UTC(2006 - 1900,6,27,13,10,10));
  assertEquals("String_Node_Str",DateTimeFormat.getFormat("String_Node_Str").format(date,usPacific));
  assertEquals("String_Node_Str",DateTimeFormat.getFormat("String_Node_Str").format(date,usPacific));
  assertEquals("String_Node_Str",DateTimeFormat.getFormat("String_Node_Str").format(date,usPacific));
  assertEquals("String_Node_Str",DateTimeFormat.getFormat("String_Node_Str").format(date,usPacific));
  date.setTime(Date.UTC(2006 - 1900,1,27,13,10,10));
  assertEquals("String_Node_Str",DateTimeFormat.getFormat("String_Node_Str").format(date,usPacific));
  assertEquals("String_Node_Str",DateTimeFormat.getFormat("String_Node_Str").format(date,usPacific));
  assertEquals("String_Node_Str",DateTimeFormat.getFormat("String_Node_Str").format(date,usPacific));
  assertEquals("String_Node_Str",DateTimeFormat.getFormat("String_Node_Str").format(date,usPacific));
}

Fixed version (ground truth):
public void test_timezonez(){
  TimeZoneConstants timeZoneData=GWT.create(TimeZoneConstants.class);
  String str=timeZoneData.americaLosAngeles();
  TimeZone usPacific=TimeZone.createTimeZone(str);
  Date date=new Date();
  date.setTime(Date.UTC(2006 - 1900,6,27,13,10,10));
  assertEquals("String_Node_Str",DateTimeFormat.getFormat("String_Node_Str").format(date,usPacific));
  assertEquals("String_Node_Str",DateTimeFormat.getFormat("String_Node_Str").format(date,usPacific));
  assertEquals("String_Node_Str",DateTimeFormat.getFormat("String_Node_Str").format(date,usPacific));
  assertEquals("String_Node_Str",DateTimeFormat.getFormat("String_Node_Str").format(date,usPacific));
  date.setTime(Date.UTC(2006 - 1900,1,27,13,10,10));
  assertEquals("String_Node_Str",DateTimeFormat.getFormat("String_Node_Str").format(date,usPacific));
  assertEquals("String_Node_Str",DateTimeFormat.getFormat("String_Node_Str").format(date,usPacific));
  assertEquals("String_Node_Str",DateTimeFormat.getFormat("String_Node_Str").format(date,usPacific));
  assertEquals("String_Node_Str",DateTimeFormat.getFormat("String_Node_Str").format(date,usPacific));
  DateTimeFormat format=DateTimeFormat.getFormat("String_Node_Str");
  assertEquals(date,format.parse(format.format(date)));
}
Program: 54140
Project: 54140
Buggy source:
/** 
 * Return the parsed value, or null if the field is empty.
 * @throws ParseFailedException if the value cannot be parsed
 */
public T getValueOrThrow() throws ParseException {
  String text=getText().trim();
  if ("String_Node_Str".equals(text)) {
    return null;
  }
  return parser.parse(text);
}

Fixed version (ground truth):
/** 
 * Return the parsed value, or null if the field is empty.
 * @throws ParseException if the value cannot be parsed
 */
public T getValueOrThrow() throws ParseException {
  String text=getText().trim();
  if ("String_Node_Str".equals(text)) {
    return null;
  }
  return parser.parse(text);
}
Program: 54142
Project: 54142
Buggy source:
public void testParse(){
  assertEquals(0f,Float.parseFloat("String_Node_Str"),0.0);
  assertEquals(-1.5f,Float.parseFloat("String_Node_Str"),0.0);
  assertEquals(3.0f,Float.parseFloat("String_Node_Str"),0.0);
  assertEquals(0.5f,Float.parseFloat("String_Node_Str"),0.0);
}

Fixed version (ground truth):
public void testParse(){
  assertEquals(0f,Float.parseFloat("String_Node_Str"),0.0);
  assertEquals(-1.5f,Float.parseFloat("String_Node_Str"),0.0);
  assertEquals(3.0f,Float.parseFloat("String_Node_Str"),0.0);
  assertEquals(0.5f,Float.parseFloat("String_Node_Str"),0.0);
  assertEquals(1.0f,Float.parseFloat("String_Node_Str"),0.0);
  assertEquals(1.0f,Float.parseFloat("String_Node_Str"),0.0);
  assertEquals(1.0f,Float.parseFloat("String_Node_Str"),0.0);
  assertEquals(1.0f,Float.parseFloat("String_Node_Str"),0.0);
}
Program: 54143
Project: 54143
Buggy source:
@Override public void finalizeLayout(Element parent){
  if (!isIE6()) {
    super.finalizeLayout(parent);
    return;
  }
  resizeRelativeToParent(parent);
  resizeHandler(parent,true);
}

Fixed version (ground truth):
@Override public void finalizeLayout(Element parent){
  resizeRelativeToParent(parent);
  resizeHandler(parent,true);
}
Program: 54144
Project: 54144
Buggy source:
@Override public void fillParent(Element elem){
  if (!isIE6()) {
    super.fillParent(elem);
    return;
  }
  fillParentImpl(elem);
}

Fixed version (ground truth):
@Override public void fillParent(Element elem){
  fillParentImpl(elem);
}
Program: 54145
Project: 54145
Buggy source:
@Override public void onDetach(Element parent){
  if (isIE6()) {
    removeLayerRefs(parent);
    removeResizeHandler(parent);
    removeUnitChangeHandler(relativeRuler);
  }
}

Fixed version (ground truth):
@Override public void onDetach(Element parent){
  removeLayerRefs(parent);
  removeResizeHandler(parent);
  removeUnitChangeHandler(relativeRuler);
}
Program: 54146
Project: 54146
Buggy source:
@Override public void layout(Layer layer){
  if (!isIE6()) {
    super.layout(layer);
    return;
  }
  Element elem=layer.getContainerElement();
  setLayer(elem,layer);
}

Fixed version (ground truth):
@Override public void layout(Layer layer){
  Element elem=layer.getContainerElement();
  setLayer(elem,layer);
}
Program: 54147
Project: 54147
Buggy source:
@Override public void onAttach(Element parent){
  if (isIE6()) {
    initResizeHandler(parent);
    initUnitChangeHandler(parent,relativeRuler);
  }
}

Fixed version (ground truth):
@Override public void onAttach(Element parent){
  initResizeHandler(parent);
  initUnitChangeHandler(parent,relativeRuler);
}
Program: 54148
Project: 54148
Buggy source:
@Override public void initParent(Element parent){
  super.initParent(parent);
  if (isIE6()) {
    setPropertyElement(parent,"String_Node_Str",createStyleRuler(parent));
  }
}

Fixed version (ground truth):
@Override public void initParent(Element parent){
  super.initParent(parent);
  setPropertyElement(parent,"String_Node_Str",createStyleRuler(parent));
}
Program: 54149
Project: 54149
Buggy source:
public void layout(Layer layer){
  Style style=layer.container.getStyle();
  if (layer.setLeft) {
    setValue(layer,"String_Node_Str",layer.left,layer.leftUnit,false,false);
  }
 else {
    style.clearLeft();
  }
  if (layer.setRight) {
    setValue(layer,"String_Node_Str",layer.right,layer.rightUnit,false,false);
  }
 else {
    style.clearRight();
  }
  if (layer.setTop) {
    setValue(layer,"String_Node_Str",layer.top,layer.topUnit,true,false);
  }
 else {
    style.clearTop();
  }
  if (layer.setBottom) {
    setValue(layer,"String_Node_Str",layer.bottom,layer.bottomUnit,true,false);
  }
 else {
    style.clearBottom();
  }
  if (layer.setWidth) {
    setValue(layer,"String_Node_Str",layer.width,layer.widthUnit,false,true);
  }
 else {
    style.clearWidth();
  }
  if (layer.setHeight) {
    setValue(layer,"String_Node_Str",layer.height,layer.heightUnit,true,true);
  }
 else {
    style.clearHeight();
  }
  style=layer.child.getStyle();
switch (layer.hPos) {
case BEGIN:
    style.setLeft(0,Unit.PX);
  style.clearRight();
break;
case END:
style.clearLeft();
style.setRight(0,Unit.PX);
break;
case STRETCH:
style.setLeft(0,Unit.PX);
style.setRight(0,Unit.PX);
break;
}
switch (layer.vPos) {
case BEGIN:
style.setTop(0,Unit.PX);
style.clearBottom();
break;
case END:
style.clearTop();
style.setBottom(0,Unit.PX);
break;
case STRETCH:
style.setTop(0,Unit.PX);
style.setBottom(0,Unit.PX);
break;
}
}

Fixed version (ground truth):
@Override public void layout(Layer layer){
  Style style=layer.container.getStyle();
  if (layer.setLeft) {
    setValue(layer,"String_Node_Str",layer.left,layer.leftUnit,false,false);
  }
 else {
    style.clearLeft();
  }
  if (layer.setRight) {
    setValue(layer,"String_Node_Str",layer.right,layer.rightUnit,false,false);
  }
 else {
    style.clearRight();
  }
  if (layer.setTop) {
    setValue(layer,"String_Node_Str",layer.top,layer.topUnit,true,false);
  }
 else {
    style.clearTop();
  }
  if (layer.setBottom) {
    setValue(layer,"String_Node_Str",layer.bottom,layer.bottomUnit,true,false);
  }
 else {
    style.clearBottom();
  }
  if (layer.setWidth) {
    setValue(layer,"String_Node_Str",layer.width,layer.widthUnit,false,true);
  }
 else {
    style.clearWidth();
  }
  if (layer.setHeight) {
    setValue(layer,"String_Node_Str",layer.height,layer.heightUnit,true,true);
  }
 else {
    style.clearHeight();
  }
  style=layer.child.getStyle();
switch (layer.hPos) {
case BEGIN:
    style.setLeft(0,Unit.PX);
  style.clearRight();
break;
case END:
style.clearLeft();
style.setRight(0,Unit.PX);
break;
case STRETCH:
style.setLeft(0,Unit.PX);
style.setRight(0,Unit.PX);
break;
}
switch (layer.vPos) {
case BEGIN:
style.setTop(0,Unit.PX);
style.clearBottom();
break;
case END:
style.clearTop();
style.setBottom(0,Unit.PX);
break;
case STRETCH:
style.setTop(0,Unit.PX);
style.setBottom(0,Unit.PX);
break;
}
}
Program: 54150
Project: 54150
Buggy source:
/** 
 * Evaluates a JSON expression. This method does not validate the JSON text and should only be used on JSON from trusted sources.
 * @param < T > The type of JavaScriptObject that should be returned
 * @param json The source JSON text
 * @return The evaluated object
 */
public static native <T extends JavaScriptObject>T unsafeEval(String json);

Fixed version (ground truth):
/** 
 * Evaluates a JSON expression using   {@code eval()}. This method does not validate the JSON text and should only be used on JSON from trusted sources. The payload must evaluate to an Object or an Array (not a primitive or a String).
 * @param < T > The type of JavaScriptObject that should be returned
 * @param json The source JSON text
 * @return The evaluated object
 */
public static native <T extends JavaScriptObject>T unsafeEval(String json);
Program: 54151
Project: 54151
Buggy source:
/** 
 * Evaluates a trusted JSON string and returns its JSONValue representation. CAUTION! For efficiency, this method is implemented using the JavaScript <code>eval()</code> function, which can execute arbitrary script. DO NOT pass an untrusted string into this method.
 * @param jsonString a JSON object to parse
 * @return a JSONValue that has been built by parsing the JSON string
 * @throws NullPointerException if <code>jsonString</code> is<code>null</code>
 * @throws IllegalArgumentException if <code>jsonString</code> is empty
 */
public static JSONValue parse(String jsonString){
  if (jsonString == null) {
    throw new NullPointerException();
  }
  if (jsonString.length() == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  try {
    return evaluate(jsonString);
  }
 catch (  JavaScriptException ex) {
    throw new JSONException(ex);
  }
}

Fixed version (ground truth):
private static JSONValue parse(String jsonString,boolean strict){
  if (jsonString == null) {
    throw new NullPointerException();
  }
  if (jsonString.length() == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  try {
    return evaluate(jsonString,strict);
  }
 catch (  JavaScriptException ex) {
    throw new JSONException(ex);
  }
}
Program: 54152
Project: 54152
Buggy source:
/** 
 * This method converts <code>jsonString</code> into a JSONValue.
 */
private static native JSONValue evaluate(String jsonString);

Fixed version (ground truth):
/** 
 * This method converts <code>jsonString</code> into a JSONValue. In strict mode (strict == true), one of two code paths is taken: 1) Call JSON.parse if available, or 2) Validate the input and call eval() In lenient mode (strict == false), eval() is called without validation.
 * @param strict if true, parse in strict mode. 
 */
private static native JSONValue evaluate(String json,boolean strict);
Program: 54153
Project: 54153
Buggy source:
private void checkIndexForAdd(int index){
  checkIndex(index,size - 1);
}

Fixed version (ground truth):
private void checkIndexForAdd(int index){
  checkIndex(index,size + 1);
}
Program: 54154
Project: 54154
Buggy source:
private void checkListSizeAndContent(List<Integer> in,int[] expected){
  assertEquals(expected.length,in.size());
  for (int i=0; i < expected.length; i++) {
    assertEquals(expected[i],(int)in.get(i));
  }
}

Fixed version (ground truth):
private void checkListSizeAndContent(List<Integer> in,int... expected){
  assertEquals(expected.length,in.size());
  for (int i=0; i < expected.length; i++) {
    assertEquals(expected[i],(int)in.get(i));
  }
}
Program: 54156
Project: 54156
Buggy source:
public void testSin(){
  double v=Math.sin(0.0);
  assertEquals(0.0,v,1e-7);
  v=Math.sin(Math.PI * .5);
  assertEquals(1.0,v,1e-7);
  v=Math.sin(Math.PI);
  assertEquals(0.0,v,1e-7);
  v=Math.sin(Math.PI * 1.5);
  assertEquals(-1.0,v,1e-7);
}

Fixed version (ground truth):
public void testSin(){
  double v=Math.sin(0.0);
  assertEquals(0.0,v,1e-7);
  v=Math.sin(-0.0);
  assertEquals(-0.0,v,1e-7);
  v=Math.sin(Math.PI * .5);
  assertEquals(1.0,v,1e-7);
  v=Math.sin(Math.PI);
  assertEquals(0.0,v,1e-7);
  v=Math.sin(Math.PI * 1.5);
  assertEquals(-1.0,v,1e-7);
  v=Math.sin(Double.NaN);
  assertTrue(Double.isNaN(v));
  v=Math.sin(Double.NEGATIVE_INFINITY);
  assertTrue(Double.isNaN(v));
  v=Math.sin(Double.POSITIVE_INFINITY);
  assertTrue(Double.isNaN(v));
}
Program: 54157
Project: 54157
Buggy source:
public void testCos(){
  double v=Math.cos(0.0);
  assertEquals(1.0,v,1e-7);
  v=Math.cos(Math.PI * .5);
  assertEquals(0.0,v,1e-7);
  v=Math.cos(Math.PI);
  assertEquals(-1.0,v,1e-7);
  v=Math.cos(Math.PI * 1.5);
  assertEquals(0.0,v,1e-7);
}

Fixed version (ground truth):
public void testCos(){
  double v=Math.cos(0.0);
  assertEquals(1.0,v,1e-7);
  v=Math.cos(-0.0);
  assertEquals(1.0,v,1e-7);
  v=Math.cos(Math.PI * .5);
  assertEquals(0.0,v,1e-7);
  v=Math.cos(Math.PI);
  assertEquals(-1.0,v,1e-7);
  v=Math.cos(Math.PI * 1.5);
  assertEquals(0.0,v,1e-7);
  v=Math.cos(Double.NaN);
  assertTrue(Double.isNaN(v));
  v=Math.cos(Double.NEGATIVE_INFINITY);
  assertTrue(Double.isNaN(v));
  v=Math.cos(Double.POSITIVE_INFINITY);
  assertTrue(Double.isNaN(v));
}
Program: 54158
Project: 54158
Buggy source:
public static int compare(double x,double y){
  if (x < y) {
    return -1;
  }
 else   if (x > y) {
    return 1;
  }
 else {
    return 0;
  }
}

Fixed version (ground truth):
public static int compare(double x,double y){
  if (isNaN(x)) {
    if (isNaN(y)) {
      return 0;
    }
 else {
      return 1;
    }
  }
 else   if (isNaN(y)) {
    return -1;
  }
  if (x < y) {
    return -1;
  }
 else   if (x > y) {
    return 1;
  }
 else {
    return 0;
  }
}
Program: 54159
Project: 54159
Buggy source:
public int compareTo(Double b){
  if (value < b.value) {
    return -1;
  }
 else   if (value > b.value) {
    return 1;
  }
 else {
    return 0;
  }
}

Fixed version (ground truth):
public int compareTo(Double b){
  return compare(this.value,b.value);
}
Program: 54160
Project: 54160
Buggy source:
private static TypedProgramReference typedProgramReference(JsName name,JavaToJavaScriptMap jjsmap,Map<JsName,String> obfuscateMap){
  JMethod method=jjsmap.nameToMethod(name);
  if (method != null) {
    StringBuilder sb=new StringBuilder();
    sb.append(method.getEnclosingType().getName());
    sb.append("String_Node_Str");
    sb.append(method.getName());
    sb.append("String_Node_Str");
    for (    JType type : method.getOriginalParamTypes()) {
      sb.append(type.getJsniSignatureName());
    }
    sb.append("String_Node_Str");
    sb.append(method.getOriginalReturnType().getJsniSignatureName());
    String desc=sb.toString();
    return new TypedProgramReference("String_Node_Str",desc);
  }
  JClassType type=jjsmap.nameToType(name);
  if (type != null) {
    return new TypedProgramReference("String_Node_Str",type.getName());
  }
  String string=obfuscateMap.get(name);
  if (string != null) {
    return new TypedProgramReference("String_Node_Str",string);
  }
  return new TypedProgramReference("String_Node_Str",name.getShortIdent());
}

Fixed version (ground truth):
private static TypedProgramReference typedProgramReference(JsName name,JavaToJavaScriptMap jjsmap,Map<JsName,String> obfuscateMap){
  JMethod method=jjsmap.nameToMethod(name);
  if (method != null) {
    StringBuilder sb=new StringBuilder();
    sb.append(method.getEnclosingType().getName());
    sb.append("String_Node_Str");
    sb.append(method.getName());
    sb.append("String_Node_Str");
    for (    JType type : method.getOriginalParamTypes()) {
      sb.append(type.getJsniSignatureName());
    }
    sb.append("String_Node_Str");
    sb.append(method.getOriginalReturnType().getJsniSignatureName());
    String desc=sb.toString();
    return new TypedProgramReference("String_Node_Str",desc);
  }
  JField field=jjsmap.nameToField(name);
  if ((field != null) && (field.getEnclosingType() != null)) {
    StringBuilder sb=new StringBuilder();
    sb.append(field.getEnclosingType().getName());
    sb.append("String_Node_Str");
    sb.append(field.getName());
    return new TypedProgramReference("String_Node_Str",sb.toString());
  }
  JClassType type=jjsmap.nameToType(name);
  if (type != null) {
    return new TypedProgramReference("String_Node_Str",type.getName());
  }
  String string=obfuscateMap.get(name);
  if (string != null) {
    return new TypedProgramReference("String_Node_Str",string);
  }
  return new TypedProgramReference("String_Node_Str",name.getShortIdent());
}
Program: 54161
Project: 54161
Buggy source:
private void assertIsChild(Widget widget){
}

Fixed version (ground truth):
void assertIsChild(Widget widget){
}
Program: 54162
Project: 54162
Buggy source:
/** 
 * Sets the minimum allowable size for the given widget. <p> Its assocated splitter cannot be dragged to a position that would make it smaller than this size. This method has no effect for the  {@link DockLayoutPanel.Direction#CENTER} widget.</p>
 * @param child the child whose minimum size will be set
 * @param minSize the minimum size for this widget
 */
public void setWidgetMinSize(Widget child,int minSize){
  Splitter splitter=getAssociatedSplitter(child);
  splitter.setMinSize(minSize);
}

Fixed version (ground truth):
/** 
 * Sets the minimum allowable size for the given widget. <p> Its associated splitter cannot be dragged to a position that would make it smaller than this size. This method has no effect for the  {@link DockLayoutPanel.Direction#CENTER} widget.</p>
 * @param child the child whose minimum size will be set
 * @param minSize the minimum size for this widget
 */
public void setWidgetMinSize(Widget child,int minSize){
  assertIsChild(child);
  Splitter splitter=getAssociatedSplitter(child);
  if (splitter != null) {
    splitter.setMinSize(minSize);
  }
}
Program: 54163
Project: 54163
Buggy source:
private static Set<ExpensesKey<?>> get(){
  if (instance == null) {
    instance=new HashSet<ExpensesKey<?>>();
    instance.add(ReportKey.get());
    instance.add(EmployeeKey.get());
  }
  return instance;
}

Fixed version (ground truth):
private static Set<ExpensesKey<?>> get(){
  if (instance == null) {
    HashSet<ExpensesKey<?>> newInstance=new HashSet<ExpensesKey<?>>();
    newInstance.add(ReportKey.get());
    newInstance.add(EmployeeKey.get());
    instance=newInstance;
  }
  return instance;
}
Program: 54164
Project: 54164
Buggy source:
public Response execute(Request request) throws Exception {
  if (request.getServiceType() != Request.ServiceType.DEV_MODE) {
    throw new IllegalArgumentException("String_Node_Str" + request.getServiceType().name());
  }
switch (request.getDevModeRequest().getRequestType()) {
case CAPABILITY_EXCHANGE:
    return processCapabilityExchange();
case RESTART_WEB_SERVER:
  return processRestartServer();
default :
{
  break;
}
}
throw new IllegalArgumentException("String_Node_Str" + request.getDevModeRequest().getRequestType().name());
}

Fixed version (ground truth):
public Response execute(Request request) throws Exception {
  if (request.getServiceType() != Request.ServiceType.DEV_MODE) {
    throw new IllegalArgumentException("String_Node_Str" + request.getServiceType().name());
  }
  RequestType requestType=request.getDevModeRequest().getRequestType();
  if (requestType != null) {
switch (requestType) {
case CAPABILITY_EXCHANGE:
      return processCapabilityExchange();
case RESTART_WEB_SERVER:
    return processRestartServer();
default :
{
    break;
  }
}
}
throw new IllegalArgumentException("String_Node_Str" + requestType == null ? "String_Node_Str" : requestType.name());
}
Program: 54165
Project: 54165
Buggy source:
private void processMessage(final Message message) throws InterruptedException {
switch (message.getMessageType()) {
case RESPONSE:
{
      processServerResponse(message.getMessageId(),message.getResponse());
      break;
    }
case REQUEST:
{
    processClientRequest(message.getMessageId(),message.getRequest());
    break;
  }
case FAILURE:
{
  processFailure(message.getMessageId(),message.getFailure());
  break;
}
default :
{
processUnknownMessageType(message.getMessageId(),message.getMessageType().name());
break;
}
}
}

Fixed version (ground truth):
private void processMessage(final Message message) throws InterruptedException {
  MessageType messageType=message.getMessageType();
  if (messageType == null) {
    processUnknownMessageType(message.getMessageId(),"String_Node_Str");
    return;
  }
switch (messageType) {
case RESPONSE:
{
      processServerResponse(message.getMessageId(),message.getResponse());
      break;
    }
case REQUEST:
{
    processClientRequest(message.getMessageId(),message.getRequest());
    break;
  }
case FAILURE:
{
  processFailure(message.getMessageId(),message.getFailure());
  break;
}
default :
{
processUnknownMessageType(message.getMessageId(),messageType.name());
break;
}
}
}
Program: 54166
Project: 54166
Buggy source:
private String getContent(HttpServletRequest request) throws IOException {
  int contentLength=request.getContentLength();
  byte contentBytes[]=new byte[contentLength];
  BufferedInputStream bis=new BufferedInputStream(request.getInputStream());
  int readBytes=0;
  while (bis.read(contentBytes,readBytes,contentLength - readBytes) > 0) {
  }
  return new String(contentBytes);
}

Fixed version (ground truth):
private String getContent(HttpServletRequest request) throws IOException {
  int contentLength=request.getContentLength();
  byte contentBytes[]=new byte[contentLength];
  BufferedInputStream bis=new BufferedInputStream(request.getInputStream());
  try {
    int readBytes=0;
    while (bis.read(contentBytes,readBytes,contentLength - readBytes) > 0) {
    }
    return new String(contentBytes);
  }
  finally {
    bis.close();
  }
}
Program: 54167
Project: 54167
Buggy source:
/** 
 * Shows the popup and attach it to the page. It must have a child widget before this method is called.
 */
public void show(){
  if (showing) {
    return;
  }
  resizeAnimation.setState(true,false);
}

Fixed version (ground truth):
/** 
 * Shows the popup and attach it to the page. It must have a child widget before this method is called.
 */
public void show(){
  if (showing) {
    return;
  }
 else   if (isAttached()) {
    this.removeFromParent();
  }
  resizeAnimation.setState(true,false);
}
Program: 54168
Project: 54168
Buggy source:
/** 
 * Test the showing a popup while it is hiding will not result in an illegal state.
 */
public void testShowWhileHiding(){
  PopupPanel popup=createPopupPanel();
  popup.setAnimationEnabled(false);
  popup.show();
  assertTrue(popup.isShowing());
  popup.setAnimationEnabled(true);
  popup.hide();
  assertFalse(popup.isShowing());
  popup.show();
  assertTrue(popup.isShowing());
}

Fixed version (ground truth):
/** 
 * Test that showing a popup while it is hiding will not result in an illegal state.
 */
public void testShowWhileHiding(){
  PopupPanel popup=createPopupPanel();
  popup.setAnimationEnabled(false);
  popup.show();
  assertTrue(popup.isShowing());
  popup.setAnimationEnabled(true);
  popup.hide();
  assertFalse(popup.isShowing());
  popup.show();
  assertTrue(popup.isShowing());
}
Program: 54169
Project: 54169
Buggy source:
/** 
 * Resizes the grid to the specified number of columns.
 * @param columns the number of columns
 * @throws IndexOutOfBoundsException
 */
public void resizeColumns(int columns){
  if (numColumns == columns) {
    return;
  }
  if (columns < 0) {
    throw new IndexOutOfBoundsException("String_Node_Str" + columns);
  }
  if (numColumns > columns) {
    for (int i=0; i < numRows; i++) {
      for (int j=numColumns - 1; j >= columns; j--) {
        removeCell(i,j);
      }
    }
  }
 else {
    for (int i=0; i < numRows; i++) {
      for (int j=numColumns; j < columns; j++) {
        insertCell(i,j);
      }
    }
  }
  numColumns=columns;
  getColumnFormatter().resizeColumnGroup(columns);
}

Fixed version (ground truth):
/** 
 * Resizes the grid to the specified number of columns.
 * @param columns the number of columns
 * @throws IndexOutOfBoundsException
 */
public void resizeColumns(int columns){
  if (numColumns == columns) {
    return;
  }
  if (columns < 0) {
    throw new IndexOutOfBoundsException("String_Node_Str" + columns);
  }
  if (numColumns > columns) {
    for (int i=0; i < numRows; i++) {
      for (int j=numColumns - 1; j >= columns; j--) {
        removeCell(i,j);
      }
    }
  }
 else {
    for (int i=0; i < numRows; i++) {
      for (int j=numColumns; j < columns; j++) {
        insertCell(i,j);
      }
    }
  }
  numColumns=columns;
  getColumnFormatter().resizeColumnGroup(columns,false);
}
Program: 54170
Project: 54170
Buggy source:
/** 
 * Resize the column group element.
 * @param columns the number of columns
 */
void resizeColumnGroup(int columns){
  columns=Math.max(columns,1);
  int num=columnGroup.getChildCount();
  if (num < columns) {
    for (int i=num; i < columns; i++) {
      columnGroup.appendChild(Document.get().createColElement());
    }
  }
 else   if (num > columns) {
    for (int i=num; i > columns; i--) {
      columnGroup.removeChild(columnGroup.getLastChild());
    }
  }
}

Fixed version (ground truth):
/** 
 * Resize the column group element.
 * @param columns the number of columns
 * @param growOnly true to only grow, false to shrink if needed
 */
void resizeColumnGroup(int columns,boolean growOnly){
  columns=Math.max(columns,1);
  int num=columnGroup.getChildCount();
  if (num < columns) {
    for (int i=num; i < columns; i++) {
      columnGroup.appendChild(Document.get().createColElement());
    }
  }
 else   if (!growOnly && num > columns) {
    for (int i=num; i > columns; i--) {
      columnGroup.removeChild(columnGroup.getLastChild());
    }
  }
}
Program: 54171
Project: 54171
Buggy source:
private Element ensureColumn(int col){
  prepareColumn(col);
  prepareColumnGroup();
  resizeColumnGroup(col + 1);
  return columnGroup.getChild(col).cast();
}

Fixed version (ground truth):
private Element ensureColumn(int col){
  prepareColumn(col);
  prepareColumnGroup();
  resizeColumnGroup(col + 1,true);
  return columnGroup.getChild(col).cast();
}
Program: 54172
Project: 54172
Buggy source:
public void testColumnFormatterStyleName(){
  Grid r=new Grid(4,5);
  Grid.ColumnFormatter columns=r.getColumnFormatter();
  columns.setStyleName(0,"String_Node_Str");
  columns.addStyleName(0,"String_Node_Str");
  assertEquals("String_Node_Str",columns.getStyleName(0));
  columns.addStyleName(0,"String_Node_Str");
  assertEquals("String_Node_Str",columns.getStyleName(0));
  columns.addStyleName(0,"String_Node_Str");
  assertEquals("String_Node_Str",columns.getStyleName(0));
  columns.removeStyleName(0,"String_Node_Str");
  assertEquals("String_Node_Str",columns.getStyleName(0));
  columns.removeStyleName(0,"String_Node_Str");
  assertEquals("String_Node_Str",columns.getStyleName(0));
  Element e=DOM.getChild(r.getElement(),0);
  assertEquals(1,DOM.getChildCount(e));
  columns.addStyleName(3,"String_Node_Str");
  e=DOM.getChild(r.getElement(),0);
  assertEquals(4,DOM.getChildCount(e));
}

Fixed version (ground truth):
public void testColumnFormatterStyleName(){
  Grid r=new Grid(4,5);
  Grid.ColumnFormatter columns=r.getColumnFormatter();
  columns.setStyleName(0,"String_Node_Str");
  columns.addStyleName(0,"String_Node_Str");
  assertEquals("String_Node_Str",columns.getStyleName(0));
  columns.addStyleName(0,"String_Node_Str");
  assertEquals("String_Node_Str",columns.getStyleName(0));
  columns.addStyleName(0,"String_Node_Str");
  assertEquals("String_Node_Str",columns.getStyleName(0));
  columns.removeStyleName(0,"String_Node_Str");
  assertEquals("String_Node_Str",columns.getStyleName(0));
  columns.removeStyleName(0,"String_Node_Str");
  assertEquals("String_Node_Str",columns.getStyleName(0));
  Element e=DOM.getChild(r.getElement(),0);
  assertEquals(5,DOM.getChildCount(e));
  columns.addStyleName(3,"String_Node_Str");
  e=DOM.getChild(r.getElement(),0);
  assertEquals(5,DOM.getChildCount(e));
  assertEquals("String_Node_Str",columns.getStyleName(0));
  assertEquals("String_Node_Str",columns.getStyleName(3));
}