Program: 76530
Project: 76530
Buggy source:
/** 
 * Configure the context param settings
 * @param map
 * @param project
 * @param query
 * @param monitor
 * @throws CoreException
 */
public static void configureContextParam(Map map,IProject project,IOverwriteQuery query,IProgressMonitor monitor) throws CoreException {
  if (monitor.isCanceled())   return;
  if (map == null || project == null) {
    return;
  }
  WebArtifactEdit webEdit=WebArtifactEdit.getWebArtifactEditForWrite(project);
  if (webEdit == null)   return;
  try {
    WebApp webapp=(WebApp)webEdit.getDeploymentDescriptorRoot();
    Iterator it=map.keySet().iterator();
    while (it.hasNext()) {
      String name=DataUtil.getString(it.next(),false);
      ContextParamBean bean=(ContextParamBean)map.get(name);
      if (bean == null)       continue;
      List list=null;
      if (webapp.getVersionID() == 23) {
        list=webapp.getContexts();
      }
 else {
        list=webapp.getContextParams();
      }
      Object obj=getContextParamByName(list,name);
      if (obj != null) {
        String ret=query.queryOverwrite("String_Node_Str" + name + "String_Node_Str");
        if (IOverwriteQuery.NO.equalsIgnoreCase(ret)) {
          continue;
        }
        if (IOverwriteQuery.CANCEL.equalsIgnoreCase(ret)) {
          monitor.setCanceled(true);
          return;
        }
        webapp.getContextParams().remove(obj);
      }
      String value=bean.getValue();
      String description=bean.getDescription();
      if (webapp.getVersionID() == 23) {
        ContextParam param=WebapplicationFactory.eINSTANCE.createContextParam();
        param.setParamName(name);
        param.setParamValue(value);
        if (description != null)         param.setDescription(description);
        param.setWebApp(webapp);
      }
 else {
        ParamValue param=CommonFactory.eINSTANCE.createParamValue();
        param.setName(name);
        param.setValue(value);
        if (description != null)         param.setDescription(description);
        webapp.getContextParams().add(param);
      }
    }
    webEdit.saveIfNecessary(monitor);
  }
  finally {
    webEdit.dispose();
  }
}

Fixed version (ground truth):
/** 
 * Configure the context param settings
 * @param map
 * @param project
 * @param query
 * @param monitor
 * @throws CoreException
 */
public static void configureContextParam(Map map,IProject project,IOverwriteQuery query,IProgressMonitor monitor) throws CoreException {
  if (monitor.isCanceled())   return;
  if (map == null || project == null) {
    return;
  }
  WebArtifactEdit webEdit=WebArtifactEdit.getWebArtifactEditForWrite(project);
  if (webEdit == null)   return;
  try {
    WebApp webapp=(WebApp)webEdit.getDeploymentDescriptorRoot();
    Iterator it=map.keySet().iterator();
    while (it.hasNext()) {
      String name=DataUtil.getString(it.next(),false);
      ContextParamBean bean=(ContextParamBean)map.get(name);
      if (bean == null)       continue;
      List list=null;
      if (webapp.getVersionID() == 23) {
        list=webapp.getContexts();
      }
 else {
        list=webapp.getContextParams();
      }
      Object obj=getContextParamByName(list,name);
      if (obj != null) {
        String ret=query.queryOverwrite("String_Node_Str" + name + "String_Node_Str");
        if (IOverwriteQuery.NO.equalsIgnoreCase(ret)) {
          continue;
        }
        if (IOverwriteQuery.CANCEL.equalsIgnoreCase(ret)) {
          monitor.setCanceled(true);
          return;
        }
        webapp.getContextParams().remove(obj);
      }
      String value=bean.getValue();
      String description=bean.getDescription();
      if (webapp.getVersionID() == 23) {
        ContextParam param=WebapplicationFactory.eINSTANCE.createContextParam();
        param.setParamName(name);
        param.setParamValue(value);
        if (description != null)         param.setDescription(description);
        param.setWebApp(webapp);
      }
 else {
        ParamValue param=CommonFactory.eINSTANCE.createParamValue();
        param.setName(name);
        param.setValue(value);
        if (description != null) {
          Description descriptionObj=CommonFactory.eINSTANCE.createDescription();
          descriptionObj.setValue(description);
          param.getDescriptions().add(descriptionObj);
          param.setDescription(description);
        }
        webapp.getContextParams().add(param);
      }
    }
    webEdit.saveIfNecessary(monitor);
  }
  finally {
    webEdit.dispose();
  }
}