nus-yam/ex-repair huggingface dataset:
Program: 10472
Project: 10472
Buggy source:
/** 
 * gets custom slider
 * @return slider 
 */
private UISlider getCustomSlider(){
  if (customSlider == null) {
    CGRect frame=new CGRect(0.0,12.0,130.0,SLIDER_HEIGHT);
    customSlider=new UISlider(frame);
    customSlider.addOnValueChangedListener(new UIControl.OnValueChangedListener(){
      @Override public void onValueChanged(      UIControl control){
        System.err.println("String_Node_Str" + customSlider.getValue());
      }
    }
);
    customSlider.setBackgroundColor(UIColor.clear());
    UIImage stetchLeftTrack=UIImage.createFromBundle("String_Node_Str");
    stetchLeftTrack=stetchLeftTrack.newStretchable(10l,0l);
    UIImage stetchRightTrack=UIImage.createFromBundle("String_Node_Str");
    stetchRightTrack=stetchRightTrack.newStretchable(10l,0l);
    customSlider.setThumbImage(UIImage.createFromBundle("String_Node_Str"),UIControlState.Normal);
    customSlider.setMinimumTrackImage(stetchLeftTrack,UIControlState.Normal);
    customSlider.setMaximumTrackImage(stetchRightTrack,UIControlState.Normal);
    customSlider.setMinimumValue(0.0f);
    customSlider.setMaximumValue(100.0f);
    customSlider.setContinuous(true);
    customSlider.setValue(50.0f);
  }
  return customSlider;
}

Fixed version (ground truth):
/** 
 * gets custom slider
 * @return slider 
 */
private UISlider getCustomSlider(){
  if (customSlider == null) {
    CGRect frame=new CGRect(0.0,12.0,130.0,SLIDER_HEIGHT);
    customSlider=new UISlider(frame);
    customSlider.addOnValueChangedListener(new UIControl.OnValueChangedListener(){
      @Override public void onValueChanged(      UIControl control){
        System.err.println("String_Node_Str" + customSlider.getValue());
      }
    }
);
    customSlider.setBackgroundColor(UIColor.clear());
    UIImage stetchLeftTrack=UIImage.createFromBundle("String_Node_Str");
    stetchLeftTrack=stetchLeftTrack.createStretchable(10l,0l);
    UIImage stetchRightTrack=UIImage.createFromBundle("String_Node_Str");
    stetchRightTrack=stetchRightTrack.createStretchable(10l,0l);
    customSlider.setThumbImage(UIImage.createFromBundle("String_Node_Str"),UIControlState.Normal);
    customSlider.setMinimumTrackImage(stetchLeftTrack,UIControlState.Normal);
    customSlider.setMaximumTrackImage(stetchRightTrack,UIControlState.Normal);
    customSlider.setMinimumValue(0.0f);
    customSlider.setMaximumValue(100.0f);
    customSlider.setContinuous(true);
    customSlider.setValue(50.0f);
  }
  return customSlider;
}
Program: 10473
Project: 10473
Buggy source:
@Override public void viewWillAppear(boolean animated){
  super.viewWillAppear(animated);
  Selector willShow=Selector.register("String_Node_Str");
  Selector willHide=Selector.register("String_Node_Str");
  NSNotificationCenter center=NSNotificationCenter.getDefaultCenter();
  center.addObserver(this,willShow,UIKit.KeyboardWillShowNotification(),null);
  center.addObserver(this,willHide,UIKit.KeyboardWillHideNotification(),null);
}

Fixed version (ground truth):
@Override public void viewWillAppear(boolean animated){
  super.viewWillAppear(animated);
  keyboardWillShowObserver=UIWindow.Notifications.observeKeyboardWillShow(new VoidBlock1<UIKeyboardAnimation>(){
    @Override public void invoke(    UIKeyboardAnimation a){
      adjustViewForKeyboardReveal(true,a);
    }
  }
);
  keyboardWillHideObserver=UIWindow.Notifications.observeKeyboardWillHide(new VoidBlock1<UIKeyboardAnimation>(){
    @Override public void invoke(    UIKeyboardAnimation a){
      adjustViewForKeyboardReveal(false,a);
    }
  }
);
}
Program: 10474
Project: 10474
Buggy source:
@Override public void viewDidDisappear(boolean animated){
  super.viewDidDisappear(animated);
  NSNotificationCenter.getDefaultCenter().removeObserver(UIKit.KeyboardWillShowNotification());
  NSNotificationCenter.getDefaultCenter().removeObserver(UIKit.KeyboardWillHideNotification());
}

Fixed version (ground truth):
@Override public void viewDidDisappear(boolean animated){
  super.viewDidDisappear(animated);
  NSNotificationCenter.getDefaultCenter().removeObserver(keyboardWillShowObserver);
  NSNotificationCenter.getDefaultCenter().removeObserver(keyboardWillHideObserver);
}
Program: 10475
Project: 10475
Buggy source:
/** 
 * Modifies keyboards size to fit screen
 * @param showKeyboard
 * @param notificationInfo 
 */
private void adjustViewForKeyboardReveal(boolean showKeyboard,NSDictionary<NSString,?> notificationInfo){
  CGRect keyboardRect=NSValueExtensions.getRectValue((NSValue)notificationInfo.get(UIKit.KeyboardFrameEndUserInfoKey()));
  double animationDuration=((NSNumber)notificationInfo.get(UIKit.KeyboardAnimationDurationUserInfoKey())).doubleValue();
  CGRect frame=this.textView.getFrame();
  double adjustDelta=isPortrait(this.getInterfaceOrientation()) ? keyboardRect.getHeight() : keyboardRect.getWidth();
  if (showKeyboard) {
    frame.size().height(frame.size().height() - adjustDelta);
  }
 else {
    frame.size().height(frame.size().height() + adjustDelta);
  }
  UIView.beginAnimations("String_Node_Str",null);
  UIView.setDurationForAnimation(animationDuration);
  this.textView.setFrame(frame);
  UIView.commitAnimations();
}

Fixed version (ground truth):
/** 
 * Modifies keyboards size to fit screen.
 * @param showKeyboard
 * @param notificationInfo 
 */
private void adjustViewForKeyboardReveal(boolean showKeyboard,UIKeyboardAnimation animation){
  CGRect keyboardRect=animation.getEndFrame();
  double animationDuration=animation.getAnimationDuration();
  CGRect frame=this.textView.getFrame();
  double adjustDelta=isPortrait(this.getInterfaceOrientation()) ? keyboardRect.getHeight() : keyboardRect.getWidth();
  if (showKeyboard) {
    frame.size().height(frame.size().height() - adjustDelta);
  }
 else {
    frame.size().height(frame.size().height() + adjustDelta);
  }
  UIView.beginAnimations("String_Node_Str",null);
  UIView.setDurationForAnimation(animationDuration);
  this.textView.setFrame(frame);
  UIView.commitAnimations();
}
Program: 10478
Project: 10478
Buggy source:
@Override public boolean didFinishLaunching(UIApplication application,UIApplicationLaunchOptions launchOptions){
  tabBarController=new UITabBarController();
  getLocationViewController=new GetLocationViewController();
  UINavigationController getLocationController=new UINavigationController(getLocationViewController);
  getLocationController.getTabBarItem().setTitle("String_Node_Str");
  getLocationController.getTabBarItem().setImage(UIImage.createFromBundle("String_Node_Str"));
  tabBarController.addChildViewController(getLocationController);
  trackLocationViewController=new TrackLocationViewController();
  UINavigationController trackLocationController=new UINavigationController(trackLocationViewController);
  trackLocationController.getTabBarItem().setTitle("String_Node_Str");
  trackLocationController.getTabBarItem().setImage(UIImage.createFromBundle("String_Node_Str"));
  tabBarController.addChildViewController(trackLocationController);
  window=new UIWindow(UIScreen.getMainScreen().getBounds());
  window.setRootViewController(tabBarController);
  window.makeKeyAndVisible();
  if (!CLLocationManager.isLocationServicesEnabled()) {
    UIAlertView servicesDisabledAlert=new UIAlertView("String_Node_Str","String_Node_Str",null,"String_Node_Str");
    servicesDisabledAlert.show();
  }
  addStrongRef(window);
  return true;
}

Fixed version (ground truth):
@Override public boolean didFinishLaunching(UIApplication application,UIApplicationLaunchOptions launchOptions){
  tabBarController=new UITabBarController();
  getLocationViewController=new GetLocationViewController();
  UINavigationController getLocationController=new UINavigationController(getLocationViewController);
  getLocationController.getTabBarItem().setTitle("String_Node_Str");
  getLocationController.getTabBarItem().setImage(UIImage.create("String_Node_Str"));
  tabBarController.addChildViewController(getLocationController);
  trackLocationViewController=new TrackLocationViewController();
  UINavigationController trackLocationController=new UINavigationController(trackLocationViewController);
  trackLocationController.getTabBarItem().setTitle("String_Node_Str");
  trackLocationController.getTabBarItem().setImage(UIImage.create("String_Node_Str"));
  tabBarController.addChildViewController(trackLocationController);
  window=new UIWindow(UIScreen.getMainScreen().getBounds());
  window.setRootViewController(tabBarController);
  window.makeKeyAndVisible();
  if (!CLLocationManager.isLocationServicesEnabled()) {
    UIAlertView servicesDisabledAlert=new UIAlertView("String_Node_Str","String_Node_Str",null,"String_Node_Str");
    servicesDisabledAlert.show();
  }
  addStrongRef(window);
  return true;
}
Program: 10480
Project: 10480
Buggy source:
public MyLocalMovieViewController(){
  super();
  UIView view=getView();
  view.setBackgroundColor(UIColor.fromWhiteAlpha(0.66,1));
  imageView=new MyImageView(new CGRect(57,59,205,135));
  imageView.setMovieViewController(this);
  imageView.setUserInteractionEnabled(true);
  imageView.setImage(UIImage.createFromBundle("String_Node_Str"));
  imageView.setContentMode(UIViewContentMode.ScaleAspectFit);
  view.addSubview(imageView);
  playButton=UIButton.create(UIButtonType.RoundedRect);
  playButton.setFrame(new CGRect(106,201,108,44));
  playButton.setBackgroundColor(UIColor.fromWhiteAlpha(0.66,0.5));
  playButton.setTitle("String_Node_Str",UIControlState.Normal);
  playButton.getTitleLabel().setFont(UIFont.getSystemFont(18));
  playButton.addOnTouchUpInsideListener(new UIControl.OnTouchUpInsideListener(){
    @Override public void onTouchUpInside(    UIControl control,    UIEvent event){
      playLocalMovieFile();
    }
  }
);
  view.addSubview(playButton);
  setTabBarItem(new UITabBarItem("String_Node_Str",UIImage.createFromBundle("String_Node_Str"),0));
}

Fixed version (ground truth):
public MyLocalMovieViewController(){
  super();
  UIView view=getView();
  view.setBackgroundColor(UIColor.fromWhiteAlpha(0.66,1));
  imageView=new MyImageView(new CGRect(57,59,205,135));
  imageView.setMovieViewController(this);
  imageView.setUserInteractionEnabled(true);
  imageView.setImage(UIImage.create("String_Node_Str"));
  imageView.setContentMode(UIViewContentMode.ScaleAspectFit);
  view.addSubview(imageView);
  playButton=UIButton.create(UIButtonType.RoundedRect);
  playButton.setFrame(new CGRect(106,201,108,44));
  playButton.setBackgroundColor(UIColor.fromWhiteAlpha(0.66,0.5));
  playButton.setTitle("String_Node_Str",UIControlState.Normal);
  playButton.getTitleLabel().setFont(UIFont.getSystemFont(18));
  playButton.addOnTouchUpInsideListener(new UIControl.OnTouchUpInsideListener(){
    @Override public void onTouchUpInside(    UIControl control,    UIEvent event){
      playLocalMovieFile();
    }
  }
);
  view.addSubview(playButton);
  setTabBarItem(new UITabBarItem("String_Node_Str",UIImage.create("String_Node_Str"),0));
}
Program: 10481
Project: 10481
Buggy source:
public MyMovieViewController(){
  super();
  movieBackgroundImageView=new UIImageView(UIImage.createFromBundle("String_Node_Str"));
  movieBackgroundImageView.setFrame(new CGRect(0,0,240,128));
  backgroundView=new UIView(new CGRect(0,0,320,460));
  backgroundView.setBackgroundColor(UIColor.fromWhiteAlpha(0.66,1));
  overlayController=new MyOverlayViewController(this);
  if (Integer.valueOf(UIDevice.getCurrentDevice().getSystemVersion().substring(0,1)) >= 7) {
    setEdgesForExtendedLayout(UIRectEdge.None);
  }
}

Fixed version (ground truth):
public MyMovieViewController(){
  super();
  movieBackgroundImageView=new UIImageView(UIImage.create("String_Node_Str"));
  movieBackgroundImageView.setFrame(new CGRect(0,0,240,128));
  backgroundView=new UIView(new CGRect(0,0,320,460));
  backgroundView.setBackgroundColor(UIColor.fromWhiteAlpha(0.66,1));
  overlayController=new MyOverlayViewController(this);
  if (Integer.valueOf(UIDevice.getCurrentDevice().getSystemVersion().substring(0,1)) >= 7) {
    setEdgesForExtendedLayout(UIRectEdge.None);
  }
}
Program: 10484
Project: 10484
Buggy source:
/** 
 * Called when users tap "Display and Edit Contact" in the application. Searches for a contact named "Appleseed" in in the address book. Displays and allows editing of all information associated with that contact if the search is successful. Shows an alert, otherwise. 
 */
private void showPersonViewController(){
  NSArray<?> people=this.addressBook.getPeople("String_Node_Str");
  if ((people != null) && !people.isEmpty()) {
    ABPerson person=people.get(0).as(ABPerson.class);
    ABPersonViewController picker=new ABPersonViewController();
    picker.setPersonViewDelegate(this);
    picker.setDisplayedPerson(person);
    picker.setAllowsEditing(true);
    this.getNavigationController().pushViewController(picker,true);
  }
 else {
    UIAlertView alert=new UIAlertView("String_Node_Str","String_Node_Str",null,"String_Node_Str",new String[0]);
    alert.show();
  }
}

Fixed version (ground truth):
/** 
 * Called when users tap "Display and Edit Contact" in the application. Searches for a contact named "Appleseed" in in the address book. Displays and allows editing of all information associated with that contact if the search is successful. Shows an alert, otherwise. 
 */
private void showPersonViewController(){
  List<ABPerson> people=this.addressBook.getPeople("String_Node_Str");
  if ((people != null) && !people.isEmpty()) {
    ABPerson person=people.get(0).as(ABPerson.class);
    ABPersonViewController picker=new ABPersonViewController();
    picker.setPersonViewDelegate(this);
    picker.setDisplayedPerson(person);
    picker.setAllowsEditing(true);
    this.getNavigationController().pushViewController(picker,true);
  }
 else {
    UIAlertView alert=new UIAlertView("String_Node_Str","String_Node_Str",null,"String_Node_Str",new String[0]);
    alert.show();
  }
}
Program: 10485
Project: 10485
Buggy source:
@Override public void viewWillDisappear(boolean animated){
  this.currentPicker.setHidden(animated);
}

Fixed version (ground truth):
@Override public void viewWillDisappear(boolean animated){
  super.viewWillDisappear(animated);
  this.currentPicker.setHidden(true);
}
Program: 10486
Project: 10486
Buggy source:
@Override public void onActivityResumed(Activity activity){
  new LoadFrontCameraAsyncTask(this).load();
}

Fixed version (ground truth):
@Override public void onActivityResumed(){
  cameraStrategy.loadCamera(this);
}
Program: 10487
Project: 10487
Buggy source:
public static void retrieve(Context context,Listener listener){
  Application application=(Application)context.getApplicationContext();
  FrontCameraRetriever frontCameraRetriever=new FrontCameraRetriever(listener);
  application.registerActivityLifecycleCallbacks(frontCameraRetriever);
}

Fixed version (ground truth):
public static void retrieve(Activity activity,Listener listener){
  Application application=(Application)activity.getApplicationContext();
  FrontCameraRetriever frontCameraRetriever=new FrontCameraRetriever(listener);
  UniqueActivityLifecycleCallbacks callbacks=UniqueActivityLifecycleCallbacks.newInstance(activity,frontCameraRetriever);
  application.registerActivityLifecycleCallbacks(callbacks);
  frontCameraRetriever.cameraStrategy=new ActuallyGetCameraStrategy();
  if (!RETRIEVERS.isEmpty()) {
    FrontCameraRetriever latestRetriever=RETRIEVERS.get(RETRIEVERS.size() - 1);
    if (latestRetriever != null) {
      latestRetriever.cameraStrategy=new DontGetCameraStrategy();
    }
  }
  RETRIEVERS.add(frontCameraRetriever);
}
Program: 10488
Project: 10488
Buggy source:
@Override public void onActivityPaused(Activity activity){
  if (camera != null) {
    camera.recycle();
  }
}

Fixed version (ground truth):
@Override public void onActivityPaused(){
  if (camera != null) {
    cameraStrategy.disposeCamera(camera);
  }
}
Program: 10489
Project: 10489
Buggy source:
@Override public void onActivityDestroyed(Activity activity){
  activity.getApplication().unregisterActivityLifecycleCallbacks(this);
}

Fixed version (ground truth):
@Override public void onActivityDestroyed(){
  RETRIEVERS.remove(RETRIEVERS.size() - 1);
  if (!RETRIEVERS.isEmpty()) {
    FrontCameraRetriever latestRetriever=RETRIEVERS.get(RETRIEVERS.size() - 1);
    if (latestRetriever != null) {
      latestRetriever.cameraStrategy=new ActuallyGetCameraStrategy();
    }
  }
}
Program: 10491
Project: 10491
Buggy source:
private void measureHorizontal(int widthMeasureSpec,int heightMeasureSpec){
  int wSize=MeasureSpec.getSize(widthMeasureSpec) - (getPaddingLeft() + getPaddingRight());
  if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.UNSPECIFIED)   wSize=Integer.MAX_VALUE;
  int count=getChildCount();
  int rowWidth=0;
  int totalHeight=0;
  int rowMaxHeight=0;
  int childWidth;
  int childHeight;
  int maxRowHeight=getPaddingTop() + getPaddingBottom();
  for (int i=0; i < count; i++) {
    final View child=getChildAt(i);
    if (child.getVisibility() != GONE) {
      measureChildWithMargins(child,widthMeasureSpec,0,heightMeasureSpec,0);
      final LayoutParams lp=(LayoutParams)child.getLayoutParams();
      childWidth=child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin;
      childHeight=child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin;
      rowMaxHeight=Math.max(rowMaxHeight,childHeight);
      if (childWidth + rowWidth > wSize) {
        totalHeight+=rowMaxHeight;
        maxRowHeight=Math.max(maxRowHeight,rowWidth);
        rowWidth=childWidth;
        rowMaxHeight=childHeight;
      }
 else {
        rowWidth+=childWidth;
      }
    }
  }
  if (rowWidth != 0) {
    maxRowHeight=Math.max(maxRowHeight,rowWidth);
    totalHeight+=rowMaxHeight;
  }
  if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.UNSPECIFIED)   wSize=maxRowHeight - (getPaddingLeft() + getPaddingRight());
  setMeasuredDimension(resolveSize(wSize,widthMeasureSpec),resolveSize(totalHeight + getPaddingTop() + getPaddingBottom(),heightMeasureSpec));
}

Fixed version (ground truth):
private void measureHorizontal(int widthMeasureSpec,int heightMeasureSpec){
  int wSize=MeasureSpec.getSize(widthMeasureSpec) - (getPaddingLeft() + getPaddingRight());
  if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.UNSPECIFIED)   wSize=Integer.MAX_VALUE;
  int count=getChildCount();
  int rowWidth=0;
  int totalHeight=0;
  int rowMaxHeight=0;
  int childWidth;
  int childHeight;
  int maxRowWidth=getPaddingLeft() + getPaddingRight();
  for (int i=0; i < count; i++) {
    final View child=getChildAt(i);
    if (child.getVisibility() != GONE) {
      measureChildWithMargins(child,widthMeasureSpec,0,heightMeasureSpec,0);
      final LayoutParams lp=(LayoutParams)child.getLayoutParams();
      childWidth=child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin;
      childHeight=child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin;
      rowMaxHeight=Math.max(rowMaxHeight,childHeight);
      if (childWidth + rowWidth > wSize) {
        totalHeight+=rowMaxHeight;
        maxRowWidth=Math.max(maxRowWidth,rowWidth);
        rowWidth=childWidth;
        rowMaxHeight=childHeight;
      }
 else {
        rowWidth+=childWidth;
      }
    }
  }
  if (rowWidth != 0) {
    maxRowWidth=Math.max(maxRowWidth,rowWidth);
    totalHeight+=rowMaxHeight;
  }
  if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.UNSPECIFIED)   wSize=maxRowWidth + (getPaddingLeft() + getPaddingRight());
  setMeasuredDimension(resolveSize(wSize,widthMeasureSpec),resolveSize(totalHeight + getPaddingTop() + getPaddingBottom(),heightMeasureSpec));
}
Program: 10492
Project: 10492
Buggy source:
/** 
 * Updates children positions. Takes cares about gravity and layout gravity. Finally layout children to parent if needed. Analog to vertical.
 * @param width parent width
 * @param totalSize total horizontal size used by children in a row
 * @param row row number
 * @param maxChildHeight the biggest child height
 */
private void updateChildPositionHorizontal(int width,int totalSize,int row,int maxChildHeight){
  for (int i=0; i < mListPositions.size(); i++) {
    ViewPosition pos=mListPositions.get(i);
    final View child=getChildAt(i);
    if (mOrientation == VERTICAL || pos.position == row) {
      updateLeftPositionByGravity(pos,width - totalSize,mGravity);
    }
    if (mOrientation == HORIZONTAL && pos.position == row) {
      LayoutParams lp=(LayoutParams)child.getLayoutParams();
      int size=maxChildHeight - child.getMeasuredHeight() - lp.topMargin- lp.bottomMargin;
      updateTopPositionByGravity(pos,size,lp.gravity);
    }
    if (mOrientation == VERTICAL)     layout(child,pos);
  }
}

Fixed version (ground truth):
/** 
 * Updates children positions. Takes cares about gravity and layout gravity. Finally layout children to parent if needed. Analog to vertical.
 * @param parentWidth parent parentWidth
 * @param totalSize total horizontal size used by children in a row
 * @param row row number
 * @param maxChildHeight the biggest child height
 */
private void updateChildPositionHorizontal(int parentWidth,int totalSize,int row,int maxChildHeight){
  for (int i=0; i < mListPositions.size(); i++) {
    ViewPosition pos=mListPositions.get(i);
    final View child=getChildAt(i);
    if (mOrientation == VERTICAL || pos.position == row) {
      updateLeftPositionByGravity(pos,parentWidth - totalSize,mGravity);
    }
    if (mOrientation == HORIZONTAL && pos.position == row) {
      LayoutParams lp=(LayoutParams)child.getLayoutParams();
      int size=maxChildHeight - child.getMeasuredHeight() - lp.topMargin- lp.bottomMargin;
      updateTopPositionByGravity(pos,size,lp.gravity);
    }
    if (mOrientation == VERTICAL)     layout(child,pos);
  }
}
Program: 10493
Project: 10493
Buggy source:
/** 
 * Updates children positions. Takes cares about gravity and layout gravity. Finally layout children to parent if needed.
 * @param height parent height
 * @param totalSize total vertical size used by children in a column
 * @param column column number
 * @param maxChildWidth the biggest child width
 */
private void updateChildPositionVertical(int height,int totalSize,int column,int maxChildWidth){
  for (int i=0; i < mListPositions.size(); i++) {
    ViewPosition pos=mListPositions.get(i);
    final View child=getChildAt(i);
    if (mOrientation == HORIZONTAL || pos.position == column) {
      updateTopPositionByGravity(pos,height - totalSize,mGravity);
    }
    if (mOrientation == VERTICAL && pos.position == column) {
      LayoutParams lp=(LayoutParams)child.getLayoutParams();
      int size=maxChildWidth - child.getMeasuredWidth() - lp.leftMargin- lp.rightMargin;
      updateLeftPositionByGravity(pos,size,lp.gravity);
    }
    if (mOrientation == HORIZONTAL)     layout(child,pos);
  }
}

Fixed version (ground truth):
/** 
 * Updates children positions. Takes cares about gravity and layout gravity. Finally layout children to parent if needed.
 * @param parentHeight parent parentHeight
 * @param totalSize total vertical size used by children in a column
 * @param column column number
 * @param maxChildWidth the biggest child width
 */
private void updateChildPositionVertical(int parentHeight,int totalSize,int column,int maxChildWidth){
  for (int i=0; i < mListPositions.size(); i++) {
    ViewPosition pos=mListPositions.get(i);
    final View child=getChildAt(i);
    if (mOrientation == HORIZONTAL || pos.position == column) {
      updateTopPositionByGravity(pos,parentHeight - totalSize,mGravity);
    }
    if (mOrientation == VERTICAL && pos.position == column) {
      LayoutParams lp=(LayoutParams)child.getLayoutParams();
      int size=maxChildWidth - child.getMeasuredWidth() - lp.leftMargin- lp.rightMargin;
      updateLeftPositionByGravity(pos,size,lp.gravity);
    }
    if (mOrientation == HORIZONTAL)     layout(child,pos);
  }
}
Program: 10496
Project: 10496
Buggy source:
private void measureHorizontal(int widthMeasureSpec,int heightMeasureSpec){
  int wSize=MeasureSpec.getSize(widthMeasureSpec) - (getPaddingLeft() + getPaddingRight());
  if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.UNSPECIFIED)   wSize=Integer.MAX_VALUE;
  int count=getChildCount();
  int rowWidth=0;
  int totalHeight=0;
  int rowMaxHeight=0;
  int childWidth;
  int childHeight;
  int maxRowHeight=getPaddingTop() + getPaddingBottom();
  for (int i=0; i < count; i++) {
    final View child=getChildAt(i);
    if (child.getVisibility() != GONE) {
      measureChildWithMargins(child,widthMeasureSpec,0,heightMeasureSpec,0);
      final LayoutParams lp=(LayoutParams)child.getLayoutParams();
      childWidth=child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin;
      childHeight=child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin;
      rowMaxHeight=Math.max(rowMaxHeight,childHeight);
      if (childWidth + rowWidth > wSize) {
        totalHeight+=rowMaxHeight;
        maxRowHeight=Math.max(maxRowHeight,rowWidth);
        rowWidth=childWidth;
        rowMaxHeight=childHeight;
      }
 else {
        rowWidth+=childWidth;
      }
    }
  }
  if (rowWidth != 0) {
    maxRowHeight=Math.max(maxRowHeight,rowWidth);
    totalHeight+=rowMaxHeight;
  }
  if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.UNSPECIFIED)   wSize=maxRowHeight - (getPaddingLeft() + getPaddingRight());
  setMeasuredDimension(resolveSize(wSize,widthMeasureSpec),resolveSize(totalHeight + getPaddingTop() + getPaddingBottom(),heightMeasureSpec));
}

Fixed version (ground truth):
private void measureHorizontal(int widthMeasureSpec,int heightMeasureSpec){
  int wSize=MeasureSpec.getSize(widthMeasureSpec) - (getPaddingLeft() + getPaddingRight());
  if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.UNSPECIFIED)   wSize=Integer.MAX_VALUE;
  int count=getChildCount();
  int rowWidth=0;
  int totalHeight=0;
  int rowMaxHeight=0;
  int childWidth;
  int childHeight;
  int maxRowWidth=getPaddingLeft() + getPaddingRight();
  for (int i=0; i < count; i++) {
    final View child=getChildAt(i);
    if (child.getVisibility() != GONE) {
      measureChildWithMargins(child,widthMeasureSpec,0,heightMeasureSpec,0);
      final LayoutParams lp=(LayoutParams)child.getLayoutParams();
      childWidth=child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin;
      childHeight=child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin;
      rowMaxHeight=Math.max(rowMaxHeight,childHeight);
      if (childWidth + rowWidth > wSize) {
        totalHeight+=rowMaxHeight;
        maxRowWidth=Math.max(maxRowWidth,rowWidth);
        rowWidth=childWidth;
        rowMaxHeight=childHeight;
      }
 else {
        rowWidth+=childWidth;
      }
    }
  }
  if (rowWidth != 0) {
    maxRowWidth=Math.max(maxRowWidth,rowWidth);
    totalHeight+=rowMaxHeight;
  }
  if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.UNSPECIFIED)   wSize=maxRowWidth + (getPaddingLeft() + getPaddingRight());
  setMeasuredDimension(resolveSize(wSize,widthMeasureSpec),resolveSize(totalHeight + getPaddingTop() + getPaddingBottom(),heightMeasureSpec));
}
Program: 10497
Project: 10497
Buggy source:
/** 
 * Updates children positions. Takes cares about gravity and layout gravity. Finally layout children to parent if needed. Analog to vertical.
 * @param width parent width
 * @param totalSize total horizontal size used by children in a row
 * @param row row number
 * @param maxChildHeight the biggest child height
 */
private void updateChildPositionHorizontal(int width,int totalSize,int row,int maxChildHeight){
  for (int i=0; i < mListPositions.size(); i++) {
    ViewPosition pos=mListPositions.get(i);
    final View child=getChildAt(i);
    if (mOrientation == VERTICAL || pos.position == row) {
      updateLeftPositionByGravity(pos,width - totalSize,mGravity);
    }
    if (mOrientation == HORIZONTAL && pos.position == row) {
      LayoutParams lp=(LayoutParams)child.getLayoutParams();
      int size=maxChildHeight - child.getMeasuredHeight() - lp.topMargin- lp.bottomMargin;
      updateTopPositionByGravity(pos,size,lp.gravity);
    }
    if (mOrientation == VERTICAL)     layout(child,pos);
  }
}

Fixed version (ground truth):
/** 
 * Updates children positions. Takes cares about gravity and layout gravity. Finally layout children to parent if needed. Analog to vertical.
 * @param parentWidth parent parentWidth
 * @param totalSize total horizontal size used by children in a row
 * @param row row number
 * @param maxChildHeight the biggest child height
 */
private void updateChildPositionHorizontal(int parentWidth,int totalSize,int row,int maxChildHeight){
  for (int i=0; i < mListPositions.size(); i++) {
    ViewPosition pos=mListPositions.get(i);
    final View child=getChildAt(i);
    if (mOrientation == VERTICAL || pos.position == row) {
      updateLeftPositionByGravity(pos,parentWidth - totalSize,mGravity);
    }
    if (mOrientation == HORIZONTAL && pos.position == row) {
      LayoutParams lp=(LayoutParams)child.getLayoutParams();
      int size=maxChildHeight - child.getMeasuredHeight() - lp.topMargin- lp.bottomMargin;
      updateTopPositionByGravity(pos,size,lp.gravity);
    }
    if (mOrientation == VERTICAL)     layout(child,pos);
  }
}
Program: 10498
Project: 10498
Buggy source:
/** 
 * Updates children positions. Takes cares about gravity and layout gravity. Finally layout children to parent if needed.
 * @param height parent height
 * @param totalSize total vertical size used by children in a column
 * @param column column number
 * @param maxChildWidth the biggest child width
 */
private void updateChildPositionVertical(int height,int totalSize,int column,int maxChildWidth){
  for (int i=0; i < mListPositions.size(); i++) {
    ViewPosition pos=mListPositions.get(i);
    final View child=getChildAt(i);
    if (mOrientation == HORIZONTAL || pos.position == column) {
      updateTopPositionByGravity(pos,height - totalSize,mGravity);
    }
    if (mOrientation == VERTICAL && pos.position == column) {
      LayoutParams lp=(LayoutParams)child.getLayoutParams();
      int size=maxChildWidth - child.getMeasuredWidth() - lp.leftMargin- lp.rightMargin;
      updateLeftPositionByGravity(pos,size,lp.gravity);
    }
    if (mOrientation == HORIZONTAL)     layout(child,pos);
  }
}

Fixed version (ground truth):
/** 
 * Updates children positions. Takes cares about gravity and layout gravity. Finally layout children to parent if needed.
 * @param parentHeight parent parentHeight
 * @param totalSize total vertical size used by children in a column
 * @param column column number
 * @param maxChildWidth the biggest child width
 */
private void updateChildPositionVertical(int parentHeight,int totalSize,int column,int maxChildWidth){
  for (int i=0; i < mListPositions.size(); i++) {
    ViewPosition pos=mListPositions.get(i);
    final View child=getChildAt(i);
    if (mOrientation == HORIZONTAL || pos.position == column) {
      updateTopPositionByGravity(pos,parentHeight - totalSize,mGravity);
    }
    if (mOrientation == VERTICAL && pos.position == column) {
      LayoutParams lp=(LayoutParams)child.getLayoutParams();
      int size=maxChildWidth - child.getMeasuredWidth() - lp.leftMargin- lp.rightMargin;
      updateLeftPositionByGravity(pos,size,lp.gravity);
    }
    if (mOrientation == HORIZONTAL)     layout(child,pos);
  }
}
Program: 10500
Project: 10500
Buggy source:
private void measureHorizontal(int widthMeasureSpec,int heightMeasureSpec){
  int wSize=MeasureSpec.getSize(widthMeasureSpec) - (getPaddingLeft() + getPaddingRight());
  if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.UNSPECIFIED)   wSize=Integer.MAX_VALUE;
  int count=getChildCount();
  int rowWidth=0;
  int totalHeight=0;
  int rowMaxHeight=0;
  int childWidth;
  int childHeight;
  int maxRowHeight=getPaddingTop() + getPaddingBottom();
  for (int i=0; i < count; i++) {
    final View child=getChildAt(i);
    if (child.getVisibility() != GONE) {
      measureChildWithMargins(child,widthMeasureSpec,0,heightMeasureSpec,0);
      final LayoutParams lp=(LayoutParams)child.getLayoutParams();
      childWidth=child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin;
      childHeight=child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin;
      rowMaxHeight=Math.max(rowMaxHeight,childHeight);
      if (childWidth + rowWidth > wSize) {
        totalHeight+=rowMaxHeight;
        maxRowHeight=Math.max(maxRowHeight,rowWidth);
        rowWidth=childWidth;
        rowMaxHeight=childHeight;
      }
 else {
        rowWidth+=childWidth;
      }
    }
  }
  if (rowWidth != 0) {
    maxRowHeight=Math.max(maxRowHeight,rowWidth);
    totalHeight+=rowMaxHeight;
  }
  if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.UNSPECIFIED)   wSize=maxRowHeight - (getPaddingLeft() + getPaddingRight());
  setMeasuredDimension(resolveSize(wSize,widthMeasureSpec),resolveSize(totalHeight + getPaddingTop() + getPaddingBottom(),heightMeasureSpec));
}

Fixed version (ground truth):
private void measureHorizontal(int widthMeasureSpec,int heightMeasureSpec){
  int wSize=MeasureSpec.getSize(widthMeasureSpec) - (getPaddingLeft() + getPaddingRight());
  if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.UNSPECIFIED)   wSize=Integer.MAX_VALUE;
  int count=getChildCount();
  int rowWidth=0;
  int totalHeight=0;
  int rowMaxHeight=0;
  int childWidth;
  int childHeight;
  int maxRowWidth=getPaddingLeft() + getPaddingRight();
  for (int i=0; i < count; i++) {
    final View child=getChildAt(i);
    if (child.getVisibility() != GONE) {
      measureChildWithMargins(child,widthMeasureSpec,0,heightMeasureSpec,0);
      final LayoutParams lp=(LayoutParams)child.getLayoutParams();
      childWidth=child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin;
      childHeight=child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin;
      rowMaxHeight=Math.max(rowMaxHeight,childHeight);
      if (childWidth + rowWidth > wSize) {
        totalHeight+=rowMaxHeight;
        maxRowWidth=Math.max(maxRowWidth,rowWidth);
        rowWidth=childWidth;
        rowMaxHeight=childHeight;
      }
 else {
        rowWidth+=childWidth;
      }
    }
  }
  if (rowWidth != 0) {
    maxRowWidth=Math.max(maxRowWidth,rowWidth);
    totalHeight+=rowMaxHeight;
  }
  if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.UNSPECIFIED)   wSize=maxRowWidth + (getPaddingLeft() + getPaddingRight());
  setMeasuredDimension(resolveSize(wSize,widthMeasureSpec),resolveSize(totalHeight + getPaddingTop() + getPaddingBottom(),heightMeasureSpec));
}
Program: 10502
Project: 10502
Buggy source:
/** 
 * Updates children positions. Takes cares about gravity and layout gravity. Finally layout children to parent if needed. Analog to vertical.
 * @param width parent width
 * @param totalSize total horizontal size used by children in a row
 * @param row row number
 * @param maxChildHeight the biggest child height
 */
private void updateChildPositionHorizontal(int width,int totalSize,int row,int maxChildHeight){
  for (int i=0; i < mListPositions.size(); i++) {
    ViewPosition pos=mListPositions.get(i);
    final View child=getChildAt(i);
    if (mOrientation == VERTICAL || pos.position == row) {
      updateLeftPositionByGravity(pos,width - totalSize,mGravity);
    }
    if (mOrientation == HORIZONTAL && pos.position == row) {
      LayoutParams lp=(LayoutParams)child.getLayoutParams();
      int size=maxChildHeight - child.getMeasuredHeight() - lp.topMargin- lp.bottomMargin;
      updateTopPositionByGravity(pos,size,lp.gravity);
    }
    if (mOrientation == VERTICAL)     layout(child,pos);
  }
}

Fixed version (ground truth):
/** 
 * Updates children positions. Takes cares about gravity and layout gravity. Finally layout children to parent if needed. Analog to vertical.
 * @param parentWidth parent parentWidth
 * @param totalSize total horizontal size used by children in a row
 * @param row row number
 * @param maxChildHeight the biggest child height
 */
private void updateChildPositionHorizontal(int parentWidth,int totalSize,int row,int maxChildHeight){
  for (int i=0; i < mListPositions.size(); i++) {
    ViewPosition pos=mListPositions.get(i);
    final View child=getChildAt(i);
    if (mOrientation == VERTICAL || pos.position == row) {
      updateLeftPositionByGravity(pos,parentWidth - totalSize,mGravity);
    }
    if (mOrientation == HORIZONTAL && pos.position == row) {
      LayoutParams lp=(LayoutParams)child.getLayoutParams();
      int size=maxChildHeight - child.getMeasuredHeight() - lp.topMargin- lp.bottomMargin;
      updateTopPositionByGravity(pos,size,lp.gravity);
    }
    if (mOrientation == VERTICAL)     layout(child,pos);
  }
}
Program: 10503
Project: 10503
Buggy source:
/** 
 * Updates children positions. Takes cares about gravity and layout gravity. Finally layout children to parent if needed.
 * @param height parent height
 * @param totalSize total vertical size used by children in a column
 * @param column column number
 * @param maxChildWidth the biggest child width
 */
private void updateChildPositionVertical(int height,int totalSize,int column,int maxChildWidth){
  for (int i=0; i < mListPositions.size(); i++) {
    ViewPosition pos=mListPositions.get(i);
    final View child=getChildAt(i);
    if (mOrientation == HORIZONTAL || pos.position == column) {
      updateTopPositionByGravity(pos,height - totalSize,mGravity);
    }
    if (mOrientation == VERTICAL && pos.position == column) {
      LayoutParams lp=(LayoutParams)child.getLayoutParams();
      int size=maxChildWidth - child.getMeasuredWidth() - lp.leftMargin- lp.rightMargin;
      updateLeftPositionByGravity(pos,size,lp.gravity);
    }
    if (mOrientation == HORIZONTAL)     layout(child,pos);
  }
}

Fixed version (ground truth):
/** 
 * Updates children positions. Takes cares about gravity and layout gravity. Finally layout children to parent if needed.
 * @param parentHeight parent parentHeight
 * @param totalSize total vertical size used by children in a column
 * @param column column number
 * @param maxChildWidth the biggest child width
 */
private void updateChildPositionVertical(int parentHeight,int totalSize,int column,int maxChildWidth){
  for (int i=0; i < mListPositions.size(); i++) {
    ViewPosition pos=mListPositions.get(i);
    final View child=getChildAt(i);
    if (mOrientation == HORIZONTAL || pos.position == column) {
      updateTopPositionByGravity(pos,parentHeight - totalSize,mGravity);
    }
    if (mOrientation == VERTICAL && pos.position == column) {
      LayoutParams lp=(LayoutParams)child.getLayoutParams();
      int size=maxChildWidth - child.getMeasuredWidth() - lp.leftMargin- lp.rightMargin;
      updateLeftPositionByGravity(pos,size,lp.gravity);
    }
    if (mOrientation == HORIZONTAL)     layout(child,pos);
  }
}
Program: 10504
Project: 10504
Buggy source:
private void measureVertical(int widthMeasureSpec,int heightMeasureSpec){
  int hSize=MeasureSpec.getSize(heightMeasureSpec) - (getPaddingTop() + getPaddingBottom());
  int count=getChildCount();
  int columnHeight=0;
  int totalWidth=0, maxColumnHeight=0;
  int columnMaxWidth=0;
  int childHeight;
  if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.UNSPECIFIED)   hSize=Integer.MAX_VALUE;
  for (int i=0; i < count; i++) {
    final View child=getChildAt(i);
    if (child.getVisibility() != GONE) {
      measureChildWithMargins(child,widthMeasureSpec,0,heightMeasureSpec,0);
      final LayoutParams lp=(LayoutParams)child.getLayoutParams();
      childHeight=child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin;
      columnMaxWidth=Math.max(columnMaxWidth,child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin);
      if (childHeight + columnHeight > hSize) {
        totalWidth+=columnMaxWidth;
        maxColumnHeight=Math.max(maxColumnHeight,columnHeight);
        columnHeight=childHeight;
        columnMaxWidth=0;
      }
 else {
        columnHeight+=childHeight;
      }
    }
  }
  if (columnHeight != 0) {
    maxColumnHeight=Math.max(maxColumnHeight,columnHeight);
    totalWidth+=columnMaxWidth;
  }
  if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.UNSPECIFIED)   hSize=maxColumnHeight - (getPaddingTop() + getPaddingBottom());
  setMeasuredDimension(resolveSize(totalWidth + getPaddingRight() + getPaddingLeft(),widthMeasureSpec),resolveSize(hSize,heightMeasureSpec));
}

Fixed version (ground truth):
private void measureVertical(int widthMeasureSpec,int heightMeasureSpec){
  int hSize=MeasureSpec.getSize(heightMeasureSpec) - (getPaddingTop() + getPaddingBottom());
  int count=getChildCount();
  int columnHeight=0;
  int totalWidth=0, maxColumnHeight=0;
  int columnMaxWidth=0;
  int childWidth;
  int childHeight;
  if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.UNSPECIFIED)   hSize=Integer.MAX_VALUE;
  for (int i=0; i < count; i++) {
    final View child=getChildAt(i);
    if (child.getVisibility() != GONE) {
      measureChildWithMargins(child,widthMeasureSpec,0,heightMeasureSpec,0);
      final LayoutParams lp=(LayoutParams)child.getLayoutParams();
      childWidth=child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin;
      childHeight=child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin;
      columnMaxWidth=Math.max(columnMaxWidth,childWidth);
      if (childHeight + columnHeight > hSize) {
        totalWidth+=columnMaxWidth;
        maxColumnHeight=Math.max(maxColumnHeight,columnHeight);
        columnHeight=childHeight;
        columnMaxWidth=childWidth;
      }
 else {
        columnHeight+=childHeight;
      }
    }
  }
  if (columnHeight != 0) {
    maxColumnHeight=Math.max(maxColumnHeight,columnHeight);
    totalWidth+=columnMaxWidth;
  }
  if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.UNSPECIFIED)   hSize=maxColumnHeight - (getPaddingTop() + getPaddingBottom());
  setMeasuredDimension(resolveSize(totalWidth + getPaddingRight() + getPaddingLeft(),widthMeasureSpec),resolveSize(hSize,heightMeasureSpec));
}
Program: 10505
Project: 10505
Buggy source:
private void measureHorizontal(int widthMeasureSpec,int heightMeasureSpec){
  int wSize=MeasureSpec.getSize(widthMeasureSpec) - (getPaddingLeft() + getPaddingRight());
  if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.UNSPECIFIED)   wSize=Integer.MAX_VALUE;
  int count=getChildCount();
  int rowWidth=0;
  int totalHeight=0;
  int rowMaxHeight=0;
  int childWidth;
  int maxRowHeight=getPaddingTop() + getPaddingBottom();
  for (int i=0; i < count; i++) {
    final View child=getChildAt(i);
    if (child.getVisibility() != GONE) {
      measureChildWithMargins(child,widthMeasureSpec,0,heightMeasureSpec,0);
      final LayoutParams lp=(LayoutParams)child.getLayoutParams();
      childWidth=child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin;
      rowMaxHeight=Math.max(rowMaxHeight,child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin);
      if (childWidth + rowWidth > wSize) {
        totalHeight+=rowMaxHeight;
        maxRowHeight=Math.max(maxRowHeight,rowWidth);
        rowWidth=childWidth;
        rowMaxHeight=0;
      }
 else {
        rowWidth+=childWidth;
      }
    }
  }
  if (rowWidth != 0) {
    maxRowHeight=Math.max(maxRowHeight,rowWidth);
    totalHeight+=rowMaxHeight;
  }
  if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.UNSPECIFIED)   wSize=maxRowHeight - (getPaddingLeft() + getPaddingRight());
  setMeasuredDimension(resolveSize(wSize,widthMeasureSpec),resolveSize(totalHeight + getPaddingTop() + getPaddingBottom(),heightMeasureSpec));
}

Fixed version (ground truth):
private void measureHorizontal(int widthMeasureSpec,int heightMeasureSpec){
  int wSize=MeasureSpec.getSize(widthMeasureSpec) - (getPaddingLeft() + getPaddingRight());
  if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.UNSPECIFIED)   wSize=Integer.MAX_VALUE;
  int count=getChildCount();
  int rowWidth=0;
  int totalHeight=0;
  int rowMaxHeight=0;
  int childWidth;
  int childHeight;
  int maxRowHeight=getPaddingTop() + getPaddingBottom();
  for (int i=0; i < count; i++) {
    final View child=getChildAt(i);
    if (child.getVisibility() != GONE) {
      measureChildWithMargins(child,widthMeasureSpec,0,heightMeasureSpec,0);
      final LayoutParams lp=(LayoutParams)child.getLayoutParams();
      childWidth=child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin;
      childHeight=child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin;
      rowMaxHeight=Math.max(rowMaxHeight,childHeight);
      if (childWidth + rowWidth > wSize) {
        totalHeight+=rowMaxHeight;
        maxRowHeight=Math.max(maxRowHeight,rowWidth);
        rowWidth=childWidth;
        rowMaxHeight=childHeight;
      }
 else {
        rowWidth+=childWidth;
      }
    }
  }
  if (rowWidth != 0) {
    maxRowHeight=Math.max(maxRowHeight,rowWidth);
    totalHeight+=rowMaxHeight;
  }
  if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.UNSPECIFIED)   wSize=maxRowHeight - (getPaddingLeft() + getPaddingRight());
  setMeasuredDimension(resolveSize(wSize,widthMeasureSpec),resolveSize(totalHeight + getPaddingTop() + getPaddingBottom(),heightMeasureSpec));
}
Program: 10506
Project: 10506
Buggy source:
@Test public void testTheCoreWithoutNettyBufferStack(){
  System.setProperty("String_Node_Str",new VersionCommand().getVersion());
  Stack stack=Stack.fromDescriptor(new File("String_Node_Str"));
  StackResolution resolution=new StackResolution(stack,root,new StackResolutionOptions().setFailOnConflicts(true));
  Map<String,File> resolved=resolution.resolve();
  assertThat(resolved).isNotEmpty().doesNotContainKey("String_Node_Str");
}

Fixed version (ground truth):
@Test public void testTheCoreWithoutNettyBufferStack(){
  Stack stack=Stack.fromDescriptor(new File("String_Node_Str"));
  StackResolution resolution=new StackResolution(stack,root,new StackResolutionOptions().setFailOnConflicts(true));
  Map<String,File> resolved=resolution.resolve();
  assertThat(resolved).isNotEmpty().doesNotContainKey("String_Node_Str");
}
Program: 10507
Project: 10507
Buggy source:
@Before public void setUp(){
  FileUtils.delete(root);
}

Fixed version (ground truth):
@Before public void setUp(){
  FileUtils.delete(root);
  vertxVersion=new VersionCommand().getVersion();
  assertThat(vertxVersion).isNotEmpty();
  System.setProperty("String_Node_Str",vertxVersion);
}
Program: 10508
Project: 10508
Buggy source:
/** 
 * This tests checks that all our dependencies converge to the same version.
 */
@Test public void testConvergence(){
  System.setProperty("String_Node_Str",new VersionCommand().getVersion());
  Stack stack=Stack.fromDescriptor(new File("String_Node_Str"));
  StackResolution resolution=new StackResolution(stack,root,new StackResolutionOptions().setFailOnConflicts(true));
  Map<String,File> resolved=resolution.resolve();
  assertThat(resolved).isNotEmpty();
}

Fixed version (ground truth):
/** 
 * This tests checks that all our dependencies converge to the same version.
 */
@Test public void testConvergence(){
  Stack stack=Stack.fromDescriptor(new File("String_Node_Str"));
  StackResolution resolution=new StackResolution(stack,root,new StackResolutionOptions().setFailOnConflicts(true));
  Map<String,File> resolved=resolution.resolve();
  assertThat(resolved).isNotEmpty();
}
Program: 10509
Project: 10509
Buggy source:
@Test public void testTheResolutionOfTheWebStack(){
  System.setProperty("String_Node_Str",new VersionCommand().getVersion());
  Stack stack=Stack.fromDescriptor(new File("String_Node_Str"));
  StackResolution resolution=new StackResolution(stack,root,new StackResolutionOptions().setFailOnConflicts(true));
  Map<String,File> resolved=resolution.resolve();
  assertThat(resolved).isNotEmpty();
}

Fixed version (ground truth):
@Test public void testTheResolutionOfTheWebStack(){
  Stack stack=Stack.fromDescriptor(new File("String_Node_Str"));
  StackResolution resolution=new StackResolution(stack,root,new StackResolutionOptions().setFailOnConflicts(true));
  Map<String,File> resolved=resolution.resolve();
  assertThat(resolved).isNotEmpty();
}