Program: 118702
Project: 118702
Buggy source:
@Override protected Command createComboCommand(CCombo combo){
  IMetadataTable repositoryMetadata=null;
  String fullParamName=(String)combo.getData(PARAMETER_NAME);
  IElementParameter switchParam=elem.getElementParameter(EParameterName.REPOSITORY_ALLOW_AUTO_SWITCH.getName());
  String value=new String("String_Node_Str");
  IElementParameter param=elem.getElementParameter(fullParamName);
  for (int j=0; j < param.getListItemsValue().length; j++) {
    if (combo.getText().equals(param.getListItemsDisplayName()[j])) {
      value=(String)param.getListItemsValue()[j];
    }
  }
  boolean isValRulesLost=false;
  IRepositoryViewObject currentValRuleObj=ValidationRulesUtil.getCurrentValidationRuleObjs(elem);
  if (value.equals(EmfComponent.BUILTIN) && currentValRuleObj != null) {
    if (!MessageDialog.openConfirm(combo.getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"))) {
      return null;
    }
 else {
      isValRulesLost=true;
    }
  }
  org.talend.core.model.metadata.builder.connection.Connection connection=null;
  if (elem instanceof Node) {
    Node node=(Node)elem;
    Command baseCommand=null;
    boolean isReadOnly=false;
    String newRepositoryIdValue=null;
    if (node.getMetadataFromConnector(param.getContext()) != null) {
      isReadOnly=node.getMetadataFromConnector(param.getContext()).isReadOnly();
    }
    if (value.equals(EmfComponent.BUILTIN) && isReadOnly && !"String_Node_Str".equals(node.getComponent().getName())&& !"String_Node_Str".equals(node.getComponent().getName())) {
      boolean hasMetadataInput=false;
      if (node.getCurrentActiveLinksNbInput(EConnectionType.FLOW_MAIN) > 0 || node.getCurrentActiveLinksNbInput(EConnectionType.TABLE) > 0) {
        hasMetadataInput=true;
      }
      repositoryMetadata=new MetadataTable();
      if (hasMetadataInput) {
        for (        Connection connec : (List<Connection>)node.getIncomingConnections()) {
          if (connec.isActivate() && (connec.getLineStyle().equals(EConnectionType.FLOW_MAIN) || connec.getLineStyle().equals(EConnectionType.TABLE))) {
            repositoryMetadata=connec.getMetadataTable().clone();
          }
        }
      }
    }
 else     if (value.equals(EmfComponent.REPOSITORY)) {
      IElementParameter property=((Node)elem).getElementParameter(EParameterName.PROPERTY_TYPE.getName());
      if ((property != null) && EmfComponent.REPOSITORY.equals(property.getValue())) {
        String propertySelected=(String)((Node)elem).getElementParameter(EParameterName.REPOSITORY_PROPERTY_TYPE.getName()).getValue();
        IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
        Item item=null;
        try {
          IRepositoryViewObject repobj=factory.getLastVersion(propertySelected);
          if (repobj != null) {
            Property tmpproperty=repobj.getProperty();
            if (tmpproperty != null) {
              item=tmpproperty.getItem();
            }
          }
        }
 catch (        PersistenceException e) {
          ExceptionHandler.process(e);
        }
        if (item != null && item instanceof ConnectionItem) {
          final ConnectionItem connectionItem=(ConnectionItem)item;
          if (connectionItem != null) {
            connection=connectionItem.getConnection();
          }
        }
      }
      IElementParameter repositorySchemaType=param.getParentParameter().getChildParameters().get(EParameterName.REPOSITORY_SCHEMA_TYPE.getName());
      String schemaSelected=(String)repositorySchemaType.getValue();
      String[] keySplitValues=schemaSelected.toString().split("String_Node_Str");
      if (keySplitValues.length > 1) {
        String connectionId=keySplitValues[0];
        String tableLabel=keySplitValues[1];
        IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
        Item item=null;
        try {
          IRepositoryViewObject repobj=factory.getLastVersion(connectionId);
          if (repobj != null) {
            Property tmpproperty=repobj.getProperty();
            if (tmpproperty != null) {
              item=tmpproperty.getItem();
            }
          }
        }
 catch (        PersistenceException e) {
          ExceptionHandler.process(e);
        }
        if (item != null && item instanceof ConnectionItem) {
          final ConnectionItem connectionItem=(ConnectionItem)item;
          if (connectionItem != null) {
            connection=connectionItem.getConnection();
          }
        }
        if (item != null && item instanceof ConnectionItem) {
          boolean findTable=false;
          for (          org.talend.core.model.metadata.builder.connection.MetadataTable table : ConnectionHelper.getTables(connection)) {
            if (table.getLabel().equals(tableLabel)) {
              repositoryMetadata=ConvertionHelper.convert(table);
              newRepositoryIdValue=schemaSelected;
              findTable=true;
              break;
            }
          }
          if (!findTable) {
            repositoryMetadata=new MetadataTable();
          }
        }
 else {
          repositoryMetadata=new MetadataTable();
        }
      }
 else {
        repositoryMetadata=new MetadataTable();
      }
    }
 else {
      baseCommand=new PropertyChangeCommand(elem,fullParamName,value);
    }
    if (switchParam != null) {
      switchParam.setValue(Boolean.FALSE);
    }
    CompoundCommand cc=new CompoundCommand();
    if (baseCommand != null) {
      cc.add(baseCommand);
    }
 else {
      RepositoryChangeMetadataCommand changeMetadataCommand=new RepositoryChangeMetadataCommand((Node)elem,fullParamName,value,repositoryMetadata,newRepositoryIdValue,null);
      changeMetadataCommand.setConnection(connection);
      cc.add(changeMetadataCommand);
    }
    if (isValRulesLost) {
      ValidationRulesUtil.appendRemoveValidationRuleCommands(cc,elem);
    }
    return cc;
  }
  return null;
}

Fixed version (ground truth):
@Override protected Command createComboCommand(CCombo combo){
  IMetadataTable repositoryMetadata=null;
  String fullParamName=(String)combo.getData(PARAMETER_NAME);
  IElementParameter switchParam=elem.getElementParameter(EParameterName.REPOSITORY_ALLOW_AUTO_SWITCH.getName());
  String value=new String("String_Node_Str");
  IElementParameter param=elem.getElementParameter(fullParamName);
  for (int j=0; j < param.getListItemsValue().length; j++) {
    if (combo.getText().equals(param.getListItemsDisplayName()[j])) {
      value=(String)param.getListItemsValue()[j];
    }
  }
  boolean isValRulesLost=false;
  IRepositoryViewObject currentValRuleObj=ValidationRulesUtil.getCurrentValidationRuleObjs(elem);
  if (value.equals(EmfComponent.BUILTIN) && currentValRuleObj != null) {
    if (!MessageDialog.openConfirm(combo.getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"))) {
      return null;
    }
 else {
      isValRulesLost=true;
    }
  }
  org.talend.core.model.metadata.builder.connection.Connection connection=null;
  if (elem instanceof Node) {
    Node node=(Node)elem;
    Command baseCommand=null;
    boolean isReadOnly=false;
    String newRepositoryIdValue=null;
    if (node.getMetadataFromConnector(param.getContext()) != null) {
      isReadOnly=node.getMetadataFromConnector(param.getContext()).isReadOnly();
    }
    if (value.equals(EmfComponent.BUILTIN) && isReadOnly && !"String_Node_Str".equals(node.getComponent().getName())&& !"String_Node_Str".equals(node.getComponent().getName())) {
      boolean hasMetadataInput=false;
      if (node.getCurrentActiveLinksNbInput(EConnectionType.FLOW_MAIN) > 0 || node.getCurrentActiveLinksNbInput(EConnectionType.TABLE) > 0) {
        hasMetadataInput=true;
      }
      repositoryMetadata=new MetadataTable();
      if (hasMetadataInput) {
        for (        Connection connec : (List<Connection>)node.getIncomingConnections()) {
          if (connec.isActivate() && (connec.getLineStyle().equals(EConnectionType.FLOW_MAIN) || connec.getLineStyle().equals(EConnectionType.TABLE))) {
            repositoryMetadata=connec.getMetadataTable().clone();
          }
        }
      }
    }
 else     if (value.equals(EmfComponent.REPOSITORY)) {
      IElementParameter property=((Node)elem).getElementParameter(EParameterName.PROPERTY_TYPE.getName());
      if ((property != null) && EmfComponent.REPOSITORY.equals(property.getValue())) {
        String propertySelected=(String)((Node)elem).getElementParameter(EParameterName.REPOSITORY_PROPERTY_TYPE.getName()).getValue();
        IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
        Item item=null;
        try {
          IRepositoryViewObject repobj=factory.getLastVersion(propertySelected);
          if (repobj != null) {
            Property tmpproperty=repobj.getProperty();
            if (tmpproperty != null) {
              item=tmpproperty.getItem();
            }
          }
        }
 catch (        PersistenceException e) {
          ExceptionHandler.process(e);
        }
        if (item != null && item instanceof ConnectionItem) {
          final ConnectionItem connectionItem=(ConnectionItem)item;
          if (connectionItem != null) {
            connection=connectionItem.getConnection();
          }
        }
      }
      IElementParameter repositorySchemaType=param.getParentParameter().getChildParameters().get(EParameterName.REPOSITORY_SCHEMA_TYPE.getName());
      String schemaSelected=(String)repositorySchemaType.getValue();
      String[] keySplitValues=schemaSelected.toString().split("String_Node_Str");
      if (keySplitValues.length > 1) {
        String connectionId=keySplitValues[0];
        String tableLabel=keySplitValues[1];
        IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
        Item item=null;
        try {
          IRepositoryViewObject repobj=factory.getLastVersion(connectionId);
          if (repobj != null) {
            Property tmpproperty=repobj.getProperty();
            if (tmpproperty != null) {
              item=tmpproperty.getItem();
            }
          }
        }
 catch (        PersistenceException e) {
          ExceptionHandler.process(e);
        }
        if (item != null && item instanceof ConnectionItem) {
          final ConnectionItem connectionItem=(ConnectionItem)item;
          if (connectionItem != null) {
            connection=connectionItem.getConnection();
          }
        }
        if (item != null && item instanceof ConnectionItem) {
          boolean findTable=false;
          Set<org.talend.core.model.metadata.builder.connection.MetadataTable> tables=null;
          IGenericWizardService wizardService=null;
          if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
            wizardService=(IGenericWizardService)GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
          }
          if (wizardService != null && wizardService.isGenericItem(item)) {
            tables=new HashSet<>(wizardService.getMetadataTables(connection));
          }
 else {
            tables=ConnectionHelper.getTables(connection);
          }
          for (          org.talend.core.model.metadata.builder.connection.MetadataTable table : tables) {
            if (table.getLabel().equals(tableLabel)) {
              repositoryMetadata=ConvertionHelper.convert(table);
              newRepositoryIdValue=schemaSelected;
              findTable=true;
              break;
            }
          }
          if (!findTable) {
            repositoryMetadata=new MetadataTable();
          }
        }
 else {
          repositoryMetadata=new MetadataTable();
        }
      }
 else {
        repositoryMetadata=new MetadataTable();
      }
    }
 else {
      baseCommand=new PropertyChangeCommand(elem,fullParamName,value);
    }
    if (switchParam != null) {
      switchParam.setValue(Boolean.FALSE);
    }
    CompoundCommand cc=new CompoundCommand();
    if (baseCommand != null) {
      cc.add(baseCommand);
    }
 else {
      RepositoryChangeMetadataCommand changeMetadataCommand=new RepositoryChangeMetadataCommand((Node)elem,fullParamName,value,repositoryMetadata,newRepositoryIdValue,null);
      changeMetadataCommand.setConnection(connection);
      cc.add(changeMetadataCommand);
    }
    if (isValRulesLost) {
      ValidationRulesUtil.appendRemoveValidationRuleCommands(cc,elem);
    }
    return cc;
  }
  return null;
}