Program: 42574
Project: 42574
Buggy source:
/** 
 * @param fileName      Name of the data-set file with extension, to calculate summary statistics
 * @param datasetID     Unique Identifier of the data-set
 * @param projectID     Unique Identifier of the project associated with the dataset
 * @return              Number of features in the data-set
 * @throws DatasetServiceException
 */
@Override public int calculateSummaryStatistics(String fileName,String datasetID,String projectID) throws DatasetServiceException {
  try {
    String uploadDir=dataUploadSettings.getUploadLocation();
    String fileSeparator=System.getProperty(DatasetConfigurations.FILE_SEPARATOR);
    if (uploadDir.equalsIgnoreCase(DatasetConfigurations.USER_HOME)) {
      uploadDir=System.getProperty(DatasetConfigurations.HOME) + fileSeparator + DatasetConfigurations.ML_PROJECTS;
    }
    String dataSetFullPath=uploadDir + fileSeparator + projectID+ fileSeparator+ fileName;
    File targetFile=new File(dataSetFullPath);
    if (targetFile.isFile() && targetFile.canRead()) {
      DatabaseService dbService=MLDatasetServiceValueHolder.getDatabaseService();
      dbService.insertDatasetDetails(datasetID,targetFile.getPath(),projectID);
      DatasetSummary summary=new DatasetSummary(targetFile,datasetID);
      int noOfFeatures=summary.generateSummary(summaryStatSettings.getSampleSize(),summaryStatSettings.getHistogramBins(),summaryStatSettings.getCategoricalThreshold(),true,mlDatabaseName);
      dbService.updateDatasetSample(datasetID,summary.samplePoints());
      return noOfFeatures;
    }
 else {
      throw new DatasetServiceException("String_Node_Str");
    }
  }
 catch (  DatasetSummaryException e) {
    throw new DatasetServiceException("String_Node_Str" + e.getMessage(),e);
  }
catch (  DatabaseHandlerException e) {
    throw new DatasetServiceException("String_Node_Str" + e.getMessage(),e);
  }
 finally {
  }
}

Fixed version (ground truth):
/** 
 * @param fileName      Name of the data-set file with extension, to calculate summary statistics
 * @param datasetID     Unique Identifier of the data-set
 * @param projectID     Unique Identifier of the project associated with the dataset
 * @return              Number of features in the data-set
 * @throws DatasetServiceException
 */
@Override public int calculateSummaryStatistics(String fileName,String datasetID,String projectID) throws DatasetServiceException {
  try {
    String uploadDir=dataUploadSettings.getUploadLocation();
    String fileSeparator=System.getProperty(DatasetConfigurations.FILE_SEPARATOR);
    if (uploadDir.equalsIgnoreCase(DatasetConfigurations.USER_HOME)) {
      uploadDir=System.getProperty(DatasetConfigurations.HOME) + fileSeparator + DatasetConfigurations.ML_PROJECTS;
    }
    String dataSetFullPath=uploadDir + fileSeparator + projectID+ fileSeparator+ fileName;
    int tenantId=CarbonContext.getThreadLocalCarbonContext().getTenantId();
    String datasetName=fileName;
    String username=CarbonContext.getThreadLocalCarbonContext().getUsername();
    String comments="String_Node_Str";
    String sourceType="String_Node_Str";
    String targetType="String_Node_Str";
    String dataType="String_Node_Str";
    File targetFile=new File(dataSetFullPath);
    if (targetFile.isFile() && targetFile.canRead()) {
      DatabaseService dbService=MLDatasetServiceValueHolder.getDatabaseService();
      dbService.insertDatasetDetails(datasetName,String.valueOf(tenantId),username,comments,sourceType,targetType,dataType);
      String datasetVersion="String_Node_Str";
      dbService.insertDatasetVersionDetails("String_Node_Str",String.valueOf(tenantId),datasetVersion);
      DatasetSummary summary=new DatasetSummary(targetFile,datasetID);
      int noOfFeatures=summary.generateSummary(summaryStatSettings.getSampleSize(),summaryStatSettings.getHistogramBins(),summaryStatSettings.getCategoricalThreshold(),true,mlDatabaseName);
      dbService.updateValueSetSample(datasetID,summary.samplePoints());
      return noOfFeatures;
    }
 else {
      throw new DatasetServiceException("String_Node_Str");
    }
  }
 catch (  DatasetSummaryException e) {
    throw new DatasetServiceException("String_Node_Str" + e.getMessage(),e);
  }
catch (  DatabaseHandlerException e) {
    throw new DatasetServiceException("String_Node_Str" + e.getMessage(),e);
  }
 finally {
  }
}