Program: 122047
Project: 122047
Buggy source:
@Override public void execute(){
  IElementParameter currentParam=elem.getElementParameter(propName);
  oldElementValues.clear();
  if (currentParam == null) {
    return;
  }
  if (currentParam.isRepositoryValueUsed()) {
    if (currentParam.getFieldType() == EParameterFieldType.MEMO_SQL) {
      Object queryStoreValue=elem.getPropertyValue(EParameterName.QUERYSTORE_TYPE.getName());
      if (!EmfComponent.BUILTIN.equals(queryStoreValue) || !EmfComponent.TNS_FILE.equals(queryStoreValue)) {
        elem.setPropertyValue(EParameterName.QUERYSTORE_TYPE.getName(),EmfComponent.BUILTIN);
      }
      currentParam.setRepositoryValueUsed(false);
    }
 else {
      toUpdate=true;
      String oldValueString=elem.getPropertyValue(propName).toString();
      if (!oldValueString.endsWith("String_Node_Str") && !oldValueString.endsWith("String_Node_Str")) {
        elem.setPropertyValue(propertyTypeName,EmfComponent.BUILTIN);
      }
      for (      IElementParameter param : elem.getElementParameters()) {
        if (param.getCategory().equals(currentParam.getCategory())) {
          param.setRepositoryValueUsed(false);
        }
      }
    }
    repositoryValueWasUsed=true;
  }
 else {
    repositoryValueWasUsed=false;
  }
  oldValue=elem.getPropertyValue(propName);
  elem.setPropertyValue(propName,newValue);
  if (propName.contains(EParameterName.USE_DYNAMIC_JOB.getName()) && newValue.equals(false)) {
    IElementParameter processParam=elem.getElementParameter(EParameterName.PROCESS.getName());
    IElementParameter processTypeParameter=elem.getElementParameter(EParameterName.PROCESS_TYPE_PROCESS.getName());
    final String parentName=processParam.getName() + "String_Node_Str";
    elem.setPropertyValue(parentName + processTypeParameter.getName(),"String_Node_Str");
    elem.setPropertyValue(processParam.getName(),"String_Node_Str");
  }
  if (propName.contains(EParameterName.PROCESS_TYPE_PROCESS.getName())) {
    boolean isSelectUseDynamic=false;
    IElementParameter useDynamicJobParameter=elem.getElementParameter(EParameterName.USE_DYNAMIC_JOB.getName());
    if (useDynamicJobParameter != null && useDynamicJobParameter instanceof IElementParameter) {
      Object useDynamicJobValue=(Object)useDynamicJobParameter.getValue();
      if (useDynamicJobValue != null && useDynamicJobValue instanceof Boolean) {
        isSelectUseDynamic=(Boolean)useDynamicJobValue;
      }
    }
    if (isSelectUseDynamic) {
      StringBuffer labels=new StringBuffer("String_Node_Str");
      if (newValue != null) {
        String[] strValues=newValue.toString().split("String_Node_Str");
        for (int i=0; i < strValues.length; i++) {
          String strValue=strValues[i];
          ProcessItem processItem=ItemCacheManager.getProcessItem((String)strValue);
          if (processItem != null) {
            String label=processItem.getProperty().getLabel();
            if (i > 0) {
              labels.append("String_Node_Str");
            }
            labels.append(label);
          }
        }
      }
      currentParam.getParentParameter().setValue(labels.toString());
    }
 else {
      ProcessItem processItem=ItemCacheManager.getProcessItem((String)newValue);
      if (processItem != null) {
        currentParam.getParentParameter().setValue(processItem.getProperty().getLabel());
      }
    }
  }
  if (propName.contains(EParameterName.PROCESS_TYPE_VERSION.getName())) {
    boolean isJobletComponent=false;
    IJobletProviderService service=null;
    if (PluginChecker.isJobLetPluginLoaded()) {
      service=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
    }
    if (elem instanceof Node) {
      if (service != null) {
        isJobletComponent=service.isJobletComponent((Node)elem);
      }
    }
    if (isJobletComponent) {
      String id=service.getJobletComponentItem((Node)elem).getId();
      String version=(String)newValue;
      IComponent newComponent=service.setPropertyForJobletComponent(id,version);
      reloadNode((Node)elem,newComponent);
    }
 else {
      IElementParameter processIdParam=currentParam.getParentParameter().getChildParameters().get(EParameterName.PROCESS_TYPE_PROCESS.getName());
      ProcessItem processItem=ItemCacheManager.getProcessItem((String)processIdParam.getValue(),(String)newValue);
      if (processItem != null) {
        currentParam.getParentParameter().setValue(processItem.getProperty().getLabel());
      }
    }
  }
  if (propName.contains(EParameterName.PROCESS_TYPE_CONTEXT.getName())) {
    if (elem instanceof Node) {
      Node node=(Node)elem;
      List<IContext> listContext=node.getProcess().getContextManager().getListContext();
      List<String> values=new ArrayList<String>();
      for (      IContext context : listContext) {
        values.add(context.getName());
      }
      currentParam.setListItemsDisplayName(values.toArray(new String[0]));
      currentParam.setListItemsValue(values.toArray(new String[0]));
      currentParam.setValue(newValue);
    }
  }
  if (propName.equals(EParameterName.VALIDATION_RULES.getName())) {
    if (elem instanceof INode) {
      ValidationRulesUtil.createRejectConnector((INode)elem);
      ValidationRulesUtil.updateRejectMetatable((INode)elem,null);
      if (newValue != null && (!(Boolean)newValue)) {
        ValidationRulesUtil.removeRejectConnector((INode)elem);
        ValidationRulesUtil.removeRejectConnection((INode)elem);
      }
    }
  }
  String dbType="String_Node_Str";
  if (newValue instanceof String) {
    dbType=(String)newValue;
  }
  if (propName.equals(EParameterName.DB_TYPE.getName())) {
    IElementParameter elementParameter=elem.getElementParameter(EParameterName.DB_VERSION.getName());
    IElementParameter elementParameter2=elem.getElementParameter(EParameterName.SCHEMA_DB.getName());
    setDbVersion(elementParameter,dbType);
    DesignerUtilities.setSchemaDB(elementParameter2,newValue);
  }
 else   if (propName.equals(JobSettingsConstants.getExtraParameterName(EParameterName.DB_TYPE.getName()))) {
    IElementParameter elementParameter=elem.getElementParameter(JobSettingsConstants.getExtraParameterName(EParameterName.DB_VERSION.getName()));
    IElementParameter elementParameter2=elem.getElementParameter(JobSettingsConstants.getExtraParameterName(EParameterName.SCHEMA_DB.getName()));
    setDbVersion(elementParameter,dbType);
    DesignerUtilities.setSchemaDB(elementParameter2,newValue);
  }
  if (!toUpdate && (currentParam.getFieldType().equals(EParameterFieldType.RADIO) || currentParam.getFieldType().equals(EParameterFieldType.CLOSED_LIST) || currentParam.getFieldType().equals(EParameterFieldType.CHECK)|| currentParam.getFieldType().equals(EParameterFieldType.AS400_CHECK))) {
    toUpdate=false;
    for (int i=0; i < elem.getElementParameters().size(); i++) {
      IElementParameter testedParam=elem.getElementParameters().get(i);
      String showIf=testedParam.getShowIf();
      String notShowIf=testedParam.getNotShowIf();
      if (showIf != null) {
        if (showIf.contains(currentParam.getName())) {
          toUpdate=true;
        }
      }
 else {
        if (notShowIf != null) {
          if (notShowIf.contains(currentParam.getName())) {
            toUpdate=true;
          }
        }
      }
      if (testedParam.getFieldType() == EParameterFieldType.TABLE) {
        String[] tmpShowIfs=testedParam.getListItemsShowIf();
        if (tmpShowIfs != null) {
          for (          String show : tmpShowIfs) {
            if (show != null && show.contains(currentParam.getName())) {
              toUpdate=true;
            }
          }
        }
        tmpShowIfs=testedParam.getListItemsNotShowIf();
        if (tmpShowIfs != null) {
          for (          String show : tmpShowIfs) {
            if (show != null && show.contains(currentParam.getName())) {
              toUpdate=true;
            }
          }
        }
      }
      if (currentParam.getFieldType().equals(EParameterFieldType.CLOSED_LIST)) {
        if (testedParam.getListItemsShowIf() != null) {
          for (int j=0; j < testedParam.getListItemsShowIf().length && !toUpdate; j++) {
            showIf=testedParam.getListItemsShowIf()[j];
            notShowIf=testedParam.getListItemsNotShowIf()[j];
            if (showIf != null) {
              if (showIf.contains(currentParam.getName())) {
                toUpdate=true;
              }
            }
 else {
              if (notShowIf != null) {
                if (notShowIf.contains(currentParam.getName())) {
                  toUpdate=true;
                }
              }
            }
          }
        }
      }
      setDefaultValues(currentParam,testedParam);
    }
  }
  if (currentParam.getName().equals(EParameterName.PROCESS_TYPE_PROCESS.getName())) {
    toUpdate=true;
  }
  if (toUpdate) {
    elem.setPropertyValue(updataComponentParamName,new Boolean(true));
  }
  boolean updateCode=false;
  if (getNewValue() instanceof String && elem instanceof INode) {
    INode curNode=(INode)elem;
    String uniqueName=curNode.getUniqueName();
    IProcess process=curNode.getProcess();
    if (process != null && process instanceof IProcess2) {
      IProcess2 process2=(IProcess2)process;
      List<? extends INode> generatingNodes=null;
      if (process2.isProcessModified()) {
        process2.setProcessModified(false);
        generatingNodes=process2.getGeneratingNodes();
        if (generatingNodes != null) {
          for (          INode genNode : generatingNodes) {
            if (genNode.getUniqueName().equals(uniqueName)) {
              IElementParameter genParam=genNode.getElementParameter(propName);
              if (genParam != null) {
                genParam.setValue(newValue);
                break;
              }
            }
          }
        }
        CodeView.refreshCodeView(elem);
        process2.setProcessModified(true);
        updateCode=true;
      }
    }
  }
  if (elem instanceof IGraphicalNode) {
    ((IGraphicalNode)elem).checkAndRefreshNode();
  }
  if (needUpdateMonitorConnection()) {
    ((Connection)elem).setMonitorConnection((Boolean)currentParam.getValue());
  }
}

Fixed version (ground truth):
@Override public void execute(){
  IElementParameter currentParam=elem.getElementParameter(propName);
  oldElementValues.clear();
  if (currentParam == null) {
    return;
  }
  if (currentParam.isRepositoryValueUsed()) {
    if (currentParam.getFieldType() == EParameterFieldType.MEMO_SQL) {
      Object queryStoreValue=elem.getPropertyValue(EParameterName.QUERYSTORE_TYPE.getName());
      if (!EmfComponent.BUILTIN.equals(queryStoreValue) || !EmfComponent.TNS_FILE.equals(queryStoreValue)) {
        elem.setPropertyValue(EParameterName.QUERYSTORE_TYPE.getName(),EmfComponent.BUILTIN);
      }
      currentParam.setRepositoryValueUsed(false);
    }
 else {
      toUpdate=true;
      String oldValueString=elem.getPropertyValue(propName).toString();
      if (!oldValueString.endsWith("String_Node_Str") && !oldValueString.endsWith("String_Node_Str")) {
        elem.setPropertyValue(propertyTypeName,EmfComponent.BUILTIN);
      }
      for (      IElementParameter param : elem.getElementParameters()) {
        if (param.getCategory().equals(currentParam.getCategory())) {
          param.setRepositoryValueUsed(false);
        }
      }
    }
    repositoryValueWasUsed=true;
  }
 else {
    repositoryValueWasUsed=false;
  }
  oldValue=elem.getPropertyValue(propName);
  elem.setPropertyValue(propName,newValue);
  if (propName.contains(EParameterName.USE_DYNAMIC_JOB.getName()) && newValue.equals(false)) {
    IElementParameter processParam=elem.getElementParameter(EParameterName.PROCESS.getName());
    IElementParameter processTypeParameter=elem.getElementParameter(EParameterName.PROCESS_TYPE_PROCESS.getName());
    final String parentName=processParam.getName() + "String_Node_Str";
    elem.setPropertyValue(parentName + processTypeParameter.getName(),"String_Node_Str");
    elem.setPropertyValue(processParam.getName(),"String_Node_Str");
  }
  if (propName.contains(EParameterName.PROCESS_TYPE_PROCESS.getName())) {
    boolean isSelectUseDynamic=false;
    IElementParameter useDynamicJobParameter=elem.getElementParameter(EParameterName.USE_DYNAMIC_JOB.getName());
    if (useDynamicJobParameter != null && useDynamicJobParameter instanceof IElementParameter) {
      Object useDynamicJobValue=useDynamicJobParameter.getValue();
      if (useDynamicJobValue != null && useDynamicJobValue instanceof Boolean) {
        isSelectUseDynamic=(Boolean)useDynamicJobValue;
      }
    }
    if (isSelectUseDynamic) {
      StringBuffer labels=new StringBuffer("String_Node_Str");
      if (newValue != null) {
        String[] strValues=newValue.toString().split("String_Node_Str");
        for (int i=0; i < strValues.length; i++) {
          String strValue=strValues[i];
          ProcessItem processItem=ItemCacheManager.getProcessItem(strValue);
          if (processItem != null) {
            String label=processItem.getProperty().getLabel();
            if (i > 0) {
              labels.append("String_Node_Str");
            }
            labels.append(label);
          }
        }
      }
      currentParam.getParentParameter().setValue(labels.toString());
    }
 else {
      ProcessItem processItem=ItemCacheManager.getProcessItem((String)newValue);
      if (processItem != null) {
        currentParam.getParentParameter().setValue(processItem.getProperty().getLabel());
      }
    }
  }
  if (propName.contains(EParameterName.PROCESS_TYPE_VERSION.getName())) {
    boolean isJobletComponent=false;
    IJobletProviderService service=null;
    if (PluginChecker.isJobLetPluginLoaded()) {
      service=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
    }
    if (elem instanceof Node) {
      if (service != null) {
        isJobletComponent=service.isJobletComponent((Node)elem);
      }
    }
    if (isJobletComponent) {
      String id=service.getJobletComponentItem((Node)elem).getId();
      String version=(String)newValue;
      IComponent newComponent=service.setPropertyForJobletComponent(id,version);
      reloadNode((Node)elem,newComponent);
    }
 else {
      IElementParameter processIdParam=currentParam.getParentParameter().getChildParameters().get(EParameterName.PROCESS_TYPE_PROCESS.getName());
      ProcessItem processItem=ItemCacheManager.getProcessItem((String)processIdParam.getValue(),(String)newValue);
      if (processItem != null) {
        currentParam.getParentParameter().setValue(processItem.getProperty().getLabel());
      }
    }
  }
  if (propName.contains(EParameterName.PROCESS_TYPE_CONTEXT.getName())) {
    if (elem instanceof Node) {
      Node node=(Node)elem;
      List<IContext> listContext=node.getProcess().getContextManager().getListContext();
      List<String> values=new ArrayList<String>();
      for (      IContext context : listContext) {
        values.add(context.getName());
      }
      currentParam.setListItemsDisplayName(values.toArray(new String[0]));
      currentParam.setListItemsValue(values.toArray(new String[0]));
      currentParam.setValue(newValue);
    }
  }
  if (propName.equals(EParameterName.VALIDATION_RULES.getName())) {
    if (elem instanceof INode) {
      ValidationRulesUtil.createRejectConnector((INode)elem);
      ValidationRulesUtil.updateRejectMetatable((INode)elem,null);
      if (newValue != null && (!(Boolean)newValue)) {
        ValidationRulesUtil.removeRejectConnector((INode)elem);
        ValidationRulesUtil.removeRejectConnection((INode)elem);
      }
    }
  }
  String dbType="String_Node_Str";
  if (newValue instanceof String) {
    dbType=(String)newValue;
  }
  IElementParameter schemaParameter=null;
  if (propName.equals(EParameterName.DB_TYPE.getName())) {
    IElementParameter elementParameter=elem.getElementParameter(EParameterName.DB_VERSION.getName());
    schemaParameter=elem.getElementParameter(EParameterName.SCHEMA_DB.getName());
    setDbVersion(elementParameter,dbType);
    DesignerUtilities.setSchemaDB(schemaParameter,newValue);
  }
 else   if (propName.equals(JobSettingsConstants.getExtraParameterName(EParameterName.DB_TYPE.getName()))) {
    IElementParameter elementParameter=elem.getElementParameter(JobSettingsConstants.getExtraParameterName(EParameterName.DB_VERSION.getName()));
    schemaParameter=elem.getElementParameter(JobSettingsConstants.getExtraParameterName(EParameterName.SCHEMA_DB.getName()));
    setDbVersion(elementParameter,dbType);
    DesignerUtilities.setSchemaDB(schemaParameter,newValue);
  }
  if (schemaParameter != null) {
    if (currentParam.getValue() != null) {
      int indexOfItemFromList=currentParam.getIndexOfItemFromList(currentParam.getValue().toString());
      if (indexOfItemFromList != -1) {
        dbType=currentParam.getListItemsDisplayCodeName()[indexOfItemFromList];
      }
    }
    if (EDatabaseTypeName.GENERAL_JDBC.getProduct().equals(dbType) || EDatabaseTypeName.GODBC.getProduct().equals(dbType) || EDatabaseTypeName.MYSQL.getProduct().equals(dbType)|| EDatabaseTypeName.IBMDB2.getProduct().equals(dbType)|| EDatabaseTypeName.SYBASEASE.getProduct().equals(dbType)|| EDatabaseTypeName.SYBASEIQ.getProduct().equals(dbType)|| EDatabaseTypeName.INGRES.getProduct().equals(dbType)|| EDatabaseTypeName.INTERBASE.getProduct().equals(dbType)|| EDatabaseTypeName.SQLITE.getProduct().equals(dbType)|| EDatabaseTypeName.FIREBIRD.getProduct().equals(dbType)|| EDatabaseTypeName.ACCESS.getProduct().equals(dbType)|| EDatabaseTypeName.TERADATA.getProduct().equals(dbType)) {
      if (!schemaParameter.getValue().equals("String_Node_Str")) {
        schemaParameter.setValue("String_Node_Str");
      }
    }
  }
  if (!toUpdate && (currentParam.getFieldType().equals(EParameterFieldType.RADIO) || currentParam.getFieldType().equals(EParameterFieldType.CLOSED_LIST) || currentParam.getFieldType().equals(EParameterFieldType.CHECK)|| currentParam.getFieldType().equals(EParameterFieldType.AS400_CHECK))) {
    toUpdate=false;
    for (int i=0; i < elem.getElementParameters().size(); i++) {
      IElementParameter testedParam=elem.getElementParameters().get(i);
      String showIf=testedParam.getShowIf();
      String notShowIf=testedParam.getNotShowIf();
      if (showIf != null) {
        if (showIf.contains(currentParam.getName())) {
          toUpdate=true;
        }
      }
 else {
        if (notShowIf != null) {
          if (notShowIf.contains(currentParam.getName())) {
            toUpdate=true;
          }
        }
      }
      if (testedParam.getFieldType() == EParameterFieldType.TABLE) {
        String[] tmpShowIfs=testedParam.getListItemsShowIf();
        if (tmpShowIfs != null) {
          for (          String show : tmpShowIfs) {
            if (show != null && show.contains(currentParam.getName())) {
              toUpdate=true;
            }
          }
        }
        tmpShowIfs=testedParam.getListItemsNotShowIf();
        if (tmpShowIfs != null) {
          for (          String show : tmpShowIfs) {
            if (show != null && show.contains(currentParam.getName())) {
              toUpdate=true;
            }
          }
        }
      }
      if (currentParam.getFieldType().equals(EParameterFieldType.CLOSED_LIST)) {
        if (testedParam.getListItemsShowIf() != null) {
          for (int j=0; j < testedParam.getListItemsShowIf().length && !toUpdate; j++) {
            showIf=testedParam.getListItemsShowIf()[j];
            notShowIf=testedParam.getListItemsNotShowIf()[j];
            if (showIf != null) {
              if (showIf.contains(currentParam.getName())) {
                toUpdate=true;
              }
            }
 else {
              if (notShowIf != null) {
                if (notShowIf.contains(currentParam.getName())) {
                  toUpdate=true;
                }
              }
            }
          }
        }
      }
      setDefaultValues(currentParam,testedParam);
    }
  }
  if (currentParam.getName().equals(EParameterName.PROCESS_TYPE_PROCESS.getName())) {
    toUpdate=true;
  }
  if (toUpdate) {
    elem.setPropertyValue(updataComponentParamName,new Boolean(true));
  }
  boolean updateCode=false;
  if (getNewValue() instanceof String && elem instanceof INode) {
    INode curNode=(INode)elem;
    String uniqueName=curNode.getUniqueName();
    IProcess process=curNode.getProcess();
    if (process != null && process instanceof IProcess2) {
      IProcess2 process2=(IProcess2)process;
      List<? extends INode> generatingNodes=null;
      if (process2.isProcessModified()) {
        process2.setProcessModified(false);
        generatingNodes=process2.getGeneratingNodes();
        if (generatingNodes != null) {
          for (          INode genNode : generatingNodes) {
            if (genNode.getUniqueName().equals(uniqueName)) {
              IElementParameter genParam=genNode.getElementParameter(propName);
              if (genParam != null) {
                genParam.setValue(newValue);
                break;
              }
            }
          }
        }
        CodeView.refreshCodeView(elem);
        process2.setProcessModified(true);
        updateCode=true;
      }
    }
  }
  if (elem instanceof IGraphicalNode) {
    ((IGraphicalNode)elem).checkAndRefreshNode();
  }
  if (needUpdateMonitorConnection()) {
    ((Connection)elem).setMonitorConnection((Boolean)currentParam.getValue());
  }
}