Program: 7241
Project: 7241
Buggy source:
/** 
 * Enable ad-hoc exploration on the given dataset by creating a corresponding Hive table. If exploration has already been enabled on the dataset, this will be a no-op. Assumes the dataset actually exists.
 * @param datasetID the ID of the dataset to enable
 * @param spec the specification for the dataset to enable
 * @return query handle for creating the Hive table for the dataset
 * @throws IllegalArgumentException if some required dataset property like schema is not set
 * @throws UnsupportedTypeException if the schema of the dataset is not compatible with Hive
 * @throws ExploreException if there was an exception submitting the create table statement
 * @throws SQLException if there was a problem with the create table statement
 */
public QueryHandle enableDataset(Id.DatasetInstance datasetID,DatasetSpecification spec) throws IllegalArgumentException, ExploreException, SQLException, UnsupportedTypeException {
  String datasetName=datasetID.getId();
  Map<String,String> serdeProperties=ImmutableMap.of(Constants.Explore.DATASET_NAME,datasetName,Constants.Explore.DATASET_NAMESPACE,datasetID.getNamespaceId());
  String createStatement=null;
  String datasetType=spec.getType();
  if (ObjectMappedTableModule.FULL_NAME.equals(datasetType) || ObjectMappedTableModule.SHORT_NAME.equals(datasetType)) {
    String schemaStr=spec.getProperty(DatasetProperties.SCHEMA);
    if (schemaStr == null) {
      throw new IllegalArgumentException("String_Node_Str" + datasetID);
    }
    try {
      Schema schema=Schema.parseJson(schemaStr);
      createStatement=new CreateStatementBuilder(datasetName,getHiveTableName(datasetName)).setSchema(schema).setTableComment("String_Node_Str").buildWithStorageHandler(Constants.Explore.DATASET_STORAGE_HANDLER_CLASS,serdeProperties);
      return exploreService.execute(datasetID.getNamespace(),createStatement);
    }
 catch (    IOException e) {
      throw new IllegalArgumentException("String_Node_Str" + datasetID);
    }
  }
  Dataset dataset;
  try {
    dataset=instantiateDataset(datasetID);
    if (dataset == null) {
      return QueryHandle.NO_OP;
    }
  }
 catch (  Exception e) {
    throw new ExploreException("String_Node_Str" + datasetID,e);
  }
  if (dataset instanceof RecordScannable || dataset instanceof RecordWritable) {
    LOG.debug("String_Node_Str",datasetName);
    createStatement=new CreateStatementBuilder(datasetName,getDatasetTableName(datasetID)).setSchema(hiveSchemaFor(dataset)).setTableComment("String_Node_Str").buildWithStorageHandler(Constants.Explore.DATASET_STORAGE_HANDLER_CLASS,serdeProperties);
  }
 else   if (dataset instanceof FileSet || dataset instanceof PartitionedFileSet) {
    Map<String,String> properties=spec.getProperties();
    if (FileSetProperties.isExploreEnabled(properties)) {
      LOG.debug("String_Node_Str",datasetName);
      createStatement=generateFileSetCreateStatement(datasetID,dataset,properties);
    }
  }
  return exploreService.execute(datasetID.getNamespace(),createStatement);
}

Fixed version (ground truth):
/** 
 * Enable ad-hoc exploration on the given dataset by creating a corresponding Hive table. If exploration has already been enabled on the dataset, this will be a no-op. Assumes the dataset actually exists.
 * @param datasetID the ID of the dataset to enable
 * @param spec the specification for the dataset to enable
 * @return query handle for creating the Hive table for the dataset
 * @throws IllegalArgumentException if some required dataset property like schema is not set
 * @throws UnsupportedTypeException if the schema of the dataset is not compatible with Hive
 * @throws ExploreException if there was an exception submitting the create table statement
 * @throws SQLException if there was a problem with the create table statement
 * @throws DatasetNotFoundException if the dataset had to be instantiated, but could not be found
 */
public QueryHandle enableDataset(Id.DatasetInstance datasetID,DatasetSpecification spec) throws IllegalArgumentException, ExploreException, SQLException, UnsupportedTypeException, DatasetNotFoundException {
  String datasetName=datasetID.getId();
  Map<String,String> serdeProperties=ImmutableMap.of(Constants.Explore.DATASET_NAME,datasetName,Constants.Explore.DATASET_NAMESPACE,datasetID.getNamespaceId());
  String createStatement=null;
  String datasetType=spec.getType();
  if (ObjectMappedTableModule.FULL_NAME.equals(datasetType) || ObjectMappedTableModule.SHORT_NAME.equals(datasetType)) {
    String schemaStr=spec.getProperty(DatasetProperties.SCHEMA);
    if (schemaStr == null) {
      throw new IllegalArgumentException("String_Node_Str" + datasetID);
    }
    try {
      Schema schema=Schema.parseJson(schemaStr);
      createStatement=new CreateStatementBuilder(datasetName,getHiveTableName(datasetName)).setSchema(schema).setTableComment("String_Node_Str").buildWithStorageHandler(Constants.Explore.DATASET_STORAGE_HANDLER_CLASS,serdeProperties);
      return exploreService.execute(datasetID.getNamespace(),createStatement);
    }
 catch (    IOException e) {
      throw new IllegalArgumentException("String_Node_Str" + datasetID);
    }
  }
  Dataset dataset=ExploreServiceUtils.instantiateDataset(datasetFramework,datasetID);
  if (dataset instanceof RecordScannable || dataset instanceof RecordWritable) {
    LOG.debug("String_Node_Str",datasetName);
    createStatement=new CreateStatementBuilder(datasetName,getDatasetTableName(datasetID)).setSchema(hiveSchemaFor(dataset)).setTableComment("String_Node_Str").buildWithStorageHandler(Constants.Explore.DATASET_STORAGE_HANDLER_CLASS,serdeProperties);
  }
 else   if (dataset instanceof FileSet || dataset instanceof PartitionedFileSet) {
    Map<String,String> properties=spec.getProperties();
    if (FileSetProperties.isExploreEnabled(properties)) {
      LOG.debug("String_Node_Str",datasetName);
      createStatement=generateFileSetCreateStatement(datasetID,dataset,properties);
    }
  }
  return exploreService.execute(datasetID.getNamespace(),createStatement);
}