Program: 118092
Project: 118092
Buggy source:
public static void renameConnectionInElement(String oldConnectionName,String newConnectionName,IElement elem){
  for (  IElementParameter curParam : elem.getElementParameters()) {
    if (curParam.getFieldType().equals(EParameterFieldType.CONNECTION_LIST)) {
      if (oldConnectionName.equals(curParam.getValue())) {
        curParam.setValue(newConnectionName);
      }
    }
 else     if (curParam.getFieldType().equals(EParameterFieldType.TABLE)) {
      final Object[] itemsValue=curParam.getListItemsValue();
      for (      Object element : itemsValue) {
        if (element instanceof IElementParameter) {
          IElementParameter param=(IElementParameter)element;
          if (param.getFieldType().equals(EParameterFieldType.CONNECTION_LIST)) {
            List<Map<String,Object>> tableValues=(List<Map<String,Object>>)curParam.getValue();
            for (            Map<String,Object> curLine : tableValues) {
              Object value=curLine.get(param.getName());
              if (value instanceof Integer) {
                String connectionName=(String)param.getListItemsValue()[(Integer)value];
                if (connectionName.equals(oldConnectionName)) {
                  curLine.put(param.getName(),newConnectionName);
                }
              }
 else               if (value instanceof String) {
                String connectionName=(String)curLine.get(param.getName());
                if (connectionName.equals(oldConnectionName)) {
                  curLine.put(param.getName(),newConnectionName);
                }
              }
            }
          }
          if (param.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) || param.getFieldType().equals(EParameterFieldType.SCHEMA_REFERENCE)) {
            List<Map<String,Object>> tableValues=(List<Map<String,Object>>)curParam.getValue();
            for (            Map<String,Object> curLine : tableValues) {
              Object value=curLine.get(param.getName());
              if (value instanceof String) {
                String connectionName=(String)curLine.get(param.getName());
                if (PluginChecker.isEBCDICPluginLoaded() && elem instanceof INode) {
                  IEBCDICProviderService service=(IEBCDICProviderService)GlobalServiceRegister.getDefault().getService(IEBCDICProviderService.class);
                  if (service != null && service.isEbcdicNode((INode)elem)) {
                    return;
                  }
                }
                if (connectionName.equals(oldConnectionName)) {
                  if (elem instanceof INode) {
                    INode node=(INode)elem;
                    if (node.getComponent() != null && "String_Node_Str".equals(node.getComponent().getName())) {
                      List<IMetadataTable> metadataList=node.getMetadataList();
                      for (                      IMetadataTable metadataTable : metadataList) {
                        if (metadataTable.getTableName() != null && metadataTable.getTableName().equals(oldConnectionName)) {
                          metadataTable.setTableName(newConnectionName);
                          break;
                        }
                      }
                      List<? extends IConnection> outgoingConnections=node.getOutgoingConnections();
                      for (                      IConnection connection : outgoingConnections) {
                        if (connection.getMetaName() != null && connection.getMetaName().equals(oldConnectionName)) {
                          connection.setMetaName(newConnectionName);
                          break;
                        }
                      }
                    }
                  }
                  curLine.put(param.getName(),newConnectionName);
                }
              }
            }
          }
        }
      }
    }
 else     if (curParam.getFieldType().equals(EParameterFieldType.TABLE_BY_ROW)) {
      List<Map<String,Object>> tableValues=(List<Map<String,Object>>)curParam.getValue();
      for (      Map<String,Object> curLine : tableValues) {
        String newValue=null;
        Iterator it=curLine.keySet().iterator();
        while (it.hasNext()) {
          String key=(String)it.next();
          if (key != null) {
            if (key.equals(oldConnectionName)) {
              newValue=(String)curLine.get(key);
              it.remove();
            }
          }
        }
        curLine.put(newConnectionName,newValue);
      }
    }
  }
}

Fixed version (ground truth):
public static void renameConnectionInElement(String oldConnectionName,String newConnectionName,IElement elem){
  for (  IElementParameter curParam : elem.getElementParameters()) {
    if (curParam.getFieldType().equals(EParameterFieldType.CONNECTION_LIST)) {
      if (oldConnectionName.equals(curParam.getValue())) {
        curParam.setValue(newConnectionName);
      }
    }
 else     if (curParam.getFieldType().equals(EParameterFieldType.TABLE)) {
      final Object[] itemsValue=curParam.getListItemsValue();
      for (      Object element : itemsValue) {
        if (element instanceof IElementParameter) {
          IElementParameter param=(IElementParameter)element;
          if (param.getFieldType().equals(EParameterFieldType.CONNECTION_LIST)) {
            List<Map<String,Object>> tableValues=(List<Map<String,Object>>)curParam.getValue();
            for (            Map<String,Object> curLine : tableValues) {
              Object value=curLine.get(param.getName());
              if (value instanceof Integer) {
                String connectionName=(String)param.getListItemsValue()[(Integer)value];
                if (connectionName.equals(oldConnectionName)) {
                  curLine.put(param.getName(),newConnectionName);
                }
              }
 else               if (value instanceof String) {
                String connectionName=(String)curLine.get(param.getName());
                if (connectionName.equals(oldConnectionName)) {
                  curLine.put(param.getName(),newConnectionName);
                }
              }
            }
          }
          if (param.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) || param.getFieldType().equals(EParameterFieldType.SCHEMA_REFERENCE)) {
            List<Map<String,Object>> tableValues=(List<Map<String,Object>>)curParam.getValue();
            for (            Map<String,Object> curLine : tableValues) {
              Object value=curLine.get(param.getName());
              if (value instanceof String) {
                String connectionName=(String)curLine.get(param.getName());
                if (PluginChecker.isEBCDICPluginLoaded() && elem instanceof INode) {
                  IEBCDICProviderService service=(IEBCDICProviderService)GlobalServiceRegister.getDefault().getService(IEBCDICProviderService.class);
                  if (service != null && service.isEbcdicNode((INode)elem)) {
                    return;
                  }
                }
                if (connectionName.equals(oldConnectionName)) {
                  if (elem instanceof INode) {
                    INode node=(INode)elem;
                    if (node.getComponent() != null && "String_Node_Str".equals(node.getComponent().getName())) {
                      List<IMetadataTable> metadataList=node.getMetadataList();
                      for (                      IMetadataTable metadataTable : metadataList) {
                        if (metadataTable.getTableName() != null && metadataTable.getTableName().equals(oldConnectionName)) {
                          metadataTable.setTableName(newConnectionName);
                          break;
                        }
                      }
                      List<? extends IConnection> outgoingConnections=node.getOutgoingConnections();
                      for (                      IConnection connection : outgoingConnections) {
                        if (connection.getMetaName() != null && connection.getMetaName().equals(oldConnectionName)) {
                          connection.setMetaName(newConnectionName);
                          break;
                        }
                      }
                    }
                  }
                  curLine.put(param.getName(),newConnectionName);
                }
              }
            }
          }
        }
      }
    }
 else     if (curParam.getFieldType().equals(EParameterFieldType.TABLE_BY_ROW)) {
      List<Map<String,Object>> tableValues=(List<Map<String,Object>>)curParam.getValue();
      for (      Map<String,Object> curLine : tableValues) {
        String newValue=null;
        Iterator it=curLine.keySet().iterator();
        while (it.hasNext()) {
          String key=(String)it.next();
          if (key != null) {
            if (key.equals(oldConnectionName)) {
              newValue=(String)curLine.get(key);
              it.remove();
            }
          }
        }
        curLine.put(newConnectionName,newValue);
      }
    }
 else     if (curParam.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE)) {
      Map<String,IElementParameter> children=curParam.getChildParameters();
      IElementParameter ele=children.get(EParameterName.CONNECTION.getName());
      if (ele != null && ele.getFieldType().equals(EParameterFieldType.CONNECTION_LIST) && ele.getValue().equals(oldConnectionName)) {
        ele.setValue(newConnectionName);
      }
    }
  }
}