Program: 120659
Project: 120659
Buggy source:
/** 
 * nrousseau Comment method "checkNodeSchemaFromRepositoryForEBCDIC".
 * @param node
 * @return
 */
private List<UpdateResult> checkNodeSchemaFromRepositoryForEBCDIC(final Node node,boolean onlySimpleShow){
  if (node == null) {
    return Collections.emptyList();
  }
  List<UpdateResult> schemaResults=new ArrayList<UpdateResult>();
  if (PluginChecker.isEBCDICPluginLoaded()) {
    IEBCDICProviderService service=(IEBCDICProviderService)GlobalServiceRegister.getDefault().getService(IEBCDICProviderService.class);
    if (service != null) {
      EbcdicConnectionItem repositoryItem=service.getRepositoryItem(node);
      if (repositoryItem != null) {
        IElementParameter schemasTableParam=node.getElementParameter(IEbcdicConstant.TABLE_SCHEMAS);
        IElementParameter schemaParam=node.getElementParameter(IEbcdicConstant.FIELD_SCHEMA);
        if (schemasTableParam != null) {
          List<IProcess2> openedProcesses=UpdateManagerUtils.getOpenedProcess();
          List<Map<String,Object>> paramValues=(List<Map<String,Object>>)schemasTableParam.getValue();
          for (          Map<String,Object> line : paramValues) {
            if (service.isRepositorySchemaLine(node,line)) {
              final String schemaName=(String)line.get(IEbcdicConstant.FIELD_SCHEMA);
              final String propertyValue=repositoryItem.getProperty().getId() + UpdatesConstants.SEGMENT_LINE + schemaName;
              boolean builtIn=true;
              UpdateCheckResult result=null;
              if (repositoryItem != null) {
                String newSourceId=getSchemaRenamedMap().get(propertyValue);
                if (newSourceId != null && !newSourceId.equals(propertyValue)) {
                  String[] newSourceIdAndName=UpdateManagerUtils.getSourceIdAndChildName(newSourceId);
                  if (newSourceIdAndName != null) {
                    IMetadataTable table=UpdateRepositoryUtils.getTableByName(repositoryItem,newSourceIdAndName[1]);
                    if (table != null) {
                      String source=UpdateRepositoryUtils.getRepositorySourceName(repositoryItem);
                      final IMetadataTable copyOfrepositoryMetadata=table.clone();
                      List<Object> parameter=new ArrayList<Object>();
                      parameter.add(copyOfrepositoryMetadata);
                      parameter.add(propertyValue);
                      parameter.add(newSourceId);
                      parameter.add(line);
                      result=new UpdateCheckResult(node);
                      result.setResult(EUpdateItemType.NODE_SCHEMA,EUpdateResult.RENAME,parameter,source);
                      builtIn=false;
                    }
                  }
                }
 else {
                  boolean isNeedUpdateSchemaFromRepo=true;
                  if (schemaParam.getChildParameters() != null && schemaParam.getChildParameters().get("String_Node_Str") != null) {
                    boolean isBuildinSchemaType=schemaParam.getChildParameters().get("String_Node_Str").getValue().equals("String_Node_Str");
                    isNeedUpdateSchemaFromRepo=!(schemaParam.isShow(node.getElementParameters()) && isBuildinSchemaType);
                  }
                  IMetadataTable table=UpdateRepositoryUtils.getTableByName(repositoryItem,schemaName);
                  if (table != null && isNeedUpdateSchemaFromRepo) {
                    String source=UpdateRepositoryUtils.getRepositorySourceName(repositoryItem) + UpdatesConstants.SEGMENT_LINE + table.getLabel();
                    final IMetadataTable copyOfrepositoryMetadata=table.clone();
                    IMetadataTable metadataTable=null;
                    metadataTable=MetadataToolHelper.getMetadataTableFromNodeLabel(node,schemaName);
                    if (this.isAddColumn) {
                      Display.getDefault().syncExec(new Runnable(){
                        @Override public void run(){
                          isColumnUsed=MessageDialog.openQuestion(Display.getDefault().getActiveShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
                        }
                      }
);
                      this.isAddColumn=false;
                      copyUsefulAttribute(copyOfrepositoryMetadata,metadataTable,isColumnUsed);
                    }
                    if (metadataTable != null && (onlySimpleShow || !metadataTable.sameMetadataAs(copyOfrepositoryMetadata,IMetadataColumn.OPTIONS_NONE))) {
                      List<Object> parameter=new ArrayList<Object>();
                      parameter.add(copyOfrepositoryMetadata);
                      parameter.add(schemaName);
                      result=new UpdateCheckResult(node);
                      result.setResult(EUpdateItemType.NODE_SCHEMA,EUpdateResult.UPDATE,parameter,source);
                    }
                    builtIn=false;
                  }
                }
              }
              if (builtIn) {
                result=new UpdateCheckResult(node);
                result.setResult(EUpdateItemType.NODE_SCHEMA,EUpdateResult.BUIL_IN,line);
              }
              if (result != null) {
                if (!openedProcesses.contains(getProcess())) {
                  result.setFromItem(true);
                }
                result.setJob(getProcess());
                setConfigrationForReadOnlyJob(result);
                schemaResults.add(result);
              }
            }
          }
        }
      }
    }
  }
  return schemaResults;
}

Fixed version (ground truth):
/** 
 * nrousseau Comment method "checkNodeSchemaFromRepositoryForEBCDIC".
 * @param node
 * @return
 */
private List<UpdateResult> checkNodeSchemaFromRepositoryForEBCDIC(final Node node,boolean onlySimpleShow){
  if (node == null) {
    return Collections.emptyList();
  }
  List<UpdateResult> schemaResults=new ArrayList<UpdateResult>();
  if (PluginChecker.isEBCDICPluginLoaded()) {
    IEBCDICProviderService service=(IEBCDICProviderService)GlobalServiceRegister.getDefault().getService(IEBCDICProviderService.class);
    if (service != null) {
      EbcdicConnectionItem repositoryItem=service.getRepositoryItem(node);
      if (repositoryItem != null) {
        IElementParameter schemasTableParam=node.getElementParameter(IEbcdicConstant.TABLE_SCHEMAS);
        IElementParameter schemaParam=node.getElementParameter(IEbcdicConstant.FIELD_SCHEMA);
        if (schemasTableParam != null) {
          List<IProcess2> openedProcesses=UpdateManagerUtils.getOpenedProcess();
          List<Map<String,Object>> paramValues=(List<Map<String,Object>>)schemasTableParam.getValue();
          for (          Map<String,Object> line : paramValues) {
            if (service.isRepositorySchemaLine(node,line)) {
              final String schemaName=(String)line.get(IEbcdicConstant.FIELD_SCHEMA);
              final String propertyValue=repositoryItem.getProperty().getId() + UpdatesConstants.SEGMENT_LINE + schemaName;
              boolean builtIn=true;
              UpdateCheckResult result=null;
              if (repositoryItem != null) {
                String newSourceId=getSchemaRenamedMap().get(propertyValue);
                if (newSourceId != null && !newSourceId.equals(propertyValue)) {
                  String[] newSourceIdAndName=UpdateManagerUtils.getSourceIdAndChildName(newSourceId);
                  if (newSourceIdAndName != null) {
                    IMetadataTable table=UpdateRepositoryUtils.getTableByName(repositoryItem,newSourceIdAndName[1]);
                    if (table != null) {
                      String source=UpdateRepositoryUtils.getRepositorySourceName(repositoryItem);
                      final IMetadataTable copyOfrepositoryMetadata=table.clone();
                      List<Object> parameter=new ArrayList<Object>();
                      parameter.add(copyOfrepositoryMetadata);
                      parameter.add(propertyValue);
                      parameter.add(newSourceId);
                      parameter.add(line);
                      result=new UpdateCheckResult(node);
                      result.setResult(EUpdateItemType.NODE_SCHEMA,EUpdateResult.RENAME,parameter,source);
                      builtIn=false;
                    }
                  }
                }
 else {
                  boolean isNeedUpdateSchemaFromRepo=true;
                  if (schemaParam.getChildParameters() != null && schemaParam.getChildParameters().get("String_Node_Str") != null) {
                    boolean isBuildinSchemaType=schemaParam.getChildParameters().get("String_Node_Str").getValue().equals("String_Node_Str");
                    isNeedUpdateSchemaFromRepo=!(schemaParam.isShow(node.getElementParameters()) && isBuildinSchemaType);
                  }
                  IMetadataTable table=UpdateRepositoryUtils.getTableByName(repositoryItem,schemaName);
                  if (table != null && isNeedUpdateSchemaFromRepo) {
                    String source=UpdateRepositoryUtils.getRepositorySourceName(repositoryItem) + UpdatesConstants.SEGMENT_LINE + table.getLabel();
                    final IMetadataTable copyOfrepositoryMetadata=table.clone();
                    IMetadataTable metadataTable=null;
                    metadataTable=MetadataToolHelper.getMetadataTableFromNodeLabel(node,schemaName);
                    if (this.isAddColumn) {
                      Display.getDefault().syncExec(new Runnable(){
                        @Override public void run(){
                          isColumnUsed=MessageDialog.openQuestion(Display.getDefault().getActiveShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
                        }
                      }
);
                      this.isAddColumn=false;
                      copyUsefulAttribute(copyOfrepositoryMetadata,metadataTable,isColumnUsed);
                    }
                    if (metadataTable != null && (onlySimpleShow || !metadataTable.sameMetadataAs(copyOfrepositoryMetadata,IMetadataColumn.OPTIONS_IGNORE_USED))) {
                      List<Object> parameter=new ArrayList<Object>();
                      parameter.add(copyOfrepositoryMetadata);
                      parameter.add(schemaName);
                      result=new UpdateCheckResult(node);
                      result.setResult(EUpdateItemType.NODE_SCHEMA,EUpdateResult.UPDATE,parameter,source);
                    }
                    builtIn=false;
                  }
                }
              }
              if (builtIn) {
                result=new UpdateCheckResult(node);
                result.setResult(EUpdateItemType.NODE_SCHEMA,EUpdateResult.BUIL_IN,line);
              }
              if (result != null) {
                if (!openedProcesses.contains(getProcess())) {
                  result.setFromItem(true);
                }
                result.setJob(getProcess());
                setConfigrationForReadOnlyJob(result);
                schemaResults.add(result);
              }
            }
          }
        }
      }
    }
  }
  return schemaResults;
}