nus-yam/ex-repair huggingface dataset:
Program: 82174
Project: 82174
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: 82175
Project: 82175
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: 82176
Project: 82176
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: 82177
Project: 82177
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: 82178
Project: 82178
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: 82179
Project: 82179
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: 82181
Project: 82181
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: 82182
Project: 82182
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: 82183
Project: 82183
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: 82184
Project: 82184
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: 82185
Project: 82185
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: 82186
Project: 82186
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: 82187
Project: 82187
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: 82188
Project: 82188
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: 82189
Project: 82189
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: 82190
Project: 82190
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: 82191
Project: 82191
Buggy source:
private void assertIsChild(Widget widget){
}

Fixed version (ground truth):
void assertIsChild(Widget widget){
}
Program: 82192
Project: 82192
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: 82193
Project: 82193
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: 82194
Project: 82194
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: 82195
Project: 82195
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: 82196
Project: 82196
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: 82197
Project: 82197
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: 82198
Project: 82198
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: 82199
Project: 82199
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));
}
Program: 82200
Project: 82200
Buggy source:
/** 
 * Inform the views of the new data.
 * @param start the start index
 * @param length the length of the data
 * @param values the data values
 */
protected void updateViewData(int start,int length,List<T> values){
  int end=start + length;
  for (  DefaultListRegistration reg : registrations) {
    int curStart=reg.getStart();
    int curLength=reg.getLength();
    int curEnd=curStart + curLength;
    if (curStart < end && curEnd > start) {
      int realStart=curStart < start ? start : curStart;
      int realEnd=curEnd > end ? end : curEnd;
      int realLength=realEnd - realStart;
      List<T> realValues=values.subList(0,realLength);
      ListEvent<T> event=new ListEvent<T>(realStart,realLength,realValues);
      reg.getHandler().onDataChanged(event);
    }
  }
}

Fixed version (ground truth):
/** 
 * Inform the views of the new data.
 * @param start the start index
 * @param length the length of the data
 * @param values the data values
 */
protected void updateViewData(int start,int length,List<T> values){
  int end=start + length;
  for (  DefaultListRegistration reg : registrations) {
    int curStart=reg.getStart();
    int curLength=reg.getLength();
    int curEnd=curStart + curLength;
    if (curStart < end && curEnd > start) {
      int realStart=curStart < start ? start : curStart;
      int realEnd=curEnd > end ? end : curEnd;
      int realLength=realEnd - realStart;
      List<T> realValues=values.subList(realStart - start,realStart - start + realLength);
      ListEvent<T> event=new ListEvent<T>(realStart,realLength,realValues);
      reg.getHandler().onDataChanged(event);
    }
  }
}
Program: 82201
Project: 82201
Buggy source:
public void execute(){
  int newSize=list.size();
  if (curSize != newSize) {
    curSize=newSize;
    updateDataSize(curSize,true);
  }
  if (modified) {
    int length=maxModified - minModified;
    updateViewData(minModified,length,list.subList(minModified,maxModified));
    modified=false;
  }
  minModified=Integer.MAX_VALUE;
  maxModified=Integer.MIN_VALUE;
  flushPending=false;
}

Fixed version (ground truth):
public void execute(){
  flushPending=false;
  int newSize=list.size();
  if (curSize != newSize) {
    curSize=newSize;
    updateDataSize(curSize,true);
  }
  if (modified) {
    int length=maxModified - minModified;
    updateViewData(minModified,length,list.subList(minModified,maxModified));
    modified=false;
  }
  minModified=Integer.MAX_VALUE;
  maxModified=Integer.MIN_VALUE;
}
Program: 82202
Project: 82202
Buggy source:
@Override protected void moveSelectionUp(){
  if (isSuggestionListShowing()) {
    suggestionMenu.selectItem(suggestionMenu.getSelectedItemIndex() - 1);
  }
}

Fixed version (ground truth):
@Override protected void moveSelectionUp(){
  if (isSuggestionListShowing()) {
    if (suggestionMenu.getSelectedItemIndex() == -1) {
      suggestionMenu.selectItem(suggestionMenu.getNumItems() - 1);
    }
 else {
      suggestionMenu.selectItem(suggestionMenu.getSelectedItemIndex() - 1);
    }
  }
}
Program: 82203
Project: 82203
Buggy source:
@Override public synchronized void launchModule(String moduleName){
  String domain="String_Node_Str" + getLocalHostName() + "String_Node_Str"+ shell.getPort()+ "String_Node_Str";
  for (  SeleniumWrapper remote : remotes) {
    try {
      String url=shell.getModuleUrl(moduleName);
      shell.getTopLogger().log(TreeLogger.TRACE,"String_Node_Str" + domain + "String_Node_Str"+ url);
      remote.createSelenium(domain);
      remote.getSelenium().start();
      remote.getSelenium().open(url);
    }
 catch (    Exception e) {
      shell.getTopLogger().log(TreeLogger.ERROR,"String_Node_Str" + remote.getSpecifier(),e);
    }
  }
}

Fixed version (ground truth):
@Override public void launchModule(String moduleName){
  String domain="String_Node_Str" + getLocalHostName() + "String_Node_Str"+ shell.getPort()+ "String_Node_Str";
synchronized (lock) {
    for (    SeleniumWrapper remote : remotes) {
      try {
        String url=shell.getModuleUrl(moduleName);
        shell.getTopLogger().log(TreeLogger.TRACE,"String_Node_Str" + domain + "String_Node_Str"+ url);
        remote.createSelenium(domain);
        remote.getSelenium().start();
        remote.getSelenium().open(url);
      }
 catch (      Exception e) {
        shell.getTopLogger().log(TreeLogger.ERROR,"String_Node_Str" + remote.getSpecifier(),e);
      }
    }
  }
}
Program: 82204
Project: 82204
Buggy source:
private synchronized boolean doKeepAlives(){
  if (remotes != null) {
    for (    SeleniumWrapper remote : remotes) {
      try {
        if (remote.getSelenium() != null) {
          remote.getSelenium().getTitle();
        }
      }
 catch (      Throwable e) {
synchronized (wasInterruptedLock) {
          if (interruptedHosts == null) {
            interruptedHosts=new HashSet<String>();
          }
          interruptedHosts.add(remote.getSpecifier());
        }
      }
    }
  }
  return interruptedHosts == null;
}

Fixed version (ground truth):
private boolean doKeepAlives(){
synchronized (lock) {
    if (remotes != null) {
      if (stopped) {
        return false;
      }
      for (      SeleniumWrapper remote : remotes) {
        try {
          if (remote.getSelenium() != null) {
            remote.getSelenium().getTitle();
          }
        }
 catch (        Throwable e) {
          String message=e.getMessage();
          if (message != null && message.toLowerCase().contains("String_Node_Str")) {
            if (interruptedHosts == null) {
              interruptedHosts=new HashSet<String>();
            }
            interruptedHosts.add(remote.getSpecifier());
          }
        }
      }
    }
    return interruptedHosts == null;
  }
}
Program: 82205
Project: 82205
Buggy source:
@Override public String[] getInterruptedHosts(){
synchronized (wasInterruptedLock) {
    if (interruptedHosts == null) {
      return null;
    }
    return interruptedHosts.toArray(new String[interruptedHosts.size()]);
  }
}

Fixed version (ground truth):
@Override public String[] getInterruptedHosts(){
synchronized (lock) {
    if (interruptedHosts == null) {
      return null;
    }
    return interruptedHosts.toArray(new String[interruptedHosts.size()]);
  }
}
Program: 82206
Project: 82206
Buggy source:
@Override public int initialize(String args){
  if (args == null || args.length() == 0) {
    getLogger().log(TreeLogger.ERROR,"String_Node_Str");
    return -1;
  }
  String[] targetsIn=args.split("String_Node_Str");
  SeleniumWrapper targets[]=new SeleniumWrapper[targetsIn.length];
  for (int i=0; i < targets.length; ++i) {
    try {
      targets[i]=createSeleniumWrapper(targetsIn[i]);
    }
 catch (    IllegalArgumentException e) {
      getLogger().log(TreeLogger.ERROR,e.getMessage());
      return -1;
    }
  }
  this.remotes=targets;
  Runtime.getRuntime().addShutdownHook(new Thread(){
    @Override public void run(){
      for (      SeleniumWrapper remote : remotes) {
        if (remote.getSelenium() != null) {
          try {
            remote.getSelenium().stop();
          }
 catch (          SeleniumException se) {
            shell.getTopLogger().log(TreeLogger.WARN,"String_Node_Str",se);
          }
        }
      }
    }
  }
);
  start();
  return targets.length;
}

Fixed version (ground truth):
@Override public int initialize(String args){
  if (args == null || args.length() == 0) {
    getLogger().log(TreeLogger.ERROR,"String_Node_Str");
    return -1;
  }
  String[] targetsIn=args.split("String_Node_Str");
  SeleniumWrapper targets[]=new SeleniumWrapper[targetsIn.length];
  for (int i=0; i < targets.length; ++i) {
    try {
      targets[i]=createSeleniumWrapper(targetsIn[i]);
    }
 catch (    IllegalArgumentException e) {
      getLogger().log(TreeLogger.ERROR,e.getMessage());
      return -1;
    }
  }
  this.remotes=targets;
  Runtime.getRuntime().addShutdownHook(new Thread(){
    @Override public void run(){
synchronized (lock) {
        stopped=true;
        for (        SeleniumWrapper remote : remotes) {
          if (remote.getSelenium() != null) {
            try {
              remote.getSelenium().stop();
            }
 catch (            SeleniumException se) {
              shell.getTopLogger().log(TreeLogger.WARN,"String_Node_Str",se);
            }
          }
        }
      }
    }
  }
);
  start();
  return targets.length;
}
Program: 82207
Project: 82207
Buggy source:
/** 
 * Intended to be used to pull the value out of a CSS length. We rely on the behavior of parseFloat to ignore non-numeric chars in its input. If the value is "auto" or "inherit", 0 will be returned.
 * @param s The CSS length string to extract
 * @return The leading numeric portion of <code>s</code>, or 0 if "auto" or"inherit" are passed in.
 */
private native double extractLengthValue(String s);

Fixed version (ground truth):
/** 
 * Intended to be used to pull the value out of a CSS length. If the value is "auto" or "inherit", 0 will be returned.
 * @param s The CSS length string to extract
 * @return The leading numeric portion of <code>s</code>, or 0 if "auto" or"inherit" are passed in.
 */
private native double extractLengthValue(String s);
Program: 82208
Project: 82208
Buggy source:
public void testParse(){
  assertTrue(0 == Double.parseDouble("String_Node_Str"));
  assertTrue(-1.5 == Double.parseDouble("String_Node_Str"));
  assertTrue(3.0 == Double.parseDouble("String_Node_Str"));
  assertTrue(0.5 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.98e8 == Double.parseDouble("String_Node_Str"));
  assertTrue(-2.98e-8 == Double.parseDouble("String_Node_Str"));
  assertTrue(+2.98E+8 == Double.parseDouble("String_Node_Str"));
  assertTrue("String_Node_Str",Double.MIN_VALUE == Double.parseDouble(String.valueOf(Double.MIN_VALUE)));
  assertTrue("String_Node_Str",Double.MAX_VALUE == Double.parseDouble(String.valueOf(Double.MAX_VALUE)));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(-2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(-2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(-2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(-2.56789e1 == Double.parseDouble("String_Node_Str"));
}

Fixed version (ground truth):
public void testParse(){
  assertTrue(0 == Double.parseDouble("String_Node_Str"));
  assertTrue(100 == Double.parseDouble("String_Node_Str"));
  assertTrue(-100 == Double.parseDouble("String_Node_Str"));
  assertTrue(-1.5 == Double.parseDouble("String_Node_Str"));
  assertTrue(3.0 == Double.parseDouble("String_Node_Str"));
  assertTrue(0.5 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.98e8 == Double.parseDouble("String_Node_Str"));
  assertTrue(-2.98e-8 == Double.parseDouble("String_Node_Str"));
  assertTrue(+2.98E+8 == Double.parseDouble("String_Node_Str"));
  assertTrue("String_Node_Str",Double.MIN_VALUE == Double.parseDouble(String.valueOf(Double.MIN_VALUE)));
  assertTrue("String_Node_Str",Double.MAX_VALUE == Double.parseDouble(String.valueOf(Double.MAX_VALUE)));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(-2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(-2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(-2.56789e1 == Double.parseDouble("String_Node_Str"));
  assertTrue(-2.56789e1 == Double.parseDouble("String_Node_Str"));
}
Program: 82209
Project: 82209
Buggy source:
public void testBadStrings(){
  try {
    new Double("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  NumberFormatException e) {
  }
  try {
    Double.parseDouble("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  NumberFormatException e) {
  }
  try {
    Double.valueOf("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  NumberFormatException e) {
  }
}

Fixed version (ground truth):
public void testBadStrings(){
  try {
    new Double("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  NumberFormatException e) {
  }
  try {
    Double.parseDouble("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  NumberFormatException e) {
  }
  try {
    Double.parseDouble("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  NumberFormatException e) {
  }
  try {
    Double.parseDouble("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  NumberFormatException e) {
  }
  try {
    Double.parseDouble("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  NumberFormatException e) {
  }
  try {
    Double.parseDouble("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  NumberFormatException e) {
  }
  try {
    Double.valueOf("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  NumberFormatException e) {
  }
}
Program: 82210
Project: 82210
Buggy source:
public void onSizeChanged(SizeChangeEvent event){
  int size=event.getSize();
  if (size > maxSize) {
    showMoreElem.getStyle().clearDisplay();
  }
 else {
    showMoreElem.getStyle().setDisplay(Display.NONE);
  }
  int dataSize=data.size();
  if (size < dataSize) {
    while (size < dataSize) {
      data.remove(dataSize - 1);
      dataSize--;
    }
  }
 else {
    data.ensureCapacity(size);
    while (dataSize < size) {
      data.add(null);
      dataSize++;
    }
  }
  gc(size);
}

Fixed version (ground truth):
public void onSizeChanged(SizeChangeEvent event){
  size=event.getSize();
  showOrHide(showMoreElem,size > maxSize);
  showOrHide(showFewerElem,maxSize > initialMaxSize);
}
Program: 82211
Project: 82211
Buggy source:
@Override protected void onLoad(){
  super.onLoad();
  this.reg=model.addListHandler(new ListHandler<T>(){
    public void onDataChanged(    ListEvent<T> event){
      int start=event.getStart(), len=event.getLength();
      List<T> values=event.getValues();
      for (int i=0; i < len; ++i) {
        data.set(start + i,values.get(i));
      }
      render(start,len,values);
    }
    public void onSizeChanged(    SizeChangeEvent event){
      int size=event.getSize();
      if (size > maxSize) {
        showMoreElem.getStyle().clearDisplay();
      }
 else {
        showMoreElem.getStyle().setDisplay(Display.NONE);
      }
      int dataSize=data.size();
      if (size < dataSize) {
        while (size < dataSize) {
          data.remove(dataSize - 1);
          dataSize--;
        }
      }
 else {
        data.ensureCapacity(size);
        while (dataSize < size) {
          data.add(null);
          dataSize++;
        }
      }
      gc(size);
    }
  }
);
  reg.setRangeOfInterest(0,maxSize);
}

Fixed version (ground truth):
@Override protected void onLoad(){
  super.onLoad();
  this.reg=model.addListHandler(new ListHandler<T>(){
    public void onDataChanged(    ListEvent<T> event){
      int start=event.getStart();
      int len=event.getLength();
      List<T> values=event.getValues();
      StringBuilder sb=new StringBuilder();
      for (int i=0; i < len; i++) {
        sb.append("String_Node_Str" + (start + i) + "String_Node_Str"+ seq+++ "String_Node_Str");
        cell.render(values.get(i),null,sb);
        sb.append("String_Node_Str");
      }
      Element parent=getElement().getFirstChildElement();
      if (start == 0 && len == maxSize) {
        parent.setInnerHTML(sb.toString());
      }
 else {
        makeElements();
        tmpElem.setInnerHTML(sb.toString());
        for (int i=0; i < len; i++) {
          Element child=parent.getChild(start + i).cast();
          parent.replaceChild(tmpElem.getChild(0),child);
        }
      }
    }
    public void onSizeChanged(    SizeChangeEvent event){
      size=event.getSize();
      showOrHide(showMoreElem,size > maxSize);
      showOrHide(showFewerElem,maxSize > initialMaxSize);
    }
    private void makeElements(){
      Element parent=getElement().getFirstChildElement();
      int childCount=parent.getChildCount();
      int actualSize=Math.min(size,maxSize);
      if (actualSize > childCount) {
        StringBuilder sb=new StringBuilder();
        int newElements=actualSize - childCount;
        for (int i=0; i < newElements; i++) {
          sb.append("String_Node_Str" + (childCount + i) + "String_Node_Str");
        }
        if (childCount == 0) {
          parent.setInnerHTML(sb.toString());
        }
 else {
          tmpElem.setInnerHTML(sb.toString());
          for (int i=0; i < newElements; i++) {
            parent.appendChild(tmpElem.getChild(0));
          }
        }
      }
 else       if (actualSize < childCount) {
        while (actualSize < childCount) {
          parent.getChild(--childCount).removeFromParent();
        }
      }
    }
  }
);
  reg.setRangeOfInterest(0,maxSize);
}
Program: 82212
Project: 82212
Buggy source:
public SimpleCellList(ListModel<T> model,Cell<T,Void> cell,int maxSize,int increment){
  this.maxSize=maxSize;
  this.increment=increment;
  this.model=model;
  this.cell=cell;
  tmpElem=Document.get().createDivElement();
  showMoreElem=Document.get().createDivElement();
  showMoreElem.setInnerHTML("String_Node_Str" + increment + "String_Node_Str");
  showMoreElem.getStyle().setDisplay(Display.NONE);
  DivElement outerDiv=Document.get().createDivElement();
  DivElement innerDiv=Document.get().createDivElement();
  outerDiv.appendChild(innerDiv);
  outerDiv.appendChild(showMoreElem);
  setElement(outerDiv);
  sinkEvents(Event.ONCLICK);
  sinkEvents(Event.ONCHANGE);
}

Fixed version (ground truth):
public SimpleCellList(ListModel<T> model,Cell<T,Void> cell,int maxSize,int increment){
  this.initialMaxSize=this.maxSize=maxSize;
  this.increment=increment;
  this.model=model;
  this.cell=cell;
  this.seq=0;
  tmpElem=Document.get().createDivElement();
  showMoreElem=Document.get().createDivElement();
  showMoreElem.setInnerHTML("String_Node_Str");
  showFewerElem=Document.get().createDivElement();
  showFewerElem.setInnerHTML("String_Node_Str");
  showOrHide(showMoreElem,false);
  showOrHide(showFewerElem,false);
  DivElement outerDiv=Document.get().createDivElement();
  DivElement innerDiv=Document.get().createDivElement();
  outerDiv.appendChild(innerDiv);
  outerDiv.appendChild(showFewerElem);
  outerDiv.appendChild(showMoreElem);
  setElement(outerDiv);
  sinkEvents(Event.ONCLICK);
  sinkEvents(Event.ONCHANGE);
}
Program: 82213
Project: 82213
Buggy source:
@Override public void onBrowserEvent(Event event){
  Element target=event.getEventTarget().cast();
  String idxString="String_Node_Str";
  while ((target != null) && ((idxString=target.getAttribute("String_Node_Str")).length() == 0)) {
    target=target.getParentElement();
  }
  if (idxString.length() > 0) {
    int idx=Integer.parseInt(idxString);
    cell.onBrowserEvent(target,data.get(idx),null,event,valueUpdater);
  }
}

Fixed version (ground truth):
@Override public void onBrowserEvent(Event event){
  Element target=event.getEventTarget().cast();
  if (target.getParentElement() == showMoreElem) {
    this.maxSize+=increment;
    reg.setRangeOfInterest(0,maxSize);
  }
 else   if (target.getParentElement() == showFewerElem) {
    this.maxSize=Math.max(initialMaxSize,maxSize - increment);
    reg.setRangeOfInterest(0,maxSize);
  }
 else {
    String idxString="String_Node_Str";
    while ((target != null) && ((idxString=target.getAttribute("String_Node_Str")).length() == 0)) {
      target=target.getParentElement();
    }
    if (idxString.length() > 0) {
      int idx=Integer.parseInt(idxString);
      cell.onBrowserEvent(target,data.get(idx),null,event,valueUpdater);
    }
  }
}
Program: 82214
Project: 82214
Buggy source:
public void onDataChanged(ListEvent<T> event){
  int start=event.getStart(), len=event.getLength();
  List<T> values=event.getValues();
  for (int i=0; i < len; ++i) {
    data.set(start + i,values.get(i));
  }
  render(start,len,values);
}

Fixed version (ground truth):
public void onDataChanged(ListEvent<T> event){
  int start=event.getStart();
  int len=event.getLength();
  List<T> values=event.getValues();
  StringBuilder sb=new StringBuilder();
  for (int i=0; i < len; i++) {
    sb.append("String_Node_Str" + (start + i) + "String_Node_Str"+ seq+++ "String_Node_Str");
    cell.render(values.get(i),null,sb);
    sb.append("String_Node_Str");
  }
  Element parent=getElement().getFirstChildElement();
  if (start == 0 && len == maxSize) {
    parent.setInnerHTML(sb.toString());
  }
 else {
    makeElements();
    tmpElem.setInnerHTML(sb.toString());
    for (int i=0; i < len; i++) {
      Element child=parent.getChild(start + i).cast();
      parent.replaceChild(tmpElem.getChild(0),child);
    }
  }
}
Program: 82215
Project: 82215
Buggy source:
public boolean remove(Object o){
  return flush(list.remove(o));
}

Fixed version (ground truth):
public boolean remove(Object o){
  int index=indexOf(o);
  if (index == -1) {
    return false;
  }
  remove(index);
  return true;
}
Program: 82216
Project: 82216
Buggy source:
public boolean removeAll(Collection<?> c){
  return flush(list.removeAll(c));
}

Fixed version (ground truth):
public boolean removeAll(Collection<?> c){
  boolean toRet=list.removeAll(c);
  minModified=0;
  maxModified=size();
  modified=true;
  return flush(toRet);
}
Program: 82217
Project: 82217
Buggy source:
public boolean add(T e){
  return flush(list.add(e));
}

Fixed version (ground truth):
public boolean add(T e){
  boolean toRet=list.add(e);
  minModified=Math.min(minModified,size() - 1);
  maxModified=size();
  modified=true;
  return flush(toRet);
}
Program: 82218
Project: 82218
Buggy source:
public T set(int index,T element){
  T toRet=list.set(index,element);
  flush();
  return toRet;
}

Fixed version (ground truth):
public T set(int index,T element){
  T toRet=list.set(index,element);
  minModified=Math.min(minModified,index);
  maxModified=Math.max(maxModified,index + 1);
  modified=true;
  flush();
  return toRet;
}
Program: 82219
Project: 82219
Buggy source:
public void clear(){
  list.clear();
  flush();
}

Fixed version (ground truth):
public void clear(){
  list.clear();
  minModified=maxModified=0;
  modified=true;
  flush();
}
Program: 82220
Project: 82220
Buggy source:
public ListWrapper(List<T> list){
  this.list=list;
}

Fixed version (ground truth):
public ListWrapper(List<T> list){
  this.list=list;
  minModified=0;
  maxModified=list.size();
  modified=true;
}
Program: 82221
Project: 82221
Buggy source:
public void execute(){
  int newSize=list.size();
  if (curSize != newSize) {
    curSize=newSize;
    updateDataSize(curSize,true);
  }
  updateViewData(0,list.size(),list);
  flushPending=false;
}

Fixed version (ground truth):
public void execute(){
  int newSize=list.size();
  if (curSize != newSize) {
    curSize=newSize;
    updateDataSize(curSize,true);
  }
  if (modified) {
    int length=maxModified - minModified;
    updateViewData(minModified,length,list.subList(minModified,maxModified));
    modified=false;
  }
  minModified=Integer.MAX_VALUE;
  maxModified=Integer.MIN_VALUE;
  flushPending=false;
}
Program: 82222
Project: 82222
Buggy source:
public boolean addAll(int index,Collection<? extends T> c){
  return flush(list.addAll(index,c));
}

Fixed version (ground truth):
public boolean addAll(int index,Collection<? extends T> c){
  try {
    boolean toRet=list.addAll(index,c);
    minModified=Math.min(minModified,index);
    maxModified=size();
    modified=true;
    return flush(toRet);
  }
 catch (  IndexOutOfBoundsException e) {
    throw new IndexOutOfBoundsException(e.getMessage());
  }
}