Program: 121688
Project: 121688
Buggy source:
private void updateContextList(IElementParameter param){
  List<String> contextParameterNamesList=new ArrayList<String>();
  IElementParameter processTypeParam=elem.getElementParameterFromField(EParameterFieldType.PROCESS_TYPE);
  if (processTypeParam == null) {
    return;
  }
  IElementParameter jobElemParam=processTypeParam.getChildParameters().get(EParameterName.PROCESS_TYPE_PROCESS.getName());
  IElementParameter jobVersionParam=processTypeParam.getChildParameters().get(EParameterName.PROCESS_TYPE_VERSION.getName());
  IElementParameter contextElemParam=processTypeParam.getChildParameters().get(EParameterName.PROCESS_TYPE_CONTEXT.getName());
  String processId=(String)jobElemParam.getValue();
  String contextName=(String)contextElemParam.getValue();
  if (processId == null || contextName == null) {
    revertToolBarButtonState(false);
    return;
  }
  ProcessItem processItem=ItemCacheManager.getProcessItem(processId,(String)jobVersionParam.getValue());
  Process process=null;
  String[] contextParameterNames=null;
  if (processItem != null) {
    IDesignerCoreService service=CorePlugin.getDefault().getDesignerCoreService();
    process=(Process)service.getProcessFromItem(processItem);
    IContext context=process.getContextManager().getContext(contextName);
    for (    IContextParameter contextParam : context.getContextParameterList()) {
      contextParameterNamesList.add(contextParam.getName());
    }
    contextParameterNames=contextParameterNamesList.toArray(new String[0]);
  }
 else {
    contextParameterNames=new String[0];
  }
  TableViewerCreator tableViewerCreator=(TableViewerCreator)hashCurControls.get(param.getName());
  Object[] itemsValue=param.getListItemsValue();
  if (tableViewerCreator != null) {
    List colList=tableViewerCreator.getColumns();
    for (int j=0; j < itemsValue.length; j++) {
      if ((j + 1) >= colList.size()) {
        break;
      }
      if (itemsValue[j] instanceof IElementParameter) {
        IElementParameter tmpParam=(IElementParameter)itemsValue[j];
        if (tmpParam.getFieldType() == EParameterFieldType.CONTEXT_PARAM_NAME_LIST) {
          tmpParam.setListItemsDisplayCodeName(contextParameterNames);
          tmpParam.setListItemsDisplayName(contextParameterNames);
          tmpParam.setListItemsValue(contextParameterNames);
          if (contextParameterNames.length > 0) {
            tmpParam.setDefaultClosedListValue(contextParameterNames[0]);
          }
 else {
            tmpParam.setDefaultClosedListValue("String_Node_Str");
          }
          TableViewerCreatorColumnNotModifiable column=(TableViewerCreatorColumnNotModifiable)colList.get(j + 1);
          CCombo combo=(CCombo)column.getCellEditor().getControl();
          String[] oldItems=combo.getItems();
          combo.setItems(contextParameterNames);
          List<Map<String,Object>> paramValues=(List<Map<String,Object>>)param.getValue();
          String[] items=param.getListItemsDisplayCodeName();
          for (int currentIndex=0; currentIndex < paramValues.size(); currentIndex++) {
            Map<String,Object> currentLine=paramValues.get(currentIndex);
            Object o=currentLine.get(items[j]);
            if (o instanceof Integer) {
              Integer nb=(Integer)o;
              if ((nb >= oldItems.length) || (nb == -1)) {
                currentLine.put(items[j],tmpParam.getDefaultClosedListValue());
              }
 else {
                currentLine.put(items[j],oldItems[nb]);
              }
            }
 else {
              if (o instanceof String) {
                Integer nb=new Integer(tmpParam.getIndexOfItemFromList((String)o));
                if (nb == -1) {
                  currentLine.put(items[j],tmpParam.getDefaultClosedListValue());
                }
              }
            }
          }
        }
      }
    }
  }
  boolean checked=contextParameterNames != null && contextParameterNames.length > 0;
  if (!checked) {
    Object value=param.getValue();
    if (value != null && value instanceof List) {
      if (!((List)value).isEmpty()) {
        ((List)value).clear();
        if (part != null && part.getTalendEditor() != null) {
          part.getTalendEditor().setDirty(true);
        }
      }
    }
  }
  revertToolBarButtonState(checked);
}

Fixed version (ground truth):
private void updateContextList(IElementParameter param){
  List<String> contextParameterNamesList=new ArrayList<String>();
  IElementParameter processTypeParam=elem.getElementParameterFromField(EParameterFieldType.PROCESS_TYPE);
  if (processTypeParam == null) {
    return;
  }
  boolean haveContextParamList=false;
  for (  Object valueParam : param.getListItemsValue()) {
    if (valueParam instanceof IElementParameter) {
      IElementParameter vParam=(IElementParameter)valueParam;
      if (vParam.getFieldType() == EParameterFieldType.CONTEXT_PARAM_NAME_LIST) {
        haveContextParamList=true;
        break;
      }
    }
  }
  if (!haveContextParamList) {
    return;
  }
  IElementParameter jobElemParam=processTypeParam.getChildParameters().get(EParameterName.PROCESS_TYPE_PROCESS.getName());
  IElementParameter jobVersionParam=processTypeParam.getChildParameters().get(EParameterName.PROCESS_TYPE_VERSION.getName());
  IElementParameter contextElemParam=processTypeParam.getChildParameters().get(EParameterName.PROCESS_TYPE_CONTEXT.getName());
  String processId=(String)jobElemParam.getValue();
  String contextName=(String)contextElemParam.getValue();
  if (processId == null || contextName == null) {
    revertToolBarButtonState(false);
    return;
  }
  ProcessItem processItem=ItemCacheManager.getProcessItem(processId,(String)jobVersionParam.getValue());
  Process process=null;
  String[] contextParameterNames=null;
  if (processItem != null) {
    IDesignerCoreService service=CorePlugin.getDefault().getDesignerCoreService();
    process=(Process)service.getProcessFromItem(processItem);
    IContext context=process.getContextManager().getContext(contextName);
    for (    IContextParameter contextParam : context.getContextParameterList()) {
      contextParameterNamesList.add(contextParam.getName());
    }
    contextParameterNames=contextParameterNamesList.toArray(new String[0]);
  }
 else {
    contextParameterNames=new String[0];
  }
  TableViewerCreator tableViewerCreator=(TableViewerCreator)hashCurControls.get(param.getName());
  Object[] itemsValue=param.getListItemsValue();
  if (tableViewerCreator != null) {
    List colList=tableViewerCreator.getColumns();
    for (int j=0; j < itemsValue.length; j++) {
      if ((j + 1) >= colList.size()) {
        break;
      }
      if (itemsValue[j] instanceof IElementParameter) {
        IElementParameter tmpParam=(IElementParameter)itemsValue[j];
        if (tmpParam.getFieldType() == EParameterFieldType.CONTEXT_PARAM_NAME_LIST) {
          tmpParam.setListItemsDisplayCodeName(contextParameterNames);
          tmpParam.setListItemsDisplayName(contextParameterNames);
          tmpParam.setListItemsValue(contextParameterNames);
          if (contextParameterNames.length > 0) {
            tmpParam.setDefaultClosedListValue(contextParameterNames[0]);
          }
 else {
            tmpParam.setDefaultClosedListValue("String_Node_Str");
          }
          TableViewerCreatorColumnNotModifiable column=(TableViewerCreatorColumnNotModifiable)colList.get(j + 1);
          CCombo combo=(CCombo)column.getCellEditor().getControl();
          String[] oldItems=combo.getItems();
          combo.setItems(contextParameterNames);
          List<Map<String,Object>> paramValues=(List<Map<String,Object>>)param.getValue();
          String[] items=param.getListItemsDisplayCodeName();
          for (int currentIndex=0; currentIndex < paramValues.size(); currentIndex++) {
            Map<String,Object> currentLine=paramValues.get(currentIndex);
            Object o=currentLine.get(items[j]);
            if (o instanceof Integer) {
              Integer nb=(Integer)o;
              if ((nb >= oldItems.length) || (nb == -1)) {
                currentLine.put(items[j],tmpParam.getDefaultClosedListValue());
              }
 else {
                currentLine.put(items[j],oldItems[nb]);
              }
            }
 else {
              if (o instanceof String) {
                Integer nb=new Integer(tmpParam.getIndexOfItemFromList((String)o));
                if (nb == -1) {
                  currentLine.put(items[j],tmpParam.getDefaultClosedListValue());
                }
              }
            }
          }
        }
      }
    }
  }
  boolean checked=contextParameterNames != null && contextParameterNames.length > 0;
  if (!checked) {
    Object value=param.getValue();
    if (value != null && value instanceof List) {
      if (!((List)value).isEmpty()) {
        ((List)value).clear();
        if (part != null && part.getTalendEditor() != null) {
          part.getTalendEditor().setDirty(true);
        }
      }
    }
  }
  revertToolBarButtonState(checked);
}