nus-yam/ex-repair huggingface dataset:
Program: 170413
Project: 170413
Buggy source:
/** 
 * Query the GetEndpoints service at the given endpoint URL.
 * @param endpointUrl the endpoint URL to get endpoints from.
 * @return the {@link EndpointDescription}s returned by the GetEndpoints service.
 */
public static CompletableFuture<EndpointDescription[]> getEndpoints(String endpointUrl){
  CompletableFuture<EndpointDescription[]> endpointsFuture=new CompletableFuture<>();
  UaTcpClient client=new UaTcpClientBuilder().build(endpointUrl);
  GetEndpointsRequest request=new GetEndpointsRequest(new RequestHeader(null,DateTime.now(),uint(1),uint(0),null,uint(5000),null),endpointUrl,null,new String[]{Stack.UA_TCP_BINARY_TRANSPORT_URI});
  client.sendRequest(request).whenComplete((r,ex) -> {
    GetEndpointsResponse response=(GetEndpointsResponse)r;
    if (response != null)     endpointsFuture.complete(response.getEndpoints());
 else     endpointsFuture.completeExceptionally(ex);
    client.disconnect();
  }
);
  return endpointsFuture;
}

Fixed version (ground truth):
/** 
 * Query the GetEndpoints service at the given endpoint URL.
 * @param endpointUrl the endpoint URL to get endpoints from.
 * @return the {@link EndpointDescription}s returned by the GetEndpoints service.
 */
public static CompletableFuture<EndpointDescription[]> getEndpoints(String endpointUrl){
  UaTcpClient client=new UaTcpClientBuilder().build(endpointUrl);
  GetEndpointsRequest request=new GetEndpointsRequest(new RequestHeader(null,DateTime.now(),uint(1),uint(0),null,uint(5000),null),endpointUrl,null,new String[]{Stack.UA_TCP_BINARY_TRANSPORT_URI});
  return client.<GetEndpointsResponse>sendRequest(request).thenApply(GetEndpointsResponse::getEndpoints);
}
Program: 170414
Project: 170414
Buggy source:
@Override public void readSecurityHeader(SecureChannel channel,ByteBuf chunkBuffer) throws UaException {
  long tokenId=SymmetricSecurityHeader.decode(chunkBuffer).getTokenId();
  ChannelSecurity channelSecurity=channel.getChannelSecurity();
  if (channelSecurity == null) {
    if (tokenId != 0L) {
      throw new UaException(StatusCodes.Bad_SecureChannelTokenUnknown,"String_Node_Str" + tokenId);
    }
  }
 else {
    long currentTokenId=channelSecurity.getCurrentToken().getTokenId().longValue();
    if (tokenId == currentTokenId) {
      securitySecrets=channelSecurity.getCurrentKeys();
    }
 else {
      long previousTokenId=channelSecurity.getPreviousToken().map(t -> t.getTokenId().longValue()).orElse(-1L);
      if (tokenId == previousTokenId && channelSecurity.getPreviousKeys().isPresent()) {
        securitySecrets=channelSecurity.getPreviousKeys().get();
      }
 else {
        throw new UaException(StatusCodes.Bad_SecureChannelTokenUnknown,"String_Node_Str" + tokenId);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void readSecurityHeader(SecureChannel channel,ByteBuf chunkBuffer) throws UaException {
  long tokenId=SymmetricSecurityHeader.decode(chunkBuffer).getTokenId();
  ChannelSecurity channelSecurity=channel.getChannelSecurity();
  if (channelSecurity == null) {
    if (tokenId != 0L) {
      throw new UaException(StatusCodes.Bad_SecureChannelTokenUnknown,"String_Node_Str" + tokenId);
    }
  }
 else {
    long currentTokenId=channelSecurity.getCurrentToken().getTokenId().longValue();
    if (tokenId == currentTokenId) {
      securitySecrets=channelSecurity.getCurrentKeys();
    }
 else {
      long previousTokenId=channelSecurity.getPreviousToken().map(t -> t.getTokenId().longValue()).orElse(-1L);
      if (tokenId != previousTokenId) {
        throw new UaException(StatusCodes.Bad_SecureChannelTokenUnknown,"String_Node_Str" + tokenId);
      }
      if (channel.isSymmetricEncryptionEnabled() && channelSecurity.getPreviousKeys().isPresent()) {
        securitySecrets=channelSecurity.getPreviousKeys().get();
      }
    }
  }
}
Program: 170416
Project: 170416
Buggy source:
private void receiveServiceFault(ServiceFault serviceFault){
  ResponseHeader header=serviceFault.getResponseHeader();
  Long requestHandle=header.getRequestHandle();
  CompletableFuture<UaResponseMessage> future=pending.remove(requestHandle);
  if (future != null) {
    StatusCode serviceResult=serviceFault.getResponseHeader().getServiceResult();
    future.completeExceptionally(new UaException(serviceResult.getValue(),"String_Node_Str"));
  }
  Timeout timeout=timeouts.remove(requestHandle);
  if (timeout != null)   timeout.cancel();
}

Fixed version (ground truth):
public void receiveServiceFault(ServiceFault serviceFault){
  ResponseHeader header=serviceFault.getResponseHeader();
  Long requestHandle=header.getRequestHandle();
  CompletableFuture<UaResponseMessage> future=pending.remove(requestHandle);
  if (future != null) {
    StatusCode serviceResult=serviceFault.getResponseHeader().getServiceResult();
    future.completeExceptionally(new UaException(serviceResult.getValue(),"String_Node_Str"));
  }
  Timeout timeout=timeouts.remove(requestHandle);
  if (timeout != null)   timeout.cancel();
}
Program: 170417
Project: 170417
Buggy source:
private void receiveServiceResponse(UaResponseMessage response){
  ResponseHeader header=response.getResponseHeader();
  Long requestHandle=header.getRequestHandle();
  CompletableFuture<UaResponseMessage> future=pending.remove(requestHandle);
  if (future != null) {
    future.complete(response);
  }
  Timeout timeout=timeouts.remove(requestHandle);
  if (timeout != null)   timeout.cancel();
}

Fixed version (ground truth):
public void receiveServiceResponse(UaResponseMessage response){
  ResponseHeader header=response.getResponseHeader();
  Long requestHandle=header.getRequestHandle();
  CompletableFuture<UaResponseMessage> future=pending.remove(requestHandle);
  if (future != null) {
    future.complete(response);
  }
  Timeout timeout=timeouts.remove(requestHandle);
  if (timeout != null)   timeout.cancel();
}
Program: 170419
Project: 170419
Buggy source:
private static Map<String,List<Object>> extractMultiValuedIdentifiers(ResourceMapping mapping,AmazonWebServiceRequest request,Object result){
  Map<String,List<Object>> ids=new HashMap<>();
  int listSize=-1;
  for (  PathSourceMapping m : mapping.getRequestParamMappings()) {
    List<Object> values=ReflectionUtils.getAllByPath(request,m.getSource());
    if (listSize == -1) {
      listSize=values.size();
    }
 else     if (values.size() != listSize) {
      throw new IllegalStateException("String_Node_Str" + listSize + "String_Node_Str"+ values.size());
    }
    ids.put(m.getTarget(),values);
  }
  for (  PathSourceMapping m : mapping.getResponseIdentifierMappings()) {
    List<Object> values=ReflectionUtils.getAllByPath(result,m.getSource());
    if (listSize == -1) {
      listSize=values.size();
    }
 else     if (values.size() != listSize) {
      throw new IllegalStateException("String_Node_Str" + listSize + "String_Node_Str"+ values.size());
    }
    ids.put(m.getTarget(),values);
  }
  return ids;
}

Fixed version (ground truth):
private static Map<String,List<Object>> extractMultiValuedIdentifiers(ResourceMapping mapping,AmazonWebServiceRequest request,Object result){
  Map<String,List<Object>> ids=new HashMap<>();
  int listSize=-1;
  for (  PathSourceMapping m : mapping.getResponseIdentifierMappings()) {
    List<Object> values=ReflectionUtils.getAllByPath(result,m.getSource());
    if (listSize == -1) {
      listSize=values.size();
    }
 else     if (values.size() != listSize) {
      throw new IllegalStateException("String_Node_Str" + listSize + "String_Node_Str"+ values.size());
    }
    ids.put(m.getTarget(),values);
  }
  for (  PathSourceMapping m : mapping.getRequestParamMappings()) {
    List<Object> values;
    if (m.isMultiValued()) {
      values=ReflectionUtils.getAllByPath(request,m.getSource());
      if (listSize == -1) {
        listSize=values.size();
      }
 else       if (values.size() != listSize) {
        throw new IllegalStateException("String_Node_Str" + listSize + "String_Node_Str"+ values.size());
      }
    }
 else {
      Object singleValue=ReflectionUtils.getByPath(request,m.getSource());
      values=new ArrayList<Object>(listSize);
      for (int i=0; i < listSize; i++) {
        values.add(singleValue);
      }
    }
    ids.put(m.getTarget(),values);
  }
  return ids;
}
Program: 170420
Project: 170420
Buggy source:
public final void setColorKey(final String ckey){
  if (null == ckey) {
    m_k_color=ckey;
    m_ignores=new ClearFilter();
  }
 else   if (false == ckey.equals(m_k_color)) {
    m_k_color=ckey;
    m_ignores=new RGBIgnoreAlphaImageDataFilter(m_k_color);
  }
 else {
    return;
  }
  if (isLoaded()) {
    doFiltering(m_filterImage,m_selectImage,m_ignores);
    if (m_image.isVisible()) {
      final Layer layer=m_image.getLayer();
      if (null != layer) {
        layer.batch();
      }
    }
  }
}

Fixed version (ground truth):
public final void setColorKey(final String ckey){
  if (null == ckey) {
    m_k_color=null;
    m_ignores=new ClearFilter();
  }
 else   if (false == ckey.equals(m_k_color)) {
    m_k_color=ckey;
    m_ignores=new RGBIgnoreAlphaImageDataFilter(m_k_color);
  }
 else {
    return;
  }
  if (isLoaded()) {
    doFiltering(m_filterImage,m_selectImage,m_ignores);
    if (m_image.isVisible()) {
      final Layer layer=m_image.getLayer();
      if (null != layer) {
        layer.batch();
      }
    }
  }
}
Program: 170423
Project: 170423
Buggy source:
private final void setErrorCode(final int code){
switch (code) {
case MediaError.MEDIA_ERR_ABORTED:
    m_error=MessageConstants.MESSAGES.moviePlaybackWasAborted();
  break;
case MediaError.MEDIA_ERR_NETWORK:
m_error=MessageConstants.MESSAGES.movieNetworkError();
break;
case MediaError.MEDIA_ERR_DECODE:
m_error=MessageConstants.MESSAGES.movieErrorInDecoding();
break;
case MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED:
m_error=MessageConstants.MESSAGES.movieFormatNotSupported();
break;
}
}

Fixed version (ground truth):
private final void setErrorCode(final int code){
switch (code) {
case MediaError.MEDIA_ERR_ABORTED:
    m_error=MessageConstants.MESSAGES.moviePlaybackWasAborted();
  break;
case MediaError.MEDIA_ERR_NETWORK:
m_error=MessageConstants.MESSAGES.movieNetworkError();
break;
case MediaError.MEDIA_ERR_DECODE:
m_error=MessageConstants.MESSAGES.movieErrorInDecoding();
break;
case MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED:
m_error=MessageConstants.MESSAGES.movieFormatNotSupported();
break;
default :
m_error="String_Node_Str" + code;
break;
}
}
Program: 170424
Project: 170424
Buggy source:
@Override public boolean parse(final Attributes attr){
  final Point2DArray list=attr.getPoints().noAdjacentPoints();
  final int size=list.size();
  if (size > 1) {
    final PathPartList path=getPathPartList();
    final double headOffset=attr.getHeadOffset();
    final double tailOffset=attr.getTailOffset();
    m_headOffsetPoint=Geometry.getProjection(list.get(0),list.get(1),headOffset);
    m_tailOffsetPoint=Geometry.getProjection(list.get(size - 1),list.get(size - 2),tailOffset);
    path.M(m_headOffsetPoint);
    final double corner=getCornerRadius();
    if (corner <= 0) {
      for (int i=1; i < (size - 1); i++) {
        path.L(list.get(i));
      }
      path.L(m_tailOffsetPoint);
    }
 else {
      Geometry.drawArcJoinedLines(path,list.copy().set(size - 1,m_tailOffsetPoint),corner);
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean parse(final Attributes attr){
  final Point2DArray points=attr.getPoints();
  if (points == null) {
    return false;
  }
  final Point2DArray list=points.noAdjacentPoints();
  final int size=list.size();
  if (size > 1) {
    final PathPartList path=getPathPartList();
    final double headOffset=attr.getHeadOffset();
    final double tailOffset=attr.getTailOffset();
    m_headOffsetPoint=Geometry.getProjection(list.get(0),list.get(1),headOffset);
    m_tailOffsetPoint=Geometry.getProjection(list.get(size - 1),list.get(size - 2),tailOffset);
    path.M(m_headOffsetPoint);
    final double corner=getCornerRadius();
    if (corner <= 0) {
      for (int i=1; i < (size - 1); i++) {
        path.L(list.get(i));
      }
      path.L(m_tailOffsetPoint);
    }
 else {
      Geometry.drawArcJoinedLines(path,list.copy().set(size - 1,m_tailOffsetPoint),corner);
    }
    return true;
  }
  return true;
}
Program: 170425
Project: 170425
Buggy source:
private static final NFastDoubleArrayJSO drawOrthogonalLinePoints(final Point2DArray points,Direction headDirection,Direction tailDirection,final double correction,final OrthogonalPolyLine pline,boolean write){
  final NFastDoubleArrayJSO buffer=NFastDoubleArrayJSO.make();
  Point2D p0=points.get(0);
  p0=correctP0(headDirection,correction,pline,write,buffer,p0);
  int i=1;
  Direction direction=headDirection;
  final int size=points.size();
  Point2D p1;
  Point2D p2;
  for (; i < size - 1; i++) {
    p1=points.get(i);
    p2=points.get(i + 1);
    direction=drawOrthogonalLineSegment(buffer,direction,null,p0.getX(),p0.getY(),p1.getX(),p1.getY(),p2.getX(),p2.getY(),write);
    if (null == direction) {
      return null;
    }
    p0=p1;
  }
  p1=points.get(size - 1);
  drawTail(points,buffer,direction,tailDirection,p0,p1,correction,pline);
  return buffer;
}

Fixed version (ground truth):
private static final NFastDoubleArrayJSO drawOrthogonalLinePoints(final Point2DArray points,Direction headDirection,Direction tailDirection,final double correction,final OrthogonalPolyLine pline,double breakDistance,boolean write){
  final NFastDoubleArrayJSO buffer=NFastDoubleArrayJSO.make();
  Point2D p0=points.get(0);
  p0=correctP0(headDirection,correction,pline,write,buffer,p0);
  int i=1;
  Direction direction=headDirection;
  final int size=points.size();
  Point2D p1;
  Point2D p2;
  for (; i < size - 1; i++) {
    p1=points.get(i);
    p2=points.get(i + 1);
    direction=drawOrthogonalLineSegment(buffer,direction,null,p0.getX(),p0.getY(),p1.getX(),p1.getY(),p2.getX(),p2.getY(),write);
    if (null == direction) {
      return null;
    }
    p0=p1;
  }
  p1=points.get(size - 1);
  drawTail(points,buffer,direction,tailDirection,p0,p1,correction,pline);
  return buffer;
}
Program: 170427
Project: 170427
Buggy source:
@Override public void clear(){
  for (  WiresShape shape : selectionContext.getShapes()) {
    enableDocking(shape.getControl());
    shape.getControl().clear();
  }
  clearState();
}

Fixed version (ground truth):
@Override public void clear(){
  for (  WiresShape shape : selectionContext.getShapes()) {
    shape.getControl().clear();
    enableDocking(shape.getControl());
  }
  clearState();
}
Program: 170428
Project: 170428
Buggy source:
private Point2D getCandidateShapeLocationRelativeToInitialParent(final WiresShape shape){
  Point2D candidate=null;
  if (shape.getControl().getContainmentControl().isAllow()) {
    candidate=shape.getControl().getContainmentControl().getCandidateLocation();
  }
 else   if (shape.getControl().getDockingControl().isAllow()) {
    candidate=shape.getControl().getDockingControl().getCandidateLocation();
  }
  if (null != candidate) {
    final WiresParentPickerControlImpl parentPickerControl=(WiresParentPickerControlImpl)shape.getControl().getParentPickerControl();
    if (!parentPickerControl.getShapeLocationControl().isStartDocked() && parentPickerControl.getInitialParent() != parentPickerControl.getParent()) {
      final Point2D io=null != parentPickerControl.getInitialParent() ? parentPickerControl.getInitialParent().getComputedLocation() : new Point2D(0,0);
      final Point2D co=null != parentPickerControl.getParent() ? parentPickerControl.getParent().getComputedLocation() : new Point2D(0,0);
      return co.add(candidate).minus(io);
    }
    return candidate;
  }
  return shape.getControl().getParentPickerControl().getShapeLocation();
}

Fixed version (ground truth):
private Point2D getCandidateShapeLocationRelativeToInitialParent(final WiresShape shape){
  Point2D candidate=null;
  if (shape.getControl().getContainmentControl().isAllow()) {
    candidate=shape.getControl().getContainmentControl().getCandidateLocation();
  }
  if (null != candidate) {
    final WiresParentPickerControlImpl parentPickerControl=(WiresParentPickerControlImpl)shape.getControl().getParentPickerControl();
    if (!parentPickerControl.getShapeLocationControl().isStartDocked() && parentPickerControl.getInitialParent() != parentPickerControl.getParent()) {
      final Point2D io=null != parentPickerControl.getInitialParent() ? parentPickerControl.getInitialParent().getComputedLocation() : new Point2D(0,0);
      final Point2D co=null != parentPickerControl.getParent() ? parentPickerControl.getParent().getComputedLocation() : new Point2D(0,0);
      return co.add(candidate).minus(io);
    }
    return candidate;
  }
  return shape.getControl().getParentPickerControl().getShapeLocation();
}
Program: 170429
Project: 170429
Buggy source:
@Override public void reset(){
  for (  WiresShape shape : selectionContext.getShapes()) {
    shape.getControl().reset();
    shape.shapeMoved();
  }
  for (  WiresConnector connector : selectionContext.getConnectors()) {
    WiresConnector.WiresConnectorHandler handler=connector.getWiresConnectorHandler();
    handler.getControl().reset();
    WiresConnector.updateHeadTailForRefreshedConnector(connector);
  }
  clearState();
}

Fixed version (ground truth):
@Override public void reset(){
  for (  WiresShape shape : selectionContext.getShapes()) {
    shape.getControl().reset();
    enableDocking(shape.getControl());
  }
  for (  WiresConnector connector : selectionContext.getConnectors()) {
    WiresConnector.WiresConnectorHandler handler=connector.getWiresConnectorHandler();
    handler.getControl().reset();
    WiresConnector.updateHeadTailForRefreshedConnector(connector);
  }
  clearState();
}
Program: 170430
Project: 170430
Buggy source:
@Override public void onNodeDragMove(NodeDragMoveEvent event){
  int i=0;
  for (  WiresShape shape : m_selectionManager.m_selected.m_shapes) {
    shape.setX(m_shapeStartLocations.get(i++) + event.getDragContext().getDx());
    shape.setY(m_shapeStartLocations.get(i++) + event.getDragContext().getDy());
    shape.getMagnets().onNodeDragMove(event);
    ((WiresShapeControlImpl)shape.getHandler().getControl()).dragMove(event.getDragContext());
  }
  for (  WiresConnector connector : m_selectionManager.m_selected.m_connectors) {
    WiresConnector.WiresConnectorHandler handler=connector.getWiresConnectorHandler();
    ((WiresConnectorControlImpl)handler.getControl()).move(event.getDragContext().getDx(),event.getDragContext().getDy(),true,true);
  }
  WiresShapeControlImpl.updateSpecialConnections(m_connectorsWithSpecialConnections);
}

Fixed version (ground truth):
@Override public void onNodeDragMove(NodeDragMoveEvent event){
  int i=0;
  for (  WiresShape shape : m_selectionManager.m_selected.m_shapes) {
    shape.setX(m_shapeStartLocations.get(i++) + event.getDragContext().getDx());
    shape.setY(m_shapeStartLocations.get(i++) + event.getDragContext().getDy());
    if (shape.getMagnets() != null) {
      shape.getMagnets().onNodeDragMove(event);
    }
    ((WiresShapeControlImpl)shape.getHandler().getControl()).dragMove(event.getDragContext());
  }
  for (  WiresConnector connector : m_selectionManager.m_selected.m_connectors) {
    WiresConnector.WiresConnectorHandler handler=connector.getWiresConnectorHandler();
    ((WiresConnectorControlImpl)handler.getControl()).move(event.getDragContext().getDx(),event.getDragContext().getDy(),true,true);
  }
  WiresShapeControlImpl.updateSpecialConnections(m_connectorsWithSpecialConnections);
  m_selectionManager.m_layer.batch();
}
Program: 170431
Project: 170431
Buggy source:
@Override public void onNodeDragStart(NodeDragStartEvent event){
  m_shapeStartLocations=new NFastDoubleArray();
  Map<String,WiresConnector> connectors=new HashMap<String,WiresConnector>();
  for (  WiresShape shape : m_selectionManager.m_selected.m_shapes) {
    WiresShapeControlImpl.collectionSpecialConnectors(shape,connectors);
    shape.getMagnets().onNodeDragStart(event);
    m_shapeStartLocations.push(shape.getX(),shape.getY());
    ((WiresShapeControlImpl)shape.getHandler().getControl()).dragStart(event.getDragContext());
  }
  m_connectorsWithSpecialConnections=connectors.values().toArray(new WiresConnector[connectors.size()]);
  for (  WiresConnector connector : m_selectionManager.m_selected.m_connectors) {
    WiresConnector.WiresConnectorHandler handler=connector.getWiresConnectorHandler();
    handler.onNodeDragStart(event);
  }
}

Fixed version (ground truth):
@Override public void onNodeDragStart(NodeDragStartEvent event){
  m_shapeStartLocations=new NFastDoubleArray();
  Map<String,WiresConnector> connectors=new HashMap<String,WiresConnector>();
  for (  WiresShape shape : m_selectionManager.m_selected.m_shapes) {
    if (shape.getMagnets() != null) {
      WiresShapeControlImpl.collectionSpecialConnectors(shape,connectors);
      shape.getMagnets().onNodeDragStart(event);
    }
    m_shapeStartLocations.push(shape.getX(),shape.getY());
    ((WiresShapeControlImpl)shape.getHandler().getControl()).dragStart(event.getDragContext());
  }
  m_connectorsWithSpecialConnections=connectors.values().toArray(new WiresConnector[connectors.size()]);
  for (  WiresConnector connector : m_selectionManager.m_selected.m_connectors) {
    WiresConnector.WiresConnectorHandler handler=connector.getWiresConnectorHandler();
    handler.onNodeDragStart(event);
  }
}
Program: 170432
Project: 170432
Buggy source:
@Override public void onNodeDragEnd(NodeDragEndEvent event){
  int i=0;
  for (  WiresShape shape : m_selectionManager.m_selected.m_shapes) {
    shape.setX(m_shapeStartLocations.get(i++) + event.getDragContext().getDx());
    shape.setY(m_shapeStartLocations.get(i++) + event.getDragContext().getDy());
    shape.getMagnets().onNodeDragEnd(event);
    ((WiresShapeControlImpl)shape.getHandler().getControl()).dragEnd(event.getDragContext());
  }
  for (  WiresConnector connector : m_selectionManager.m_selected.m_connectors) {
    WiresConnector.WiresConnectorHandler handler=connector.getWiresConnectorHandler();
    ((WiresConnectorControlImpl)handler.getControl()).move(event.getDragContext().getDx(),event.getDragContext().getDy(),true,true);
    ((WiresConnectorControlImpl)handler.getControl()).dragEnd();
  }
  WiresShapeControlImpl.updateSpecialConnections(m_connectorsWithSpecialConnections);
  m_connectorsWithSpecialConnections=null;
  m_shapeStartLocations=null;
  m_selectionManager.m_ignoreMouseClick=true;
}

Fixed version (ground truth):
@Override public void onNodeDragEnd(NodeDragEndEvent event){
  int i=0;
  for (  WiresShape shape : m_selectionManager.m_selected.m_shapes) {
    shape.setX(m_shapeStartLocations.get(i++) + event.getDragContext().getDx());
    shape.setY(m_shapeStartLocations.get(i++) + event.getDragContext().getDy());
    if (shape.getMagnets() != null) {
      shape.getMagnets().onNodeDragEnd(event);
    }
    ((WiresShapeControlImpl)shape.getHandler().getControl()).dragEnd(event.getDragContext());
  }
  for (  WiresConnector connector : m_selectionManager.m_selected.m_connectors) {
    WiresConnector.WiresConnectorHandler handler=connector.getWiresConnectorHandler();
    ((WiresConnectorControlImpl)handler.getControl()).move(event.getDragContext().getDx(),event.getDragContext().getDy(),true,true);
    ((WiresConnectorControlImpl)handler.getControl()).dragEnd();
  }
  WiresShapeControlImpl.updateSpecialConnections(m_connectorsWithSpecialConnections);
  m_connectorsWithSpecialConnections=null;
  m_shapeStartLocations=null;
  m_selectionManager.m_ignoreMouseClick=true;
  m_selectionManager.m_layer.batch();
}
Program: 170433
Project: 170433
Buggy source:
@Override public void onNodeDragMove(NodeDragMoveEvent event){
  int i=0;
  for (  WiresShape shape : m_selectionManager.m_selected.m_shapes) {
    shape.setX(m_shapeStartLocations.get(i++) + event.getDragContext().getDx());
    shape.setY(m_shapeStartLocations.get(i++) + event.getDragContext().getDy());
    if (shape.getMagnets() != null) {
      shape.getMagnets().onNodeDragMove(event);
    }
    ((WiresShapeControlImpl)shape.getHandler().getControl()).dragMove(event.getDragContext());
  }
  for (  WiresConnector connector : m_selectionManager.m_selected.m_connectors) {
    WiresConnector.WiresConnectorHandler handler=connector.getWiresConnectorHandler();
    ((WiresConnectorControlImpl)handler.getControl()).move(event.getDragContext().getDx(),event.getDragContext().getDy(),true,true);
  }
  WiresShapeControlImpl.updateSpecialConnections(m_connectorsWithSpecialConnections);
  m_selectionManager.m_layer.batch();
}

Fixed version (ground truth):
@Override public void onNodeDragMove(NodeDragMoveEvent event){
  int i=0;
  for (  WiresShape shape : m_selectionManager.m_selected.m_shapes) {
    shape.setX(m_shapeStartLocations.get(i++) + event.getDragContext().getDx());
    shape.setY(m_shapeStartLocations.get(i++) + event.getDragContext().getDy());
    if (shape.getMagnets() != null) {
      shape.getMagnets().onNodeDragMove(event);
    }
    ((WiresShapeControlImpl)shape.getHandler().getControl()).dragMove(event.getDragContext());
  }
  for (  WiresConnector connector : m_selectionManager.m_selected.m_connectors) {
    WiresConnector.WiresConnectorHandler handler=connector.getWiresConnectorHandler();
    ((WiresConnectorControlImpl)handler.getControl()).move(event.getDragContext().getDx(),event.getDragContext().getDy(),true,true);
  }
  WiresShapeControlImpl.updateSpecialConnections(m_connectorsWithSpecialConnections,false);
  m_selectionManager.m_layer.batch();
}
Program: 170434
Project: 170434
Buggy source:
@Override public void onNodeDragEnd(NodeDragEndEvent event){
  int i=0;
  for (  WiresShape shape : m_selectionManager.m_selected.m_shapes) {
    shape.setX(m_shapeStartLocations.get(i++) + event.getDragContext().getDx());
    shape.setY(m_shapeStartLocations.get(i++) + event.getDragContext().getDy());
    if (shape.getMagnets() != null) {
      shape.getMagnets().onNodeDragEnd(event);
    }
    ((WiresShapeControlImpl)shape.getHandler().getControl()).dragEnd(event.getDragContext());
  }
  for (  WiresConnector connector : m_selectionManager.m_selected.m_connectors) {
    WiresConnector.WiresConnectorHandler handler=connector.getWiresConnectorHandler();
    ((WiresConnectorControlImpl)handler.getControl()).move(event.getDragContext().getDx(),event.getDragContext().getDy(),true,true);
    ((WiresConnectorControlImpl)handler.getControl()).dragEnd();
  }
  WiresShapeControlImpl.updateSpecialConnections(m_connectorsWithSpecialConnections);
  m_connectorsWithSpecialConnections=null;
  m_shapeStartLocations=null;
  m_selectionManager.m_ignoreMouseClick=true;
  m_selectionManager.m_layer.batch();
}

Fixed version (ground truth):
@Override public void onNodeDragEnd(NodeDragEndEvent event){
  int i=0;
  for (  WiresShape shape : m_selectionManager.m_selected.m_shapes) {
    shape.setX(m_shapeStartLocations.get(i++) + event.getDragContext().getDx());
    shape.setY(m_shapeStartLocations.get(i++) + event.getDragContext().getDy());
    if (shape.getMagnets() != null) {
      shape.getMagnets().onNodeDragEnd(event);
    }
    ((WiresShapeControlImpl)shape.getHandler().getControl()).dragEnd(event.getDragContext());
  }
  for (  WiresConnector connector : m_selectionManager.m_selected.m_connectors) {
    WiresConnector.WiresConnectorHandler handler=connector.getWiresConnectorHandler();
    ((WiresConnectorControlImpl)handler.getControl()).move(event.getDragContext().getDx(),event.getDragContext().getDy(),true,true);
    ((WiresConnectorControlImpl)handler.getControl()).dragEnd();
  }
  WiresShapeControlImpl.updateSpecialConnections(m_connectorsWithSpecialConnections,true);
  m_connectorsWithSpecialConnections=null;
  m_shapeStartLocations=null;
  m_selectionManager.m_ignoreMouseClick=true;
  m_selectionManager.m_layer.batch();
}
Program: 170435
Project: 170435
Buggy source:
public boolean isSpecialConnection(){
  return m_autoConnection || m_magnet != null && m_magnet.getIndex() == 0;
}

Fixed version (ground truth):
public static boolean isSpecialConnection(boolean auto,Integer magnet){
  return auto || magnet != null && magnet == 0;
}
Program: 170436
Project: 170436
Buggy source:
public WiresConnector setHeadMagnet(WiresMagnet headMagnet){
  if (null != headMagnet) {
    m_headConnection.setMagnet(headMagnet);
  }
  return this;
}

Fixed version (ground truth):
public WiresConnector setHeadMagnet(WiresMagnet headMagnet){
  m_headConnection.setMagnet(headMagnet);
  return this;
}
Program: 170437
Project: 170437
Buggy source:
public boolean updateForAutoConnections(WiresShape headS,WiresShape tailS){
  boolean accept=true;
  WiresMagnet[] magnets=getMagnetsOnAutoConnection(headS,tailS);
  if (magnets != null) {
    if (magnets[0] != null && getHeadConnection().getMagnet() != magnets[0]) {
      accept=accept && getConnectionAcceptor().acceptHead(getHeadConnection(),magnets[0]);
      if (accept) {
        getHeadConnection().setMagnet(magnets[0]);
      }
    }
    if (accept && magnets[1] != null && getTailConnection().getMagnet() != magnets[1]) {
      accept=accept && getConnectionAcceptor().acceptTail(getTailConnection(),magnets[1]);
      if (accept) {
        getTailConnection().setMagnet(magnets[1]);
      }
    }
  }
  return accept;
}

Fixed version (ground truth):
public boolean updateForAutoConnections(WiresShape headS,WiresShape tailS,boolean isAcceptOp){
  boolean accept=true;
  WiresMagnet[] magnets=getMagnetsOnAutoConnection(headS,tailS);
  if (magnets != null) {
    if (magnets[0] != null && getHeadConnection().getMagnet() != magnets[0]) {
      accept=accept && executeHeadConnectionOperation(headS,magnets[0],isAcceptOp);
      if (accept) {
        getHeadConnection().setMagnet(magnets[0]);
      }
    }
    if (accept && magnets[1] != null && getTailConnection().getMagnet() != magnets[1]) {
      accept=accept && executeTailConnectionOperation(tailS,magnets[1],isAcceptOp);
      if (accept) {
        getTailConnection().setMagnet(magnets[1]);
      }
    }
  }
  return accept;
}
Program: 170438
Project: 170438
Buggy source:
public void updateForSpecialConnections(){
  updateForCenterConnection();
  updateForAutoConnections();
}

Fixed version (ground truth):
public void updateForSpecialConnections(boolean isAcceptOp){
  updateForCenterConnection();
  updateForAutoConnections(isAcceptOp);
}
Program: 170439
Project: 170439
Buggy source:
public WiresConnector setTailMagnet(WiresMagnet tailMagnet){
  if (null != tailMagnet) {
    m_tailConnection.setMagnet(tailMagnet);
  }
  return this;
}

Fixed version (ground truth):
public WiresConnector setTailMagnet(WiresMagnet tailMagnet){
  m_tailConnection.setMagnet(tailMagnet);
  return this;
}
Program: 170440
Project: 170440
Buggy source:
public void add(WiresShape shape){
  if (shape.getParent() == this) {
    return;
  }
  if (shape.getParent() != null) {
    shape.removeFromParent();
  }
  m_childShapes.add(shape);
  m_container.add(shape.getGroup());
  shape.setParent(this);
  if (shape.getMagnets() != null) {
    shape.getMagnets().shapeMoved();
  }
  m_wiresManager.getAlignAndDistribute().getControlForShape(shape.uuid()).refresh();
  getLayoutHandler().requestLayout(this);
}

Fixed version (ground truth):
public void add(WiresShape shape){
  if (shape.getParent() == this) {
    return;
  }
  if (shape.getParent() != null) {
    shape.removeFromParent();
  }
  m_childShapes.add(shape);
  m_container.add(shape.getGroup());
  shape.setParent(this);
  if (shape.getMagnets() != null) {
    shape.getMagnets().shapeMoved();
  }
  if (m_wiresManager.getAlignAndDistribute().isShapeIndexed(shape.uuid())) {
    m_wiresManager.getAlignAndDistribute().getControlForShape(shape.uuid()).refresh();
  }
  getLayoutHandler().requestLayout(this);
}
Program: 170441
Project: 170441
Buggy source:
@Override public boolean onLayerBeforeDraw(Layer layer){
  for (  WiresConnector c : m_wiresManager.getConnectorList()) {
    if (c.getLine().getPathPartList().size() < 1) {
      AbstractDirectionalMultiPointShape<?> line=c.getLine();
      if (c.isSpecialConnection() && line.getPathPartList().size() == 0) {
        c.updateForSpecialConnections();
      }
      final boolean prepared=line.isPathPartListPrepared(c.getLine().getAttributes());
      if (!prepared) {
        return false;
      }
      Point2DArray points=line.getPoint2DArray();
      Point2D p0=points.get(0);
      Point2D p1=line.getHeadOffsetPoint();
      Point2DArray headPoints=new Point2DArray(p1,p0);
      c.getHeadDecorator().draw(headPoints);
      p0=points.get(points.size() - 1);
      p1=line.getTailOffsetPoint();
      Point2DArray tailPoints=new Point2DArray(p1,p0);
      c.getTailDecorator().draw(tailPoints);
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onLayerBeforeDraw(Layer layer){
  for (  WiresConnector c : m_wiresManager.getConnectorList()) {
    if (c.getLine().getPathPartList().size() < 1) {
      AbstractDirectionalMultiPointShape<?> line=c.getLine();
      if (c.isSpecialConnection() && line.getPathPartList().size() == 0) {
        c.updateForSpecialConnections(false);
      }
      final boolean prepared=line.isPathPartListPrepared(c.getLine().getAttributes());
      if (!prepared) {
        return false;
      }
      Point2DArray points=line.getPoint2DArray();
      Point2D p0=points.get(0);
      Point2D p1=line.getHeadOffsetPoint();
      Point2DArray headPoints=new Point2DArray(p1,p0);
      c.getHeadDecorator().draw(headPoints);
      p0=points.get(points.size() - 1);
      p1=line.getTailOffsetPoint();
      Point2DArray tailPoints=new Point2DArray(p1,p0);
      c.getTailDecorator().draw(tailPoints);
    }
  }
  return true;
}
Program: 170442
Project: 170442
Buggy source:
public static boolean acceptMagnetAndUpdateAutoConnection(WiresConnection connection,boolean isHead,WiresShape headS,WiresShape tailS,WiresMagnet currentMagnet){
  WiresConnector connector=connection.getConnector();
  boolean accept=true;
  if (!connection.isAutoConnection()) {
    if (isHead) {
      accept=accept && connector.getConnectionAcceptor().acceptHead(connection,currentMagnet);
    }
 else {
      accept=accept && connector.getConnectionAcceptor().acceptTail(connection,currentMagnet);
    }
    if (accept) {
      connection.setMagnet(currentMagnet);
    }
  }
  if (accept) {
    accept=accept && connector.updateForAutoConnections(headS,tailS);
    connector.updateForCenterConnection();
  }
  return accept;
}

Fixed version (ground truth):
public static boolean acceptMagnetAndUpdateAutoConnection(WiresConnection connection,boolean isHead,WiresShape headS,WiresShape tailS,WiresMagnet currentMagnet){
  WiresConnector connector=connection.getConnector();
  boolean accept=true;
  final boolean isAuto=connection.isAutoConnection();
  if (!isAuto) {
    if (isHead) {
      accept=accept && connector.getConnectionAcceptor().acceptHead(connection,currentMagnet);
    }
 else {
      accept=accept && connector.getConnectionAcceptor().acceptTail(connection,currentMagnet);
    }
    if (accept) {
      connection.setMagnet(currentMagnet);
    }
  }
  if (accept) {
    accept=accept && connector.updateForAutoConnections(headS,tailS,isAuto);
    connector.updateForCenterConnection();
  }
  return accept;
}
Program: 170444
Project: 170444
Buggy source:
@Override public boolean dragEnd(final DragContext context){
  WiresConnection connection=getConnection();
  boolean accept=makeAndUpdateSpecialConnections();
  if (!accept) {
    connection.setAutoConnection(m_initialAutoConnect);
    connection.setMagnet(m_initial_magnet);
    WiresConnector connector=connection.getConnector();
    connector.updateForSpecialConnections();
  }
  if (m_magnets != null) {
    m_magnets.hide();
  }
  m_shapesBacking=null;
  m_magnetsBacking=null;
  m_magnets=null;
  m_colorKey=null;
  m_current_magnet=null;
  m_initial_magnet=null;
  m_shape_color_map.clear();
  m_magnet_color_map.clear();
  return accept;
}

Fixed version (ground truth):
@Override public boolean dragEnd(final DragContext context){
  WiresConnection connection=getConnection();
  boolean accept=makeAndUpdateSpecialConnections();
  if (!accept) {
    connection.setAutoConnection(m_initialAutoConnect);
    connection.setMagnet(m_initial_magnet);
    WiresConnector connector=connection.getConnector();
    connector.updateForSpecialConnections(false);
  }
  if (m_magnets != null) {
    m_magnets.hide();
  }
  m_shapesBacking=null;
  m_magnetsBacking=null;
  m_magnets=null;
  m_colorKey=null;
  m_current_magnet=null;
  m_initial_magnet=null;
  m_shape_color_map.clear();
  m_magnet_color_map.clear();
  return accept;
}
Program: 170445
Project: 170445
Buggy source:
public void showPointHandles(){
  if (m_HandlerRegistrationManager == null) {
    m_HandlerRegistrationManager=m_connector.getPointHandles().getHandlerRegistrationManager();
  }
  m_connector.getPointHandles().show();
  final ConnectionHandler connectionHandler=new ConnectionHandler();
  Shape<?> head=m_connector.getHeadConnection().getControl().asShape();
  head.setDragConstraints(connectionHandler);
  m_HandlerRegistrationManager.register(head.addNodeDragEndHandler(connectionHandler));
  Shape<?> tail=m_connector.getTailConnection().getControl().asShape();
  tail.setDragConstraints(connectionHandler);
  m_HandlerRegistrationManager.register(tail.addNodeDragEndHandler(connectionHandler));
  final WiresConnectorControlHandler controlPointsHandler=new WiresConnectorControlHandler();
  for (  IControlHandle handle : m_connector.getPointHandles()) {
    Shape<?> shape=handle.getControl().asShape();
    m_HandlerRegistrationManager.register(shape.addNodeMouseDoubleClickHandler(controlPointsHandler));
  }
}

Fixed version (ground truth):
public void showPointHandles(){
  if (m_HandlerRegistrationManager == null) {
    m_HandlerRegistrationManager=m_connector.getPointHandles().getHandlerRegistrationManager();
    m_connector.getPointHandles().show();
    final ConnectionHandler connectionHandler=new ConnectionHandler();
    Shape<?> head=m_connector.getHeadConnection().getControl().asShape();
    head.setDragConstraints(connectionHandler);
    m_HandlerRegistrationManager.register(head.addNodeDragEndHandler(connectionHandler));
    Shape<?> tail=m_connector.getTailConnection().getControl().asShape();
    tail.setDragConstraints(connectionHandler);
    m_HandlerRegistrationManager.register(tail.addNodeDragEndHandler(connectionHandler));
    final WiresConnectorControlHandler controlPointsHandler=new WiresConnectorControlHandler();
    for (    IControlHandle handle : m_connector.getPointHandles()) {
      Shape<?> shape=handle.getControl().asShape();
      m_HandlerRegistrationManager.register(shape.addNodeMouseDoubleClickHandler(controlPointsHandler));
    }
  }
}
Program: 170446
Project: 170446
Buggy source:
@Override public void hideControlPoints(){
  if (m_HandlerRegistrationManager != null) {
    m_HandlerRegistrationManager.destroy();
  }
  m_HandlerRegistrationManager=null;
  m_connector.destroyPointHandles();
}

Fixed version (ground truth):
@Override public void hideControlPoints(){
  if (m_HandlerRegistrationManager != null) {
    m_HandlerRegistrationManager.destroy();
    m_connector.destroyPointHandles();
    m_HandlerRegistrationManager=null;
  }
}
Program: 170447
Project: 170447
Buggy source:
@Override public void showControlPoints(){
  if (this.m_HandlerRegistrationManager == null) {
    showPointHandles();
  }
}

Fixed version (ground truth):
@Override public void showControlPoints(){
  showPointHandles();
}
Program: 170448
Project: 170448
Buggy source:
public static void updateSpecialConnections(WiresConnector[] connectors){
  if (connectors == null) {
    return;
  }
  for (  WiresConnector connector : connectors) {
    connector.updateForSpecialConnections();
  }
}

Fixed version (ground truth):
public static void updateSpecialConnections(WiresConnector[] connectors,boolean isAcceptOp){
  if (connectors == null) {
    return;
  }
  for (  WiresConnector connector : connectors) {
    connector.updateForSpecialConnections(isAcceptOp);
  }
}
Program: 170449
Project: 170449
Buggy source:
@Override public boolean dragAdjust(final Point2D dxy){
  boolean adjusted1=false;
  if (m_dockingAndContainmentControl != null) {
    adjusted1=m_dockingAndContainmentControl.dragAdjust(dxy);
  }
  double dx=dxy.getX();
  double dy=dxy.getY();
  boolean adjusted2=false;
  if (m_alignAndDistributeControl != null && m_alignAndDistributeControl.isDraggable()) {
    adjusted2=m_alignAndDistributeControl.dragAdjust(dxy);
  }
  if (adjusted1 && adjusted2 && (dxy.getX() != dx || dxy.getY() != dy)) {
    BoundingBox box=m_shape.getPath().getBoundingBox();
    PickerPart part=m_dockingAndContainmentControl.getPicker().findShapeAt((int)(m_shapeStartX + dxy.getX() + (box.getWidth() / 2)),(int)(m_shapeStartY + dxy.getY() + (box.getHeight() / 2)));
    if (part == null || part.getShapePart() != PickerPart.ShapePart.BORDER) {
      dxy.setX(dx);
      dxy.setY(dy);
      adjusted2=false;
    }
  }
  updateSpecialConnections(m_connectorsWithSpecialConnections);
  if (m_shape.getChildShapes() != null && !m_shape.getChildShapes().isEmpty()) {
    for (    WiresShape child : m_shape.getChildShapes()) {
      if (child.getMagnets() != null) {
        child.getMagnets().shapeMoved();
      }
    }
  }
  return adjusted1 && adjusted2;
}

Fixed version (ground truth):
@Override public boolean dragAdjust(final Point2D dxy){
  boolean adjusted1=false;
  if (m_dockingAndContainmentControl != null) {
    adjusted1=m_dockingAndContainmentControl.dragAdjust(dxy);
  }
  double dx=dxy.getX();
  double dy=dxy.getY();
  boolean adjusted2=false;
  if (m_alignAndDistributeControl != null && m_alignAndDistributeControl.isDraggable()) {
    adjusted2=m_alignAndDistributeControl.dragAdjust(dxy);
  }
  if (adjusted1 && adjusted2 && (dxy.getX() != dx || dxy.getY() != dy)) {
    BoundingBox box=m_shape.getPath().getBoundingBox();
    PickerPart part=m_dockingAndContainmentControl.getPicker().findShapeAt((int)(m_shapeStartX + dxy.getX() + (box.getWidth() / 2)),(int)(m_shapeStartY + dxy.getY() + (box.getHeight() / 2)));
    if (part == null || part.getShapePart() != PickerPart.ShapePart.BORDER) {
      dxy.setX(dx);
      dxy.setY(dy);
      adjusted2=false;
    }
  }
  updateSpecialConnections(m_connectorsWithSpecialConnections,false);
  if (m_shape.getChildShapes() != null && !m_shape.getChildShapes().isEmpty()) {
    for (    WiresShape child : m_shape.getChildShapes()) {
      if (child.getMagnets() != null) {
        child.getMagnets().shapeMoved();
      }
    }
  }
  return adjusted1 && adjusted2;
}
Program: 170450
Project: 170450
Buggy source:
@Override public boolean dragEnd(final DragContext context){
  boolean allowed=true;
  if (m_dockingAndContainmentControl != null) {
    allowed=m_dockingAndContainmentControl.dragEnd(context);
  }
  allowed=allowed & checkForAndApplyLineSplice();
  if (!allowed) {
    context.reset();
  }
 else {
    updateSpecialConnections(m_connectorsWithSpecialConnections);
  }
  if (m_alignAndDistributeControl != null) {
    m_alignAndDistributeControl.dragEnd();
  }
  return allowed;
}

Fixed version (ground truth):
@Override public boolean dragEnd(final DragContext context){
  boolean allowed=true;
  if (m_dockingAndContainmentControl != null) {
    allowed=m_dockingAndContainmentControl.dragEnd(context);
  }
  allowed=allowed & checkForAndApplyLineSplice();
  if (!allowed) {
    context.reset();
  }
 else {
    updateSpecialConnections(m_connectorsWithSpecialConnections,false);
  }
  if (m_alignAndDistributeControl != null) {
    m_alignAndDistributeControl.dragEnd();
  }
  return allowed;
}
Program: 170451
Project: 170451
Buggy source:
/** 
 * Sets this layer's pixel size.
 * @param wide
 * @param high
 */
void setPixelSize(final int wide,final int high){
  m_wide=wide;
  m_high=high;
  if (LienzoCore.IS_CANVAS_SUPPORTED) {
    if (false == isSelection()) {
      getElement().getStyle().setWidth(wide,Unit.PX);
      getElement().getStyle().setHeight(high,Unit.PX);
    }
    final CanvasElement element=getCanvasElement();
    element.setWidth(wide);
    element.setHeight(high);
    if ((false == isSelection()) && (null != m_select)) {
      m_select.setPixelSize(wide,high);
    }
  }
}

Fixed version (ground truth):
/** 
 * Sets this layer's pixel size.
 * @param wide
 * @param high
 */
void setPixelSize(final int wide,final int high){
  m_wide=wide;
  m_high=high;
  if (LienzoCore.IS_CANVAS_SUPPORTED) {
    if (false == isSelection()) {
      getElement().getStyle().setWidth(wide,Unit.PX);
      getElement().getStyle().setHeight(high,Unit.PX);
    }
    final CanvasElement element=getCanvasElement();
    element.setWidth(wide);
    element.setHeight(high);
    if (false == isSelection()) {
      getContext().getNativeContext().initDeviceRatio();
    }
    if ((false == isSelection()) && (null != m_select)) {
      m_select.setPixelSize(wide,high);
    }
  }
}
Program: 170452
Project: 170452
Buggy source:
public void shapeChanged(){
  if (m_list.isEmpty()) {
    return;
  }
  Direction[] cardinals=m_list.size() == 9 ? EIGHT_CARDINALS : FOUR_CARDINALS;
  final Point2DArray points=MagnetManager.getWiresIntersectionPoints(m_wiresShape,cardinals);
  for (int i=0; i < m_list.size(); i++) {
    Point2D p=points.get(i);
    WiresMagnet m=(WiresMagnet)m_list.getHandle(i);
    m.setRx(p.getX()).setRy(p.getY());
  }
  this.shapeMoved();
}

Fixed version (ground truth):
public void shapeChanged(){
  if (m_list.isEmpty()) {
    return;
  }
  Direction[] cardinals=m_list.size() == 9 ? EIGHT_CARDINALS : FOUR_CARDINALS;
  final Point2DArray points=MagnetManager.getWiresIntersectionPoints(m_wiresShape,cardinals);
  Console.get().info("String_Node_Str" + m_list.size() + "String_Node_Str"+ points.size());
  for (int i=0; i < m_list.size(); i++) {
    Point2D p=points.get(i);
    WiresMagnet m=(WiresMagnet)m_list.getHandle(i);
    m.setRx(p.getX()).setRy(p.getY());
  }
  this.shapeMoved();
}
Program: 170453
Project: 170453
Buggy source:
public Magnets(MagnetManager magnetManager,IControlHandleList list,WiresShape wiresShape){
  m_list=list;
  m_magnetManager=magnetManager;
  m_wiresShape=wiresShape;
  Group shapeGroup=wiresShape.getGroup();
  m_registrationManager.register(shapeGroup.addAttributesChangedHandler(Attribute.X,this));
  m_registrationManager.register(shapeGroup.addAttributesChangedHandler(Attribute.Y,this));
  m_registrationManager.register(shapeGroup.addNodeDragStartHandler(this));
  m_registrationManager.register(shapeGroup.addNodeDragMoveHandler(this));
  m_registrationManager.register(shapeGroup.addNodeDragEndHandler(this));
}

Fixed version (ground truth):
public Magnets(MagnetManager magnetManager,IControlHandleList list,WiresShape wiresShape){
  m_list=list;
  m_magnetManager=magnetManager;
  m_wiresShape=wiresShape;
  if (list != null) {
    Group shapeGroup=wiresShape.getGroup();
    m_registrationManager.register(shapeGroup.addAttributesChangedHandler(Attribute.X,this));
    m_registrationManager.register(shapeGroup.addAttributesChangedHandler(Attribute.Y,this));
    m_registrationManager.register(shapeGroup.addNodeDragStartHandler(this));
    m_registrationManager.register(shapeGroup.addNodeDragMoveHandler(this));
    m_registrationManager.register(shapeGroup.addNodeDragEndHandler(this));
  }
 else {
    m_list=new ControlHandleList(wiresShape.getGroup());
  }
}
Program: 170454
Project: 170454
Buggy source:
public final HandlerRegistration addWiresResizeEndHandler(final WiresResizeEndHandler handler){
  Objects.requireNonNull(handler);
  return getHandlerManager().addHandler(WiresResizeEndEvent.TYPE,new WiresResizeEndHandler(){
    @Override public void onShapeResizeEnd(    WiresResizeEndEvent event){
      handler.onShapeResizeEnd(event);
      innerLayoutContainer.refresh();
      refresh();
    }
  }
);
}

Fixed version (ground truth):
public final HandlerRegistration addWiresResizeEndHandler(final WiresResizeEndHandler handler){
  Objects.requireNonNull(handler);
  return getHandlerManager().addHandler(WiresResizeEndEvent.TYPE,new WiresResizeEndHandler(){
    @Override public void onShapeResizeEnd(    WiresResizeEndEvent event){
      handler.onShapeResizeEnd(event);
      m_innerLayoutContainer.refresh();
      refresh();
    }
  }
);
}
Program: 170455
Project: 170455
Buggy source:
@Override public void onShapeResizeEnd(WiresResizeEndEvent event){
  handler.onShapeResizeEnd(event);
  innerLayoutContainer.refresh();
  refresh();
}

Fixed version (ground truth):
@Override public void onShapeResizeEnd(WiresResizeEndEvent event){
  handler.onShapeResizeEnd(event);
  m_innerLayoutContainer.refresh();
  refresh();
}