Program: 118652
Project: 118652
Buggy source:
@SuppressWarnings("String_Node_Str") private void updateProperty(){
  Object updateObject=result.getUpdateObject();
  if (updateObject == null) {
    return;
  }
  if (updateObject instanceof Node) {
    Node node=(Node)updateObject;
    boolean update=false;
    boolean isXsdPath=false;
    Object parameter=result.getParameter();
    IElementParameter curPropertyParam=null;
    String parentParamName="String_Node_Str";
    ConnectionItem connectionItem=null;
    if (parameter instanceof ConnectionItem) {
      if (parameter instanceof XmlFileConnectionItem) {
        String filePath=((XmlFileConnection)((XmlFileConnectionItem)parameter).getConnection()).getXmlFilePath();
        if (filePath != null) {
          if (XmlUtil.isXSDFile(filePath)) {
            isXsdPath=true;
          }
        }
      }
      connectionItem=(ConnectionItem)result.getParameter();
      for (      IElementParameter param : node.getElementParameters()) {
        if (param.getFieldType() == EParameterFieldType.PROPERTY_TYPE && param.getChildParameters().get(EParameterName.REPOSITORY_PROPERTY_TYPE.getName()).getValue().equals(connectionItem.getProperty().getId())) {
          curPropertyParam=param;
          parentParamName=curPropertyParam.getName();
          break;
        }
      }
    }
    if (result.getResultType() == EUpdateResult.UPDATE) {
      if (result.isChecked() && connectionItem != null) {
        for (        IElementParameter param : node.getElementParameters()) {
          String repositoryValue=param.getRepositoryValue();
          if (param.getRepositoryValue() == null || (curPropertyParam != null && param.getRepositoryProperty() != null && !param.getRepositoryProperty().equals(curPropertyParam.getName()))) {
            continue;
          }
          if (param.getFieldType() == EParameterFieldType.PROPERTY_TYPE) {
            continue;
          }
          if ((repositoryValue != null) && (param.isShow(node.getElementParameters()) || (node instanceof INode && ((INode)node).getComponent().getName().equals("String_Node_Str")) || (node instanceof INode && ((INode)node).getComponent().getName().equals("String_Node_Str")))) {
            if (param.getName().equals(EParameterName.PROPERTY_TYPE.getName()) || param.getFieldType() == EParameterFieldType.MEMO_SQL) {
              continue;
            }
            if (param.getFieldType().equals(EParameterFieldType.FILE) && isXsdPath) {
              continue;
            }
            IMetadataTable table=null;
            if (!node.getMetadataList().isEmpty()) {
              table=node.getMetadataList().get(0);
            }
            Object objectValue=RepositoryToComponentProperty.getValue(connectionItem.getConnection(),repositoryValue,table);
            if (objectValue == null || "String_Node_Str".equals(objectValue)) {
              if (GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class)) {
                IESBService service=(IESBService)GlobalServiceRegister.getDefault().getService(IESBService.class);
                if (service != null) {
                  String propertyValue=(String)node.getPropertyValue(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
                  if (node.getComponent().getName().startsWith("String_Node_Str")) {
                    if (propertyValue.contains("String_Node_Str")) {
                      propertyValue=propertyValue.split("String_Node_Str")[0];
                    }
                  }
                  IRepositoryViewObject lastVersion=UpdateRepositoryUtils.getRepositoryObjectById(propertyValue);
                  if (lastVersion != null) {
                    Item item=lastVersion.getProperty().getItem();
                    if (item != null) {
                      Object objectValueFromESB=service.getValue(item,repositoryValue,node);
                      if (objectValueFromESB != null) {
                        objectValue=objectValueFromESB;
                      }
                    }
                  }
                }
              }
            }
            if (param.getName().equals(EParameterName.CDC_TYPE_MODE.getName())) {
              String propertyValue=(String)node.getPropertyValue(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
              Item item=null;
              IRepositoryViewObject lastVersion=UpdateRepositoryUtils.getRepositoryObjectById(propertyValue);
              if (lastVersion != null) {
                item=lastVersion.getProperty().getItem();
              }
              if (item != null && PluginChecker.isCDCPluginLoaded()) {
                ICDCProviderService service=(ICDCProviderService)GlobalServiceRegister.getDefault().getService(ICDCProviderService.class);
                if (service != null) {
                  try {
                    List<IRepositoryViewObject> all;
                    all=CorePlugin.getDefault().getProxyRepositoryFactory().getAll(ERepositoryObjectType.METADATA_CONNECTIONS);
                    for (                    IRepositoryViewObject obj : all) {
                      Item tempItem=obj.getProperty().getItem();
                      if (tempItem instanceof DatabaseConnectionItem) {
                        String cdcLinkId=service.getCDCConnectionLinkId((DatabaseConnectionItem)tempItem);
                        if (cdcLinkId != null && item.getProperty().getId().equals(cdcLinkId)) {
                          objectValue=RepositoryToComponentProperty.getValue(((DatabaseConnectionItem)tempItem).getConnection(),repositoryValue,node.getMetadataList().get(0));
                        }
                      }
                    }
                  }
 catch (                  PersistenceException e) {
                    ExceptionHandler.process(e);
                  }
                }
              }
            }
            if (GlobalServiceRegister.getDefault().isServiceRegistered(IJsonFileService.class)) {
              IJsonFileService jsonService=(IJsonFileService)GlobalServiceRegister.getDefault().getService(IJsonFileService.class);
              boolean paramChanged=jsonService.changeFilePathFromRepository(connectionItem.getConnection(),param,node,objectValue);
              if (paramChanged) {
                continue;
              }
            }
            if (objectValue != null) {
              if (param.getFieldType().equals(EParameterFieldType.CLOSED_LIST) && repositoryValue.equals(UpdatesConstants.TYPE)) {
                boolean found=false;
                String[] items=param.getListRepositoryItems();
                for (int i=0; (i < items.length) && (!found); i++) {
                  if (objectValue.equals(items[i])) {
                    found=true;
                    node.setPropertyValue(param.getName(),param.getListItemsValue()[i]);
                  }
                }
              }
 else {
                if (param.getFieldType().equals(EParameterFieldType.TABLE)) {
                  String name=param.getName();
                  if (name.equals("String_Node_Str") || name.equals("String_Node_Str") || name.equals("String_Node_Str") && objectValue instanceof List) {
                    param.setValue(objectValue);
                  }
 else                   if (param.getName().equals("String_Node_Str") && objectValue instanceof List) {
                    List<Map<String,Object>> paramMaps=(List<Map<String,Object>>)param.getValue();
                    if (paramMaps == null) {
                      paramMaps=new ArrayList<Map<String,Object>>();
                      node.setPropertyValue(param.getName(),paramMaps);
                    }
 else {
                      List<Map<String,Object>> objectValueList=(List<Map<String,Object>>)objectValue;
                      if (paramMaps.size() < objectValueList.size()) {
                        paramMaps.clear();
                        for (int i=0; i < objectValueList.size(); i++) {
                          Map<String,Object> map=objectValueList.get(i);
                          paramMaps.add(map);
                        }
                      }
 else {
                        String value=null;
                        List<String> repNames=new ArrayList<String>();
                        for (int i=0; i < objectValueList.size(); i++) {
                          repNames.add(objectValueList.get(i).get("String_Node_Str").toString());
                        }
                        for (int j=0; j < paramMaps.size(); j++) {
                          Map<String,Object> map=paramMaps.get(j);
                          value=map.get("String_Node_Str").toString();
                          if (!repNames.contains(value)) {
                            paramMaps.remove(j);
                          }
                        }
                      }
                    }
                  }
 else                   if ((name.equals("String_Node_Str") || name.equals("String_Node_Str") || name.equals("String_Node_Str")|| name.equals("String_Node_Str") && objectValue instanceof List)) {
                    List<HashMap<String,Object>> oldValue=(List<HashMap<String,Object>>)param.getValue();
                    for (                    HashMap<String,Object> map : oldValue) {
                      if (map.get("String_Node_Str") != null && !map.get("String_Node_Str").equals("String_Node_Str") && Boolean.valueOf(String.valueOf(map.get("String_Node_Str")))) {
                        ((List<HashMap<String,Object>>)objectValue).add(map);
                      }
                    }
                    param.setValue(objectValue);
                  }
 else                   if (param.getName().equals("String_Node_Str") && objectValue instanceof List) {
                    param.setValue(objectValue);
                  }
                }
 else {
                  node.setPropertyValue(param.getName(),objectValue);
                }
              }
            }
 else             if (param.getFieldType().equals(EParameterFieldType.TABLE) && UpdatesConstants.XML_MAPPING.equals(repositoryValue)) {
              RepositoryToComponentProperty.getTableXMLMappingValue(connectionItem.getConnection(),(List<Map<String,Object>>)param.getValue(),node);
            }
 else             if (param.getFieldType().equals(EParameterFieldType.TABLE) && param.getName().equals("String_Node_Str")) {
              objectValue=RepositoryToComponentProperty.getValue(connectionItem.getConnection(),"String_Node_Str",node.getMetadataList().get(0));
              List<Map<String,Object>> paramMaps=(List<Map<String,Object>>)param.getValue();
              if (paramMaps == null) {
                paramMaps=new ArrayList<Map<String,Object>>();
              }
 else {
                paramMaps.clear();
              }
              if (objectValue != null) {
                List<String> objectValueList=(List<String>)objectValue;
                for (int i=0; i < objectValueList.size(); i++) {
                  Map<String,Object> map=new HashedMap();
                  map.put("String_Node_Str",TalendTextUtils.addQuotes(objectValueList.get(i)));
                  paramMaps.add(map);
                }
              }
            }
            if (!("String_Node_Str".equals(node.getComponent().getName()) && "String_Node_Str".equals(param.getRepositoryValue()))) {
              param.setRepositoryValueUsed(true);
              param.setReadOnly(true);
              update=true;
            }
          }
        }
      }
    }
    if (!update) {
      String propertyName=parentParamName + "String_Node_Str" + EParameterName.PROPERTY_TYPE.getName();
      if (this.result.getParameter() instanceof IElementParameter) {
        IElementParameter parentParam=((IElementParameter)this.result.getParameter()).getParentParameter();
        if (parentParam != null) {
          parentParamName=parentParam.getName();
          propertyName=parentParam.getName() + "String_Node_Str" + parentParam.getChildParameters().get(EParameterName.PROPERTY_TYPE.getName()).getName();
        }
      }
      node.setPropertyValue(propertyName,EmfComponent.BUILTIN);
      for (      IElementParameter param : node.getElementParameters()) {
        if (param.getRepositoryValue() == null || param.getRepositoryProperty() != null && !param.getRepositoryProperty().equals(parentParamName)) {
          continue;
        }
        if (param.getFieldType() == EParameterFieldType.PROPERTY_TYPE) {
          continue;
        }
        if (param.isShow(node.getElementParameters())) {
          if (param.getName().equals(EParameterName.PROPERTY_TYPE.getName()) || param.getFieldType() == EParameterFieldType.MEMO_SQL) {
            continue;
          }
          param.setRepositoryValueUsed(false);
          param.setReadOnly(false);
        }
      }
    }
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void updateProperty(){
  Object updateObject=result.getUpdateObject();
  if (updateObject == null) {
    return;
  }
  if (updateObject instanceof Node) {
    Node node=(Node)updateObject;
    boolean update=false;
    boolean isXsdPath=false;
    Object parameter=result.getParameter();
    IElementParameter curPropertyParam=null;
    String parentParamName="String_Node_Str";
    ConnectionItem connectionItem=null;
    if (parameter instanceof ConnectionItem) {
      if (parameter instanceof XmlFileConnectionItem) {
        String filePath=((XmlFileConnection)((XmlFileConnectionItem)parameter).getConnection()).getXmlFilePath();
        if (filePath != null) {
          if (XmlUtil.isXSDFile(filePath)) {
            isXsdPath=true;
          }
        }
      }
      connectionItem=(ConnectionItem)result.getParameter();
      for (      IElementParameter param : node.getElementParameters()) {
        if (param.getFieldType() == EParameterFieldType.PROPERTY_TYPE && param.getChildParameters().get(EParameterName.REPOSITORY_PROPERTY_TYPE.getName()).getValue().equals(connectionItem.getProperty().getId())) {
          curPropertyParam=param;
          parentParamName=curPropertyParam.getName();
          break;
        }
      }
    }
    if (result.getResultType() == EUpdateResult.UPDATE) {
      if (result.isChecked() && connectionItem != null) {
        List<? extends IElementParameter> elemParameters=new ArrayList<>(node.getElementParameters());
        for (        IElementParameter param : elemParameters) {
          String repositoryValue=param.getRepositoryValue();
          if (param.getRepositoryValue() == null || (curPropertyParam != null && param.getRepositoryProperty() != null && !param.getRepositoryProperty().equals(curPropertyParam.getName()))) {
            continue;
          }
          if (param.getFieldType() == EParameterFieldType.PROPERTY_TYPE) {
            continue;
          }
          if ((repositoryValue != null) && (param.isShow(node.getElementParameters()) || (node instanceof INode && ((INode)node).getComponent().getName().equals("String_Node_Str")) || (node instanceof INode && ((INode)node).getComponent().getName().equals("String_Node_Str")))) {
            if (param.getName().equals(EParameterName.PROPERTY_TYPE.getName()) || param.getFieldType() == EParameterFieldType.MEMO_SQL) {
              continue;
            }
            if (param.getFieldType().equals(EParameterFieldType.FILE) && isXsdPath) {
              continue;
            }
            IMetadataTable table=null;
            if (!node.getMetadataList().isEmpty()) {
              table=node.getMetadataList().get(0);
            }
            Object objectValue=RepositoryToComponentProperty.getValue(connectionItem.getConnection(),repositoryValue,table);
            if (objectValue == null || "String_Node_Str".equals(objectValue)) {
              if (GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class)) {
                IESBService service=(IESBService)GlobalServiceRegister.getDefault().getService(IESBService.class);
                if (service != null) {
                  String propertyValue=(String)node.getPropertyValue(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
                  if (node.getComponent().getName().startsWith("String_Node_Str")) {
                    if (propertyValue.contains("String_Node_Str")) {
                      propertyValue=propertyValue.split("String_Node_Str")[0];
                    }
                  }
                  IRepositoryViewObject lastVersion=UpdateRepositoryUtils.getRepositoryObjectById(propertyValue);
                  if (lastVersion != null) {
                    Item item=lastVersion.getProperty().getItem();
                    if (item != null) {
                      Object objectValueFromESB=service.getValue(item,repositoryValue,node);
                      if (objectValueFromESB != null) {
                        objectValue=objectValueFromESB;
                      }
                    }
                  }
                }
              }
            }
            if (param.getName().equals(EParameterName.CDC_TYPE_MODE.getName())) {
              String propertyValue=(String)node.getPropertyValue(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
              Item item=null;
              IRepositoryViewObject lastVersion=UpdateRepositoryUtils.getRepositoryObjectById(propertyValue);
              if (lastVersion != null) {
                item=lastVersion.getProperty().getItem();
              }
              if (item != null && PluginChecker.isCDCPluginLoaded()) {
                ICDCProviderService service=(ICDCProviderService)GlobalServiceRegister.getDefault().getService(ICDCProviderService.class);
                if (service != null) {
                  try {
                    List<IRepositoryViewObject> all;
                    all=CorePlugin.getDefault().getProxyRepositoryFactory().getAll(ERepositoryObjectType.METADATA_CONNECTIONS);
                    for (                    IRepositoryViewObject obj : all) {
                      Item tempItem=obj.getProperty().getItem();
                      if (tempItem instanceof DatabaseConnectionItem) {
                        String cdcLinkId=service.getCDCConnectionLinkId((DatabaseConnectionItem)tempItem);
                        if (cdcLinkId != null && item.getProperty().getId().equals(cdcLinkId)) {
                          objectValue=RepositoryToComponentProperty.getValue(((DatabaseConnectionItem)tempItem).getConnection(),repositoryValue,node.getMetadataList().get(0));
                        }
                      }
                    }
                  }
 catch (                  PersistenceException e) {
                    ExceptionHandler.process(e);
                  }
                }
              }
            }
            if (GlobalServiceRegister.getDefault().isServiceRegistered(IJsonFileService.class)) {
              IJsonFileService jsonService=(IJsonFileService)GlobalServiceRegister.getDefault().getService(IJsonFileService.class);
              boolean paramChanged=jsonService.changeFilePathFromRepository(connectionItem.getConnection(),param,node,objectValue);
              if (paramChanged) {
                continue;
              }
            }
            if (objectValue != null) {
              if (param.getFieldType().equals(EParameterFieldType.CLOSED_LIST) && repositoryValue.equals(UpdatesConstants.TYPE)) {
                boolean found=false;
                String[] items=param.getListRepositoryItems();
                for (int i=0; (i < items.length) && (!found); i++) {
                  if (objectValue.equals(items[i])) {
                    found=true;
                    node.setPropertyValue(param.getName(),param.getListItemsValue()[i]);
                  }
                }
              }
 else {
                if (param.getFieldType().equals(EParameterFieldType.TABLE)) {
                  String name=param.getName();
                  if (name.equals("String_Node_Str") || name.equals("String_Node_Str") || name.equals("String_Node_Str") && objectValue instanceof List) {
                    param.setValue(objectValue);
                  }
 else                   if (param.getName().equals("String_Node_Str") && objectValue instanceof List) {
                    List<Map<String,Object>> paramMaps=(List<Map<String,Object>>)param.getValue();
                    if (paramMaps == null) {
                      paramMaps=new ArrayList<Map<String,Object>>();
                      node.setPropertyValue(param.getName(),paramMaps);
                    }
 else {
                      List<Map<String,Object>> objectValueList=(List<Map<String,Object>>)objectValue;
                      if (paramMaps.size() < objectValueList.size()) {
                        paramMaps.clear();
                        for (int i=0; i < objectValueList.size(); i++) {
                          Map<String,Object> map=objectValueList.get(i);
                          paramMaps.add(map);
                        }
                      }
 else {
                        String value=null;
                        List<String> repNames=new ArrayList<String>();
                        for (int i=0; i < objectValueList.size(); i++) {
                          repNames.add(objectValueList.get(i).get("String_Node_Str").toString());
                        }
                        for (int j=0; j < paramMaps.size(); j++) {
                          Map<String,Object> map=paramMaps.get(j);
                          value=map.get("String_Node_Str").toString();
                          if (!repNames.contains(value)) {
                            paramMaps.remove(j);
                          }
                        }
                      }
                    }
                  }
 else                   if ((name.equals("String_Node_Str") || name.equals("String_Node_Str") || name.equals("String_Node_Str")|| name.equals("String_Node_Str") && objectValue instanceof List)) {
                    List<HashMap<String,Object>> oldValue=(List<HashMap<String,Object>>)param.getValue();
                    for (                    HashMap<String,Object> map : oldValue) {
                      if (map.get("String_Node_Str") != null && !map.get("String_Node_Str").equals("String_Node_Str") && Boolean.valueOf(String.valueOf(map.get("String_Node_Str")))) {
                        ((List<HashMap<String,Object>>)objectValue).add(map);
                      }
                    }
                    param.setValue(objectValue);
                  }
 else                   if (param.getName().equals("String_Node_Str") && objectValue instanceof List) {
                    param.setValue(objectValue);
                  }
                }
 else {
                  node.setPropertyValue(param.getName(),objectValue);
                }
              }
            }
 else             if (param.getFieldType().equals(EParameterFieldType.TABLE) && UpdatesConstants.XML_MAPPING.equals(repositoryValue)) {
              RepositoryToComponentProperty.getTableXMLMappingValue(connectionItem.getConnection(),(List<Map<String,Object>>)param.getValue(),node);
            }
 else             if (param.getFieldType().equals(EParameterFieldType.TABLE) && param.getName().equals("String_Node_Str")) {
              objectValue=RepositoryToComponentProperty.getValue(connectionItem.getConnection(),"String_Node_Str",node.getMetadataList().get(0));
              List<Map<String,Object>> paramMaps=(List<Map<String,Object>>)param.getValue();
              if (paramMaps == null) {
                paramMaps=new ArrayList<Map<String,Object>>();
              }
 else {
                paramMaps.clear();
              }
              if (objectValue != null) {
                List<String> objectValueList=(List<String>)objectValue;
                for (int i=0; i < objectValueList.size(); i++) {
                  Map<String,Object> map=new HashedMap();
                  map.put("String_Node_Str",TalendTextUtils.addQuotes(objectValueList.get(i)));
                  paramMaps.add(map);
                }
              }
            }
            if (!("String_Node_Str".equals(node.getComponent().getName()) && "String_Node_Str".equals(param.getRepositoryValue()))) {
              param.setRepositoryValueUsed(true);
              param.setReadOnly(true);
              update=true;
            }
          }
        }
      }
    }
    if (!update) {
      String propertyName=parentParamName + "String_Node_Str" + EParameterName.PROPERTY_TYPE.getName();
      if (this.result.getParameter() instanceof IElementParameter) {
        IElementParameter parentParam=((IElementParameter)this.result.getParameter()).getParentParameter();
        if (parentParam != null) {
          parentParamName=parentParam.getName();
          propertyName=parentParam.getName() + "String_Node_Str" + parentParam.getChildParameters().get(EParameterName.PROPERTY_TYPE.getName()).getName();
        }
      }
      node.setPropertyValue(propertyName,EmfComponent.BUILTIN);
      for (      IElementParameter param : node.getElementParameters()) {
        if (param.getRepositoryValue() == null || param.getRepositoryProperty() != null && !param.getRepositoryProperty().equals(parentParamName)) {
          continue;
        }
        if (param.getFieldType() == EParameterFieldType.PROPERTY_TYPE) {
          continue;
        }
        if (param.isShow(node.getElementParameters())) {
          if (param.getName().equals(EParameterName.PROPERTY_TYPE.getName()) || param.getFieldType() == EParameterFieldType.MEMO_SQL) {
            continue;
          }
          param.setRepositoryValueUsed(false);
          param.setReadOnly(false);
        }
      }
    }
  }
}