Program: 122649
Project: 122649
Buggy source:
@Override public void run(){
  IMetadataTable meta=null;
  IMetadataTable newMetadata=null;
  String connectionName=null;
  if (getSelectedObjects().isEmpty()) {
    return;
  }
  List parts=getSelectedObjects();
  if (parts.size() == 1) {
    Object o=parts.get(0);
    if (!(o instanceof NodePart)) {
      return;
    }
    nodePart=(NodePart)o;
  }
 else {
    return;
  }
  Node node=(Node)nodePart.getModel();
  if (curNodeConnector.isMultiSchema()) {
    if (getText().equals(getNewOutputMenuName())) {
    }
 else {
      String tableName;
      if (connecType.equals(EConnectionType.TABLE)) {
        int end=getText().length() - 1;
        int start=getText().lastIndexOf("String_Node_Str") + 1;
        tableName=getText().substring(start,end);
        meta=node.getMetadataTable(tableName);
        connectionName=meta.getLabel();
      }
 else {
        tableName=getText();
        meta=node.getMetadataTable(tableName);
        connectionName=meta.getTableName();
      }
    }
    if (meta != null) {
      meta.setAttachedConnector(curNodeConnector.getName());
    }
  }
 else {
    if (connecType.equals(EConnectionType.TABLE)) {
      if (getText().equals(getDefaultTableName())) {
        int end=getText().lastIndexOf("String_Node_Str") - 1;
        int start=0;
        connectionName=getText().substring(start,end);
        meta=node.getMetadataList().get(0);
        meta.setAttachedConnector(curNodeConnector.getName());
      }
 else       if (getText().equals(getNewOutputMenuName()) && getDefaultTableName() != null) {
        if (node.getComponent().getName().equals("String_Node_Str")) {
          connectionName=askForConnectionNameAndSchema(node.getLabel(),null);
        }
 else {
          connectionName=askForConnectionName(node.getLabel(),null);
        }
      }
 else {
        if (node.getComponent().getName().equals("String_Node_Str")) {
          connectionName=askForConnectionNameAndSchema(node.getLabel(),getDefaultSchemaName());
        }
 else {
          connectionName=askForConnectionName(node.getLabel(),null);
        }
      }
    }
 else {
      if (connecType.hasConnectionCategory(IConnectionCategory.FLOW)) {
        connectionName=node.getProcess().generateUniqueConnectionName(Process.DEFAULT_ROW_CONNECTION_NAME);
      }
 else {
        connectionName=curNodeConnector.getLinkName();
      }
    }
    if (node.getMetadataList().size() == 0) {
      meta=null;
    }
 else {
      meta=node.getMetadataFromConnector(curNodeConnector.getName());
    }
  }
  Point point=null;
  point=nodePart.getFigure().getClientArea().getCenter();
  Point p=point;
  nodePart.getFigure().translateToAbsolute(p);
  Canvas canvas=(Canvas)nodePart.getViewer().getControl();
  Event event=new Event();
  event.button=1;
  event.count=0;
  event.detail=0;
  event.end=0;
  event.height=0;
  event.keyCode=0;
  event.start=0;
  event.stateMask=0;
  event.time=9516624;
  event.type=3;
  event.widget=canvas;
  event.width=0;
  event.x=p.x + 3;
  event.y=p.y + 3;
  listArgs=new ArrayList<Object>();
  if (connecType.equals(EConnectionType.FLOW_MAIN) || connecType.equals(EConnectionType.FLOW_REF) || connecType.equals(EConnectionType.TABLE)) {
    if (meta == null) {
      listArgs.add(null);
    }
 else {
      listArgs.add(meta.getTableName());
    }
  }
 else {
    listArgs.add(node.getUniqueName());
  }
  String baseName=node.getConnectionName();
  String fromConnectionName=null;
  if (node.getProcess().checkValidConnectionName(baseName)) {
    fromConnectionName=node.getProcess().generateUniqueConnectionName(baseName);
  }
  if (fromConnectionName != null && connecType.hasConnectionCategory(IConnectionCategory.FLOW) && node.getProcess().checkValidConnectionName(fromConnectionName,false) && !curNodeConnector.isMultiSchema()) {
    listArgs.add(fromConnectionName);
  }
 else {
    listArgs.add(connectionName);
  }
  listArgs.add(newMetadata);
  TalendConnectionCreationTool myConnectTool=new TalendConnectionCreationTool(new CreationFactory(){
    public Object getNewObject(){
      return listArgs;
    }
    public Object getObjectType(){
      return curNodeConnector.getName();
    }
  }
,true);
  myConnectTool.performConnectionStartWith(nodePart);
  nodePart.getViewer().getEditDomain().setActiveTool(myConnectTool);
  canvas.notifyListeners(3,event);
}

Fixed version (ground truth):
@Override public void run(){
  IMetadataTable meta=null;
  IMetadataTable newMetadata=null;
  String connectionName=null;
  if (getSelectedObjects().isEmpty()) {
    return;
  }
  List parts=getSelectedObjects();
  if (parts.size() == 1) {
    Object o=parts.get(0);
    if (!(o instanceof NodePart)) {
      return;
    }
    nodePart=(NodePart)o;
  }
 else {
    return;
  }
  Node node=(Node)nodePart.getModel();
  if (curNodeConnector.isMultiSchema()) {
    if (getText().equals(getNewOutputMenuName())) {
    }
 else {
      String tableName;
      if (connecType.equals(EConnectionType.TABLE)) {
        int end=getText().length() - 1;
        int start=getText().lastIndexOf("String_Node_Str") + 1;
        tableName=getText().substring(start,end);
        meta=node.getMetadataTable(tableName);
        connectionName=meta.getLabel();
      }
 else {
        tableName=getText();
        meta=node.getMetadataTable(tableName);
        connectionName=meta.getTableName();
      }
    }
    if (meta != null) {
      meta.setAttachedConnector(curNodeConnector.getName());
    }
  }
 else {
    if (connecType.equals(EConnectionType.TABLE)) {
      if (getText().equals(getDefaultTableName())) {
        int end=getText().lastIndexOf("String_Node_Str") - 1;
        int start=0;
        if (end >= start) {
          connectionName=getText().substring(start,end);
          meta=node.getMetadataList().get(0);
          meta.setAttachedConnector(curNodeConnector.getName());
        }
      }
 else       if (getText().equals(getNewOutputMenuName()) && getDefaultTableName() != null) {
        if (node.getComponent().getName().equals("String_Node_Str")) {
          connectionName=askForConnectionNameAndSchema(node.getLabel(),null);
        }
 else {
          connectionName=askForConnectionName(node.getLabel(),null);
        }
      }
 else {
        if (node.getComponent().getName().equals("String_Node_Str")) {
          connectionName=askForConnectionNameAndSchema(node.getLabel(),getDefaultSchemaName());
        }
 else {
          connectionName=askForConnectionName(node.getLabel(),null);
        }
      }
    }
 else {
      if (connecType.hasConnectionCategory(IConnectionCategory.FLOW)) {
        connectionName=node.getProcess().generateUniqueConnectionName(Process.DEFAULT_ROW_CONNECTION_NAME);
      }
 else {
        connectionName=curNodeConnector.getLinkName();
      }
    }
    if (node.getMetadataList().size() == 0) {
      meta=null;
    }
 else {
      meta=node.getMetadataFromConnector(curNodeConnector.getName());
    }
  }
  Point point=null;
  point=nodePart.getFigure().getClientArea().getCenter();
  Point p=point;
  nodePart.getFigure().translateToAbsolute(p);
  Canvas canvas=(Canvas)nodePart.getViewer().getControl();
  Event event=new Event();
  event.button=1;
  event.count=0;
  event.detail=0;
  event.end=0;
  event.height=0;
  event.keyCode=0;
  event.start=0;
  event.stateMask=0;
  event.time=9516624;
  event.type=3;
  event.widget=canvas;
  event.width=0;
  event.x=p.x + 3;
  event.y=p.y + 3;
  listArgs=new ArrayList<Object>();
  if (connecType.equals(EConnectionType.FLOW_MAIN) || connecType.equals(EConnectionType.FLOW_REF) || connecType.equals(EConnectionType.TABLE)) {
    if (meta == null) {
      listArgs.add(null);
    }
 else {
      listArgs.add(meta.getTableName());
    }
  }
 else {
    listArgs.add(node.getUniqueName());
  }
  String baseName=node.getConnectionName();
  String fromConnectionName=null;
  if (node.getProcess().checkValidConnectionName(baseName)) {
    fromConnectionName=node.getProcess().generateUniqueConnectionName(baseName);
  }
  if (fromConnectionName != null && connecType.hasConnectionCategory(IConnectionCategory.FLOW) && node.getProcess().checkValidConnectionName(fromConnectionName,false) && !curNodeConnector.isMultiSchema()) {
    listArgs.add(fromConnectionName);
  }
 else {
    listArgs.add(connectionName);
  }
  listArgs.add(newMetadata);
  TalendConnectionCreationTool myConnectTool=new TalendConnectionCreationTool(new CreationFactory(){
    public Object getNewObject(){
      return listArgs;
    }
    public Object getObjectType(){
      return curNodeConnector.getName();
    }
  }
,true);
  myConnectTool.performConnectionStartWith(nodePart);
  nodePart.getViewer().getEditDomain().setActiveTool(myConnectTool);
  canvas.notifyListeners(3,event);
}