nus-yam/ex-repair huggingface dataset:
Program: 111902
Project: 111902
Buggy source:
public void testIsAssignableFrom(){
  assertTrue(Primitive.INT.assignableFrom(Primitive.BYTE));
  assertTrue(Primitive.INT.assignableFrom(Primitive.SHORT));
  assertTrue(Primitive.INT.assignableFrom(Primitive.CHAR));
  assertTrue(Primitive.INT.assignableFrom(Primitive.INT));
  assertTrue(Primitive.INT.assignableFrom(Primitive.SHORT));
  assertFalse(Primitive.INT.assignableFrom(Primitive.LONG));
  assertTrue(Primitive.LONG.assignableFrom(Primitive.BYTE));
  assertTrue(Primitive.LONG.assignableFrom(Primitive.SHORT));
  assertTrue(Primitive.LONG.assignableFrom(Primitive.CHAR));
  assertTrue(Primitive.LONG.assignableFrom(Primitive.INT));
  assertTrue(Primitive.LONG.assignableFrom(Primitive.LONG));
  assertTrue(Primitive.SHORT.assignableFrom(Primitive.BYTE));
  assertTrue(Primitive.SHORT.assignableFrom(Primitive.SHORT));
  assertFalse(Primitive.SHORT.assignableFrom(Primitive.CHAR));
  assertFalse(Primitive.SHORT.assignableFrom(Primitive.INT));
  assertFalse(Primitive.SHORT.assignableFrom(Primitive.LONG));
  assertTrue(Primitive.CHAR.assignableFrom(Primitive.BYTE));
  assertFalse(Primitive.CHAR.assignableFrom(Primitive.SHORT));
  assertTrue(Primitive.CHAR.assignableFrom(Primitive.CHAR));
  assertFalse(Primitive.CHAR.assignableFrom(Primitive.INT));
  assertFalse(Primitive.CHAR.assignableFrom(Primitive.LONG));
  assertFalse(Primitive.BOOLEAN.assignableFrom(Primitive.INT));
  assertFalse(Primitive.INT.assignableFrom(Primitive.BOOLEAN));
}

Fixed version (ground truth):
public void testIsAssignableFrom(){
  assertTrue(Primitive.INT.assignableFrom(Primitive.BYTE));
  assertTrue(Primitive.INT.assignableFrom(Primitive.SHORT));
  assertTrue(Primitive.INT.assignableFrom(Primitive.CHAR));
  assertTrue(Primitive.INT.assignableFrom(Primitive.INT));
  assertTrue(Primitive.INT.assignableFrom(Primitive.SHORT));
  assertFalse(Primitive.INT.assignableFrom(Primitive.LONG));
  assertTrue(Primitive.LONG.assignableFrom(Primitive.BYTE));
  assertTrue(Primitive.LONG.assignableFrom(Primitive.SHORT));
  assertTrue(Primitive.LONG.assignableFrom(Primitive.CHAR));
  assertTrue(Primitive.LONG.assignableFrom(Primitive.INT));
  assertTrue(Primitive.LONG.assignableFrom(Primitive.LONG));
  assertTrue(Primitive.SHORT.assignableFrom(Primitive.BYTE));
  assertTrue(Primitive.SHORT.assignableFrom(Primitive.SHORT));
  assertFalse(Primitive.SHORT.assignableFrom(Primitive.CHAR));
  assertFalse(Primitive.SHORT.assignableFrom(Primitive.INT));
  assertFalse(Primitive.SHORT.assignableFrom(Primitive.LONG));
  assertFalse(Primitive.CHAR.assignableFrom(Primitive.BYTE));
  assertFalse(Primitive.CHAR.assignableFrom(Primitive.SHORT));
  assertTrue(Primitive.CHAR.assignableFrom(Primitive.CHAR));
  assertFalse(Primitive.CHAR.assignableFrom(Primitive.INT));
  assertFalse(Primitive.CHAR.assignableFrom(Primitive.LONG));
  assertFalse(Primitive.BOOLEAN.assignableFrom(Primitive.INT));
  assertFalse(Primitive.INT.assignableFrom(Primitive.BOOLEAN));
}
Program: 111903
Project: 111903
Buggy source:
public void testInsert(){
  final List<JdbcTest.Employee> employees=new ArrayList<JdbcTest.Employee>();
  employees.add(new JdbcTest.Employee(0,0,"String_Node_Str"));
  OptiqAssert.AssertThat with=assertThat().with(new OptiqAssert.ConnectionFactory(){
    public OptiqConnection createConnection() throws Exception {
      final Connection connection=JdbcTest.getConnection("String_Node_Str","String_Node_Str");
      OptiqConnection optiqConnection=connection.unwrap(OptiqConnection.class);
      MutableSchema rootSchema=optiqConnection.getRootSchema();
      MapSchema mapSchema=MapSchema.create(optiqConnection,rootSchema,"String_Node_Str");
      mapSchema.addTable("String_Node_Str",new JdbcTest.AbstractModifiableTable(mapSchema,JdbcTest.Employee.class,optiqConnection.getTypeFactory().createType(JdbcTest.Employee.class),"String_Node_Str"){
        public Enumerator enumerator(){
          return Linq4j.enumerator(employees);
        }
        public Collection getModifiableCollection(){
          return employees;
        }
      }
);
      return optiqConnection;
    }
  }
);
  with.query("String_Node_Str").returns("String_Node_Str");
  if (false) {
    with.query("String_Node_Str").returns("String_Node_Str");
  }
  with.query("String_Node_Str").returns("String_Node_Str");
  with.query("String_Node_Str").returns("String_Node_Str");
  with.query("String_Node_Str" + "String_Node_Str").returns("String_Node_Str");
  with.query("String_Node_Str" + "String_Node_Str").returns("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
public void testInsert(){
  final List<JdbcTest.Employee> employees=new ArrayList<JdbcTest.Employee>();
  OptiqAssert.AssertThat with=mutable(employees);
  with.query("String_Node_Str").returns("String_Node_Str");
  with.query("String_Node_Str").returns("String_Node_Str");
  with.query("String_Node_Str").returns("String_Node_Str");
  with.query("String_Node_Str" + "String_Node_Str").returns("String_Node_Str");
  with.query("String_Node_Str" + "String_Node_Str").returns("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
}
Program: 111904
Project: 111904
Buggy source:
private void load(final RelDataType elementType){
  final List<Type> types=new AbstractList<Type>(){
    final List<RelDataTypeField> fields=elementType.getFieldList();
    public Type get(    int index){
      return typeFactory.getJavaClass(fields.get(index).getType());
    }
    public int size(){
      return fields.size();
    }
  }
;
  for (  Pair<Integer,Type> pair : Pair.zip(types)) {
    final int i=pair.left;
    @SuppressWarnings("String_Node_Str") final List<?> sliceList=types.size() == 1 ? list : new AbstractList<Object>(){
      public Object get(      int index){
        return ((Object[])list.get(index))[i];
      }
      public int size(){
        return list.size();
      }
    }
;
    final Type type=pair.right;
    final Class clazz=type instanceof Class ? (Class)type : Object.class;
    ValueSet valueSet=new ValueSet(clazz);
    for (    Object o : sliceList) {
      valueSet.add((Comparable)o);
    }
    representationValues.add(valueSet.freeze(i));
  }
}

Fixed version (ground truth):
private void load(final RelDataType elementType){
  final List<Type> types=new AbstractList<Type>(){
    final List<RelDataTypeField> fields=elementType.getFieldList();
    public Type get(    int index){
      return typeFactory.getJavaClass(fields.get(index).getType());
    }
    public int size(){
      return fields.size();
    }
  }
;
  for (  final Ord<Type> pair : Ord.zip(types)) {
    @SuppressWarnings("String_Node_Str") final List<?> sliceList=types.size() == 1 ? list : new AbstractList<Object>(){
      public Object get(      int index){
        return ((Object[])list.get(index))[pair.i];
      }
      public int size(){
        return list.size();
      }
    }
;
    final Class clazz=pair.e instanceof Class ? (Class)pair.e : Object.class;
    ValueSet valueSet=new ValueSet(clazz);
    for (    Object o : sliceList) {
      valueSet.add((Comparable)o);
    }
    representationValues.add(valueSet.freeze(pair.i));
  }
}
Program: 111905
Project: 111905
Buggy source:
ArrayTable.Representation chooseRep(int ordinal){
  Primitive primitive=Primitive.of(clazz);
  Primitive boxPrimitive=Primitive.ofBox(clazz);
  Primitive p=primitive != null ? primitive : boxPrimitive;
  if (!containsNull && p != null) {
switch (p) {
case FLOAT:
case DOUBLE:
      return new ArrayTable.PrimitiveArray(ordinal,p,p);
case OTHER:
case VOID:
    throw new AssertionError("String_Node_Str");
}
if (canBeLong(min) && canBeLong(max)) {
  return chooseFixedRep(ordinal,p,toLong(min),toLong(max));
}
}
final int codeBitCount=log2(nextPowerOf2(map.size()));
if (codeBitCount < 10 && values.size() > 2000) {
final ArrayTable.Representation representation=chooseFixedRep(-1,Primitive.INT,0,map.size() - 1);
return new ArrayTable.ObjectDictionary(ordinal,representation);
}
return new ArrayTable.ObjectArray(ordinal);
}

Fixed version (ground truth):
ArrayTable.Representation chooseRep(int ordinal){
  Primitive primitive=Primitive.of(clazz);
  Primitive boxPrimitive=Primitive.ofBox(clazz);
  Primitive p=primitive != null ? primitive : boxPrimitive;
  if (!containsNull && p != null) {
switch (p) {
case FLOAT:
case DOUBLE:
      return new ArrayTable.PrimitiveArray(ordinal,p,p);
case OTHER:
case VOID:
    throw new AssertionError("String_Node_Str");
}
if (canBeLong(min) && canBeLong(max)) {
  return chooseFixedRep(ordinal,p,toLong(min),toLong(max));
}
}
final int codeCount=map.size() + (containsNull ? 1 : 0);
final int codeBitCount=log2(nextPowerOf2(codeCount));
if (codeBitCount < 10 && values.size() > 2000) {
final ArrayTable.Representation representation=chooseFixedRep(-1,Primitive.INT,0,codeCount - 1);
return new ArrayTable.ObjectDictionary(ordinal,representation);
}
return new ArrayTable.ObjectArray(ordinal);
}
Program: 111906
Project: 111906
Buggy source:
public Object get(int index){
  return ((Object[])list.get(index))[i];
}

Fixed version (ground truth):
public Object get(int index){
  return ((Object[])list.get(index))[pair.i];
}
Program: 111907
Project: 111907
Buggy source:
public MetaColumn apply(RelDataTypeField a0){
  return new MetaColumn(table.tableCat,table.tableSchem,table.tableName,a0.getName(),a0.getType().getSqlTypeName().getJdbcOrdinal(),a0.getType().getFullTypeString(),a0.getType().getPrecision(),a0.getType().getSqlTypeName().allowsScale() ? a0.getType().getScale() : null,10,a0.getType().isNullable() ? DatabaseMetaData.columnNullable : DatabaseMetaData.columnNoNulls,a0.getType().getPrecision(),a0.getIndex() + 1,a0.getType().isNullable() ? "String_Node_Str" : "String_Node_Str");
}

Fixed version (ground truth):
public MetaColumn apply(RelDataTypeField a0){
  final int precision=a0.getType().getSqlTypeName().allowsPrec() && !(a0.getType() instanceof RelDataTypeFactoryImpl.JavaType) ? a0.getType().getPrecision() : -1;
  return new MetaColumn(table.tableCat,table.tableSchem,table.tableName,a0.getName(),a0.getType().getSqlTypeName().getJdbcOrdinal(),a0.getType().getFullTypeString(),precision,a0.getType().getSqlTypeName().allowsScale() ? a0.getType().getScale() : null,10,a0.getType().isNullable() ? DatabaseMetaData.columnNullable : DatabaseMetaData.columnNoNulls,precision,a0.getIndex() + 1,a0.getType().isNullable() ? "String_Node_Str" : "String_Node_Str");
}
Program: 111908
Project: 111908
Buggy source:
public Enumerable<MetaColumn> columns(final MetaTable table){
  RelDataType x=connection.getTypeFactory().createType(table.optiqTable.getElementType());
  return Linq4j.asEnumerable(x.getFieldList()).select(new Function1<RelDataTypeField,MetaColumn>(){
    public MetaColumn apply(    RelDataTypeField a0){
      return new MetaColumn(table.tableCat,table.tableSchem,table.tableName,a0.getName(),a0.getType().getSqlTypeName().getJdbcOrdinal(),a0.getType().getFullTypeString(),a0.getType().getPrecision(),a0.getType().getSqlTypeName().allowsScale() ? a0.getType().getScale() : null,10,a0.getType().isNullable() ? DatabaseMetaData.columnNullable : DatabaseMetaData.columnNoNulls,a0.getType().getPrecision(),a0.getIndex() + 1,a0.getType().isNullable() ? "String_Node_Str" : "String_Node_Str");
    }
  }
);
}

Fixed version (ground truth):
public Enumerable<MetaColumn> columns(final MetaTable table){
  RelDataType x=connection.getTypeFactory().createType(table.optiqTable.getElementType());
  return Linq4j.asEnumerable(x.getFieldList()).select(new Function1<RelDataTypeField,MetaColumn>(){
    public MetaColumn apply(    RelDataTypeField a0){
      final int precision=a0.getType().getSqlTypeName().allowsPrec() && !(a0.getType() instanceof RelDataTypeFactoryImpl.JavaType) ? a0.getType().getPrecision() : -1;
      return new MetaColumn(table.tableCat,table.tableSchem,table.tableName,a0.getName(),a0.getType().getSqlTypeName().getJdbcOrdinal(),a0.getType().getFullTypeString(),precision,a0.getType().getSqlTypeName().allowsScale() ? a0.getType().getScale() : null,10,a0.getType().isNullable() ? DatabaseMetaData.columnNullable : DatabaseMetaData.columnNoNulls,precision,a0.getIndex() + 1,a0.getType().isNullable() ? "String_Node_Str" : "String_Node_Str");
    }
  }
);
}
Program: 111909
Project: 111909
Buggy source:
public OptiqPreparingStmt(CatalogReader catalogReader,RelDataTypeFactory typeFactory,Schema schema){
  super(catalogReader);
  this.schema=schema;
  planner=new VolcanoPlanner();
  planner.addRelTraitDef(CallingConventionTraitDef.instance);
  RelOptUtil.registerAbstractRels(planner);
  planner.addRule(JavaRules.ENUMERABLE_JOIN_RULE);
  planner.addRule(JavaRules.ENUMERABLE_CALC_RULE);
  planner.addRule(JavaRules.ENUMERABLE_AGGREGATE_RULE);
  planner.addRule(JavaRules.ENUMERABLE_SORT_RULE);
  planner.addRule(JavaRules.ENUMERABLE_UNION_RULE);
  planner.addRule(JavaRules.ENUMERABLE_INTERSECT_RULE);
  planner.addRule(JavaRules.ENUMERABLE_MINUS_RULE);
  planner.addRule(JavaRules.ENUMERABLE_TABLE_MODIFICATION_RULE);
  planner.addRule(TableAccessRule.instance);
  planner.addRule(PushFilterPastJoinRule.instance);
  planner.addRule(RemoveDistinctAggregateRule.instance);
  rexBuilder=new RexBuilder(typeFactory);
}

Fixed version (ground truth):
public OptiqPreparingStmt(CatalogReader catalogReader,RelDataTypeFactory typeFactory,Schema schema){
  super(catalogReader);
  this.schema=schema;
  planner=new VolcanoPlanner();
  planner.addRelTraitDef(CallingConventionTraitDef.instance);
  RelOptUtil.registerAbstractRels(planner);
  planner.addRule(JavaRules.ENUMERABLE_JOIN_RULE);
  planner.addRule(JavaRules.ENUMERABLE_CALC_RULE);
  planner.addRule(JavaRules.ENUMERABLE_AGGREGATE_RULE);
  planner.addRule(JavaRules.ENUMERABLE_SORT_RULE);
  planner.addRule(JavaRules.ENUMERABLE_UNION_RULE);
  planner.addRule(JavaRules.ENUMERABLE_INTERSECT_RULE);
  planner.addRule(JavaRules.ENUMERABLE_MINUS_RULE);
  planner.addRule(JavaRules.ENUMERABLE_TABLE_MODIFICATION_RULE);
  planner.addRule(JavaRules.ENUMERABLE_VALUES_RULE);
  planner.addRule(TableAccessRule.instance);
  planner.addRule(PushFilterPastProjectRule.instance);
  planner.addRule(PushFilterPastJoinRule.instance);
  planner.addRule(RemoveDistinctAggregateRule.instance);
  rexBuilder=new RexBuilder(typeFactory);
}
Program: 111910
Project: 111910
Buggy source:
private Expression translate0(RexNode expr){
  if (expr instanceof RexInputRef) {
    final Expression input=getInput(0);
    final int index=((RexInputRef)expr).getIndex();
    final List<RelDataTypeField> fields=program.getInputRowType().getFieldList();
    final RelDataTypeField field=fields.get(index);
    if (fields.size() == 1) {
      return input;
    }
 else     if (input.getType() == Object[].class) {
      return Expressions.convert_(Expressions.arrayIndex(input,Expressions.constant(field.getIndex())),Types.box(JavaRules.EnumUtil.javaClass(typeFactory,field.getType())));
    }
 else     if (Types.isPrimitive(Types.unbox(input.getType())) || input.getType() == String.class) {
      return input;
    }
 else {
      return Expressions.field(input,field.getName());
    }
  }
  if (expr instanceof RexLocalRef) {
    return translate(program.getExprList().get(((RexLocalRef)expr).getIndex()));
  }
  if (expr instanceof RexLiteral) {
    Type javaClass=typeFactory.getJavaClass(expr.getType());
    if (javaClass == BigDecimal.class) {
      return Expressions.new_(BigDecimal.class,Arrays.<Expression>asList(Expressions.constant(((RexLiteral)expr).getValue3().toString())));
    }
    return Expressions.constant(((RexLiteral)expr).getValue3(),javaClass);
  }
  if (expr instanceof RexCall) {
    final RexCall call=(RexCall)expr;
    final SqlOperator operator=call.getOperator();
    CallImplementor implementor=ImpTable.INSTANCE.get(operator);
    if (implementor != null) {
      return implementor.implement(this,call);
    }
  }
switch (expr.getKind()) {
default :
    throw new RuntimeException("String_Node_Str" + expr);
}
}

Fixed version (ground truth):
private Expression translate0(RexNode expr){
  if (expr instanceof RexInputRef) {
    final Expression input=getInput(0);
    final int index=((RexInputRef)expr).getIndex();
    final List<RelDataTypeField> fields=program.getInputRowType().getFieldList();
    final RelDataTypeField field=fields.get(index);
    if (fields.size() == 1) {
      return input;
    }
 else     if (input.getType() == Object[].class) {
      return Expressions.convert_(Expressions.arrayIndex(input,Expressions.constant(field.getIndex())),Types.box(JavaRules.EnumUtil.javaClass(typeFactory,field.getType())));
    }
 else     if (Types.isPrimitive(Types.unbox(input.getType())) || input.getType() == String.class) {
      return input;
    }
 else {
      return Expressions.field(input,field.getName());
    }
  }
  if (expr instanceof RexLocalRef) {
    return translate(program.getExprList().get(((RexLocalRef)expr).getIndex()));
  }
  if (expr instanceof RexLiteral) {
    return translateLiteral(expr,typeFactory);
  }
  if (expr instanceof RexCall) {
    final RexCall call=(RexCall)expr;
    final SqlOperator operator=call.getOperator();
    CallImplementor implementor=ImpTable.INSTANCE.get(operator);
    if (implementor != null) {
      return implementor.implement(this,call);
    }
  }
switch (expr.getKind()) {
default :
    throw new RuntimeException("String_Node_Str" + expr);
}
}
Program: 111911
Project: 111911
Buggy source:
/** 
 * @return true if all tuples match rowType; otherwise, assert on mismatch
 */
private boolean assertRowType(){
  for (  List<RexLiteral> tuple : tuples) {
    RelDataTypeField[] fields=rowType.getFields();
    assert(tuple.size() == fields.length);
    int i=0;
    for (    RexLiteral literal : tuple) {
      RelDataType fieldType=fields[i++].getType();
      if (!RexLiteral.isNullLiteral(literal)) {
        assert(SqlTypeUtil.canAssignFrom(fieldType,literal.getType()));
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * @return true if all tuples match rowType; otherwise, assert on mismatch
 */
private boolean assertRowType(){
}
Program: 111912
Project: 111912
Buggy source:
private void adjustTextSize(){
  if (!_initiallized)   return;
  final int startSize=(int)_minTextSize;
  final int heightLimit=getMeasuredHeight() - getCompoundPaddingBottom() - getCompoundPaddingTop();
  _widthLimit=getMeasuredWidth() - getCompoundPaddingLeft() - getCompoundPaddingRight();
  if (_widthLimit <= 0)   return;
  _availableSpaceRect.right=_widthLimit;
  _availableSpaceRect.bottom=heightLimit;
  super.setTextSize(TypedValue.COMPLEX_UNIT_PX,efficientTextSizeSearch(startSize,(int)_maxTextSize,_sizeTester,_availableSpaceRect));
}

Fixed version (ground truth):
private void adjustTextSize(){
  post(new Runnable(){
    @Override public void run(){
      if (!_initiallized)       return;
      final int startSize=(int)_minTextSize;
      final int heightLimit=getMeasuredHeight() - getCompoundPaddingBottom() - getCompoundPaddingTop();
      _widthLimit=getMeasuredWidth() - getCompoundPaddingLeft() - getCompoundPaddingRight();
      if (_widthLimit <= 0)       return;
      _availableSpaceRect.right=_widthLimit;
      _availableSpaceRect.bottom=heightLimit;
      superSetTextSize(startSize);
    }
  }
);
}
Program: 111913
Project: 111913
Buggy source:
private void adjustTextSize(){
  if (!_initiallized)   return;
  final int startSize=(int)_minTextSize;
  final int heightLimit=getMeasuredHeight() - getCompoundPaddingBottom() - getCompoundPaddingTop();
  _widthLimit=getMeasuredWidth() - getCompoundPaddingLeft() - getCompoundPaddingRight();
  _availableSpaceRect.right=_widthLimit;
  _availableSpaceRect.bottom=heightLimit;
  super.setTextSize(TypedValue.COMPLEX_UNIT_PX,efficientTextSizeSearch(startSize,(int)_maxTextSize,_sizeTester,_availableSpaceRect));
}

Fixed version (ground truth):
private void adjustTextSize(){
  if (!_initiallized)   return;
  final int startSize=(int)_minTextSize;
  final int heightLimit=getMeasuredHeight() - getCompoundPaddingBottom() - getCompoundPaddingTop();
  _widthLimit=getMeasuredWidth() - getCompoundPaddingLeft() - getCompoundPaddingRight();
  if (_widthLimit <= 0)   return;
  _availableSpaceRect.right=_widthLimit;
  _availableSpaceRect.bottom=heightLimit;
  super.setTextSize(TypedValue.COMPLEX_UNIT_PX,efficientTextSizeSearch(startSize,(int)_maxTextSize,_sizeTester,_availableSpaceRect));
}
Program: 111914
Project: 111914
Buggy source:
public void dismiss(){
  if (mDismissed) {
    return;
  }
  mDismissed=true;
  FragmentTransaction ft=getFragmentManager().beginTransaction();
  ft.remove(this);
  ft.commit();
}

Fixed version (ground truth):
public void dismiss(){
  if (mDismissed) {
    return;
  }
  mDismissed=true;
  getFragmentManager().popBackStack();
  FragmentTransaction ft=getFragmentManager().beginTransaction();
  ft.remove(this);
  ft.commit();
}
Program: 111915
Project: 111915
Buggy source:
private void startExitAnimation(){
  Util.animateAlpha(mBgView,0f,mAnimDuration,null);
  Util.animateAlpha(mBlurImgView,0f,mAnimDuration,new Runnable(){
    @Override public void run(){
      mRoot.removeView(mBgView);
      mRoot.removeView(mBlurImgView);
    }
  }
);
}

Fixed version (ground truth):
private void startExitAnimation(){
  Util.animateAlpha(mBgView,1f,0f,mAnimDuration,null);
  Util.animateAlpha(mBlurImgView,1f,0f,mAnimDuration,new Runnable(){
    @Override public void run(){
      mRoot.removeView(mBlurImgView);
      mRoot.removeView(mBgView);
    }
  }
);
}
Program: 111916
Project: 111916
Buggy source:
@Override public void run(){
  mRoot.removeView(mBgView);
  mRoot.removeView(mBlurImgView);
}

Fixed version (ground truth):
@Override public void run(){
  mRoot.removeView(mBlurImgView);
  mRoot.removeView(mBgView);
}
Program: 111917
Project: 111917
Buggy source:
private void startEnterAnimation(){
  Util.animateAlpha(mBgView,1f,mAnimDuration,null);
  Util.animateAlpha(mBlurImgView,1f,mAnimDuration,null);
}

Fixed version (ground truth):
private void startEnterAnimation(){
  Util.animateAlpha(mBgView,0f,1f,mAnimDuration,null);
  Util.animateAlpha(mBlurImgView,0f,1f,mAnimDuration,null);
}
Program: 111918
Project: 111918
Buggy source:
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1) public static void animateAlpha(View view,float toAlpha,int duration,final Runnable endAction){
  if (isPostHoneycomb()) {
    ViewPropertyAnimator animator=view.animate().alpha(toAlpha).setDuration(duration);
    if (endAction != null) {
      animator.setListener(new AnimatorListenerAdapter(){
        public void onAnimationEnd(        Animator animation){
          endAction.run();
        }
      }
);
    }
  }
 else {
    AlphaAnimation alphaAnimation=new AlphaAnimation(0f,toAlpha);
    alphaAnimation.setDuration(duration);
    alphaAnimation.setFillAfter(true);
    if (endAction != null) {
      alphaAnimation.setAnimationListener(new Animation.AnimationListener(){
        @Override public void onAnimationEnd(        Animation animation){
          endAction.run();
        }
        @Override public void onAnimationStart(        Animation animation){
        }
        @Override public void onAnimationRepeat(        Animation animation){
        }
      }
);
    }
    view.startAnimation(alphaAnimation);
  }
}

Fixed version (ground truth):
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1) public static void animateAlpha(final View view,float fromAlpha,float toAlpha,int duration,final Runnable endAction){
  if (isPostHoneycomb()) {
    ViewPropertyAnimator animator=view.animate().alpha(toAlpha).setDuration(duration);
    if (endAction != null) {
      animator.setListener(new AnimatorListenerAdapter(){
        public void onAnimationEnd(        Animator animation){
          endAction.run();
        }
      }
);
    }
  }
 else {
    AlphaAnimation alphaAnimation=new AlphaAnimation(fromAlpha,toAlpha);
    alphaAnimation.setDuration(duration);
    alphaAnimation.setFillAfter(true);
    if (endAction != null) {
      alphaAnimation.setAnimationListener(new Animation.AnimationListener(){
        @Override public void onAnimationEnd(        Animation animation){
          Handler handler=new Handler();
          handler.post(endAction);
        }
        @Override public void onAnimationStart(        Animation animation){
        }
        @Override public void onAnimationRepeat(        Animation animation){
        }
      }
);
    }
    view.startAnimation(alphaAnimation);
  }
}
Program: 111919
Project: 111919
Buggy source:
@Override public void onAnimationEnd(Animation animation){
  endAction.run();
}

Fixed version (ground truth):
@Override public void onAnimationEnd(Animation animation){
  Handler handler=new Handler();
  handler.post(endAction);
}
Program: 111920
Project: 111920
Buggy source:
@Override public void onDrawerOpened(View drawerView){
  super.onDrawerOpened(drawerView);
  if (!isAdded()) {
    return;
  }
  if (!mUserLearnedDrawer) {
    mUserLearnedDrawer=true;
    SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(getActivity());
    sp.edit().putBoolean(PREF_USER_LEARNED_DRAWER,true).apply();
  }
  getActivity().supportInvalidateOptionsMenu();
}

Fixed version (ground truth):
@Override public void onDrawerOpened(View drawerView){
  super.onDrawerOpened(drawerView);
  if (!isAdded()) {
    return;
  }
  if (!mUserLearnedDrawer) {
    mUserLearnedDrawer=true;
    SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(getActivity());
    sp.edit().putBoolean(PREF_USER_LEARNED_DRAWER,true).commit();
  }
  getActivity().supportInvalidateOptionsMenu();
}
Program: 111922
Project: 111922
Buggy source:
private static void addType(String t,Tokenizer st,Types.GroupBuilder builder){
  Repetition repetition=asRepetition(t,st);
  String type=st.nextToken();
  if ("String_Node_Str".equalsIgnoreCase(type)) {
    addGroupType(t,st,repetition,builder);
  }
 else {
    addPrimitiveType(t,st,asPrimitive(type,st),repetition,builder);
  }
}

Fixed version (ground truth):
private static void addType(String t,Tokenizer st,Types.GroupBuilder builder){
  Repetition repetition=asRepetition(t,st);
  String type=st.nextToken();
  if ("String_Node_Str".equalsIgnoreCase(type)) {
    addGroupType(st,repetition,builder);
  }
 else {
    addPrimitiveType(st,asPrimitive(type,st),repetition,builder);
  }
}
Program: 111924
Project: 111924
Buggy source:
private static void addGroupType(String t,Tokenizer st,Repetition r,GroupBuilder<?> builder){
  GroupBuilder<?> childBuilder=builder.group(r);
  String name=st.nextToken();
  t=st.nextToken();
  OriginalType originalType=null;
  if (t.equalsIgnoreCase("String_Node_Str")) {
    originalType=OriginalType.valueOf(st.nextToken());
    childBuilder.as(originalType);
    check(st.nextToken(),"String_Node_Str","String_Node_Str",st);
    t=st.nextToken();
  }
  if (t.equals("String_Node_Str")) {
    childBuilder.id(Integer.parseInt(st.nextToken()));
    t=st.nextToken();
  }
  try {
    addGroupTypeFields(t,st,childBuilder);
  }
 catch (  IllegalArgumentException e) {
    throw new IllegalArgumentException("String_Node_Str" + name + "String_Node_Str"+ originalType,e);
  }
  childBuilder.named(name);
}

Fixed version (ground truth):
private static void addGroupType(Tokenizer st,Repetition r,GroupBuilder<?> builder){
  GroupBuilder<?> childBuilder=builder.group(r);
  String t;
  String name=st.nextToken();
  t=st.nextToken();
  OriginalType originalType=null;
  if (t.equalsIgnoreCase("String_Node_Str")) {
    originalType=OriginalType.valueOf(st.nextToken());
    childBuilder.as(originalType);
    check(st.nextToken(),"String_Node_Str","String_Node_Str",st);
    t=st.nextToken();
  }
  if (t.equals("String_Node_Str")) {
    childBuilder.id(Integer.parseInt(st.nextToken()));
    t=st.nextToken();
  }
  try {
    addGroupTypeFields(t,st,childBuilder);
  }
 catch (  IllegalArgumentException e) {
    throw new IllegalArgumentException("String_Node_Str" + name + "String_Node_Str"+ originalType,e);
  }
  childBuilder.named(name);
}
Program: 111925
Project: 111925
Buggy source:
static OriginalType getOriginalType(ConvertedType type){
switch (type) {
case UTF8:
    return OriginalType.UTF8;
case MAP:
  return OriginalType.MAP;
case MAP_KEY_VALUE:
return OriginalType.MAP_KEY_VALUE;
case LIST:
return OriginalType.LIST;
case ENUM:
return OriginalType.ENUM;
case DECIMAL:
return OriginalType.DECIMAL;
case DATE:
return OriginalType.DATE;
case TIME_MILLIS:
return OriginalType.TIME_MILLIS;
case TIMESTAMP_MILLIS:
return OriginalType.TIMESTAMP_MILLIS;
case INTERVAL:
return OriginalType.INTERVAL;
case INT_8:
return OriginalType.INT_8;
case INT_16:
return OriginalType.INT_16;
case INT_32:
return OriginalType.INT_32;
case INT_64:
return OriginalType.INT_64;
case UINT_8:
return OriginalType.UINT_8;
case UINT_16:
return OriginalType.UINT_16;
case UINT_32:
return OriginalType.UINT_32;
case UINT_64:
return OriginalType.UINT_64;
case JSON:
return OriginalType.JSON;
case BSON:
return OriginalType.BSON;
default :
throw new RuntimeException("String_Node_Str" + type);
}
}

Fixed version (ground truth):
OriginalType getOriginalType(ConvertedType type){
switch (type) {
case UTF8:
    return OriginalType.UTF8;
case MAP:
  return OriginalType.MAP;
case MAP_KEY_VALUE:
return OriginalType.MAP_KEY_VALUE;
case LIST:
return OriginalType.LIST;
case ENUM:
return OriginalType.ENUM;
case DECIMAL:
return OriginalType.DECIMAL;
case DATE:
return OriginalType.DATE;
case TIME_MILLIS:
return OriginalType.TIME_MILLIS;
case TIMESTAMP_MILLIS:
return OriginalType.TIMESTAMP_MILLIS;
case INTERVAL:
return OriginalType.INTERVAL;
case INT_8:
return OriginalType.INT_8;
case INT_16:
return OriginalType.INT_16;
case INT_32:
return OriginalType.INT_32;
case INT_64:
return OriginalType.INT_64;
case UINT_8:
return OriginalType.UINT_8;
case UINT_16:
return OriginalType.UINT_16;
case UINT_32:
return OriginalType.UINT_32;
case UINT_64:
return OriginalType.UINT_64;
case JSON:
return OriginalType.JSON;
case BSON:
return OriginalType.BSON;
default :
throw new RuntimeException("String_Node_Str" + type);
}
}
Program: 111926
Project: 111926
Buggy source:
public static void writeDataPageV2Header(int uncompressedSize,int compressedSize,int valueCount,int nullCount,int rowCount,org.apache.parquet.column.statistics.Statistics statistics,org.apache.parquet.column.Encoding dataEncoding,int rlByteLength,int dlByteLength,OutputStream to) throws IOException {
  writePageHeader(newDataPageV2Header(uncompressedSize,compressedSize,valueCount,nullCount,rowCount,statistics,dataEncoding,rlByteLength,dlByteLength),to);
}

Fixed version (ground truth):
public void writeDataPageV2Header(int uncompressedSize,int compressedSize,int valueCount,int nullCount,int rowCount,org.apache.parquet.column.statistics.Statistics statistics,org.apache.parquet.column.Encoding dataEncoding,int rlByteLength,int dlByteLength,OutputStream to) throws IOException {
  writePageHeader(newDataPageV2Header(uncompressedSize,compressedSize,valueCount,nullCount,rowCount,statistics,dataEncoding,rlByteLength,dlByteLength),to);
}
Program: 111927
Project: 111927
Buggy source:
static MessageType fromParquetSchema(List<SchemaElement> schema){
  Iterator<SchemaElement> iterator=schema.iterator();
  SchemaElement root=iterator.next();
  Types.MessageTypeBuilder builder=Types.buildMessage();
  buildChildren(builder,iterator,root.getNum_children());
  return builder.named(root.name);
}

Fixed version (ground truth):
MessageType fromParquetSchema(List<SchemaElement> schema){
  Iterator<SchemaElement> iterator=schema.iterator();
  SchemaElement root=iterator.next();
  Types.MessageTypeBuilder builder=Types.buildMessage();
  buildChildren(builder,iterator,root.getNum_children());
  return builder.named(root.name);
}
Program: 111928
Project: 111928
Buggy source:
public static void writeDictionaryPageHeader(int uncompressedSize,int compressedSize,int valueCount,org.apache.parquet.column.Encoding valuesEncoding,OutputStream to) throws IOException {
  PageHeader pageHeader=new PageHeader(PageType.DICTIONARY_PAGE,uncompressedSize,compressedSize);
  pageHeader.setDictionary_page_header(new DictionaryPageHeader(valueCount,getEncoding(valuesEncoding)));
  writePageHeader(pageHeader,to);
}

Fixed version (ground truth):
public void writeDictionaryPageHeader(int uncompressedSize,int compressedSize,int valueCount,org.apache.parquet.column.Encoding valuesEncoding,OutputStream to) throws IOException {
  PageHeader pageHeader=new PageHeader(PageType.DICTIONARY_PAGE,uncompressedSize,compressedSize);
  pageHeader.setDictionary_page_header(new DictionaryPageHeader(valueCount,getEncoding(valuesEncoding)));
  writePageHeader(pageHeader,to);
}
Program: 111929
Project: 111929
Buggy source:
private static PageHeader newDataPageV2Header(int uncompressedSize,int compressedSize,int valueCount,int nullCount,int rowCount,org.apache.parquet.column.statistics.Statistics<?> statistics,org.apache.parquet.column.Encoding dataEncoding,int rlByteLength,int dlByteLength){
  DataPageHeaderV2 dataPageHeaderV2=new DataPageHeaderV2(valueCount,nullCount,rowCount,getEncoding(dataEncoding),dlByteLength,rlByteLength);
  if (!statistics.isEmpty()) {
    dataPageHeaderV2.setStatistics(toParquetStatistics(statistics));
  }
  PageHeader pageHeader=new PageHeader(PageType.DATA_PAGE_V2,uncompressedSize,compressedSize);
  pageHeader.setData_page_header_v2(dataPageHeaderV2);
  return pageHeader;
}

Fixed version (ground truth):
private PageHeader newDataPageV2Header(int uncompressedSize,int compressedSize,int valueCount,int nullCount,int rowCount,org.apache.parquet.column.statistics.Statistics<?> statistics,org.apache.parquet.column.Encoding dataEncoding,int rlByteLength,int dlByteLength){
  DataPageHeaderV2 dataPageHeaderV2=new DataPageHeaderV2(valueCount,nullCount,rowCount,getEncoding(dataEncoding),dlByteLength,rlByteLength);
  if (!statistics.isEmpty()) {
    dataPageHeaderV2.setStatistics(toParquetStatistics(statistics));
  }
  PageHeader pageHeader=new PageHeader(PageType.DATA_PAGE_V2,uncompressedSize,compressedSize);
  pageHeader.setData_page_header_v2(dataPageHeaderV2);
  return pageHeader;
}
Program: 111931
Project: 111931
Buggy source:
public static Encoding getEncoding(org.apache.parquet.column.Encoding encoding){
  return Encoding.valueOf(encoding.name());
}

Fixed version (ground truth):
public Encoding getEncoding(org.apache.parquet.column.Encoding encoding){
  return Encoding.valueOf(encoding.name());
}
Program: 111932
Project: 111932
Buggy source:
public static FileMetaData toParquetMetadata(int currentVersion,ParquetMetadata parquetMetadata){
  List<BlockMetaData> blocks=parquetMetadata.getBlocks();
  List<RowGroup> rowGroups=new ArrayList<RowGroup>();
  int numRows=0;
  for (  BlockMetaData block : blocks) {
    numRows+=block.getRowCount();
    addRowGroup(parquetMetadata,rowGroups,block);
  }
  FileMetaData fileMetaData=new FileMetaData(currentVersion,toParquetSchema(parquetMetadata.getFileMetaData().getSchema()),numRows,rowGroups);
  Set<Entry<String,String>> keyValues=parquetMetadata.getFileMetaData().getKeyValueMetaData().entrySet();
  for (  Entry<String,String> keyValue : keyValues) {
    addKeyValue(fileMetaData,keyValue.getKey(),keyValue.getValue());
  }
  fileMetaData.setCreated_by(parquetMetadata.getFileMetaData().getCreatedBy());
  return fileMetaData;
}

Fixed version (ground truth):
public FileMetaData toParquetMetadata(int currentVersion,ParquetMetadata parquetMetadata){
  List<BlockMetaData> blocks=parquetMetadata.getBlocks();
  List<RowGroup> rowGroups=new ArrayList<RowGroup>();
  int numRows=0;
  for (  BlockMetaData block : blocks) {
    numRows+=block.getRowCount();
    addRowGroup(parquetMetadata,rowGroups,block);
  }
  FileMetaData fileMetaData=new FileMetaData(currentVersion,toParquetSchema(parquetMetadata.getFileMetaData().getSchema()),numRows,rowGroups);
  Set<Entry<String,String>> keyValues=parquetMetadata.getFileMetaData().getKeyValueMetaData().entrySet();
  for (  Entry<String,String> keyValue : keyValues) {
    addKeyValue(fileMetaData,keyValue.getKey(),keyValue.getValue());
  }
  fileMetaData.setCreated_by(parquetMetadata.getFileMetaData().getCreatedBy());
  return fileMetaData;
}
Program: 111933
Project: 111933
Buggy source:
static FieldRepetitionType toParquetRepetition(Repetition repetition){
  return FieldRepetitionType.valueOf(repetition.name());
}

Fixed version (ground truth):
FieldRepetitionType toParquetRepetition(Repetition repetition){
  return FieldRepetitionType.valueOf(repetition.name());
}
Program: 111934
Project: 111934
Buggy source:
public static void writeDataPageHeader(int uncompressedSize,int compressedSize,int valueCount,org.apache.parquet.column.statistics.Statistics statistics,org.apache.parquet.column.Encoding rlEncoding,org.apache.parquet.column.Encoding dlEncoding,org.apache.parquet.column.Encoding valuesEncoding,OutputStream to) throws IOException {
  writePageHeader(newDataPageHeader(uncompressedSize,compressedSize,valueCount,statistics,rlEncoding,dlEncoding,valuesEncoding),to);
}

Fixed version (ground truth):
public void writeDataPageHeader(int uncompressedSize,int compressedSize,int valueCount,org.apache.parquet.column.statistics.Statistics statistics,org.apache.parquet.column.Encoding rlEncoding,org.apache.parquet.column.Encoding dlEncoding,org.apache.parquet.column.Encoding valuesEncoding,OutputStream to) throws IOException {
  writePageHeader(newDataPageHeader(uncompressedSize,compressedSize,valueCount,statistics,rlEncoding,dlEncoding,valuesEncoding),to);
}
Program: 111935
Project: 111935
Buggy source:
public static PrimitiveTypeName getPrimitive(Type type){
switch (type) {
case BYTE_ARRAY:
    return PrimitiveTypeName.BINARY;
case INT64:
  return PrimitiveTypeName.INT64;
case INT32:
return PrimitiveTypeName.INT32;
case BOOLEAN:
return PrimitiveTypeName.BOOLEAN;
case FLOAT:
return PrimitiveTypeName.FLOAT;
case DOUBLE:
return PrimitiveTypeName.DOUBLE;
case INT96:
return PrimitiveTypeName.INT96;
case FIXED_LEN_BYTE_ARRAY:
return PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY;
default :
throw new RuntimeException("String_Node_Str" + type);
}
}

Fixed version (ground truth):
public PrimitiveTypeName getPrimitive(Type type){
switch (type) {
case BYTE_ARRAY:
    return PrimitiveTypeName.BINARY;
case INT64:
  return PrimitiveTypeName.INT64;
case INT32:
return PrimitiveTypeName.INT32;
case BOOLEAN:
return PrimitiveTypeName.BOOLEAN;
case FLOAT:
return PrimitiveTypeName.FLOAT;
case DOUBLE:
return PrimitiveTypeName.DOUBLE;
case INT96:
return PrimitiveTypeName.INT96;
case FIXED_LEN_BYTE_ARRAY:
return PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY;
default :
throw new RuntimeException("String_Node_Str" + type);
}
}
Program: 111936
Project: 111936
Buggy source:
public static ParquetMetadata readParquetMetadata(final InputStream from,MetadataFilter filter) throws IOException {
  FileMetaData fileMetaData=filter.accept(new MetadataFilterVisitor<FileMetaData,IOException>(){
    @Override public FileMetaData visit(    NoFilter filter) throws IOException {
      return readFileMetaData(from);
    }
    @Override public FileMetaData visit(    SkipMetadataFilter filter) throws IOException {
      return readFileMetaData(from,true);
    }
    @Override public FileMetaData visit(    RangeMetadataFilter filter) throws IOException {
      return filterFileMetaData(readFileMetaData(from),filter);
    }
  }
);
  if (Log.DEBUG)   LOG.debug(fileMetaData);
  ParquetMetadata parquetMetadata=fromParquetMetadata(fileMetaData);
  if (Log.DEBUG)   LOG.debug(ParquetMetadata.toPrettyJSON(parquetMetadata));
  return parquetMetadata;
}

Fixed version (ground truth):
public ParquetMetadata readParquetMetadata(final InputStream from,MetadataFilter filter) throws IOException {
  FileMetaData fileMetaData=filter.accept(new MetadataFilterVisitor<FileMetaData,IOException>(){
    @Override public FileMetaData visit(    NoFilter filter) throws IOException {
      return readFileMetaData(from);
    }
    @Override public FileMetaData visit(    SkipMetadataFilter filter) throws IOException {
      return readFileMetaData(from,true);
    }
    @Override public FileMetaData visit(    RangeMetadataFilter filter) throws IOException {
      return filterFileMetaData(readFileMetaData(from),filter);
    }
  }
);
  if (Log.DEBUG)   LOG.debug(fileMetaData);
  ParquetMetadata parquetMetadata=fromParquetMetadata(fileMetaData);
  if (Log.DEBUG)   LOG.debug(ParquetMetadata.toPrettyJSON(parquetMetadata));
  return parquetMetadata;
}
Program: 111937
Project: 111937
Buggy source:
private static PageHeader newDataPageHeader(int uncompressedSize,int compressedSize,int valueCount,org.apache.parquet.column.statistics.Statistics statistics,org.apache.parquet.column.Encoding rlEncoding,org.apache.parquet.column.Encoding dlEncoding,org.apache.parquet.column.Encoding valuesEncoding){
  PageHeader pageHeader=new PageHeader(PageType.DATA_PAGE,uncompressedSize,compressedSize);
  pageHeader.setData_page_header(new DataPageHeader(valueCount,getEncoding(valuesEncoding),getEncoding(dlEncoding),getEncoding(rlEncoding)));
  if (!statistics.isEmpty()) {
    pageHeader.getData_page_header().setStatistics(toParquetStatistics(statistics));
  }
  return pageHeader;
}

Fixed version (ground truth):
private PageHeader newDataPageHeader(int uncompressedSize,int compressedSize,int valueCount,org.apache.parquet.column.statistics.Statistics statistics,org.apache.parquet.column.Encoding rlEncoding,org.apache.parquet.column.Encoding dlEncoding,org.apache.parquet.column.Encoding valuesEncoding){
  PageHeader pageHeader=new PageHeader(PageType.DATA_PAGE,uncompressedSize,compressedSize);
  pageHeader.setData_page_header(new DataPageHeader(valueCount,getEncoding(valuesEncoding),getEncoding(dlEncoding),getEncoding(rlEncoding)));
  if (!statistics.isEmpty()) {
    pageHeader.getData_page_header().setStatistics(toParquetStatistics(statistics));
  }
  return pageHeader;
}
Program: 111938
Project: 111938
Buggy source:
static Repetition fromParquetRepetition(FieldRepetitionType repetition){
  return Repetition.valueOf(repetition.name());
}

Fixed version (ground truth):
Repetition fromParquetRepetition(FieldRepetitionType repetition){
  return Repetition.valueOf(repetition.name());
}
Program: 111939
Project: 111939
Buggy source:
static List<SchemaElement> toParquetSchema(MessageType schema){
  List<SchemaElement> result=new ArrayList<SchemaElement>();
  addToList(result,schema);
  return result;
}

Fixed version (ground truth):
List<SchemaElement> toParquetSchema(MessageType schema){
  List<SchemaElement> result=new ArrayList<SchemaElement>();
  addToList(result,schema);
  return result;
}
Program: 111940
Project: 111940
Buggy source:
private static List<Encoding> toFormatEncodings(Set<org.apache.parquet.column.Encoding> encodings){
  List<Encoding> converted=new ArrayList<Encoding>(encodings.size());
  for (  org.apache.parquet.column.Encoding encoding : encodings) {
    converted.add(getEncoding(encoding));
  }
  return converted;
}

Fixed version (ground truth):
private List<Encoding> toFormatEncodings(Set<org.apache.parquet.column.Encoding> encodings){
  List<Encoding> converted=new ArrayList<Encoding>(encodings.size());
  for (  org.apache.parquet.column.Encoding encoding : encodings) {
    converted.add(getEncoding(encoding));
  }
  return converted;
}
Program: 111941
Project: 111941
Buggy source:
private static void buildChildren(Types.GroupBuilder builder,Iterator<SchemaElement> schema,int childrenCount){
  for (int i=0; i < childrenCount; i++) {
    SchemaElement schemaElement=schema.next();
    Types.Builder childBuilder;
    if (schemaElement.type != null) {
      Types.PrimitiveBuilder primitiveBuilder=builder.primitive(getPrimitive(schemaElement.type),fromParquetRepetition(schemaElement.repetition_type));
      if (schemaElement.isSetType_length()) {
        primitiveBuilder.length(schemaElement.type_length);
      }
      if (schemaElement.isSetPrecision()) {
        primitiveBuilder.precision(schemaElement.precision);
      }
      if (schemaElement.isSetScale()) {
        primitiveBuilder.scale(schemaElement.scale);
      }
      childBuilder=primitiveBuilder;
    }
 else {
      childBuilder=builder.group(fromParquetRepetition(schemaElement.repetition_type));
      buildChildren((Types.GroupBuilder)childBuilder,schema,schemaElement.num_children);
    }
    if (schemaElement.isSetConverted_type()) {
      childBuilder.as(getOriginalType(schemaElement.converted_type));
    }
    if (schemaElement.isSetField_id()) {
      childBuilder.id(schemaElement.field_id);
    }
    childBuilder.named(schemaElement.name);
  }
}

Fixed version (ground truth):
private void buildChildren(Types.GroupBuilder builder,Iterator<SchemaElement> schema,int childrenCount){
  for (int i=0; i < childrenCount; i++) {
    SchemaElement schemaElement=schema.next();
    Types.Builder childBuilder;
    if (schemaElement.type != null) {
      Types.PrimitiveBuilder primitiveBuilder=builder.primitive(getPrimitive(schemaElement.type),fromParquetRepetition(schemaElement.repetition_type));
      if (schemaElement.isSetType_length()) {
        primitiveBuilder.length(schemaElement.type_length);
      }
      if (schemaElement.isSetPrecision()) {
        primitiveBuilder.precision(schemaElement.precision);
      }
      if (schemaElement.isSetScale()) {
        primitiveBuilder.scale(schemaElement.scale);
      }
      childBuilder=primitiveBuilder;
    }
 else {
      childBuilder=builder.group(fromParquetRepetition(schemaElement.repetition_type));
      buildChildren((Types.GroupBuilder)childBuilder,schema,schemaElement.num_children);
    }
    if (schemaElement.isSetConverted_type()) {
      childBuilder.as(getOriginalType(schemaElement.converted_type));
    }
    if (schemaElement.isSetField_id()) {
      childBuilder.id(schemaElement.field_id);
    }
    childBuilder.named(schemaElement.name);
  }
}
Program: 111942
Project: 111942
Buggy source:
private static void addRowGroup(ParquetMetadata parquetMetadata,List<RowGroup> rowGroups,BlockMetaData block){
  List<ColumnChunkMetaData> columns=block.getColumns();
  List<ColumnChunk> parquetColumns=new ArrayList<ColumnChunk>();
  for (  ColumnChunkMetaData columnMetaData : columns) {
    ColumnChunk columnChunk=new ColumnChunk(columnMetaData.getFirstDataPageOffset());
    columnChunk.file_path=block.getPath();
    columnChunk.meta_data=new ColumnMetaData(getType(columnMetaData.getType()),toFormatEncodings(columnMetaData.getEncodings()),Arrays.asList(columnMetaData.getPath().toArray()),columnMetaData.getCodec().getParquetCompressionCodec(),columnMetaData.getValueCount(),columnMetaData.getTotalUncompressedSize(),columnMetaData.getTotalSize(),columnMetaData.getFirstDataPageOffset());
    columnChunk.meta_data.dictionary_page_offset=columnMetaData.getDictionaryPageOffset();
    if (!columnMetaData.getStatistics().isEmpty()) {
      columnChunk.meta_data.setStatistics(toParquetStatistics(columnMetaData.getStatistics()));
    }
    parquetColumns.add(columnChunk);
  }
  RowGroup rowGroup=new RowGroup(parquetColumns,block.getTotalByteSize(),block.getRowCount());
  rowGroups.add(rowGroup);
}

Fixed version (ground truth):
private void addRowGroup(ParquetMetadata parquetMetadata,List<RowGroup> rowGroups,BlockMetaData block){
  List<ColumnChunkMetaData> columns=block.getColumns();
  List<ColumnChunk> parquetColumns=new ArrayList<ColumnChunk>();
  for (  ColumnChunkMetaData columnMetaData : columns) {
    ColumnChunk columnChunk=new ColumnChunk(columnMetaData.getFirstDataPageOffset());
    columnChunk.file_path=block.getPath();
    columnChunk.meta_data=new ColumnMetaData(getType(columnMetaData.getType()),toFormatEncodings(columnMetaData.getEncodings()),Arrays.asList(columnMetaData.getPath().toArray()),columnMetaData.getCodec().getParquetCompressionCodec(),columnMetaData.getValueCount(),columnMetaData.getTotalUncompressedSize(),columnMetaData.getTotalSize(),columnMetaData.getFirstDataPageOffset());
    columnChunk.meta_data.dictionary_page_offset=columnMetaData.getDictionaryPageOffset();
    if (!columnMetaData.getStatistics().isEmpty()) {
      columnChunk.meta_data.setStatistics(toParquetStatistics(columnMetaData.getStatistics()));
    }
    parquetColumns.add(columnChunk);
  }
  RowGroup rowGroup=new RowGroup(parquetColumns,block.getTotalByteSize(),block.getRowCount());
  rowGroups.add(rowGroup);
}