Program: 139175
Project: 139175
Buggy source:
@Override public void doSave(IProgressMonitor monitor){
  super.doSave(monitor);
  if (!checkBeforeSave())   return;
  EList<Expression> expressions=definition.getSqlGenericExpression();
  expressions.clear();
  Iterator<CCombo> it=tempExpressionMap.keySet().iterator();
  CCombo javaUIDCombo=null;
  while (it.hasNext()) {
    CCombo cb=it.next();
    if (cb.getText().equals(PatternLanguageType.JAVA.getName())) {
      javaUIDCombo=cb;
    }
 else     if (tempExpressionMap.get(cb).getBody() != null && !PluginConstant.EMPTY_STRING.equals(tempExpressionMap.get(cb).getBody())) {
      expressions.add(tempExpressionMap.get(cb));
    }
  }
  EList<TaggedValue> tvs=definition.getTaggedValue();
  if (javaUIDCombo != null) {
    boolean isNewTaggedValue=true;
    for (    TaggedValue tv : tvs) {
      if (tv.getTag().equals(PluginConstant.CLASS_NAME_TEXT)) {
        tv.setValue(((Text)javaUIDCombo.getData(PluginConstant.CLASS_NAME_TEXT)).getText());
        isNewTaggedValue=false;
        continue;
      }
      if (tv.getTag().equals(PluginConstant.JAR_FILE_PATH)) {
        tv.setValue(((Text)javaUIDCombo.getData(PluginConstant.JAR_FILE_PATH)).getText());
      }
    }
    if (isNewTaggedValue) {
      TaggedValue classNameTV=TaggedValueHelper.createTaggedValue(PluginConstant.CLASS_NAME_TEXT,((Text)javaUIDCombo.getData(PluginConstant.CLASS_NAME_TEXT)).getText());
      TaggedValue jarPathTV=TaggedValueHelper.createTaggedValue(PluginConstant.JAR_FILE_PATH,((Text)javaUIDCombo.getData(PluginConstant.JAR_FILE_PATH)).getText());
      definition.getTaggedValue().add(classNameTV);
      definition.getTaggedValue().add(jarPathTV);
    }
  }
 else {
    TaggedValue tvCN=null;
    TaggedValue tvJARP=null;
    for (    TaggedValue tv : tvs) {
      if (tv.getTag().equals(PluginConstant.CLASS_NAME_TEXT)) {
        tvCN=tv;
        continue;
      }
      if (tv.getTag().equals(PluginConstant.JAR_FILE_PATH)) {
        tvJARP=tv;
      }
    }
    if (tvCN != null) {
      tvs.remove(tvCN);
    }
    if (tvJARP != null) {
      tvs.remove(tvJARP);
    }
  }
  if (hasAggregateExpression) {
    EList<Expression> aggregate1argFunctions=definition.getAggregate1argFunctions();
    aggregate1argFunctions.clear();
    for (    AggregateDateExpression ade : afExpressionMapTemp.values()) {
      Expression expression=ade.getAggregateExpression();
      if (expression.getBody() != null && !"String_Node_Str".equals(expression.getBody())) {
        aggregate1argFunctions.add(expression);
      }
    }
  }
  if (hasDateExpression) {
    EList<Expression> date1argFunctions=definition.getDate1argFunctions();
    date1argFunctions.clear();
    for (    AggregateDateExpression ade : afExpressionMapTemp.values()) {
      Expression expression=ade.getDateExpression();
      if (expression.getBody() != null && !"String_Node_Str".equals(expression.getBody())) {
        date1argFunctions.add(expression);
      }
    }
  }
  if (hasCharactersMapping) {
    EList<CharactersMapping> charactersMappings=definition.getCharactersMapping();
    charactersMappings.clear();
    for (    CharactersMapping cm : charactersMappingMapTemp.values()) {
      String c=cm.getCharactersToReplace();
      String r=cm.getReplacementCharacters();
      if (checkMappingString(c,r)) {
        charactersMappings.add(cm);
      }
 else {
        MessageUI.openError("String_Node_Str" + cm.getLanguage() + "String_Node_Str");
        return;
      }
    }
  }
  ReturnCode rc=UDIHelper.validate(definition);
  if (rc.isOk()) {
    UDIResourceFileHelper.getInstance().save(definition);
    initTempExpressionList(definition);
    initTempExpressionMap();
    definitionComp=createDefinitionComp(definitionSection);
    definitionSection.setClient(definitionComp);
    definitionSection.pack();
    definitionSection.redraw();
    this.isDirty=false;
  }
 else {
    MessageDialog.openError(null,"String_Node_Str",rc.getMessage());
  }
}

Fixed version (ground truth):
@Override public void doSave(IProgressMonitor monitor){
  super.doSave(monitor);
  if (!checkBeforeSave())   return;
  EList<Expression> expressions=definition.getSqlGenericExpression();
  expressions.clear();
  Iterator<CCombo> it=tempExpressionMap.keySet().iterator();
  CCombo javaUIDCombo=null;
  while (it.hasNext()) {
    CCombo cb=it.next();
    if (cb.getText().equals(PatternLanguageType.JAVA.getName())) {
      javaUIDCombo=cb;
    }
 else     if (tempExpressionMap.get(cb).getBody() != null && !PluginConstant.EMPTY_STRING.equals(tempExpressionMap.get(cb).getBody())) {
      expressions.add(cloneExpression(tempExpressionMap.get(cb)));
    }
  }
  EList<TaggedValue> tvs=definition.getTaggedValue();
  if (javaUIDCombo != null) {
    boolean isNewTaggedValue=true;
    for (    TaggedValue tv : tvs) {
      if (tv.getTag().equals(PluginConstant.CLASS_NAME_TEXT)) {
        tv.setValue(((Text)javaUIDCombo.getData(PluginConstant.CLASS_NAME_TEXT)).getText());
        isNewTaggedValue=false;
        continue;
      }
      if (tv.getTag().equals(PluginConstant.JAR_FILE_PATH)) {
        tv.setValue(((Text)javaUIDCombo.getData(PluginConstant.JAR_FILE_PATH)).getText());
      }
    }
    if (isNewTaggedValue) {
      TaggedValue classNameTV=TaggedValueHelper.createTaggedValue(PluginConstant.CLASS_NAME_TEXT,((Text)javaUIDCombo.getData(PluginConstant.CLASS_NAME_TEXT)).getText());
      TaggedValue jarPathTV=TaggedValueHelper.createTaggedValue(PluginConstant.JAR_FILE_PATH,((Text)javaUIDCombo.getData(PluginConstant.JAR_FILE_PATH)).getText());
      definition.getTaggedValue().add(classNameTV);
      definition.getTaggedValue().add(jarPathTV);
    }
  }
 else {
    TaggedValue tvCN=null;
    TaggedValue tvJARP=null;
    for (    TaggedValue tv : tvs) {
      if (tv.getTag().equals(PluginConstant.CLASS_NAME_TEXT)) {
        tvCN=tv;
        continue;
      }
      if (tv.getTag().equals(PluginConstant.JAR_FILE_PATH)) {
        tvJARP=tv;
      }
    }
    if (tvCN != null) {
      tvs.remove(tvCN);
    }
    if (tvJARP != null) {
      tvs.remove(tvJARP);
    }
  }
  if (hasAggregateExpression) {
    EList<Expression> aggregate1argFunctions=definition.getAggregate1argFunctions();
    aggregate1argFunctions.clear();
    for (    AggregateDateExpression ade : afExpressionMapTemp.values()) {
      Expression expression=ade.getAggregateExpression();
      if (expression.getBody() != null && !"String_Node_Str".equals(expression.getBody())) {
        aggregate1argFunctions.add(expression);
      }
    }
  }
  if (hasDateExpression) {
    EList<Expression> date1argFunctions=definition.getDate1argFunctions();
    date1argFunctions.clear();
    for (    AggregateDateExpression ade : afExpressionMapTemp.values()) {
      Expression expression=ade.getDateExpression();
      if (expression.getBody() != null && !"String_Node_Str".equals(expression.getBody())) {
        date1argFunctions.add(expression);
      }
    }
  }
  if (hasCharactersMapping) {
    EList<CharactersMapping> charactersMappings=definition.getCharactersMapping();
    charactersMappings.clear();
    for (    CharactersMapping cm : charactersMappingMapTemp.values()) {
      String c=cm.getCharactersToReplace();
      String r=cm.getReplacementCharacters();
      if (checkMappingString(c,r)) {
        charactersMappings.add(cm);
      }
 else {
        MessageUI.openError("String_Node_Str" + cm.getLanguage() + "String_Node_Str");
        return;
      }
    }
  }
  ReturnCode rc=UDIHelper.validate(definition);
  if (rc.isOk()) {
    UDIResourceFileHelper.getInstance().save(definition);
    this.isDirty=false;
  }
 else {
    MessageDialog.openError(null,"String_Node_Str",rc.getMessage());
  }
}