nus-yam/ex-repair huggingface dataset:
Program: 170456
Project: 170456
Buggy source:
private static Circle getControlPrimitive(double size,double x,double y,Shape<?> shape,DragMode dragMode){
  return new Circle(size).setX(x + shape.getX()).setY(y + shape.getY()).setFillColor(ColorName.RED).setFillAlpha(0.4).setStrokeColor(ColorName.BLACK).setStrokeWidth(2).setDraggable(true).setDragMode(dragMode);
}

Fixed version (ground truth):
private static Circle getControlPrimitive(double size,double x,double y,Shape<?> shape,DragMode dragMode){
  return new Circle(size).setX(x + shape.getX()).setY(y + shape.getY()).setFillColor(ColorName.DARKRED).setFillAlpha(0.8).setStrokeColor(ColorName.BLACK).setStrokeWidth(0.5).setDraggable(true).setDragMode(dragMode);
}
Program: 170457
Project: 170457
Buggy source:
@Override public void onNodeDragEnd(NodeDragEndEvent event){
  if ((m_handle.isActive()) && (m_chlist.isActive())) {
    for (    PathPartList list : m_listOfPaths) {
      list.resetBoundingBox();
    }
    m_prim.setFillColor(ColorName.RED);
    m_prim.getLayer().draw();
  }
}

Fixed version (ground truth):
@Override public void onNodeDragEnd(NodeDragEndEvent event){
  if ((m_handle.isActive()) && (m_chlist.isActive())) {
    for (    PathPartList list : m_listOfPaths) {
      list.resetBoundingBox();
    }
    m_prim.setFillColor(ColorName.DARKRED);
    m_prim.getLayer().draw();
  }
}
Program: 170458
Project: 170458
Buggy source:
@Override public void onNodeDragEnd(NodeDragEndEvent event){
  m_isDragging=false;
  if ((m_handle.isActive()) && (m_handleList.isActive())) {
    m_prim.setFillColor(ColorName.RED);
    m_prim.getLayer().batch();
  }
}

Fixed version (ground truth):
@Override public void onNodeDragEnd(NodeDragEndEvent event){
  m_isDragging=false;
  if ((m_handle.isActive()) && (m_handleList.isActive())) {
    m_prim.setFillColor(ColorName.DARKRED);
    m_prim.getLayer().batch();
  }
}
Program: 170460
Project: 170460
Buggy source:
private Circle getControlPrimitive(double x,double y){
  return new Circle(m_ctrlSize).setFillColor(ColorName.RED).setFillAlpha(0.4).setX(x).setY(y).setDraggable(true).setDragMode(DragMode.SAME_LAYER).setStrokeColor(ColorName.BLACK).setStrokeWidth(CONTROL_STROKE_WIDTH);
}

Fixed version (ground truth):
private Circle getControlPrimitive(double x,double y){
  return new Circle(m_ctrlSize).setX(x).setY(y).setFillColor(ColorName.DARKRED).setFillAlpha(0.8).setStrokeAlpha(0).setDraggable(true).setDragMode(DragMode.SAME_LAYER);
}
Program: 170461
Project: 170461
Buggy source:
@Override public void onNodeMouseClick(NodeMouseClickEvent event){
  if (m_connector.getPointHandles().isVisible()) {
    this.m_control.hideControlPoints();
  }
 else   if (((Node<?>)event.getSource()).getParent() == m_connector.getGroup()) {
    this.m_control.showControlPoints();
  }
}

Fixed version (ground truth):
@Override public void onNodeMouseClick(NodeMouseClickEvent event){
  if (m_connector.getPointHandles().isVisible()) {
    if (event.isShiftKeyDown()) {
      this.m_control.addControlPoint(event.getX(),event.getY());
    }
 else {
      this.m_control.hideControlPoints();
    }
  }
 else   if (((Node<?>)event.getSource()).getParent() == m_connector.getGroup()) {
    this.m_control.showControlPoints();
  }
}
Program: 170462
Project: 170462
Buggy source:
private void init(){
  if (m_connector.m_HandlerRegistrationManager != null) {
    m_connector.m_HandlerRegistrationManager.removeHandler();
  }
  m_connector.m_HandlerRegistrationManager=new HandlerRegistrationManager();
  m_connector.m_HandlerRegistrationManager.register(m_connector.getLine().addNodeMouseClickHandler(this));
  m_connector.m_HandlerRegistrationManager.register(m_connector.getLine().addNodeMouseDoubleClickHandler(this));
  m_connector.m_HandlerRegistrationManager.register(m_connector.getHead().addNodeMouseClickHandler(this));
  m_connector.m_HandlerRegistrationManager.register(m_connector.getHead().addNodeMouseDoubleClickHandler(this));
  m_connector.m_HandlerRegistrationManager.register(m_connector.getTail().addNodeMouseClickHandler(this));
  m_connector.m_HandlerRegistrationManager.register(m_connector.getTail().addNodeMouseDoubleClickHandler(this));
}

Fixed version (ground truth):
private void init(){
  if (m_connector.m_HandlerRegistrationManager != null) {
    m_connector.m_HandlerRegistrationManager.removeHandler();
  }
  m_connector.m_HandlerRegistrationManager=new HandlerRegistrationManager();
  m_connector.m_HandlerRegistrationManager.register(m_connector.getLine().addNodeMouseClickHandler(this));
  m_connector.m_HandlerRegistrationManager.register(m_connector.getHead().addNodeMouseClickHandler(this));
  m_connector.m_HandlerRegistrationManager.register(m_connector.getTail().addNodeMouseClickHandler(this));
}
Program: 170463
Project: 170463
Buggy source:
@Override public void onNodeMouseDoubleClick(final NodeMouseDoubleClickEvent event){
  WiresConnectorControlImpl.this.destroyControlPoint(event.getSource());
}

Fixed version (ground truth):
@Override public void onNodeMouseDoubleClick(final NodeMouseDoubleClickEvent event){
  if (m_connector.getPointHandles().isVisible()) {
    WiresConnectorControlImpl.this.destroyControlPoint(event.getSource());
  }
}
Program: 170465
Project: 170465
Buggy source:
private void switchVisibility(final boolean visible){
  if (null == parent) {
    return;
  }
  for (  WiresShape shape : m_wires_shape.getChildShapes()) {
    if (shape.getControls() == null) {
      continue;
    }
    if (visible) {
      shape.getControls().show();
    }
 else {
      shape.getControls().hide();
    }
  }
  if (visible) {
    m_ctrls.showOn(parent);
  }
 else {
    m_ctrls.hide();
  }
}

Fixed version (ground truth):
private void switchVisibility(final boolean visible){
  if (null == parent) {
    return;
  }
  if (!visible) {
    for (    WiresShape shape : m_wires_shape.getChildShapes()) {
      if (shape.getControls() == null) {
        continue;
      }
      shape.getControls().hide();
    }
  }
  if (visible) {
    m_ctrls.showOn(parent);
  }
 else {
    m_ctrls.hide();
  }
}
Program: 170466
Project: 170466
Buggy source:
@Override public void dragStart(final Context context){
  Point2D absShapeLoc=WiresUtils.getLocation(m_shape.getPath());
  BoundingBox box=m_shape.getPath().getBoundingBox();
  m_shapeStartX=absShapeLoc.getX();
  m_shapeStartY=absShapeLoc.getY();
  m_shapeStartCenterX=m_shapeStartX + (box.getWidth() / 2);
  m_shapeStartCenterY=m_shapeStartY + (box.getHeight() / 2);
  m_mouseStartX=context.getX();
  m_mouseStartY=context.getY();
  m_startDocked=false;
  m_parent=m_shape.getParent();
  m_picker=makeColorMapBackedPicker(m_layer.getChildShapes(),m_layer.getLayer().getScratchPad(),m_shape,m_shape.getDockingAcceptor().dockingAllowed(m_parent,m_shape),m_shape.getDockingAcceptor().getHotspotSize());
  if (m_parent != null && m_parent instanceof WiresShape) {
    if (m_shape.getDockedTo() == null) {
      highlightBody((WiresShape)m_parent);
      m_parentPart=new PickerPart((WiresShape)m_parent,PickerPart.ShapePart.BODY);
    }
 else {
      highlightBorder((WiresShape)m_parent);
      m_parentPart=m_picker.findShapeAt((int)m_shapeStartCenterX,(int)m_shapeStartCenterY);
      m_startDocked=true;
    }
    m_layer.getLayer().batch();
    m_layer.getLayer().getOverLayer().batch();
  }
}

Fixed version (ground truth):
@Override public void dragStart(final Context context){
  Point2D absShapeLoc=WiresUtils.getLocation(m_shape.getPath());
  BoundingBox box=m_shape.getPath().getBoundingBox();
  m_shapeStartX=absShapeLoc.getX();
  m_shapeStartY=absShapeLoc.getY();
  m_shapeStartCenterX=m_shapeStartX + (box.getWidth() / 2);
  m_shapeStartCenterY=m_shapeStartY + (box.getHeight() / 2);
  m_mouseStartX=context.getX();
  m_mouseStartY=context.getY();
  m_startDocked=false;
  m_parent=m_shape.getParent();
  m_picker=makeColorMapBackedPicker(m_layer,m_parent,m_shape);
  if (m_parent != null && m_parent instanceof WiresShape) {
    if (m_shape.getDockedTo() == null) {
      highlightBody((WiresShape)m_parent);
      m_parentPart=new PickerPart((WiresShape)m_parent,PickerPart.ShapePart.BODY);
    }
 else {
      highlightBorder((WiresShape)m_parent);
      m_parentPart=m_picker.findShapeAt((int)m_shapeStartCenterX,(int)m_shapeStartCenterY);
      m_startDocked=true;
    }
    m_layer.getLayer().batch();
    m_layer.getLayer().getOverLayer().batch();
  }
}
Program: 170468
Project: 170468
Buggy source:
protected ColorMapBackedPicker makeColorMapBackedPicker(NFastArrayList<WiresShape> children,ScratchPad scratchPad,WiresShape shape,boolean isDockingAllowed,int hotSpotSize){
  return new ColorMapBackedPicker(children,scratchPad,shape,isDockingAllowed,hotSpotSize);
}

Fixed version (ground truth):
protected ColorMapBackedPicker makeColorMapBackedPicker(final WiresLayer m_layer,final WiresContainer m_parent,final WiresShape m_shape){
  return makeColorMapBackedPicker(m_layer.getChildShapes(),m_layer.getLayer().getScratchPad(),m_shape,m_shape.getDockingAcceptor().dockingAllowed(m_parent,m_shape),m_shape.getDockingAcceptor().getHotspotSize());
}
Program: 170469
Project: 170469
Buggy source:
public final HandlerRegistration addWiresMoveHandler(final WiresMoveHandler handler){
  Objects.requireNonNull(handler);
  return m_manager.addHandler(WiresMoveEvent.TYPE,handler);
}

Fixed version (ground truth):
public final HandlerRegistration addWiresMoveHandler(final WiresMoveHandler handler){
  Objects.requireNonNull(handler);
  return m_events.addHandler(WiresMoveEvent.TYPE,handler);
}
Program: 170470
Project: 170470
Buggy source:
@Override public void onAttributesChanged(AttributesChangedEvent event){
  if (!WiresContainer.this.m_dragging && event.evaluate(XYWH_OP)) {
    m_manager.fireEvent(new WiresMoveEvent(WiresContainer.this,(int)getGroup().getX(),(int)getGroup().getY()));
  }
}

Fixed version (ground truth):
@Override public void onAttributesChanged(AttributesChangedEvent event){
  if (!WiresContainer.this.m_dragging && event.evaluate(XYWH_OP)) {
    m_events.fireEvent(new WiresMoveEvent(WiresContainer.this,(int)getGroup().getX(),(int)getGroup().getY()));
  }
}
Program: 170471
Project: 170471
Buggy source:
public WiresContainer setDraggable(final boolean draggable){
  getGroup().setDraggable(draggable);
  return this;
}

Fixed version (ground truth):
public WiresContainer setDraggable(final boolean draggable){
  ensureHandlers();
  getGroup().setDraggable(draggable);
  return this;
}
Program: 170472
Project: 170472
Buggy source:
WiresContainer(final IContainer<?,IPrimitive<?>> container,final HandlerManager m_manager,final HandlerRegistrationManager m_registrationManager,final IAttributesChangedBatcher attributesChangedBatcher){
  this.m_container=container;
  this.m_manager=null != m_manager ? m_manager : new HandlerManager(this);
  this.m_dragging=false;
  this.m_childShapes=new NFastArrayList<WiresShape>();
  this.m_registrationManager=m_registrationManager;
  this.attributesChangedBatcher=attributesChangedBatcher;
  init();
}

Fixed version (ground truth):
WiresContainer(final IContainer<?,IPrimitive<?>> container,final HandlerManager m_events,final HandlerRegistrationManager m_registrationManager,final IAttributesChangedBatcher attributesChangedBatcher){
  this.m_container=container;
  this.m_events=null != m_events ? m_events : new HandlerManager(this);
  this.m_dragging=false;
  this.m_drag_initialized=false;
  this.m_childShapes=new NFastArrayList<WiresShape>();
  this.m_registrationManager=m_registrationManager;
  this.attributesChangedBatcher=attributesChangedBatcher;
}
Program: 170473
Project: 170473
Buggy source:
@Override public void onNodeDragMove(final NodeDragMoveEvent event){
  WiresContainer.this.m_dragging=true;
  m_manager.fireEvent(new WiresDragMoveEvent(WiresContainer.this,event));
}

Fixed version (ground truth):
@Override public void onNodeDragMove(final NodeDragMoveEvent event){
  WiresContainer.this.m_dragging=true;
  m_events.fireEvent(new WiresDragMoveEvent(WiresContainer.this,event));
}
Program: 170474
Project: 170474
Buggy source:
@Override public void onNodeDragStart(final NodeDragStartEvent event){
  WiresContainer.this.m_dragging=true;
  m_manager.fireEvent(new WiresDragStartEvent(WiresContainer.this,event));
}

Fixed version (ground truth):
@Override public void onNodeDragStart(final NodeDragStartEvent event){
  WiresContainer.this.m_dragging=true;
  m_events.fireEvent(new WiresDragStartEvent(WiresContainer.this,event));
}
Program: 170475
Project: 170475
Buggy source:
public final HandlerRegistration addWiresDragMoveHandler(final WiresDragMoveHandler dragHandler){
  Objects.requireNonNull(dragHandler);
  return m_manager.addHandler(WiresDragMoveEvent.TYPE,dragHandler);
}

Fixed version (ground truth):
public final HandlerRegistration addWiresDragMoveHandler(final WiresDragMoveHandler dragHandler){
  Objects.requireNonNull(dragHandler);
  return m_events.addHandler(WiresDragMoveEvent.TYPE,dragHandler);
}
Program: 170476
Project: 170476
Buggy source:
@Override public void onNodeDragEnd(final NodeDragEndEvent event){
  WiresContainer.this.m_dragging=false;
  m_manager.fireEvent(new WiresDragEndEvent(WiresContainer.this,event));
}

Fixed version (ground truth):
@Override public void onNodeDragEnd(final NodeDragEndEvent event){
  WiresContainer.this.m_dragging=false;
  m_events.fireEvent(new WiresDragEndEvent(WiresContainer.this,event));
}
Program: 170477
Project: 170477
Buggy source:
public final HandlerRegistration addWiresDragEndHandler(final WiresDragEndHandler dragHandler){
  Objects.requireNonNull(dragHandler);
  return m_manager.addHandler(WiresDragEndEvent.TYPE,dragHandler);
}

Fixed version (ground truth):
public final HandlerRegistration addWiresDragEndHandler(final WiresDragEndHandler dragHandler){
  Objects.requireNonNull(dragHandler);
  return m_events.addHandler(WiresDragEndEvent.TYPE,dragHandler);
}
Program: 170478
Project: 170478
Buggy source:
public final HandlerRegistration addWiresDragStartHandler(final WiresDragStartHandler dragHandler){
  Objects.requireNonNull(dragHandler);
  return m_manager.addHandler(WiresDragStartEvent.TYPE,dragHandler);
}

Fixed version (ground truth):
public final HandlerRegistration addWiresDragStartHandler(final WiresDragStartHandler dragHandler){
  Objects.requireNonNull(dragHandler);
  return m_events.addHandler(WiresDragStartEvent.TYPE,dragHandler);
}
Program: 170479
Project: 170479
Buggy source:
protected HandlerManager getHandlerManager(){
  return m_manager;
}

Fixed version (ground truth):
protected HandlerManager getHandlerManager(){
  return m_events;
}
Program: 170480
Project: 170480
Buggy source:
@Override public void onNodeDragEnd(NodeDragEndEvent event){
  this.shapeControl.dragEnd(new WiresDragControlContext(event.getX(),event.getY(),event.getSource()));
}

Fixed version (ground truth):
@Override public void onNodeDragEnd(NodeDragEndEvent event){
  final boolean accepts=this.shapeControl.dragEnd(new WiresDragControlContext(event.getX(),event.getY(),event.getSource()));
  if (!accepts) {
    event.getDragContext().reset();
  }
}
Program: 170481
Project: 170481
Buggy source:
void dragEnd(Context context);

Fixed version (ground truth):
boolean dragEnd(Context context);
Program: 170482
Project: 170482
Buggy source:
@Override public void dragEnd(final Context context){
  if (m_magnets != null) {
    m_magnets.hide();
  }
  m_shapesBacking=null;
  m_magnetsBacking=null;
  m_magnets=null;
  m_colorKey=null;
  m_shape_color_map.clear();
  m_magnet_color_map.clear();
}

Fixed version (ground truth):
@Override public boolean dragEnd(final Context context){
  if (m_magnets != null) {
    m_magnets.hide();
  }
  m_shapesBacking=null;
  m_magnetsBacking=null;
  m_magnets=null;
  m_colorKey=null;
  m_shape_color_map.clear();
  m_magnet_color_map.clear();
  return true;
}
Program: 170483
Project: 170483
Buggy source:
@Override public void dragEnd(final Context context){
  m_connector.getGroup().setX(0).setY(0);
  Point2DArray points=m_connector.getLine().getPoint2DArray();
  IControlHandleList handles=m_connector.getPointHandles();
  for (int i=0, j=0; i < handles.size(); i++, j+=2) {
    Point2D p=points.get(i);
    p.setX(p.getX() + context.getX());
    p.setY(p.getY() + context.getY());
    IControlHandle h=handles.getHandle(i);
    IPrimitive<?> prim=h.getControl();
    prim.setX(m_startPoints.get(j) + context.getX());
    prim.setY(m_startPoints.get(j + 1) + context.getY());
  }
  m_connector.getLine().refresh();
  m_wiresManager.getLayer().getLayer().batch();
  m_startPoints=null;
}

Fixed version (ground truth):
@Override public boolean dragEnd(final Context context){
  m_connector.getGroup().setX(0).setY(0);
  Point2DArray points=m_connector.getLine().getPoint2DArray();
  IControlHandleList handles=m_connector.getPointHandles();
  for (int i=0, j=0; i < handles.size(); i++, j+=2) {
    Point2D p=points.get(i);
    p.setX(p.getX() + context.getX());
    p.setY(p.getY() + context.getY());
    IControlHandle h=handles.getHandle(i);
    IPrimitive<?> prim=h.getControl();
    prim.setX(m_startPoints.get(j) + context.getX());
    prim.setY(m_startPoints.get(j + 1) + context.getY());
  }
  m_connector.getLine().refresh();
  m_wiresManager.getLayer().getLayer().batch();
  m_startPoints=null;
  return true;
}
Program: 170486
Project: 170486
Buggy source:
@Override public void dragEnd(final Context context){
  addShapeToParent();
}

Fixed version (ground truth):
@Override public boolean dragEnd(final Context context){
  return addShapeToParent();
}
Program: 170487
Project: 170487
Buggy source:
@Override public void dragEnd(final Context context){
  if (m_dockingAndContainmentControl != null) {
    m_dockingAndContainmentControl.dragEnd(context);
  }
  if (m_alignAndDistributeHandler != null) {
    m_alignAndDistributeHandler.dragEnd();
  }
}

Fixed version (ground truth):
@Override public boolean dragEnd(final Context context){
  boolean result=true;
  if (m_dockingAndContainmentControl != null) {
    result=m_dockingAndContainmentControl.dragEnd(context);
  }
  if (m_alignAndDistributeHandler != null) {
    m_alignAndDistributeHandler.dragEnd();
  }
  return result;
}
Program: 170488
Project: 170488
Buggy source:
public Group add(IPrimitive<?> child,Layout layout,double dx,double dy){
  if (null == child.getID()) {
    child.setID(UUID.uuid());
  }
  layout_keys.add(child.getID());
  layout_values.add(layout);
  layout_x.add(dx);
  layout_y.add(dy);
  Group result=group.add(child);
  result.moveToTop();
  doPositionChild(result);
  return result;
}

Fixed version (ground truth):
public WiresLayoutContainer add(final IPrimitive<?> child,final LayoutContainer.Layout layout,final double dx,final double dy){
  if (null == child.getID()) {
    child.setID(UUID.uuid());
  }
  layout_keys.add(child.getID());
  layout_values.add(layout);
  layout_x.add(dx);
  layout_y.add(dy);
  Group result=group.add(child);
  result.moveToTop();
  doPositionChild(result);
  return this;
}
Program: 170489
Project: 170489
Buggy source:
public void setY(final double y){
  group.getAttributes().setY(y);
}

Fixed version (ground truth):
public WiresLayoutContainer setY(final double y){
  group.getAttributes().setY(y);
  return this;
}
Program: 170490
Project: 170490
Buggy source:
public WiresLayoutContainer move(String id,double dx,double dy){
  final int index=layout_keys.toList().indexOf(id);
  layout_x.set(index,dx);
  layout_y.set(index,dy);
  return this;
}

Fixed version (ground truth):
public WiresLayoutContainer move(final IPrimitive<?> child,final double dx,final double dy){
  final int index=layout_keys.toList().indexOf(child.getID());
  layout_x.set(index,dx);
  layout_y.set(index,dy);
  return this;
}
Program: 170491
Project: 170491
Buggy source:
public void setX(final double x){
  group.getAttributes().setX(x);
}

Fixed version (ground truth):
public WiresLayoutContainer setX(final double x){
  group.getAttributes().setX(x);
  return this;
}
Program: 170492
Project: 170492
Buggy source:
public WiresLayoutContainer(){
  this.group=new Group().setDraggable(false);
  this.layout_keys=new NFastArrayList<String>();
  this.layout_values=new NFastArrayList<Layout>();
  this.layout_x=new NFastArrayList<Double>();
  this.layout_y=new NFastArrayList<Double>();
  init();
}

Fixed version (ground truth):
public WiresLayoutContainer(){
  this.group=new Group().setDraggable(false);
  this.layout_keys=new NFastArrayList<String>();
  this.layout_values=new NFastArrayList<LayoutContainer.Layout>();
  this.layout_x=new NFastArrayList<Double>();
  this.layout_y=new NFastArrayList<Double>();
  init();
}
Program: 170493
Project: 170493
Buggy source:
public void setHeight(final double height){
  group.getAttributes().setHeight(height);
}

Fixed version (ground truth):
public WiresLayoutContainer setHeight(final double height){
  group.getAttributes().setHeight(height);
  return this;
}
Program: 170494
Project: 170494
Buggy source:
public void setWidth(final double width){
  group.getAttributes().setWidth(width);
}

Fixed version (ground truth):
public WiresLayoutContainer setWidth(final double width){
  group.getAttributes().setWidth(width);
  return this;
}
Program: 170495
Project: 170495
Buggy source:
public Group remove(IPrimitive<?> child){
  Group result=group.remove(child);
  final Layout layout=getLayout(child.getID());
  if (null != layout) {
    layout_keys.remove(child.getID());
    layout_values.remove(layout);
  }
  return result;
}

Fixed version (ground truth):
public WiresLayoutContainer remove(final IPrimitive<?> child){
  final LayoutContainer.Layout layout=getLayout(child.getID());
  if (null != layout) {
    layout_keys.remove(child.getID());
    layout_values.remove(layout);
  }
  group.remove(child);
  return this;
}
Program: 170496
Project: 170496
Buggy source:
private Layout getLayout(final String key){
  final int index=layout_keys.toList().indexOf(key);
  return index > -1 ? layout_values.get(index) : null;
}

Fixed version (ground truth):
private LayoutContainer.Layout getLayout(final String key){
  final int index=layout_keys.toList().indexOf(key);
  return index > -1 ? layout_values.get(index) : null;
}
Program: 170497
Project: 170497
Buggy source:
private void doPositionChild(final IPrimitive<?> child){
  final int index=layout_keys.toList().indexOf(child.getID());
  final Layout childLayout=index > -1 ? layout_values.get(index) : null;
  if (null != childLayout) {
    LayoutBuilder builder=null;
switch (childLayout) {
case CENTER:
      builder=CENTER_LAYOUT;
    break;
case TOP:
  builder=TOP_LAYOUT;
break;
case LEFT:
builder=LEFT_LAYOUT;
break;
case BOTTOM:
builder=BOTTOM_LAYOUT;
break;
case RIGHT:
builder=RIGHT_LAYOUT;
break;
}
if (null != builder) {
builder.layoutIt(child);
child.setX(child.getX() + layout_x.get(index));
child.setY(child.getY() + layout_y.get(index));
}
}
}

Fixed version (ground truth):
private void doPositionChild(final IPrimitive<?> child){
  final int index=layout_keys.toList().indexOf(child.getID());
  final LayoutContainer.Layout childLayout=index > -1 ? layout_values.get(index) : null;
  if (null != childLayout) {
    LayoutBuilder builder=null;
switch (childLayout) {
case CENTER:
      builder=CENTER_LAYOUT;
    break;
case TOP:
  builder=TOP_LAYOUT;
break;
case LEFT:
builder=LEFT_LAYOUT;
break;
case BOTTOM:
builder=BOTTOM_LAYOUT;
break;
case RIGHT:
builder=RIGHT_LAYOUT;
break;
}
if (null != builder) {
builder.layoutIt(child);
child.setX(child.getX() + layout_x.get(index));
child.setY(child.getY() + layout_y.get(index));
}
}
}
Program: 170498
Project: 170498
Buggy source:
Group getGroup(){
  return group;
}

Fixed version (ground truth):
public Group getGroup(){
  return group;
}
Program: 170499
Project: 170499
Buggy source:
@Override public void layoutIt(final IPrimitive<?> child){
  final double y=getHeight() / 2;
  final BoundingBox bb=child.getBoundingBox();
  final double bbw=bb.getWidth();
  final double bbh=bb.getHeight();
  child.setX(getWidth() - bbw);
  child.setY(y - (bbh / 2));
}

Fixed version (ground truth):
@Override public void layoutIt(final IPrimitive<?> child){
  final double y=getHeight() / 2;
  final BoundingBox bb=child.getBoundingBox();
  final double bbw=bb.getWidth();
  child.setX(getWidth() - (bbw / 2));
  child.setY(y);
}
Program: 170500
Project: 170500
Buggy source:
public WiresShape createShape(final MultiPath path){
  Group group=new Group();
  group.add(path);
  group.setEventPropagationMode(EventPropagationMode.FIRST_ANCESTOR);
  WiresShape shape=new WiresShape(path,group,this);
  registerShape(shape);
  return shape;
}

Fixed version (ground truth):
public WiresShape createShape(final MultiPath path){
  WiresShape shape=new WiresShape(path,new WiresLayoutContainer(),this);
  return registerShape(shape);
}
Program: 170501
Project: 170501
Buggy source:
public WiresShape registerShape(final WiresShape shape){
  final Group group=shape.getGroup();
  final MultiPath path=shape.getPath();
  path.setDraggable(true);
  shape.setContainmentAcceptor(m_containmentAcceptor);
  m_shapesMap.put(shape.getGroup().uuid(),shape);
  WiresShapeDragHandler handler=new WiresShapeDragHandler(shape,this);
  group.addNodeMouseDownHandler(handler);
  group.addNodeMouseUpHandler(handler);
  group.addNodeDragStartHandler(handler);
  group.addNodeDragMoveHandler(handler);
  group.addNodeDragEndHandler(handler);
  createMagnets(shape);
  getLayer().add(shape);
  addToIndex(shape);
  return shape;
}

Fixed version (ground truth):
public WiresShape registerShape(final WiresShape shape){
  final Group group=shape.getGroup();
  final MultiPath path=shape.getPath();
  shape.setContainmentAcceptor(m_containmentAcceptor);
  m_shapesMap.put(shape.getGroup().uuid(),shape);
  WiresShapeDragHandler handler=new WiresShapeDragHandler(shape,this);
  group.addNodeMouseDownHandler(handler);
  group.addNodeMouseUpHandler(handler);
  group.addNodeDragStartHandler(handler);
  group.addNodeDragMoveHandler(handler);
  group.addNodeDragEndHandler(handler);
  getLayer().add(shape);
  addToIndex(shape);
  return shape;
}
Program: 170502
Project: 170502
Buggy source:
public WiresShape createShape(final MultiPath path){
  Group group=new Group();
  group.add(path);
  group.setDraggable(true);
  group.setEventPropagationMode(EventPropagationMode.FIRST_ANCESTOR);
  WiresShape shape=new WiresShape(path,group,this);
  registerShape(shape);
  return shape;
}

Fixed version (ground truth):
public WiresShape createShape(final MultiPath path){
  Group group=new Group();
  group.add(path);
  group.setEventPropagationMode(EventPropagationMode.FIRST_ANCESTOR);
  WiresShape shape=new WiresShape(path,group,this);
  registerShape(shape);
  return shape;
}
Program: 170503
Project: 170503
Buggy source:
public final boolean addPlugin(final ILienzoPlugin plugin){
  if (null == plugin) {
    return false;
  }
  if (GWT.isScript()) {
    log("String_Node_Str" + plugin.getNameSpace());
  }
 else {
    GWT.log("String_Node_Str" + plugin.getNameSpace());
  }
  if (m_plugins.contains(plugin)) {
    error("String_Node_Str" + plugin.getNameSpace() + "String_Node_Str");
    return false;
  }
  for (  ILienzoPlugin p : m_plugins) {
    if (plugin.getNameSpace().equals(p)) {
      error("String_Node_Str" + plugin.getNameSpace() + "String_Node_Str");
      return false;
    }
  }
  m_plugins.add(plugin);
  return true;
}

Fixed version (ground truth):
public final boolean addPlugin(final ILienzoPlugin plugin){
  if (null == plugin) {
    return false;
  }
  if (GWT.isScript()) {
    log("String_Node_Str" + plugin.getNameSpace());
  }
 else {
    GWT.log("String_Node_Str" + plugin.getNameSpace());
  }
  if (m_plugins.contains(plugin)) {
    error("String_Node_Str" + plugin.getNameSpace() + "String_Node_Str");
    return false;
  }
  for (  ILienzoPlugin p : m_plugins) {
    if (plugin.getNameSpace().equals(p.getNameSpace())) {
      error("String_Node_Str" + plugin.getNameSpace() + "String_Node_Str");
      return false;
    }
  }
  m_plugins.add(plugin);
  return true;
}
Program: 170504
Project: 170504
Buggy source:
protected String toValidURL(String url){
  if (url.startsWith("String_Node_Str")) {
    return url;
  }
  if ((null == url) || ((url=url.trim()).isEmpty()) || (url.startsWith("String_Node_Str"))) {
    throw new NullPointerException("String_Node_Str");
  }
  url=UriUtils.fromString(url).asString();
  if ((null == url) || ((url=url.trim()).isEmpty()) || (url.startsWith("String_Node_Str"))) {
    throw new NullPointerException("String_Node_Str");
  }
  return url;
}

Fixed version (ground truth):
protected String toValidURL(String url){
  if ((null == url) || ((url=url.trim()).isEmpty()) || (url.startsWith("String_Node_Str"))) {
    throw new NullPointerException("String_Node_Str");
  }
  if (url.startsWith("String_Node_Str")) {
    return url;
  }
  url=UriUtils.fromString(url).asString();
  if ((null == url) || ((url=url.trim()).isEmpty()) || (url.startsWith("String_Node_Str"))) {
    throw new NullPointerException("String_Node_Str");
  }
  return url;
}
Program: 170505
Project: 170505
Buggy source:
@Override public void validate(final JSONValue jval,final ValidationContext ctx) throws ValidationException {
  if (null == jval) {
    ctx.addBadTypeError("String_Node_Str");
    return;
  }
  final JSONNumber s=jval.isNumber();
  if (null == s) {
    ctx.addBadTypeError("String_Node_Str");
  }
  if (false == isNumber(s.doubleValue())) {
    ctx.addBadTypeError("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void validate(final JSONValue jval,final ValidationContext ctx) throws ValidationException {
  if (null == jval) {
    ctx.addBadTypeError("String_Node_Str");
    return;
  }
  final JSONNumber s=jval.isNumber();
  if (null == s) {
    ctx.addBadTypeError("String_Node_Str");
    return;
  }
  if (false == isNumber(s.doubleValue())) {
    ctx.addBadTypeError("String_Node_Str");
  }
}
Program: 170506
Project: 170506
Buggy source:
/** 
 * Returns the NESW quadrant the point is in.  The delta from the center NE x > 0, y < 0 SE x > 0, y >= 0 SW x <= 0, y >= 0 NW x <= 0, y < 0
 * @param x0
 * @param y0
 * @param c
 * @return
 */
public static Direction getQuadrant(double x0,double y0,Point2D c){
  Direction d;
  if (x0 > c.getX() && y0 < c.getY()) {
    d=Direction.NORTH_EAST;
  }
 else   if (x0 > c.getX() && y0 >= c.getY()) {
    d=Direction.SOUTH_EAST;
    ;
  }
 else   if (x0 <= c.getX() && y0 >= c.getY()) {
    d=Direction.SOUTH_WEST;
    ;
  }
 else {
    d=Direction.NORTH_WEST;
  }
  return d;
}

Fixed version (ground truth):
/** 
 * Returns the NESW quadrant the point is in.  The delta from the center NE x > 0, y < 0 SE x > 0, y >= 0 SW x <= 0, y >= 0 NW x <= 0, y < 0
 * @param x0
 * @param y0
 * @param c
 * @return
 */
public static Direction getQuadrant(double x0,double y0,Point2D c){
  Direction d;
  if (x0 > c.getX() && y0 < c.getY()) {
    d=Direction.NORTH_EAST;
  }
 else   if (x0 > c.getX() && y0 >= c.getY()) {
    d=Direction.SOUTH_EAST;
  }
 else   if (x0 <= c.getX() && y0 >= c.getY()) {
    d=Direction.SOUTH_WEST;
  }
 else {
    d=Direction.NORTH_WEST;
  }
  return d;
}
Program: 170507
Project: 170507
Buggy source:
public void removeLeftAlignIndexEntry(AlignAndDistributeHandler shape,double left){
  addAlignIndexEntry(m_leftIndex,shape,left);
}

Fixed version (ground truth):
public void removeLeftAlignIndexEntry(AlignAndDistributeHandler shape,double left){
  removeAlignIndexEntry(m_leftIndex,shape,left);
}
Program: 170508
Project: 170508
Buggy source:
/** 
 * use location,   {@link android.Manifest.permission#ACCESS_FINE_LOCATION},  {@link android.Manifest.permission#ACCESS_COARSE_LOCATION}
 * @param activity
 * @return true if success
 * @throws Exception
 */
private static boolean checkLocation(Activity activity) throws Exception {
  LocationManager locationManager=(LocationManager)activity.getSystemService(LOCATION_SERVICE);
  Location location=locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
  if (location == null) {
    return false;
  }
 else {
    if ((PermissionsPageManager.isUnderMHasPermissionRequestManufacturer() && PermissionsPageManager.BuildVersionUnderMAboveL()) || PermissionsPageManager.isXIAOMI()) {
      double latitude=location.getLatitude();
    }
    return true;
  }
}

Fixed version (ground truth):
/** 
 * use location,   {@link android.Manifest.permission#ACCESS_FINE_LOCATION},  {@link android.Manifest.permission#ACCESS_COARSE_LOCATION}
 * @param activity
 * @return true if success
 * @throws Exception
 */
private static boolean checkLocation(Activity activity) throws Exception {
  LocationManager locationManager=(LocationManager)activity.getSystemService(LOCATION_SERVICE);
  Location location=locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
  if (location != null) {
    if (PermissionsPageManager.isForceManufacturer()) {
      double latitude=location.getLatitude();
      Log.e(TAG,"String_Node_Str" + latitude);
    }
    return true;
  }
 else {
    return false;
  }
}
Program: 170509
Project: 170509
Buggy source:
/** 
 * read call log,   {@link android.Manifest.permission#READ_CALL_LOG}
 * @param activity
 * @return true if success
 * @throws Exception
 */
private static boolean checkReadCallLog(Activity activity) throws Exception {
  Cursor cursor=activity.getContentResolver().query(Uri.parse("String_Node_Str"),null,null,null,null);
  if (cursor != null) {
    if ((PermissionsPageManager.isUnderMHasPermissionRequestManufacturer() && PermissionsPageManager.BuildVersionUnderMAboveL()) || PermissionsPageManager.isXIAOMI()) {
      if (isNumberIndexInfoIsNull(cursor,cursor.getColumnIndex(CallLog.Calls.NUMBER))) {
        cursor.close();
        return false;
      }
    }
    cursor.close();
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * read call log,   {@link android.Manifest.permission#READ_CALL_LOG}
 * @param activity
 * @return true if success
 * @throws Exception
 */
private static boolean checkReadCallLog(Activity activity) throws Exception {
  Cursor cursor=activity.getContentResolver().query(Uri.parse("String_Node_Str"),null,null,null,null);
  if (cursor != null) {
    if (PermissionsPageManager.isForceManufacturer()) {
      if (isNumberIndexInfoIsNull(cursor,cursor.getColumnIndex(CallLog.Calls.NUMBER))) {
        cursor.close();
        return false;
      }
    }
    cursor.close();
    return true;
  }
 else {
    return false;
  }
}
Program: 170510
Project: 170510
Buggy source:
/** 
 * read contacts,   {@link android.Manifest.permission#READ_CONTACTS}
 * @param activity
 * @return true if success
 * @throws Exception
 */
private static boolean checkReadContacts(Activity activity) throws Exception {
  Cursor cursor=activity.getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,null,null,null,null);
  if (cursor != null) {
    if ((PermissionsPageManager.isUnderMHasPermissionRequestManufacturer() && PermissionsPageManager.BuildVersionUnderMAboveL()) || PermissionsPageManager.isXIAOMI()) {
      if (isNumberIndexInfoIsNull(cursor,cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER))) {
        cursor.close();
        return false;
      }
    }
    cursor.close();
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * read contacts,   {@link android.Manifest.permission#READ_CONTACTS}
 * @param activity
 * @return true if success
 * @throws Exception
 */
private static boolean checkReadContacts(Activity activity) throws Exception {
  Cursor cursor=activity.getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,null,null,null,null);
  if (cursor != null) {
    if (PermissionsPageManager.isForceManufacturer()) {
      if (isNumberIndexInfoIsNull(cursor,cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER))) {
        cursor.close();
        return false;
      }
    }
    cursor.close();
    return true;
  }
 else {
    return false;
  }
}
Program: 170511
Project: 170511
Buggy source:
/** 
 * read sms,   {@link android.Manifest.permission#READ_SMS}in MEIZU 5.0~6.0, just according normal phone request in XIAOMI 6.0~, need force judge in XIAOMI 5.0~6.0, not test!!!
 * @param activity
 * @return true if success
 * @throws Exception
 */
private static boolean checkReadSms(Activity activity) throws Exception {
  Cursor cursor=activity.getContentResolver().query(Uri.parse("String_Node_Str"),null,null,null,null);
  if (cursor != null) {
    if ((PermissionsPageManager.isUnderMHasPermissionRequestManufacturer() && PermissionsPageManager.BuildVersionUnderMAboveL()) || PermissionsPageManager.isXIAOMI()) {
      if (isNumberIndexInfoIsNull(cursor,cursor.getColumnIndex(Telephony.Sms.DATE))) {
        cursor.close();
        return false;
      }
    }
    cursor.close();
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * read sms,   {@link android.Manifest.permission#READ_SMS}in MEIZU 5.0~6.0, just according normal phone request in XIAOMI 6.0~, need force judge in XIAOMI 5.0~6.0, not test!!!
 * @param activity
 * @return true if success
 * @throws Exception
 */
private static boolean checkReadSms(Activity activity) throws Exception {
  Cursor cursor=activity.getContentResolver().query(Uri.parse("String_Node_Str"),null,null,null,null);
  if (cursor != null) {
    if (PermissionsPageManager.isForceManufacturer()) {
      if (isNumberIndexInfoIsNull(cursor,cursor.getColumnIndex(Telephony.Sms.DATE))) {
        cursor.close();
        return false;
      }
    }
    cursor.close();
    return true;
  }
 else {
    return false;
  }
}
Program: 170512
Project: 170512
Buggy source:
public static void show(String content){
  if (toast == null) {
    toast=Toast.makeText(App.getAppContetxt(),content,Toast.LENGTH_SHORT);
  }
 else {
    toast.setText(content);
  }
  toast.show();
}

Fixed version (ground truth):
public static void show(String content){
  if (toast == null) {
    toast=Toast.makeText(App.getAppContext(),content,Toast.LENGTH_SHORT);
  }
 else {
    toast.setText(content);
  }
  toast.show();
}
Program: 170513
Project: 170513
Buggy source:
private void parsePageData(String page){
  Observable.just(page).map(s -> {
    ArrayList<Collection> collections=new ArrayList<>();
    try {
      Document doc=Jsoup.parse(s,AppConfig.GITHUB_BASE_URL);
      Elements elements=doc.getElementsByClass("String_Node_Str");
      for (      Element element : elements) {
        Element titleElement=element.select("String_Node_Str").first();
        Element descElement=element.select("String_Node_Str").first();
        String id=titleElement.attr("String_Node_Str");
        id=id.substring(id.lastIndexOf("String_Node_Str") + 1);
        String title=titleElement.textNodes().get(0).toString();
        String desc=descElement.textNodes().get(0).toString();
        Collection collection=new Collection(id,title,desc);
        collections.add(collection);
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
    return collections;
  }
).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(results -> {
    if (mView == null)     return;
    if (results.size() != 0) {
      collections=results;
      mView.hideLoading();
      mView.showCollections(collections);
    }
 else {
      String errorTip=String.format(getString(R.string.github_page_parse_error),getString(R.string.repo_collections));
      mView.showLoadError(errorTip);
      mView.hideLoading();
    }
  }
);
}

Fixed version (ground truth):
private void parsePageData(String page){
  Observable.just(page).map(s -> {
    ArrayList<Collection> collections=new ArrayList<>();
    try {
      Document doc=Jsoup.parse(s,AppConfig.GITHUB_BASE_URL);
      Elements elements=doc.getElementsByClass("String_Node_Str");
      for (      Element element : elements) {
        Element titleElement=element.select("String_Node_Str").first();
        Element descElement=element.select("String_Node_Str").last();
        String id=titleElement.attr("String_Node_Str");
        id=id.substring(id.lastIndexOf("String_Node_Str") + 1);
        String title=titleElement.textNodes().get(0).toString();
        List<TextNode> descTextNodes=descElement.textNodes();
        int descIndex=descTextNodes.size() == 0 ? 0 : descTextNodes.size() - 1;
        String desc=descTextNodes.get(descIndex).toString().trim();
        Collection collection=new Collection(id,title,desc);
        collections.add(collection);
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
    return collections;
  }
).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(results -> {
    if (mView == null)     return;
    if (results.size() != 0) {
      collections=results;
      mView.hideLoading();
      mView.showCollections(collections);
    }
 else {
      String errorTip=String.format(getString(R.string.github_page_parse_error),getString(R.string.repo_collections));
      mView.showLoadError(errorTip);
      mView.hideLoading();
    }
  }
);
}
Program: 170514
Project: 170514
Buggy source:
public ArrayList<String> getIssueUsersExceptMe(){
  if (timeline == null)   return null;
  ArrayList<String> users=new ArrayList<String>();
  for (  IssueEvent event : timeline) {
    if (!AppData.INSTANCE.getLoggedUser().getLogin().equals(event.getUser().getLogin()) && !users.contains(event.getUser().getLogin())) {
      users.add(event.getUser().getLogin());
    }
  }
  return users;
}

Fixed version (ground truth):
public ArrayList<String> getIssueUsersExceptMe(){
  if (timeline == null)   return null;
  ArrayList<String> users=new ArrayList<String>();
  for (  IssueEvent event : timeline) {
    String userLoginId=event.getUser() == null ? event.getActor().getLogin() : event.getUser().getLogin();
    if (!AppData.INSTANCE.getLoggedUser().getLogin().equals(userLoginId) && !users.contains(userLoginId)) {
      users.add(userLoginId);
    }
  }
  return users;
}
Program: 170515
Project: 170515
Buggy source:
@NonNull @GET("String_Node_Str") Observable<Response<ResponseBody>> getTrendingRepos(@Header("String_Node_Str") boolean forceNetWork,@Path("String_Node_Str") String language,@Query("String_Node_Str") String since);

Fixed version (ground truth):
@NonNull @GET("String_Node_Str") Observable<Response<ResponseBody>> getTrendingRepos(@Header("String_Node_Str") boolean forceNetWork,@Path(value="String_Node_Str",encoded=true) String language,@Query("String_Node_Str") String since);
Program: 170516
Project: 170516
Buggy source:
@Override public ArrayList<TrendingLanguage> getLanguagesFromLocal(){
  List<MyTrendingLanguage> myLanguages=daoSession.getMyTrendingLanguageDao().queryBuilder().orderAsc(MyTrendingLanguageDao.Properties.Order).list();
  if (StringUtils.isBlankList(myLanguages)) {
    languages=JSONUtils.jsonToArrayList(getString(R.string.trending_languages),TrendingLanguage.class);
    languages.addAll(0,getFixedLanguages());
    languages=sortLanguages(languages);
  }
 else {
    languages=TrendingLanguage.generateFromDB(myLanguages);
    fixFixedLanguagesName(languages);
  }
  return languages;
}

Fixed version (ground truth):
@Override public ArrayList<TrendingLanguage> getLanguagesFromLocal(){
  List<MyTrendingLanguage> myLanguages=daoSession.getMyTrendingLanguageDao().queryBuilder().orderAsc(MyTrendingLanguageDao.Properties.Order).list();
  if (StringUtils.isBlankList(myLanguages)) {
    languages=JSONUtils.jsonToArrayList(getString(R.string.trending_languages),TrendingLanguage.class);
    languages.addAll(0,getFixedLanguages());
    languages=sortLanguages(languages);
  }
 else {
    languages=TrendingLanguage.generateFromDB(myLanguages);
    fixFixedLanguagesName(languages);
  }
  fixLanguagesSlug(languages);
  return languages;
}
Program: 170519
Project: 170519
Buggy source:
@Override public void onCreate(){
  super.onCreate();
  application=this;
  long startTime=System.currentTimeMillis();
  initLogger();
  Logger.t(TAG).i("String_Node_Str" + startTime);
  mAppComponent=DaggerAppComponent.builder().appModule(new AppModule(this)).build();
  NetHelper.INSTANCE.init(this);
  initBugly();
  startTime=System.currentTimeMillis();
  Logger.t(TAG).i("String_Node_Str" + (System.currentTimeMillis() - startTime));
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
  application=this;
  long startTime=System.currentTimeMillis();
  AppUtils.updateAppLanguage(getApplicationContext());
  initLogger();
  Logger.t(TAG).i("String_Node_Str" + startTime);
  mAppComponent=DaggerAppComponent.builder().appModule(new AppModule(this)).build();
  NetHelper.INSTANCE.init(this);
  initBugly();
  startTime=System.currentTimeMillis();
  Logger.t(TAG).i("String_Node_Str" + (System.currentTimeMillis() - startTime));
}
Program: 170520
Project: 170520
Buggy source:
@Override protected void initView(Bundle savedInstanceState){
  super.initView(savedInstanceState);
  setToolbarTitle(getString(R.string.settings));
  if (recreated) {
    rootLayout.post(new Runnable(){
      @Override public void run(){
        startAnimation();
      }
    }
);
    setResult(Activity.RESULT_OK);
  }
}

Fixed version (ground truth):
@Override protected void initView(Bundle savedInstanceState){
  super.initView(savedInstanceState);
  setToolbarTitle(getString(R.string.settings));
  if (recreated) {
    rootLayout.post(new Runnable(){
      @Override public void run(){
        startAnimation();
      }
    }
);
    setResult(Activity.RESULT_OK);
    recreated=false;
  }
}
Program: 170521
Project: 170521
Buggy source:
@Override protected void onSaveInstanceState(Bundle outState){
  finish();
}

Fixed version (ground truth):
@Override protected void onSaveInstanceState(Bundle outState){
  if (recreated) {
    super.onSaveInstanceState(outState);
  }
 else {
    finish();
  }
}
Program: 170522
Project: 170522
Buggy source:
@Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater,@Nullable ViewGroup container,@Nullable Bundle savedInstanceState){
  View fragmentView=inflater.inflate(getLayoutId(),container,false);
  unbinder=ButterKnife.bind(this,fragmentView);
  initFragment(savedInstanceState);
  if (mPresenter != null)   mPresenter.onViewInitialized();
  return fragmentView;
}

Fixed version (ground truth):
@Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater,@Nullable ViewGroup container,@Nullable Bundle savedInstanceState){
  AppUtils.updateAppLanguage(getActivity());
  View fragmentView=inflater.inflate(getLayoutId(),container,false);
  unbinder=ButterKnife.bind(this,fragmentView);
  initFragment(savedInstanceState);
  if (mPresenter != null)   mPresenter.onViewInitialized();
  return fragmentView;
}
Program: 170523
Project: 170523
Buggy source:
private static String generateDiffHtml(@NonNull String diffSource,@NonNull String backgroundColor,String skin,boolean wrap){
  return "String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str" + skin + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ backgroundColor+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ backgroundColor+ "String_Node_Str"+ "String_Node_Str"+ (wrap ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ "String_Node_Str"+ (wrap ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ parseDiffSource(diffSource,wrap)+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
}

Fixed version (ground truth):
private static String generateDiffHtml(@NonNull String diffSource,@NonNull String backgroundColor,String skin,boolean wrap){
  return "String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str" + skin + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ backgroundColor+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ backgroundColor+ "String_Node_Str"+ "String_Node_Str"+ (wrap ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ "String_Node_Str"+ (wrap ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ parseDiffSource(formatCode(diffSource),wrap)+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
}
Program: 170524
Project: 170524
Buggy source:
@Override public void run(){
  isTransitionComplete=true;
  if (isWaitForTransition)   mView.showProfileInfo(user);
  isWaitForTransition=false;
  getProfileInfo();
  checkFollowingStatus();
}

Fixed version (ground truth):
@Override public void run(){
  if (mView == null)   return;
  isTransitionComplete=true;
  if (isWaitForTransition)   mView.showProfileInfo(user);
  isWaitForTransition=false;
  getProfileInfo();
  checkFollowingStatus();
}