Program: 138270
Project: 138270
Buggy source:
/** 
 * If the pattern is not null, will save it and update the corresponding pattern editor content.
 */
private void savePattern(){
  if (pattern != null) {
    String expressionLanguage=this.regularExpression.getExpression().getLanguage();
    DbmsLanguage dbmsLanguage=this.getDbmsLanguage();
    dbmsLanguage.setFunctionName(getFunctionName());
    boolean isLanguageMatched=false;
    if (isJavaEngine && expressionLanguage.equals(ExecutionLanguage.JAVA.getLiteral()) || dbmsLanguage != null && (dbmsLanguage.getDbmsName().equalsIgnoreCase(expressionLanguage))) {
      isLanguageMatched=true;
    }
    if (!isLanguageMatched) {
      String messageInfo=DefaultMessagesImpl.getString("String_Node_Str",expressionLanguage,dbmsLanguage.getDbmsName(),expressionLanguage,expressionLanguage,dbmsLanguage.getDbmsName());
      MessageDialog messageDialog=new MessageDialog(new Shell(),DefaultMessagesImpl.getString("String_Node_Str"),null,messageInfo,MessageDialog.WARNING,new String[]{IDialogConstants.YES_LABEL,IDialogConstants.NO_LABEL},0);
      int result=messageDialog.open();
      if (result == MessageDialog.OK) {
        regularExpression.getExpression().setBody(regularText.getText());
      }
 else {
        EList<PatternComponent> components=this.pattern.getComponents();
        boolean isContainLanguage=false;
        for (int i=0; i < components.size(); i++) {
          RegularExpressionImpl regularExpress=(RegularExpressionImpl)components.get(i);
          if (dbmsLanguage.getDbmsName().equalsIgnoreCase(regularExpress.getExpression().getLanguage())) {
            regularExpress.getExpression().setBody(regularText.getText());
            isContainLanguage=true;
            break;
          }
        }
        if (!isContainLanguage) {
          RegularExpression newRegularExpress=BooleanExpressionHelper.createRegularExpression(dbmsLanguage.getDbmsName(),regularText.getText());
          this.pattern.getComponents().add(newRegularExpress);
        }
      }
    }
 else {
      regularExpression.getExpression().setBody(regularText.getText());
    }
    EMFUtil.saveSingleResource(pattern.eResource());
    editorPage.updatePatternDefinitonSection();
    saveButton.setEnabled(false);
  }
}

Fixed version (ground truth):
/** 
 * If the pattern is not null, will save it and update the corresponding pattern editor content.
 */
private void savePattern(){
  if (pattern != null) {
    String expressionLanguage=this.regularExpression.getExpression().getLanguage();
    DbmsLanguage dbmsLanguage=this.getDbmsLanguage();
    if (null != dbmsLanguage) {
      dbmsLanguage.setFunctionName(getFunctionName());
    }
    boolean isLanguageMatched=false;
    if (isJavaEngine && expressionLanguage.equals(ExecutionLanguage.JAVA.getLiteral()) || dbmsLanguage != null && (dbmsLanguage.getDbmsName().equalsIgnoreCase(expressionLanguage))) {
      isLanguageMatched=true;
    }
    if (!isLanguageMatched) {
      String messageInfo=DefaultMessagesImpl.getString("String_Node_Str",expressionLanguage,dbmsLanguage.getDbmsName(),expressionLanguage,expressionLanguage,dbmsLanguage.getDbmsName());
      MessageDialog messageDialog=new MessageDialog(new Shell(),DefaultMessagesImpl.getString("String_Node_Str"),null,messageInfo,MessageDialog.WARNING,new String[]{IDialogConstants.YES_LABEL,IDialogConstants.NO_LABEL},0);
      int result=messageDialog.open();
      if (result == MessageDialog.OK) {
        regularExpression.getExpression().setBody(regularText.getText());
      }
 else {
        EList<PatternComponent> components=this.pattern.getComponents();
        boolean isContainLanguage=false;
        for (int i=0; i < components.size(); i++) {
          RegularExpressionImpl regularExpress=(RegularExpressionImpl)components.get(i);
          if (dbmsLanguage.getDbmsName().equalsIgnoreCase(regularExpress.getExpression().getLanguage())) {
            regularExpress.getExpression().setBody(regularText.getText());
            isContainLanguage=true;
            break;
          }
        }
        if (!isContainLanguage) {
          RegularExpression newRegularExpress=BooleanExpressionHelper.createRegularExpression(dbmsLanguage.getDbmsName(),regularText.getText());
          this.pattern.getComponents().add(newRegularExpress);
        }
      }
    }
 else {
      regularExpression.getExpression().setBody(regularText.getText());
    }
    EMFUtil.saveSingleResource(pattern.eResource());
    editorPage.updatePatternDefinitonSection();
    saveButton.setEnabled(false);
  }
}