nus-yam/ex-repair huggingface dataset:
Program: 6605
Project: 6605
Buggy source:
private void executeNode(ApplicationSpecification appSpec,WorkflowNode node,InstantiatorFactory instantiator,ClassLoader classLoader,WorkflowToken token) throws Exception {
  WorkflowNodeType nodeType=node.getType();
  ((BasicWorkflowToken)token).setCurrentNode(node.getNodeId());
switch (nodeType) {
case ACTION:
    executeAction(appSpec,(WorkflowActionNode)node,instantiator,classLoader,token);
  break;
case FORK:
executeFork(appSpec,(WorkflowForkNode)node,instantiator,classLoader,token);
break;
case CONDITION:
executeCondition(appSpec,(WorkflowConditionNode)node,instantiator,classLoader,token);
break;
default :
break;
}
}

Fixed version (ground truth):
private void executeNode(ApplicationSpecification appSpec,WorkflowNode node,InstantiatorFactory instantiator,ClassLoader classLoader,WorkflowToken token) throws Exception {
  WorkflowNodeType nodeType=node.getType();
  ((BasicWorkflowToken)token).setCurrentNode(node.getNodeId());
switch (nodeType) {
case ACTION:
    executeAction((WorkflowActionNode)node,instantiator,classLoader,token);
  break;
case FORK:
executeFork(appSpec,(WorkflowForkNode)node,instantiator,classLoader,token);
break;
case CONDITION:
executeCondition(appSpec,(WorkflowConditionNode)node,instantiator,classLoader,token);
break;
default :
break;
}
}
Program: 6606
Project: 6606
Buggy source:
private WorkflowActionSpecification getActionSpecification(ApplicationSpecification appSpec,WorkflowActionNode node,SchedulableProgramType programType){
  WorkflowActionSpecification actionSpec;
  ScheduleProgramInfo actionInfo=node.getProgram();
switch (programType) {
case MAPREDUCE:
    MapReduceSpecification mapReduceSpec=appSpec.getMapReduce().get(actionInfo.getProgramName());
  String mapReduce=mapReduceSpec.getName();
actionSpec=new DefaultWorkflowActionSpecification(new ProgramWorkflowAction(mapReduce,mapReduce,SchedulableProgramType.MAPREDUCE));
break;
case SPARK:
SparkSpecification sparkSpec=appSpec.getSpark().get(actionInfo.getProgramName());
String spark=sparkSpec.getName();
actionSpec=new DefaultWorkflowActionSpecification(new ProgramWorkflowAction(spark,spark,SchedulableProgramType.SPARK));
break;
case CUSTOM_ACTION:
actionSpec=node.getActionSpecification();
break;
default :
LOG.error("String_Node_Str",actionInfo.getProgramType(),actionInfo.getProgramName());
throw new IllegalStateException("String_Node_Str");
}
return actionSpec;
}

Fixed version (ground truth):
private WorkflowActionSpecification getActionSpecification(WorkflowActionNode node,SchedulableProgramType programType){
  WorkflowActionSpecification actionSpec;
  ScheduleProgramInfo actionInfo=node.getProgram();
switch (programType) {
case MAPREDUCE:
case SPARK:
    actionSpec=DefaultWorkflowActionConfigurer.configureAction(new ProgramWorkflowAction(actionInfo.getProgramName(),programType));
  break;
case CUSTOM_ACTION:
actionSpec=node.getActionSpecification();
break;
default :
LOG.error("String_Node_Str",actionInfo.getProgramType(),actionInfo.getProgramName());
throw new IllegalStateException("String_Node_Str");
}
return actionSpec;
}
Program: 6608
Project: 6608
Buggy source:
public DefaultWorkflowActionConfigurer(WorkflowAction workflowAction){
  this.name=workflowAction.getClass().getSimpleName();
  this.description="String_Node_Str";
  this.className=workflowAction.getClass().getName();
  this.propertyFields=new HashMap<>();
  this.datasetFields=new HashSet<>();
  this.properties=new HashMap<>();
  this.datasets=new HashSet<>();
  Reflections.visit(workflowAction,workflowAction.getClass(),new PropertyFieldExtractor(propertyFields),new DataSetFieldExtractor(datasetFields));
}

Fixed version (ground truth):
private DefaultWorkflowActionConfigurer(WorkflowAction workflowAction){
  this.name=workflowAction.getClass().getSimpleName();
  this.description="String_Node_Str";
  this.className=workflowAction.getClass().getName();
  this.propertyFields=new HashMap<>();
  this.datasetFields=new HashSet<>();
  this.properties=new HashMap<>();
  this.datasets=new HashSet<>();
  Reflections.visit(workflowAction,workflowAction.getClass(),new PropertyFieldExtractor(propertyFields),new DataSetFieldExtractor(datasetFields));
}
Program: 6609
Project: 6609
Buggy source:
public DefaultWorkflowActionSpecification createSpecification(){
  Map<String,String> properties=new HashMap<>(this.properties);
  properties.putAll(propertyFields);
  Set<String> datasets=new HashSet<>(this.datasets);
  datasets.addAll(datasetFields);
  return new DefaultWorkflowActionSpecification(className,name,description,properties,datasets);
}

Fixed version (ground truth):
private DefaultWorkflowActionSpecification createSpecification(){
  Map<String,String> properties=new HashMap<>(this.properties);
  properties.putAll(propertyFields);
  Set<String> datasets=new HashSet<>(this.datasets);
  datasets.addAll(datasetFields);
  return new DefaultWorkflowActionSpecification(className,name,description,properties,datasets);
}
Program: 6610
Project: 6610
Buggy source:
static WorkflowNode createWorkflowCustomActionNode(WorkflowAction action){
  Preconditions.checkArgument(action != null,"String_Node_Str");
  WorkflowActionSpecification spec;
  if (action instanceof AbstractWorkflowAction) {
    DefaultWorkflowActionConfigurer configurer=new DefaultWorkflowActionConfigurer(action);
    ((AbstractWorkflowAction)action).configure(configurer);
    spec=configurer.createSpecification();
  }
 else {
    spec=action.configure();
  }
  return new WorkflowActionNode(spec.getName(),spec);
}

Fixed version (ground truth):
static WorkflowNode createWorkflowCustomActionNode(WorkflowAction action){
  Preconditions.checkArgument(action != null,"String_Node_Str");
  WorkflowActionSpecification spec;
  if (action instanceof AbstractWorkflowAction) {
    spec=DefaultWorkflowActionConfigurer.configureAction((AbstractWorkflowAction)action);
  }
 else {
    spec=new DefaultWorkflowActionSpecification(action.configure(),action);
  }
  return new WorkflowActionNode(spec.getName(),spec);
}
Program: 6611
Project: 6611
Buggy source:
public boolean isSnapshot(){
  return suffix != null && "String_Node_Str".equals(suffix.toLowerCase());
}

Fixed version (ground truth):
public boolean isSnapshot(){
  return suffix != null && !suffix.isEmpty() && suffix.toLowerCase().startsWith("String_Node_Str");
}
Program: 6615
Project: 6615
Buggy source:
/** 
 * @return programs that were running between given start and end time.
 */
Set<RunId> getRunningInRange(final long startTimeInSecs,final long endTimeInSecs);

Fixed version (ground truth):
/** 
 * @return programs that were running between given start and end time.
 */
Set<RunId> getRunningInRange(long startTimeInSecs,long endTimeInSecs);
Program: 6616
Project: 6616
Buggy source:
public static void setupDatasets(DatasetFramework dsFramework) throws DatasetManagementException, IOException, ServiceUnavailableException {
  dsFramework.addInstance(Table.class.getName(),Id.DatasetInstance.from(Id.Namespace.SYSTEM,Constants.ConfigStore.CONFIG_TABLE),DatasetProperties.EMPTY);
}

Fixed version (ground truth):
public static void setupDatasets(DatasetFramework dsFramework) throws DatasetManagementException, IOException {
  dsFramework.addInstance(Table.class.getName(),Id.DatasetInstance.from(Id.Namespace.SYSTEM,Constants.ConfigStore.CONFIG_TABLE),DatasetProperties.EMPTY);
}
Program: 6617
Project: 6617
Buggy source:
/** 
 * Stops a Program.
 */
private AppFabricServiceStatus stop(Id.Program identifier,@Nullable String runId) throws NotFoundException, BadRequestException {
  ProgramRuntimeService.RuntimeInfo runtimeInfo=findRuntimeInfo(identifier,runId);
  if (runtimeInfo == null) {
    if (!store.applicationExists(identifier.getApplication())) {
      throw new ApplicationNotFoundException(identifier.getApplication());
    }
 else     if (!store.programExists(identifier)) {
      throw new ProgramNotFoundException(identifier);
    }
 else     if (runId == null) {
      throw new BadRequestException("String_Node_Str");
    }
 else {
      throw new NotFoundException(new Id.Run(identifier,runId));
    }
  }
  try {
    ProgramController controller=runtimeInfo.getController();
    controller.stop().get();
    return AppFabricServiceStatus.OK;
  }
 catch (  Throwable throwable) {
    LOG.warn(throwable.getMessage(),throwable);
    return AppFabricServiceStatus.INTERNAL_ERROR;
  }
}

Fixed version (ground truth):
/** 
 * Stops a Program.
 */
private AppFabricServiceStatus stop(Id.Program identifier,@Nullable String runId) throws NotFoundException, BadRequestException {
  ProgramRuntimeService.RuntimeInfo runtimeInfo=findRuntimeInfo(identifier,runId);
  if (runtimeInfo == null) {
    if (!store.applicationExists(identifier.getApplication())) {
      throw new ApplicationNotFoundException(identifier.getApplication());
    }
 else     if (!store.programExists(identifier)) {
      throw new ProgramNotFoundException(identifier);
    }
 else     if (runId != null) {
      Id.Run programRunId=new Id.Run(identifier,runId);
      RunRecordMeta runRecord=store.getRun(identifier,runId);
      if (runRecord != null && runRecord.getProperties().containsKey("String_Node_Str") && runRecord.getStatus().equals(ProgramRunStatus.RUNNING)) {
        String workflowRunId=runRecord.getProperties().get("String_Node_Str");
        throw new BadRequestException(String.format("String_Node_Str" + "String_Node_Str",programRunId,workflowRunId));
      }
      throw new NotFoundException(programRunId);
    }
    throw new BadRequestException(String.format("String_Node_Str",identifier));
  }
  try {
    ProgramController controller=runtimeInfo.getController();
    controller.stop().get();
    return AppFabricServiceStatus.OK;
  }
 catch (  Throwable throwable) {
    LOG.warn(throwable.getMessage(),throwable);
    return AppFabricServiceStatus.INTERNAL_ERROR;
  }
}
Program: 6618
Project: 6618
Buggy source:
private String getSpecJson(Application app,final String bundleVersion,final String configString) throws IllegalAccessException, InstantiationException, IOException {
  File tempDir=DirUtils.createTempDir(baseUnpackDir);
  DefaultAppConfigurer configurer;
  try (PluginInstantiator pluginInstantiator=new PluginInstantiator(cConf,app.getClass().getClassLoader(),tempDir)){
    configurer=artifactId == null ? new DefaultAppConfigurer(app,configString) : new DefaultAppConfigurer(artifactId,app,configString,artifactRepository,pluginInstantiator);
    Config appConfig;
    TypeToken typeToken=TypeToken.of(app.getClass());
    TypeToken<?> configToken=typeToken.resolveType(Application.class.getTypeParameters()[0]);
    if (Strings.isNullOrEmpty(configString)) {
      appConfig=(Config)configToken.getRawType().newInstance();
    }
 else {
      try {
        appConfig=GSON.fromJson(configString,configToken.getType());
      }
 catch (      JsonSyntaxException e) {
        throw new IllegalArgumentException("String_Node_Str",e);
      }
    }
    app.configure(configurer,new DefaultApplicationContext(appConfig));
  }
  finally {
    DirUtils.deleteDirectoryContents(tempDir);
  }
  ApplicationSpecification specification=configurer.createSpecification();
  return ApplicationSpecificationAdapter.create(new ReflectionSchemaGenerator()).toJson(specification);
}

Fixed version (ground truth):
private String getSpecJson(Application app,final String configString) throws IllegalAccessException, InstantiationException, IOException {
  File tempDir=DirUtils.createTempDir(baseUnpackDir);
  DefaultAppConfigurer configurer;
  try (PluginInstantiator pluginInstantiator=new PluginInstantiator(cConf,app.getClass().getClassLoader(),tempDir)){
    configurer=artifactId == null ? new DefaultAppConfigurer(app,configString) : new DefaultAppConfigurer(artifactId,app,configString,artifactRepository,pluginInstantiator);
    Config appConfig;
    Type configType=Artifacts.getConfigType(app.getClass());
    if (Strings.isNullOrEmpty(configString)) {
      appConfig=((Class<? extends Config>)configType).newInstance();
    }
 else {
      try {
        appConfig=GSON.fromJson(configString,configType);
      }
 catch (      JsonSyntaxException e) {
        throw new IllegalArgumentException("String_Node_Str",e);
      }
    }
    app.configure(configurer,new DefaultApplicationContext(appConfig));
  }
  finally {
    DirUtils.deleteDirectoryContents(tempDir);
  }
  ApplicationSpecification specification=configurer.createSpecification();
  return ApplicationSpecificationAdapter.create(new ReflectionSchemaGenerator()).toJson(specification);
}
Program: 6619
Project: 6619
Buggy source:
private ConfigResponse createResponse(Application app,String bundleVersion) throws InstantiationException, IllegalAccessException, IOException {
  String specJson=getSpecJson(app,bundleVersion,configString);
  return new DefaultConfigResponse(0,CharStreams.newReaderSupplier(specJson));
}

Fixed version (ground truth):
private ConfigResponse createResponse(Application app) throws InstantiationException, IllegalAccessException, IOException {
  String specJson=getSpecJson(app,configString);
  return new DefaultConfigResponse(0,CharStreams.newReaderSupplier(specJson));
}
Program: 6620
Project: 6620
Buggy source:
private void readAppClassName() throws IOException {
  Manifest manifest=BundleJarUtil.getManifest(artifact);
  Preconditions.checkArgument(manifest != null,"String_Node_Str",artifact.toURI());
  Preconditions.checkArgument(manifest.getMainAttributes() != null,"String_Node_Str",artifact.toURI());
  appClassName=manifest.getMainAttributes().getValue(ManifestFields.MAIN_CLASS);
  Preconditions.checkArgument(appClassName != null && !appClassName.isEmpty(),"String_Node_Str");
  version=manifest.getMainAttributes().getValue(ManifestFields.BUNDLE_VERSION);
}

Fixed version (ground truth):
private void readAppClassName() throws IOException {
  Manifest manifest=BundleJarUtil.getManifest(artifact);
  Preconditions.checkArgument(manifest != null,"String_Node_Str",artifact.toURI());
  Preconditions.checkArgument(manifest.getMainAttributes() != null,"String_Node_Str",artifact.toURI());
  appClassName=manifest.getMainAttributes().getValue(ManifestFields.MAIN_CLASS);
  Preconditions.checkArgument(appClassName != null && !appClassName.isEmpty(),"String_Node_Str");
}
Program: 6621
Project: 6621
Buggy source:
/** 
 * Executes the <code>Application.configure</code> within the same JVM. <p> This method could be dangerous and should be used only in standalone mode. </p>
 * @return A instance of {@link ListenableFuture}.
 */
@Override public ListenableFuture<ConfigResponse> config(){
  SettableFuture<ConfigResponse> result=SettableFuture.create();
  try {
    if (appClassName == null) {
      readAppClassName();
    }
    try (CloseableClassLoader artifactClassLoader=artifactClassLoaderFactory.createClassLoader(artifact)){
      Object appMain=artifactClassLoader.loadClass(appClassName).newInstance();
      if (!(appMain instanceof Application)) {
        throw new IllegalStateException(String.format("String_Node_Str",appMain.getClass().getName()));
      }
      Application app=(Application)appMain;
      ConfigResponse response=createResponse(app,version);
      result.set(response);
    }
     return result;
  }
 catch (  Throwable t) {
    LOG.error(t.getMessage(),t);
    return Futures.immediateFailedFuture(t);
  }
}

Fixed version (ground truth):
/** 
 * Executes the <code>Application.configure</code> within the same JVM. <p> This method could be dangerous and should be used only in standalone mode. </p>
 * @return A instance of {@link ListenableFuture}.
 */
@Override public ListenableFuture<ConfigResponse> config(){
  SettableFuture<ConfigResponse> result=SettableFuture.create();
  try {
    if (appClassName == null) {
      readAppClassName();
    }
    try (CloseableClassLoader artifactClassLoader=artifactClassLoaderFactory.createClassLoader(artifact)){
      Object appMain=artifactClassLoader.loadClass(appClassName).newInstance();
      if (!(appMain instanceof Application)) {
        throw new IllegalStateException(String.format("String_Node_Str",appMain.getClass().getName()));
      }
      Application app=(Application)appMain;
      ConfigResponse response=createResponse(app);
      result.set(response);
    }
     return result;
  }
 catch (  Throwable t) {
    LOG.error(t.getMessage(),t);
    return Futures.immediateFailedFuture(t);
  }
}
Program: 6622
Project: 6622
Buggy source:
protected void verifyData(Id.Application appId,ApplicationSpecification specification) throws DatasetManagementException, ServiceUnavailableException {
  VerifyResult result;
  for (  DatasetCreationSpec dataSetCreateSpec : specification.getDatasets().values()) {
    result=getVerifier(DatasetCreationSpec.class).verify(appId,dataSetCreateSpec);
    if (!result.isSuccess()) {
      throw new RuntimeException(result.getMessage());
    }
    String dsName=dataSetCreateSpec.getInstanceName();
    Id.DatasetInstance datasetInstanceId=Id.DatasetInstance.from(appId.getNamespace(),dsName);
    DatasetSpecification existingSpec=dsFramework.getDatasetSpec(datasetInstanceId);
    if (existingSpec != null && !existingSpec.getType().equals(dataSetCreateSpec.getTypeName())) {
      throw new DataSetException(String.format("String_Node_Str",dsName,dataSetCreateSpec.getTypeName()));
    }
  }
  for (  StreamSpecification spec : specification.getStreams().values()) {
    result=getVerifier(StreamSpecification.class).verify(appId,spec);
    if (!result.isSuccess()) {
      throw new RuntimeException(result.getMessage());
    }
  }
}

Fixed version (ground truth):
protected void verifyData(Id.Application appId,ApplicationSpecification specification) throws DatasetManagementException {
  VerifyResult result;
  for (  DatasetCreationSpec dataSetCreateSpec : specification.getDatasets().values()) {
    result=getVerifier(DatasetCreationSpec.class).verify(appId,dataSetCreateSpec);
    if (!result.isSuccess()) {
      throw new RuntimeException(result.getMessage());
    }
    String dsName=dataSetCreateSpec.getInstanceName();
    Id.DatasetInstance datasetInstanceId=Id.DatasetInstance.from(appId.getNamespace(),dsName);
    DatasetSpecification existingSpec=dsFramework.getDatasetSpec(datasetInstanceId);
    if (existingSpec != null && !existingSpec.getType().equals(dataSetCreateSpec.getTypeName())) {
      throw new DataSetException(String.format("String_Node_Str",dsName,dataSetCreateSpec.getTypeName()));
    }
  }
  for (  StreamSpecification spec : specification.getStreams().values()) {
    result=getVerifier(StreamSpecification.class).verify(appId,spec);
    if (!result.isSuccess()) {
      throw new RuntimeException(result.getMessage());
    }
  }
}
Program: 6623
Project: 6623
Buggy source:
@Override public synchronized void deleteDatasets(Id.Namespace namespaceId) throws NamespaceNotFoundException, NamespaceCannotBeDeletedException {
  if (!exists(namespaceId)) {
    throw new NamespaceNotFoundException(namespaceId);
  }
  if (checkProgramsRunning(namespaceId)) {
    throw new NamespaceCannotBeDeletedException(namespaceId,String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str",namespaceId));
  }
  try {
    dsFramework.deleteAllInstances(namespaceId);
  }
 catch (  DatasetManagementException|IOException|ServiceUnavailableException e) {
    LOG.warn("String_Node_Str",namespaceId,e);
    throw new NamespaceCannotBeDeletedException(namespaceId,e);
  }
  LOG.debug("String_Node_Str",namespaceId);
}

Fixed version (ground truth):
@Override public synchronized void deleteDatasets(Id.Namespace namespaceId) throws NamespaceNotFoundException, NamespaceCannotBeDeletedException {
  if (!exists(namespaceId)) {
    throw new NamespaceNotFoundException(namespaceId);
  }
  if (checkProgramsRunning(namespaceId)) {
    throw new NamespaceCannotBeDeletedException(namespaceId,String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str",namespaceId));
  }
  try {
    dsFramework.deleteAllInstances(namespaceId);
  }
 catch (  DatasetManagementException|IOException e) {
    LOG.warn("String_Node_Str",namespaceId,e);
    throw new NamespaceCannotBeDeletedException(namespaceId,e);
  }
  LOG.debug("String_Node_Str",namespaceId);
}
Program: 6624
Project: 6624
Buggy source:
/** 
 * Creates a new namespace
 * @param metadata the {@link NamespaceMeta} for the new namespace to be created
 * @throws NamespaceAlreadyExistsException if the specified namespace already exists
 */
public synchronized void create(NamespaceMeta metadata) throws NamespaceCannotBeCreatedException, NamespaceAlreadyExistsException {
  Preconditions.checkArgument(metadata != null,"String_Node_Str");
  Id.Namespace namespace=Id.Namespace.from(metadata.getName());
  if (exists(Id.Namespace.from(metadata.getName()))) {
    throw new NamespaceAlreadyExistsException(namespace);
  }
  try {
    dsFramework.createNamespace(Id.Namespace.from(metadata.getName()));
  }
 catch (  DatasetManagementException|ServiceUnavailableException e) {
    throw new NamespaceCannotBeCreatedException(namespace,e);
  }
  store.createNamespace(metadata);
}

Fixed version (ground truth):
/** 
 * Creates a new namespace
 * @param metadata the {@link NamespaceMeta} for the new namespace to be created
 * @throws NamespaceAlreadyExistsException if the specified namespace already exists
 */
public synchronized void create(NamespaceMeta metadata) throws NamespaceCannotBeCreatedException, NamespaceAlreadyExistsException {
  Preconditions.checkArgument(metadata != null,"String_Node_Str");
  Id.Namespace namespace=Id.Namespace.from(metadata.getName());
  if (exists(Id.Namespace.from(metadata.getName()))) {
    throw new NamespaceAlreadyExistsException(namespace);
  }
  try {
    dsFramework.createNamespace(Id.Namespace.from(metadata.getName()));
  }
 catch (  DatasetManagementException e) {
    throw new NamespaceCannotBeCreatedException(namespace,e);
  }
  store.createNamespace(metadata);
}
Program: 6625
Project: 6625
Buggy source:
List<BusinessMetadataRecord> executeSearchOnColumns(String column,String searchValue,MetadataSearchTargetType type){
  List<BusinessMetadataRecord> results=new LinkedList<>();
  byte[] startKey=Bytes.toBytes(searchValue);
  byte[] stopKey=Bytes.stopKeyForPrefix(startKey);
  Scanner scanner=indexedTable.scanByIndex(Bytes.toBytes(column),startKey,stopKey);
  try {
    Row next;
    while ((next=scanner.next()) != null) {
      String rowValue=next.getString(VALUE_COLUMN);
      if (rowValue == null) {
        continue;
      }
      final byte[] rowKey=next.getRow();
      String targetType=getTargetType(rowKey);
      if ((type != MetadataSearchTargetType.ALL) && (!targetType.equals(type.getInternalName()))) {
        continue;
      }
      Id.NamespacedId targetId=getNamespaceIdFromKey(targetType,new MDSKey(rowKey));
      String key=getMetadataKey(targetType,rowKey);
      String value=Bytes.toString(next.get(Bytes.toBytes(BusinessMetadataDataset.VALUE_COLUMN)));
      BusinessMetadataRecord record=new BusinessMetadataRecord(targetId,key,value);
      results.add(record);
    }
  }
  finally {
    scanner.close();
  }
  return results;
}

Fixed version (ground truth):
List<BusinessMetadataRecord> executeSearchOnColumns(String column,String searchValue,MetadataSearchTargetType type){
  List<BusinessMetadataRecord> results=new LinkedList<>();
  byte[] startKey=Bytes.toBytes(searchValue.toLowerCase());
  byte[] stopKey=Bytes.stopKeyForPrefix(startKey);
  Scanner scanner=indexedTable.scanByIndex(Bytes.toBytes(column),startKey,stopKey);
  try {
    Row next;
    while ((next=scanner.next()) != null) {
      String rowValue=next.getString(VALUE_COLUMN);
      if (rowValue == null) {
        continue;
      }
      final byte[] rowKey=next.getRow();
      String targetType=getTargetType(rowKey);
      if ((type != MetadataSearchTargetType.ALL) && (!targetType.equals(type.getInternalName()))) {
        continue;
      }
      Id.NamespacedId targetId=getNamespaceIdFromKey(targetType,new MDSKey(rowKey));
      String key=getMetadataKey(targetType,rowKey);
      String value=Bytes.toString(next.get(Bytes.toBytes(BusinessMetadataDataset.VALUE_COLUMN)));
      BusinessMetadataRecord record=new BusinessMetadataRecord(targetId,key,value);
      results.add(record);
    }
  }
  finally {
    scanner.close();
  }
  return results;
}
Program: 6626
Project: 6626
Buggy source:
/** 
 * Find the instance of   {@link BusinessMetadataRecord} based on key.
 * @param value The metadata value to be found
 * @param type The target type of objects to search from
 * @return The {@link Iterable} of {@link BusinessMetadataRecord} that fit the value
 */
public List<BusinessMetadataRecord> findBusinessMetadataOnValue(String value,MetadataSearchTargetType type){
  return executeSearchOnColumns(BusinessMetadataDataset.VALUE_COLUMN,value,type);
}

Fixed version (ground truth):
/** 
 * Find the instance of   {@link BusinessMetadataRecord} based on key.
 * @param value The metadata value to be found
 * @param type The target type of objects to search from
 * @return The {@link Iterable} of {@link BusinessMetadataRecord} that fit the value
 */
public List<BusinessMetadataRecord> findBusinessMetadataOnValue(String value,MetadataSearchTargetType type){
  return executeSearchOnColumns(BusinessMetadataDataset.CASE_INSENSITIVE_VALUE_COLUMN,value,type);
}
Program: 6627
Project: 6627
Buggy source:
private void write(MDSKey id,BusinessMetadataRecord record){
  Put put=new Put(id.getKey());
  put.add(Bytes.toBytes(KEYVALUE_COLUMN),Bytes.toBytes(record.getKey() + KEYVALUE_SEPARATOR + record.getValue()));
  put.add(Bytes.toBytes(VALUE_COLUMN),Bytes.toBytes(record.getValue()));
  indexedTable.put(put);
}

Fixed version (ground truth):
private void write(MDSKey id,BusinessMetadataRecord record){
  Put put=new Put(id.getKey());
  put.add(Bytes.toBytes(KEYVALUE_COLUMN),Bytes.toBytes(record.getKey().toLowerCase() + KEYVALUE_SEPARATOR + record.getValue().toLowerCase()));
  put.add(Bytes.toBytes(CASE_INSENSITIVE_VALUE_COLUMN),Bytes.toBytes(record.getValue().toLowerCase()));
  put.add(Bytes.toBytes(VALUE_COLUMN),Bytes.toBytes(record.getValue()));
  indexedTable.put(put);
}
Program: 6628
Project: 6628
Buggy source:
@Test public void testSearchOnValue() throws Exception {
  BusinessMetadataRecord record=new BusinessMetadataRecord(flow1,"String_Node_Str","String_Node_Str");
  dataset.setProperty(flow1,"String_Node_Str","String_Node_Str");
  dataset.setProperty(flow1,"String_Node_Str","String_Node_Str");
  List<BusinessMetadataRecord> results=dataset.findBusinessMetadataOnValue("String_Node_Str",MetadataSearchTargetType.PROGRAM);
  Assert.assertEquals(1,results.size());
  BusinessMetadataRecord result=results.get(0);
  Assert.assertEquals(record,result);
  dataset.setProperty(flow1,"String_Node_Str","String_Node_Str");
  List<BusinessMetadataRecord> results2=dataset.findBusinessMetadataOnValue("String_Node_Str",MetadataSearchTargetType.PROGRAM);
  Assert.assertEquals(2,results2.size());
  for (  BusinessMetadataRecord result2 : results2) {
    Assert.assertEquals("String_Node_Str",result2.getValue());
  }
}

Fixed version (ground truth):
@Test public void testSearchOnValue() throws Exception {
  BusinessMetadataRecord record=new BusinessMetadataRecord(flow1,"String_Node_Str","String_Node_Str");
  dataset.setProperty(flow1,"String_Node_Str","String_Node_Str");
  dataset.setProperty(flow1,"String_Node_Str","String_Node_Str");
  List<BusinessMetadataRecord> results=dataset.findBusinessMetadataOnValue("String_Node_Str",MetadataSearchTargetType.PROGRAM);
  Assert.assertEquals(1,results.size());
  results=dataset.findBusinessMetadataOnValue("String_Node_Str",MetadataSearchTargetType.PROGRAM);
  BusinessMetadataRecord result=results.get(0);
  Assert.assertEquals(record,result);
  dataset.setProperty(flow1,"String_Node_Str","String_Node_Str");
  List<BusinessMetadataRecord> results2=dataset.findBusinessMetadataOnValue("String_Node_Str",MetadataSearchTargetType.PROGRAM);
  Assert.assertEquals(2,results2.size());
  for (  BusinessMetadataRecord result2 : results2) {
    Assert.assertEquals("String_Node_Str",result2.getValue());
  }
}
Program: 6629
Project: 6629
Buggy source:
@Override public Set<MetadataSearchResultRecord> searchMetadata(String searchQuery,@Nullable final MetadataSearchTargetType type) throws NotFoundException {
  Iterable<BusinessMetadataRecord> results;
  if (type == null) {
    results=businessMds.searchMetadata(searchQuery);
  }
 else {
    results=businessMds.searchMetadataOnType(searchQuery,type);
  }
  Set<MetadataSearchResultRecord> searchResultRecords=new LinkedHashSet<>();
  for (  BusinessMetadataRecord bmr : results) {
    MetadataSearchTargetType finalType=type;
    if (finalType == null) {
      Id.NamespacedId namespacedId=bmr.getTargetId();
      String targetType=getTargetType(namespacedId);
      finalType=getMetadataSearchTarget(targetType);
    }
    MetadataSearchResultRecord msr=new MetadataSearchResultRecord(bmr.getTargetId(),finalType);
    searchResultRecords.add(msr);
  }
  return searchResultRecords;
}

Fixed version (ground truth):
@Override public Set<MetadataSearchResultRecord> searchMetadata(String searchQuery,@Nullable final MetadataSearchTargetType type) throws NotFoundException {
  Iterable<BusinessMetadataRecord> results;
  if (type == null) {
    results=businessMds.searchMetadata(searchQuery);
  }
 else {
    results=businessMds.searchMetadataOnType(searchQuery,type);
  }
  Set<MetadataSearchResultRecord> searchResultRecords=new LinkedHashSet<>();
  for (  BusinessMetadataRecord bmr : results) {
    MetadataSearchTargetType finalType=type;
    if (finalType == null || finalType == MetadataSearchTargetType.ALL) {
      Id.NamespacedId namespacedId=bmr.getTargetId();
      String targetType=getTargetType(namespacedId);
      finalType=getMetadataSearchTarget(targetType);
    }
    MetadataSearchResultRecord msr=new MetadataSearchResultRecord(bmr.getTargetId(),finalType);
    searchResultRecords.add(msr);
  }
  return searchResultRecords;
}
Program: 6630
Project: 6630
Buggy source:
@GET @Path("String_Node_Str") public void searchMetadata(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") String namespaceId,@QueryParam("String_Node_Str") String searchQuery,@QueryParam("String_Node_Str") String target) throws Exception {
  MetadataSearchTargetType metadataSearchTargetType;
  if (target != null) {
    metadataSearchTargetType=MetadataSearchTargetType.valueOf(target.toUpperCase());
  }
 else {
    metadataSearchTargetType=null;
  }
  Set<MetadataSearchResultRecord> results=metadataAdmin.searchMetadata(searchQuery,metadataSearchTargetType);
  responder.sendJson(HttpResponseStatus.OK,results);
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") public void searchMetadata(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") String namespaceId,@QueryParam("String_Node_Str") String searchQuery,@QueryParam("String_Node_Str") String target) throws Exception {
  MetadataSearchTargetType metadataSearchTargetType;
  if (target != null) {
    metadataSearchTargetType=MetadataSearchTargetType.valueOf(target.toUpperCase());
  }
 else {
    metadataSearchTargetType=null;
  }
  Set<MetadataSearchResultRecord> results=metadataAdmin.searchMetadata(searchQuery,metadataSearchTargetType);
  responder.sendJson(HttpResponseStatus.OK,results,SET_METADATA_SEARCH_RESULT_TYPE,GSON);
}
Program: 6633
Project: 6633
Buggy source:
@Override public void init(Set<Integer> partitions){
  super.init(partitions,checkpointManager);
  scheduledExecutor=MoreExecutors.listeningDecorator(Executors.newSingleThreadScheduledExecutor(Threads.createDaemonThreadFactory("String_Node_Str")));
  partitionCheckpoints.clear();
  try {
    for (    Integer partition : partitions) {
      partitionCheckpoints.put(partition,checkpointManager.getCheckpoint(partition));
    }
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    throw Throwables.propagate(e);
  }
  checkPointWriter=new CheckPointWriter(checkpointManager,partitionCheckpoints);
  scheduledExecutor.scheduleWithFixedDelay(checkPointWriter,100,200,TimeUnit.MILLISECONDS);
}

Fixed version (ground truth):
@Override public void init(Set<Integer> partitions){
  super.init(partitions,checkpointManager);
  scheduledExecutor=MoreExecutors.listeningDecorator(Executors.newSingleThreadScheduledExecutor(Threads.createDaemonThreadFactory("String_Node_Str")));
  partitionCheckpoints.clear();
  try {
    for (    Integer partition : partitions) {
      partitionCheckpoints.put(partition,checkpointManager.getCheckpoint(partition));
    }
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    throw Throwables.propagate(e);
  }
  checkPointWriter=new CheckPointWriter(checkpointManager,partitionCheckpoints);
  scheduledExecutor.scheduleWithFixedDelay(checkPointWriter,100,10000,TimeUnit.MILLISECONDS);
}
Program: 6635
Project: 6635
Buggy source:
List<BusinessMetadataRecord> executeSearchOnColumns(String column,String searchValue,MetadataSearchTargetType type){
  List<BusinessMetadataRecord> results=new LinkedList<>();
  byte[] startKey=Bytes.toBytes(searchValue.toLowerCase());
  byte[] stopKey=Bytes.stopKeyForPrefix(startKey);
  Scanner scanner=indexedTable.scanByIndex(Bytes.toBytes(column),startKey,stopKey);
  try {
    Row next;
    while ((next=scanner.next()) != null) {
      String rowValue=next.getString(VALUE_COLUMN);
      if (rowValue == null) {
        continue;
      }
      final byte[] rowKey=next.getRow();
      String targetType=getTargetType(rowKey);
      if ((type != MetadataSearchTargetType.ALL) && (!targetType.equals(type.getInternalName()))) {
        continue;
      }
      Id.NamespacedId targetId=getNamespaceIdFromKey(targetType,new MDSKey(rowKey));
      String key=getMetadataKey(targetType,rowKey);
      String value=Bytes.toString(next.get(Bytes.toBytes(BusinessMetadataDataset.VALUE_COLUMN)));
      BusinessMetadataRecord record=new BusinessMetadataRecord(targetId,key,value);
      results.add(record);
    }
  }
  finally {
    scanner.close();
  }
  return results;
}

Fixed version (ground truth):
List<BusinessMetadataRecord> executeSearchOnColumns(String column,String searchValue,MetadataSearchTargetType type){
  List<BusinessMetadataRecord> results=new LinkedList<>();
  Scanner scanner;
  String lowerCaseSearchValue=searchValue.toLowerCase();
  if (lowerCaseSearchValue.endsWith("String_Node_Str")) {
    byte[] startKey=Bytes.toBytes(lowerCaseSearchValue.substring(0,lowerCaseSearchValue.lastIndexOf("String_Node_Str")));
    byte[] stopKey=Bytes.stopKeyForPrefix(startKey);
    scanner=indexedTable.scanByIndex(Bytes.toBytes(column),startKey,stopKey);
  }
 else {
    byte[] value=Bytes.toBytes(lowerCaseSearchValue);
    scanner=indexedTable.readByIndex(Bytes.toBytes(column),value);
  }
  try {
    Row next;
    while ((next=scanner.next()) != null) {
      String rowValue=next.getString(VALUE_COLUMN);
      if (rowValue == null) {
        continue;
      }
      final byte[] rowKey=next.getRow();
      String targetType=getTargetType(rowKey);
      if ((type != MetadataSearchTargetType.ALL) && (!targetType.equals(type.getInternalName()))) {
        continue;
      }
      Id.NamespacedId targetId=getNamespaceIdFromKey(targetType,new MDSKey(rowKey));
      String key=getMetadataKey(targetType,rowKey);
      String value=Bytes.toString(next.get(Bytes.toBytes(BusinessMetadataDataset.VALUE_COLUMN)));
      BusinessMetadataRecord record=new BusinessMetadataRecord(targetId,key,value);
      results.add(record);
    }
  }
  finally {
    scanner.close();
  }
  return results;
}
Program: 6636
Project: 6636
Buggy source:
@Test public void testSearchOnValue() throws Exception {
  BusinessMetadataRecord record=new BusinessMetadataRecord(flow1,"String_Node_Str","String_Node_Str");
  dataset.setProperty(flow1,"String_Node_Str","String_Node_Str");
  dataset.setProperty(flow1,"String_Node_Str","String_Node_Str");
  List<BusinessMetadataRecord> results=dataset.findBusinessMetadataOnValue("String_Node_Str",MetadataSearchTargetType.PROGRAM);
  Assert.assertEquals(1,results.size());
  results=dataset.findBusinessMetadataOnValue("String_Node_Str",MetadataSearchTargetType.PROGRAM);
  BusinessMetadataRecord result=results.get(0);
  Assert.assertEquals(record,result);
  dataset.setProperty(flow1,"String_Node_Str","String_Node_Str");
  List<BusinessMetadataRecord> results2=dataset.findBusinessMetadataOnValue("String_Node_Str",MetadataSearchTargetType.PROGRAM);
  Assert.assertEquals(2,results2.size());
  for (  BusinessMetadataRecord result2 : results2) {
    Assert.assertEquals("String_Node_Str",result2.getValue());
  }
}

Fixed version (ground truth):
@Test public void testSearchOnValue() throws Exception {
  BusinessMetadataRecord record=new BusinessMetadataRecord(flow1,"String_Node_Str","String_Node_Str");
  dataset.setProperty(flow1,"String_Node_Str","String_Node_Str");
  dataset.setProperty(flow1,"String_Node_Str","String_Node_Str");
  List<BusinessMetadataRecord> results=dataset.findBusinessMetadataOnValue("String_Node_Str",MetadataSearchTargetType.PROGRAM);
  Assert.assertEquals(1,results.size());
  results=dataset.findBusinessMetadataOnValue("String_Node_Str",MetadataSearchTargetType.PROGRAM);
  BusinessMetadataRecord result=results.get(0);
  Assert.assertEquals(record,result);
  dataset.setProperty(flow1,"String_Node_Str","String_Node_Str");
  List<BusinessMetadataRecord> results2=dataset.findBusinessMetadataOnValue("String_Node_Str",MetadataSearchTargetType.PROGRAM);
  Assert.assertEquals(2,results2.size());
  for (  BusinessMetadataRecord result2 : results2) {
    Assert.assertEquals("String_Node_Str",result2.getValue());
  }
  dataset.setProperty(stream1,"String_Node_Str","String_Node_Str");
  List<BusinessMetadataRecord> results3=dataset.findBusinessMetadataOnValue("String_Node_Str",MetadataSearchTargetType.ALL);
  Assert.assertEquals(2,results3.size());
  for (  BusinessMetadataRecord result3 : results3) {
    Assert.assertTrue(result3.getValue().startsWith("String_Node_Str"));
  }
}
Program: 6637
Project: 6637
Buggy source:
private void publishNotification(long absoluteSize){
  try {
    notificationService.publish(streamFeed,new StreamSizeNotification(System.currentTimeMillis(),absoluteSize)).get();
  }
 catch (  NotificationFeedException e) {
    LOG.warn("String_Node_Str",streamFeed,e);
  }
catch (  Throwable t) {
    LOG.warn("String_Node_Str",streamFeed.getFeedId(),t);
  }
}

Fixed version (ground truth):
private void publishNotification(long absoluteSize){
  try {
    notificationService.publish(streamFeed,new StreamSizeNotification(System.currentTimeMillis(),absoluteSize)).get();
  }
 catch (  NotificationFeedException e) {
    LOG.warn("String_Node_Str",streamFeed,e);
  }
catch (  Throwable t) {
    LOG.debug("String_Node_Str",streamFeed.getFeedId(),t);
  }
}
Program: 6638
Project: 6638
Buggy source:
@Override public <N>ListenableFuture<N> publish(final Id.NotificationFeed feed,final N notification,final Type notificationType) throws NotificationException {
  return executorService.submit(new Callable<N>(){
    @Override public N call() throws Exception {
      notificationReceived(feed,GSON.toJsonTree(notification,notificationType));
      return notification;
    }
  }
);
}

Fixed version (ground truth):
@Override public <N>ListenableFuture<N> publish(final Id.NotificationFeed feed,final N notification,final Type notificationType) throws NotificationException {
  if (executorService == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  return executorService.submit(new Callable<N>(){
    @Override public N call() throws Exception {
      notificationReceived(feed,GSON.toJsonTree(notification,notificationType));
      return notification;
    }
  }
);
}
Program: 6639
Project: 6639
Buggy source:
@Override protected void doInit(TwillContext context){
  this.user=DEFAULT_USER;
  CConfiguration cConf=getCConfiguration();
  Configuration hConf=getConfiguration();
  cConf.set(Constants.Dataset.Executor.ADDRESS,context.getHost().getHostName());
  injector=Guice.createInjector(new ConfigModule(cConf,hConf),new IOModule(),new ZKClientModule(),new KafkaClientModule(),new MetricsClientRuntimeModule().getDistributedModules(),new DiscoveryRuntimeModule().getDistributedModules(),new LocationRuntimeModule().getDistributedModules(),new DataFabricModules().getDistributedModules(),new DataSetsModules().getDistributedModules(true),new DataSetServiceModules().getDistributedModules(),new LoggingModules().getDistributedModules(),new ExploreClientModule(),new NamespaceClientRuntimeModule().getDistributedModules(),new MetadataServiceModule());
  injector.getInstance(LogAppenderInitializer.class).initialize();
  LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(Id.Namespace.SYSTEM.getId(),Constants.Logging.COMPONENT_NAME,Constants.Service.DATASET_EXECUTOR));
}

Fixed version (ground truth):
@Override protected void doInit(TwillContext context){
  this.user=DEFAULT_USER;
  CConfiguration cConf=getCConfiguration();
  Configuration hConf=getConfiguration();
  cConf.set(Constants.Dataset.Executor.ADDRESS,context.getHost().getHostName());
  injector=createInjector(cConf,hConf);
  injector.getInstance(LogAppenderInitializer.class).initialize();
  LoggingContextAccessor.setLoggingContext(new ServiceLoggingContext(Id.Namespace.SYSTEM.getId(),Constants.Logging.COMPONENT_NAME,Constants.Service.DATASET_EXECUTOR));
}
Program: 6640
Project: 6640
Buggy source:
/** 
 * Stops a Program.
 */
private AppFabricServiceStatus stop(Id.Program identifier,@Nullable String runId) throws NotFoundException, BadRequestException {
  ProgramRuntimeService.RuntimeInfo runtimeInfo=findRuntimeInfo(identifier,runId);
  if (runtimeInfo == null) {
    if (!store.applicationExists(identifier.getApplication())) {
      throw new ApplicationNotFoundException(identifier.getApplication());
    }
 else     if (!store.programExists(identifier)) {
      throw new ProgramNotFoundException(identifier);
    }
 else     if (runId == null) {
      throw new BadRequestException("String_Node_Str");
    }
 else {
      throw new NotFoundException(new Id.Run(identifier,runId));
    }
  }
  try {
    ProgramController controller=runtimeInfo.getController();
    controller.stop().get();
    return AppFabricServiceStatus.OK;
  }
 catch (  Throwable throwable) {
    LOG.warn(throwable.getMessage(),throwable);
    return AppFabricServiceStatus.INTERNAL_ERROR;
  }
}

Fixed version (ground truth):
/** 
 * Stops a Program.
 */
private AppFabricServiceStatus stop(Id.Program identifier,@Nullable String runId) throws NotFoundException, BadRequestException {
  ProgramRuntimeService.RuntimeInfo runtimeInfo=findRuntimeInfo(identifier,runId);
  if (runtimeInfo == null) {
    if (!store.applicationExists(identifier.getApplication())) {
      throw new ApplicationNotFoundException(identifier.getApplication());
    }
 else     if (!store.programExists(identifier)) {
      throw new ProgramNotFoundException(identifier);
    }
 else     if (runId != null) {
      Id.Run programRunId=new Id.Run(identifier,runId);
      RunRecordMeta runRecord=store.getRun(identifier,runId);
      if (runRecord != null && runRecord.getProperties().containsKey("String_Node_Str") && runRecord.getStatus().equals(ProgramRunStatus.RUNNING)) {
        String workflowRunId=runRecord.getProperties().get("String_Node_Str");
        throw new BadRequestException(String.format("String_Node_Str" + "String_Node_Str",programRunId,workflowRunId));
      }
      throw new NotFoundException(programRunId);
    }
    throw new BadRequestException(String.format("String_Node_Str",identifier));
  }
  try {
    ProgramController controller=runtimeInfo.getController();
    controller.stop().get();
    return AppFabricServiceStatus.OK;
  }
 catch (  Throwable throwable) {
    LOG.warn(throwable.getMessage(),throwable);
    return AppFabricServiceStatus.INTERNAL_ERROR;
  }
}
Program: 6641
Project: 6641
Buggy source:
protected void stopProgram(Id.Program program,int expectedStatusCode,String runId) throws Exception {
  String path;
  if (runId == null) {
    path=String.format("String_Node_Str",program.getApplicationId(),program.getType().getCategoryName(),program.getId());
  }
 else {
    path=String.format("String_Node_Str",program.getApplicationId(),program.getType().getCategoryName(),program.getId(),runId);
  }
  HttpResponse response=doPost(getVersionedAPIPath(path,program.getNamespaceId()));
  Assert.assertEquals(expectedStatusCode,response.getStatusLine().getStatusCode());
}

Fixed version (ground truth):
protected void stopProgram(Id.Program program,String runId,int expectedStatusCode,String expectedMessage) throws Exception {
  String path;
  if (runId == null) {
    path=String.format("String_Node_Str",program.getApplicationId(),program.getType().getCategoryName(),program.getId());
  }
 else {
    path=String.format("String_Node_Str",program.getApplicationId(),program.getType().getCategoryName(),program.getId(),runId);
  }
  HttpResponse response=doPost(getVersionedAPIPath(path,program.getNamespaceId()));
  Assert.assertEquals(expectedStatusCode,response.getStatusLine().getStatusCode());
  if (expectedMessage != null) {
    Assert.assertEquals(expectedMessage,EntityUtils.toString(response.getEntity()));
  }
}
Program: 6647
Project: 6647
Buggy source:
public static void setupDatasets(DatasetFramework dsFramework) throws DatasetManagementException, IOException, ServiceUnavailableException {
  dsFramework.addInstance(Table.class.getName(),Id.DatasetInstance.from(Id.Namespace.SYSTEM,Constants.ConfigStore.CONFIG_TABLE),DatasetProperties.EMPTY);
}

Fixed version (ground truth):
public static void setupDatasets(DatasetFramework dsFramework) throws DatasetManagementException, IOException {
  dsFramework.addInstance(Table.class.getName(),Id.DatasetInstance.from(Id.Namespace.SYSTEM,Constants.ConfigStore.CONFIG_TABLE),DatasetProperties.EMPTY);
}
Program: 6648
Project: 6648
Buggy source:
protected void verifyData(Id.Application appId,ApplicationSpecification specification) throws DatasetManagementException, ServiceUnavailableException {
  VerifyResult result;
  for (  DatasetCreationSpec dataSetCreateSpec : specification.getDatasets().values()) {
    result=getVerifier(DatasetCreationSpec.class).verify(appId,dataSetCreateSpec);
    if (!result.isSuccess()) {
      throw new RuntimeException(result.getMessage());
    }
    String dsName=dataSetCreateSpec.getInstanceName();
    Id.DatasetInstance datasetInstanceId=Id.DatasetInstance.from(appId.getNamespace(),dsName);
    DatasetSpecification existingSpec=dsFramework.getDatasetSpec(datasetInstanceId);
    if (existingSpec != null && !existingSpec.getType().equals(dataSetCreateSpec.getTypeName())) {
      throw new DataSetException(String.format("String_Node_Str",dsName,dataSetCreateSpec.getTypeName()));
    }
  }
  for (  StreamSpecification spec : specification.getStreams().values()) {
    result=getVerifier(StreamSpecification.class).verify(appId,spec);
    if (!result.isSuccess()) {
      throw new RuntimeException(result.getMessage());
    }
  }
}

Fixed version (ground truth):
protected void verifyData(Id.Application appId,ApplicationSpecification specification) throws DatasetManagementException {
  VerifyResult result;
  for (  DatasetCreationSpec dataSetCreateSpec : specification.getDatasets().values()) {
    result=getVerifier(DatasetCreationSpec.class).verify(appId,dataSetCreateSpec);
    if (!result.isSuccess()) {
      throw new RuntimeException(result.getMessage());
    }
    String dsName=dataSetCreateSpec.getInstanceName();
    Id.DatasetInstance datasetInstanceId=Id.DatasetInstance.from(appId.getNamespace(),dsName);
    DatasetSpecification existingSpec=dsFramework.getDatasetSpec(datasetInstanceId);
    if (existingSpec != null && !existingSpec.getType().equals(dataSetCreateSpec.getTypeName())) {
      throw new DataSetException(String.format("String_Node_Str",dsName,dataSetCreateSpec.getTypeName()));
    }
  }
  for (  StreamSpecification spec : specification.getStreams().values()) {
    result=getVerifier(StreamSpecification.class).verify(appId,spec);
    if (!result.isSuccess()) {
      throw new RuntimeException(result.getMessage());
    }
  }
}