Program: 137387
Project: 137387
Buggy source:
/** 
 * Test the text by the regular text of regularText.
 */
private void testRegularText(){
  if (isJavaEngine) {
    String regexStr=regularText.getText();
    if (regexStr.length() >= 2 && regexStr.startsWith("String_Node_Str") && regexStr.endsWith("String_Node_Str")) {
      regexStr=regexStr.substring(1,regexStr.length() - 1);
    }
    boolean flag=java.util.regex.Pattern.compile(regexStr).matcher(testText.getText()).find();
    if (flag) {
      emoticonLabel.setImage(ImageLib.getImage(ImageLib.EMOTICON_SMILE));
      resultLabel.setText(DefaultMessagesImpl.getString("String_Node_Str"));
      return;
    }
 else {
      emoticonLabel.setImage(ImageLib.getImage(ImageLib.EXCLAMATION));
      resultLabel.setText(DefaultMessagesImpl.getString("String_Node_Str"));
      return;
    }
  }
 else {
    for (    IRepositoryNode connRepNode : listTdDataProviders) {
      ConnectionItem connItem=(ConnectionItem)connRepNode.getObject().getProperty().getItem();
      Connection tddataprovider=connItem.getConnection();
      if (tddataprovider.getName().equals(dbCombo.getText())) {
        DbmsLanguage createDbmsLanguage=DbmsLanguageFactory.createDbmsLanguage(tddataprovider);
        if (null != createDbmsLanguage) {
          createDbmsLanguage.setFunctionName(getFunctionName());
        }
        String selectRegexpTestString=createDbmsLanguage.getSelectRegexpTestString(testText.getText(),regularText.getText());
        TypedReturnCode<java.sql.Connection> rcConn=JavaSqlFactory.createConnection(tddataprovider);
        try {
          if (!rcConn.isOk()) {
            throw new DataprofilerCoreException(rcConn.getMessage());
          }
          java.sql.Connection connection=rcConn.getObject();
          Statement createStatement=connection.createStatement();
          ResultSet resultSet=createStatement.executeQuery(selectRegexpTestString);
          while (resultSet.next()) {
            String okString=resultSet.getString(1);
            if ("String_Node_Str".equalsIgnoreCase(okString) || (createDbmsLanguage.getDbmsName().equals(SupportDBUrlType.POSTGRESQLEFAULTURL.getLanguage()) && "String_Node_Str".equalsIgnoreCase(okString))) {
              emoticonLabel.setImage(ImageLib.getImage(ImageLib.EMOTICON_SMILE));
              resultLabel.setText(DefaultMessagesImpl.getString("String_Node_Str"));
              return;
            }
          }
          emoticonLabel.setImage(ImageLib.getImage(ImageLib.EXCLAMATION));
          resultLabel.setText(DefaultMessagesImpl.getString("String_Node_Str"));
          return;
        }
 catch (        Exception exception) {
          log.error(exception,exception);
          String exceptionName=exception.getClass().getName();
          Shell shell=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
          MessageBoxExceptionHandler.process(exception,shell);
          emoticonLabel.setImage(null);
          return;
        }
 finally {
          ConnectionUtils.closeConnection(rcConn.getObject());
        }
      }
    }
  }
  MessageDialog.openWarning(new Shell(),"String_Node_Str",NO_DATABASE_SELECTEDED);
}

Fixed version (ground truth):
/** 
 * Test the text by the regular text of regularText.
 */
private void testRegularText(){
  if (isJavaEngine) {
    String regexStr=regularText.getText();
    if (regexStr.length() >= 2 && regexStr.startsWith("String_Node_Str") && regexStr.endsWith("String_Node_Str")) {
      regexStr=regexStr.substring(1,regexStr.length() - 1);
    }
    boolean flag=java.util.regex.Pattern.compile(regexStr).matcher(testText.getText()).find();
    if (flag) {
      emoticonLabel.setImage(ImageLib.getImage(ImageLib.EMOTICON_SMILE));
      resultLabel.setText(DefaultMessagesImpl.getString("String_Node_Str"));
      return;
    }
 else {
      emoticonLabel.setImage(ImageLib.getImage(ImageLib.EXCLAMATION));
      resultLabel.setText(DefaultMessagesImpl.getString("String_Node_Str"));
      return;
    }
  }
 else {
    for (    IRepositoryNode connRepNode : listTdDataProviders) {
      ConnectionItem connItem=(ConnectionItem)connRepNode.getObject().getProperty().getItem();
      Connection tddataprovider=connItem.getConnection();
      if (tddataprovider.getName().equals(dbCombo.getText())) {
        DbmsLanguage createDbmsLanguage=DbmsLanguageFactory.createDbmsLanguage(tddataprovider);
        String selectRegexpTestString=null;
        if (null != createDbmsLanguage) {
          createDbmsLanguage.setFunctionName(getFunctionName());
          selectRegexpTestString=createDbmsLanguage.getSelectRegexpTestString(testText.getText(),regularText.getText());
        }
        TypedReturnCode<java.sql.Connection> rcConn=JavaSqlFactory.createConnection(tddataprovider);
        try {
          if (!rcConn.isOk()) {
            throw new DataprofilerCoreException(rcConn.getMessage());
          }
          java.sql.Connection connection=rcConn.getObject();
          Statement createStatement=connection.createStatement();
          ResultSet resultSet=createStatement.executeQuery(selectRegexpTestString);
          while (resultSet.next()) {
            String okString=resultSet.getString(1);
            if ("String_Node_Str".equalsIgnoreCase(okString) || (createDbmsLanguage.getDbmsName().equals(SupportDBUrlType.POSTGRESQLEFAULTURL.getLanguage()) && "String_Node_Str".equalsIgnoreCase(okString))) {
              emoticonLabel.setImage(ImageLib.getImage(ImageLib.EMOTICON_SMILE));
              resultLabel.setText(DefaultMessagesImpl.getString("String_Node_Str"));
              return;
            }
          }
          emoticonLabel.setImage(ImageLib.getImage(ImageLib.EXCLAMATION));
          resultLabel.setText(DefaultMessagesImpl.getString("String_Node_Str"));
          return;
        }
 catch (        Exception exception) {
          log.error(exception,exception);
          String exceptionName=exception.getClass().getName();
          Shell shell=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
          MessageBoxExceptionHandler.process(exception,shell);
          emoticonLabel.setImage(null);
          return;
        }
 finally {
          ConnectionUtils.closeConnection(rcConn.getObject());
        }
      }
    }
  }
  MessageDialog.openWarning(new Shell(),"String_Node_Str",NO_DATABASE_SELECTEDED);
}