Program: 127464
Project: 127464
Buggy source:
public static void initializeMetadataTableView(MetadataTableEditorView metaView,INode node,IMetadataTable metadataTable){
  boolean dbComponent=false;
  boolean hasMappingType=false;
  boolean eltComponent=false;
  boolean hasRepositoryDbSchema=false;
  boolean isEBCDIC=false;
  if (node != null && node.getComponent() != null) {
    eltComponent=node.isELTComponent();
    isEBCDIC=node.getComponent().getName().contains("String_Node_Str");
    if (node.getComponent().getOriginalFamilyName().startsWith(DATABASE_LABEL) || eltComponent || isEBCDIC) {
      dbComponent=true && !isEBCDIC;
      for (      IElementParameter currentParam : node.getElementParameters()) {
        if (currentParam.getFieldType().equals(EParameterFieldType.MAPPING_TYPE)) {
          metaView.setCurrentDbms((String)currentParam.getValue());
          hasMappingType=true;
        }
      }
      IElementParameter schemaParam=node.getElementParameter("String_Node_Str");
      if (!hasMappingType && schemaParam != null) {
        String schemaType=(String)schemaParam.getValue();
        if (schemaType.equals("String_Node_Str")) {
          String metaRepositoryName=(String)node.getElementParameter("String_Node_Str").getValue();
          Connection connection=MetadataToolHelper.getConnectionFromRepository(metaRepositoryName);
          boolean isDatabaseConnection=connection instanceof DatabaseConnection;
          boolean isGenericSchemaConnection=connection instanceof GenericSchemaConnection;
          if (isDatabaseConnection || isGenericSchemaConnection) {
            hasRepositoryDbSchema=true;
            for (            IMetadataColumn column : metadataTable.getListColumns()) {
              if ((column.getType() == "String_Node_Str") || (column.getType() == null)) {
                hasRepositoryDbSchema=false;
              }
            }
            String componentDbType="String_Node_Str";
            for (            IElementParameter param : (List<IElementParameter>)node.getElementParameters()) {
              if (param.getRepositoryValue() != null) {
                if (param.getRepositoryValue().equals("String_Node_Str")) {
                  componentDbType=(String)param.getValue();
                }
              }
            }
            if (!EDatabaseTypeName.supportDbType(componentDbType)) {
              hasRepositoryDbSchema=false;
            }
            String componentProduct=EDatabaseTypeName.getTypeFromDbType(componentDbType).getProduct();
            String connectionProduct=null;
            if (isDatabaseConnection) {
              connectionProduct=((DatabaseConnection)connection).getProductId();
              if (!componentProduct.equals(connectionProduct)) {
                hasRepositoryDbSchema=false;
              }
 else {
                metaView.setCurrentDbms(((DatabaseConnection)connection).getDbmsId());
              }
            }
 else             if (isGenericSchemaConnection) {
              String mappingTypeId=((GenericSchemaConnection)connection).getMappingTypeId();
              if (mappingTypeId != null) {
                connectionProduct=mappingTypeId;
                metaView.setCurrentDbms(connectionProduct);
              }
            }
          }
        }
      }
    }
  }
 else {
    eltComponent=false;
  }
  metaView.setShowDbTypeColumn(hasMappingType || eltComponent,false,hasMappingType || (dbComponent && !hasRepositoryDbSchema));
  metaView.setShowDbColumnName(dbComponent,hasMappingType || (dbComponent && !hasRepositoryDbSchema));
  metaView.setShowTalendTypeColumn(!eltComponent);
  metaView.setShowPatternColumn(!eltComponent);
  metaView.setShowOriginalLength(isEBCDIC);
  if (isEBCDIC) {
    metaView.setShowOriginalLength(true);
    List<String> fieldList=new ArrayList<String>();
    fieldList.add("String_Node_Str");
    fieldList.add("String_Node_Str");
    metaView.setAdditionalFields(fieldList);
  }
}

Fixed version (ground truth):
public static void initializeMetadataTableView(MetadataTableEditorView metaView,INode node,IMetadataTable metadataTable){
  boolean dbComponent=false;
  boolean hasMappingType=false;
  boolean eltComponent=false;
  boolean hasRepositoryDbSchema=false;
  boolean isEBCDIC=false;
  if (node != null && node.getComponent() != null) {
    eltComponent=node.isELTComponent();
    isEBCDIC=node.getComponent().getName().contains("String_Node_Str");
    if (node.getComponent().getOriginalFamilyName().startsWith(DATABASE_LABEL) || eltComponent || isEBCDIC) {
      dbComponent=true && !isEBCDIC;
      for (      IElementParameter currentParam : node.getElementParameters()) {
        if (currentParam.getFieldType().equals(EParameterFieldType.MAPPING_TYPE)) {
          metaView.setCurrentDbms((String)currentParam.getValue());
          hasMappingType=true;
        }
      }
      IElementParameter schemaParam=node.getElementParameter("String_Node_Str");
      if (!hasMappingType && schemaParam != null) {
        String schemaType=(String)schemaParam.getValue();
        if (schemaType.equals("String_Node_Str")) {
          String metaRepositoryName=(String)node.getElementParameter("String_Node_Str").getValue();
          Connection connection=MetadataToolHelper.getConnectionFromRepository(metaRepositoryName);
          boolean isDatabaseConnection=connection instanceof DatabaseConnection;
          boolean isGenericSchemaConnection=connection instanceof GenericSchemaConnection;
          if (isDatabaseConnection || isGenericSchemaConnection) {
            hasRepositoryDbSchema=true;
            for (            IMetadataColumn column : metadataTable.getListColumns()) {
              if ((column.getType() == "String_Node_Str") || (column.getType() == null)) {
                hasRepositoryDbSchema=false;
              }
            }
            String componentDbType="String_Node_Str";
            for (            IElementParameter param : (List<IElementParameter>)node.getElementParameters()) {
              if (param.getRepositoryValue() != null) {
                if (param.getRepositoryValue().equals("String_Node_Str")) {
                  componentDbType=(String)param.getValue();
                }
              }
            }
            if (!EDatabaseTypeName.supportDbType(componentDbType)) {
              hasRepositoryDbSchema=false;
            }
            String componentProduct=EDatabaseTypeName.getTypeFromDbType(componentDbType).getProduct();
            String connectionProduct=null;
            if (isDatabaseConnection) {
              connectionProduct=((DatabaseConnection)connection).getProductId();
              if (!componentProduct.equals(connectionProduct)) {
                hasRepositoryDbSchema=false;
              }
 else {
                metaView.setCurrentDbms(((DatabaseConnection)connection).getDbmsId());
              }
            }
 else             if (isGenericSchemaConnection) {
              String mappingTypeId=((GenericSchemaConnection)connection).getMappingTypeId();
              if (mappingTypeId != null) {
                connectionProduct=mappingTypeId;
                metaView.setCurrentDbms(connectionProduct);
              }
            }
          }
        }
      }
    }
  }
 else {
    eltComponent=false;
  }
  metaView.setShowDbTypeColumn(hasMappingType || eltComponent,false,hasMappingType || (dbComponent && !hasRepositoryDbSchema));
  metaView.setShowDbColumnName(dbComponent,hasMappingType || (dbComponent && !hasRepositoryDbSchema));
  metaView.setShowTalendTypeColumn(!eltComponent);
  metaView.setShowPatternColumn(!eltComponent);
  metaView.setShowOriginalLength(isEBCDIC);
  if (isEBCDIC) {
    metaView.setShowOriginalLength(true);
    List<String> fieldList=new ArrayList<String>();
    fieldList.add("String_Node_Str");
    fieldList.add("String_Node_Str");
    metaView.setAdditionalFields(fieldList);
  }
  if (node != null && metadataTable != null && metadataTable instanceof MetadataTable) {
    ((MetadataTable)metadataTable).setRepository(metaView.isRepository());
  }
}