nus-yam/ex-repair huggingface dataset:
Program: 63819
Project: 63819
Buggy source:
public static ListReader readListPointer(SegmentReader segment,WirePointer ref,byte expectedElementSize,int nestingLimit){
  ListPointer listPtr=new ListPointer(ref);
  WordPointer ptr=ref.target();
switch (listPtr.elementSize()) {
case FieldSize.INLINE_COMPOSITE:
{
      int wordCount=listPtr.inlineCompositeWordCount();
      WirePointer tag=new WirePointer(ptr);
      ptr.offset+=1;
      int size=tag.inlineCompositeListElementCount();
      StructPointer structPtr=new StructPointer(tag);
      int wordsPerElement=structPtr.wordSize();
      return new ListReader(segment,ptr.offset * 8,size,wordsPerElement * 64,structPtr.dataSize() * 64,structPtr.ptrCount(),nestingLimit - 1);
    }
case FieldSize.VOID:
  break;
default :
throw new Error("String_Node_Str");
}
throw new Error();
}

Fixed version (ground truth):
public static ListReader readListPointer(SegmentReader segment,WirePointer ref,byte expectedElementSize,int nestingLimit){
  ListPointer listPtr=new ListPointer(ref);
  WordPointer ptr=ref.target();
switch (listPtr.elementSize()) {
case FieldSize.INLINE_COMPOSITE:
{
      int wordCount=listPtr.inlineCompositeWordCount();
      WirePointer tag=new WirePointer(ptr);
      ptr.offset+=1;
      int size=tag.inlineCompositeListElementCount();
      System.out.println("String_Node_Str" + size);
      StructPointer structPtr=new StructPointer(tag);
      int wordsPerElement=structPtr.wordSize();
      return new ListReader(segment,ptr.offset * 8,size,wordsPerElement * 64,structPtr.dataSize() * 64,structPtr.ptrCount(),nestingLimit - 1);
    }
case FieldSize.VOID:
  break;
default :
throw new Error("String_Node_Str");
}
throw new Error();
}
Program: 63820
Project: 63820
Buggy source:
static ByteBuffer makeByteBuffer(byte[] bytes){
  ByteBuffer result=ByteBuffer.wrap(bytes);
  result.order(ByteOrder.LITTLE_ENDIAN);
  return result;
}

Fixed version (ground truth):
static ByteBuffer makeByteBuffer(byte[] bytes){
  ByteBuffer result=ByteBuffer.wrap(bytes);
  return result;
}
Program: 63821
Project: 63821
Buggy source:
public static MessageReader create(InputStream is) throws IOException {
  ByteBuffer firstWord=makeByteBuffer(readExact(is,8));
  int segmentCount=1 + firstWord.getInt();
  int segment0Size=0;
  if (segmentCount > 0) {
    segment0Size=firstWord.getInt(1);
  }
  int totalWords=segment0Size;
  if (segmentCount > 512) {
    throw new IOException("String_Node_Str");
  }
  Vector<Integer> moreSizes=new Vector<Integer>();
  if (segmentCount > 1) {
    ByteBuffer moreSizesRaw=makeByteBuffer(readExact(is,4 * (segmentCount & ~1)));
    for (int ii=0; ii < segmentCount - 1; ++ii) {
      int size=moreSizesRaw.getInt(ii);
      moreSizes.add(size);
      totalWords+=size;
    }
  }
  byte[] allSegments=readExact(is,totalWords * 8);
  ByteBuffer[] segmentSlices=new ByteBuffer[segmentCount];
  segmentSlices[0]=ByteBuffer.wrap(allSegments,0,segment0Size);
  int offset=segment0Size;
  for (int ii=1; ii < segmentCount; ++ii) {
    segmentSlices[ii]=ByteBuffer.wrap(allSegments,offset,moreSizes.get(ii - 1));
    offset+=moreSizes.get(ii - 1);
  }
  return new MessageReader(segmentSlices);
}

Fixed version (ground truth):
public static MessageReader create(InputStream is) throws IOException {
  ByteBuffer firstWord=makeByteBuffer(readExact(is,8));
  int segmentCount=1 + firstWord.getInt(0);
  System.out.println("String_Node_Str" + segmentCount);
  int segment0Size=0;
  if (segmentCount > 0) {
    segment0Size=firstWord.getInt(1);
  }
  System.out.println("String_Node_Str" + segment0Size);
  int totalWords=segment0Size;
  if (segmentCount > 512) {
    throw new IOException("String_Node_Str");
  }
  Vector<Integer> moreSizes=new Vector<Integer>();
  if (segmentCount > 1) {
    ByteBuffer moreSizesRaw=makeByteBuffer(readExact(is,4 * (segmentCount & ~1)));
    for (int ii=0; ii < segmentCount - 1; ++ii) {
      int size=moreSizesRaw.getInt(ii);
      moreSizes.add(size);
      totalWords+=size;
    }
  }
  byte[] allSegments=readExact(is,totalWords * 8);
  ByteBuffer[] segmentSlices=new ByteBuffer[segmentCount];
  segmentSlices[0]=ByteBuffer.wrap(allSegments,0,segment0Size);
  int offset=segment0Size;
  for (int ii=1; ii < segmentCount; ++ii) {
    segmentSlices[ii]=ByteBuffer.wrap(allSegments,offset,moreSizes.get(ii - 1));
    offset+=moreSizes.get(ii - 1);
  }
  return new MessageReader(segmentSlices);
}
Program: 63822
Project: 63822
Buggy source:
public StructPointer(ByteBuffer buffer,int buffer_offset){
  super(buffer,buffer_offset);
}

Fixed version (ground truth):
public StructPointer(WirePointer ptr){
  this.ptr=ptr;
}
Program: 63823
Project: 63823
Buggy source:
public short ptrCount(){
  return this.buffer.getShort(this.buffer_offset * 4 + 3);
}

Fixed version (ground truth):
public short ptrCount(){
  return this.ptr.buffer.getShort(this.ptr.buffer_offset * 4 + 3);
}
Program: 63824
Project: 63824
Buggy source:
public short dataSize(){
  return this.buffer.getShort(this.buffer_offset * 4 + 2);
}

Fixed version (ground truth):
public short dataSize(){
  return this.ptr.buffer.getShort(this.ptr.buffer_offset * 4 + 2);
}
Program: 63825
Project: 63825
Buggy source:
public static StructReader readStructPointer(SegmentReader segment,WirePointer ref,int nestingLimit){
  WordPointer ptr=ref.target();
  StructPointer structPtr=(StructPointer)ref;
  int dataSizeWords=structPtr.dataSize();
  return new StructReader(segment,ptr.offset * 8,(ptr.offset + dataSizeWords) * 8,dataSizeWords * 64,structPtr.ptrCount(),(byte)0,nestingLimit - 1);
}

Fixed version (ground truth):
public static StructReader readStructPointer(SegmentReader segment,WirePointer ref,int nestingLimit){
  WordPointer ptr=ref.target();
  StructPointer structPtr=new StructPointer(ref);
  int dataSizeWords=structPtr.dataSize();
  return new StructReader(segment,ptr.offset * 8,(ptr.offset + dataSizeWords) * 8,dataSizeWords * 64,structPtr.ptrCount(),(byte)0,nestingLimit - 1);
}
Program: 63826
Project: 63826
Buggy source:
public static ListReader readListPointer(SegmentReader segment,WirePointer ref,byte expectedElementSize,int nestingLimit){
  ListPointer listPtr=(ListPointer)ref;
  WordPointer ptr=ref.target();
switch (listPtr.elementSize()) {
case FieldSize.INLINE_COMPOSITE:
{
      int wordCount=listPtr.inlineCompositeWordCount();
      WirePointer tag=new WirePointer(ptr);
      ptr.offset+=1;
      int size=tag.inlineCompositeListElementCount();
      StructPointer structPtr=(StructPointer)tag;
      int wordsPerElement=structPtr.wordSize();
      return new ListReader(segment,ptr.offset * 8,size,wordsPerElement * 64,structPtr.dataSize() * 64,structPtr.ptrCount(),nestingLimit - 1);
    }
case FieldSize.VOID:
  break;
default :
throw new Error("String_Node_Str");
}
throw new Error();
}

Fixed version (ground truth):
public static ListReader readListPointer(SegmentReader segment,WirePointer ref,byte expectedElementSize,int nestingLimit){
  ListPointer listPtr=(ListPointer)ref;
  WordPointer ptr=ref.target();
switch (listPtr.elementSize()) {
case FieldSize.INLINE_COMPOSITE:
{
      int wordCount=listPtr.inlineCompositeWordCount();
      WirePointer tag=new WirePointer(ptr);
      ptr.offset+=1;
      int size=tag.inlineCompositeListElementCount();
      StructPointer structPtr=new StructPointer(tag);
      int wordsPerElement=structPtr.wordSize();
      return new ListReader(segment,ptr.offset * 8,size,wordsPerElement * 64,structPtr.dataSize() * 64,structPtr.ptrCount(),nestingLimit - 1);
    }
case FieldSize.VOID:
  break;
default :
throw new Error("String_Node_Str");
}
throw new Error();
}
Program: 63827
Project: 63827
Buggy source:
public static void printAddressBook() throws java.io.IOException {
  System.out.println("String_Node_Str");
  capnp.MessageReader message=capnp.InputStreamMessageReader.create(System.in);
  Addressbook.AddressBook.Reader addressbook=message.getRoot(Addressbook.AddressBook.Reader.factory);
  capnp.StructList.Reader<Addressbook.Person> people=addressbook.getPeople();
  int size=people.size();
  for (int ii=0; ii < size; ++ii) {
    people.get(ii);
  }
}

Fixed version (ground truth):
public static void printAddressBook() throws java.io.IOException {
  System.out.println("String_Node_Str");
  capnp.MessageReader message=capnp.InputStreamMessageReader.create(System.in);
  Addressbook.AddressBook.Reader addressbook=message.getRoot(Addressbook.AddressBook.Reader.factory);
  capnp.StructList.Reader<Addressbook.Person.Reader> people=addressbook.getPeople();
  int size=people.size();
  for (int ii=0; ii < size; ++ii) {
    Addressbook.Person.Reader person=people.get(ii);
    System.out.println(person.getName().toString() + "String_Node_Str");
  }
}
Program: 63828
Project: 63828
Buggy source:
public static MessageReader create(InputStream is) throws IOException {
  ByteBuffer firstWord=makeByteBuffer(readExact(is,8));
  int segmentCount=1 + firstWord.getInt(0);
  int segment0Size=0;
  if (segmentCount > 0) {
    segment0Size=firstWord.getInt(4);
  }
  int totalWords=segment0Size;
  if (segmentCount > 512) {
    throw new IOException("String_Node_Str");
  }
  Vector<Integer> moreSizes=new Vector<Integer>();
  if (segmentCount > 1) {
    ByteBuffer moreSizesRaw=makeByteBuffer(readExact(is,4 * (segmentCount & ~1)));
    for (int ii=0; ii < segmentCount - 1; ++ii) {
      int size=moreSizesRaw.getInt(ii * 4);
      moreSizes.add(size);
      totalWords+=size;
    }
  }
  byte[] allSegments=readExact(is,totalWords * 8);
  ByteBuffer[] segmentSlices=new ByteBuffer[segmentCount];
  segmentSlices[0]=ByteBuffer.wrap(allSegments,0,segment0Size);
  segmentSlices[0].order(ByteOrder.LITTLE_ENDIAN);
  int offset=segment0Size;
  for (int ii=1; ii < segmentCount; ++ii) {
    segmentSlices[ii]=ByteBuffer.wrap(allSegments,offset,moreSizes.get(ii - 1));
    segmentSlices[ii].order(ByteOrder.LITTLE_ENDIAN);
    offset+=moreSizes.get(ii - 1);
  }
  return new MessageReader(segmentSlices);
}

Fixed version (ground truth):
public static MessageReader create(InputStream is) throws IOException {
  ByteBuffer firstWord=makeByteBuffer(readExact(is,8));
  int segmentCount=1 + firstWord.getInt(0);
  int segment0Size=0;
  if (segmentCount > 0) {
    segment0Size=firstWord.getInt(4);
  }
  int totalWords=segment0Size;
  if (segmentCount > 512) {
    throw new IOException("String_Node_Str");
  }
  Vector<Integer> moreSizes=new Vector<Integer>();
  if (segmentCount > 1) {
    ByteBuffer moreSizesRaw=makeByteBuffer(readExact(is,4 * (segmentCount & ~1)));
    for (int ii=0; ii < segmentCount - 1; ++ii) {
      int size=moreSizesRaw.getInt(ii * 4);
      moreSizes.add(size);
      totalWords+=size;
    }
  }
  byte[] allSegments=readExact(is,totalWords * 8);
  ByteBuffer[] segmentSlices=new ByteBuffer[segmentCount];
  segmentSlices[0]=ByteBuffer.wrap(allSegments,0,segment0Size * 8);
  segmentSlices[0].order(ByteOrder.LITTLE_ENDIAN);
  int offset=segment0Size;
  for (int ii=1; ii < segmentCount; ++ii) {
    segmentSlices[ii]=ByteBuffer.wrap(allSegments,offset * 8,moreSizes.get(ii - 1) * 8);
    segmentSlices[ii].order(ByteOrder.LITTLE_ENDIAN);
    offset+=moreSizes.get(ii - 1);
  }
  return new MessageReader(segmentSlices);
}
Program: 63829
Project: 63829
Buggy source:
public StructReader getStructElement(int index){
  int indexBit=index * this.step;
  int structData=this.ptr + (indexBit / 8);
  int structPointers=structData + (this.structDataSize / 8);
  return new StructReader(this.segment,structData,structPointers,this.structDataSize,this.structPointerCount,(byte)(indexBit % 8),this.nestingLimit - 1);
}

Fixed version (ground truth):
public StructReader getStructElement(int index){
  int indexBit=index * this.step;
  int structData=this.ptr + (indexBit / 8);
  int structPointers=structData + (this.structDataSize / 8);
  return new StructReader(this.segment,structData,structPointers / 8,this.structDataSize,this.structPointerCount,(byte)(indexBit % 8),this.nestingLimit - 1);
}
Program: 63830
Project: 63830
Buggy source:
public static Text.Reader readTextPointer(SegmentReader segment,WirePointer ref){
  ref.target();
  ListPointer listPtr=new ListPointer(ref);
  return new Text.Reader(listPtr);
}

Fixed version (ground truth):
public static Text.Reader readTextPointer(SegmentReader segment,WirePointer ref){
  WordPointer ptr=ref.target();
  ListPointer listPtr=new ListPointer(ref);
  return new Text.Reader(listPtr);
}
Program: 63831
Project: 63831
Buggy source:
public int offset_and_kind(){
  return this.buffer.getInt(buffer_offset * 8);
}

Fixed version (ground truth):
public int offset_and_kind(){
  return this.buffer.getInt(this.buffer_offset * 8);
}
Program: 63832
Project: 63832
Buggy source:
@GET @Path("String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value=UserOpDescription.GET_TENANT_USERS,produces=ContentType.JSON,notes=Notes.USER_NOTES,nickname="String_Node_Str") Set<UserResponseJson> getAll();

Fixed version (ground truth):
@GET @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value=UserOpDescription.GET_TENANT_USERS,produces=ContentType.JSON,notes=Notes.USER_NOTES,nickname="String_Node_Str") SortedSet<UserResponseJson> getAll();
Program: 63833
Project: 63833
Buggy source:
@Override public Set<UserResponseJson> getAll(){
  IdentityUser user=authenticatedUserService.getCbUser();
  return toJsonSet(userService.getAll(user));
}

Fixed version (ground truth):
@Override public SortedSet<UserResponseJson> getAll(){
  IdentityUser user=authenticatedUserService.getCbUser();
  Set<UserResponseJson> userResponseJsons=userService.getAll(user).stream().map(u -> conversionService.convert(u,UserResponseJson.class)).collect(Collectors.toSet());
  SortedSet<UserResponseJson> results=new TreeSet<>(new UserIdComparator());
  results.addAll(userResponseJsons);
  return results;
}
Program: 63834
Project: 63834
Buggy source:
public void executePostRecipesOnNewHosts(Long stackId,String hostGroupName) throws CloudbreakException {
  Stack stack=stackService.getByIdWithLists(stackId);
  LOGGER.info("String_Node_Str");
  recipeEngine.executePostInstall(stack);
}

Fixed version (ground truth):
public void executePostRecipesOnNewHosts(Long stackId) throws CloudbreakException {
  Stack stack=stackService.getByIdWithLists(stackId);
  LOGGER.info("String_Node_Str");
  recipeEngine.executePostInstallRecipes(stack,hostGroupService.getByCluster(stack.getCluster().getId()));
}
Program: 63835
Project: 63835
Buggy source:
@Override public void accept(Event<UpscalePostRecipesRequest> event){
  UpscalePostRecipesRequest request=event.getData();
  UpscalePostRecipesResult result;
  try {
    clusterUpscaleService.executePostRecipesOnNewHosts(request.getStackId(),request.getHostGroupName());
    result=new UpscalePostRecipesResult(request);
  }
 catch (  Exception e) {
    result=new UpscalePostRecipesResult(e.getMessage(),e,request);
  }
  eventBus.notify(result.selector(),new Event<>(event.getHeaders(),result));
}

Fixed version (ground truth):
@Override public void accept(Event<UpscalePostRecipesRequest> event){
  UpscalePostRecipesRequest request=event.getData();
  UpscalePostRecipesResult result;
  try {
    clusterUpscaleService.executePostRecipesOnNewHosts(request.getStackId());
    result=new UpscalePostRecipesResult(request);
  }
 catch (  Exception e) {
    result=new UpscalePostRecipesResult(e.getMessage(),e,request);
  }
  eventBus.notify(result.selector(),new Event<>(event.getHeaders(),result));
}
Program: 63837
Project: 63837
Buggy source:
public void executePreTerminationRecipes(Stack stack,Set<HostGroup> hostGroups,Set<String> hostNames) throws CloudbreakException {
  Orchestrator orchestrator=stack.getOrchestrator();
  if (recipesFound(hostGroups,RecipeType.PRE_TERMINATION) && recipesSupportedOnOrchestrator(orchestrator)) {
    orchestratorRecipeExecutor.preTerminationRecipes(stack,hostNames);
  }
}

Fixed version (ground truth):
public void executePreTerminationRecipes(Stack stack,Set<HostGroup> hostGroups,Set<String> hostNames) throws CloudbreakException {
  Orchestrator orchestrator=stack.getOrchestrator();
  if (shouldExecuteRecipeOnStack(hostGroups,orchestrator,PRE_TERMINATION)) {
    orchestratorRecipeExecutor.preTerminationRecipes(stack,hostNames);
  }
}
Program: 63838
Project: 63838
Buggy source:
public void executePreAmbariStartRecipes(Stack stack,Set<HostGroup> hostGroups) throws CloudbreakException {
  Orchestrator orchestrator=stack.getOrchestrator();
  if (shouldExecuteRecipeOnStack(stack,hostGroups,orchestrator)) {
    orchestratorRecipeExecutor.preAmbariStartRecipes(stack);
  }
}

Fixed version (ground truth):
public void executePreAmbariStartRecipes(Stack stack,Set<HostGroup> hostGroups) throws CloudbreakException {
  Orchestrator orchestrator=stack.getOrchestrator();
  if (shouldExecuteRecipeOnStack(hostGroups,orchestrator,PRE_AMBARI_START)) {
    orchestratorRecipeExecutor.preAmbariStartRecipes(stack);
  }
}
Program: 63839
Project: 63839
Buggy source:
private void addContainerExecutorScripts(Stack stack,Set<HostGroup> hostGroups){
  try {
    Cluster cluster=stack.getCluster();
    if (cluster != null && ExecutorType.CONTAINER.equals(cluster.getExecutorType())) {
      for (      HostGroup hostGroup : hostGroups) {
        String script=FileReaderUtils.readFileFromClasspath("String_Node_Str");
        RecipeScript recipeScript=new RecipeScript(script,RecipeType.POST_CLUSTER_INSTALL);
        Recipe recipe=recipeBuilder.buildRecipes("String_Node_Str",Collections.singletonList(recipeScript)).get(0);
        hostGroup.addRecipe(recipe);
      }
    }
  }
 catch (  IOException e) {
    LOGGER.warn("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void addContainerExecutorScripts(Stack stack,Set<HostGroup> hostGroups){
  try {
    Cluster cluster=stack.getCluster();
    if (cluster != null && ExecutorType.CONTAINER.equals(cluster.getExecutorType())) {
      for (      HostGroup hostGroup : hostGroups) {
        String script=FileReaderUtils.readFileFromClasspath("String_Node_Str");
        RecipeScript recipeScript=new RecipeScript(script,POST_CLUSTER_INSTALL);
        Recipe recipe=recipeBuilder.buildRecipes("String_Node_Str",Collections.singletonList(recipeScript)).get(0);
        hostGroup.addRecipe(recipe);
      }
    }
  }
 catch (  IOException e) {
    LOGGER.warn("String_Node_Str",e);
  }
}
Program: 63840
Project: 63840
Buggy source:
private void addHDFSRecipe(Stack stack,Set<HostGroup> hostGroups){
  try {
    Cluster cluster=stack.getCluster();
    String blueprintText=cluster.getBlueprint().getBlueprintText();
    for (    HostGroup hostGroup : hostGroups) {
      if (isComponentPresent(blueprintText,"String_Node_Str",hostGroup)) {
        String script=FileReaderUtils.readFileFromClasspath("String_Node_Str").replaceAll("String_Node_Str",cluster.getUserName());
        RecipeScript recipeScript=new RecipeScript(script,RecipeType.POST_CLUSTER_INSTALL);
        Recipe recipe=recipeBuilder.buildRecipes("String_Node_Str",Collections.singletonList(recipeScript)).get(0);
        hostGroup.addRecipe(recipe);
        break;
      }
    }
  }
 catch (  IOException e) {
    LOGGER.warn("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void addHDFSRecipe(Stack stack,Set<HostGroup> hostGroups){
  try {
    Cluster cluster=stack.getCluster();
    String blueprintText=cluster.getBlueprint().getBlueprintText();
    for (    HostGroup hostGroup : hostGroups) {
      if (isComponentPresent(blueprintText,"String_Node_Str",hostGroup)) {
        String script=FileReaderUtils.readFileFromClasspath("String_Node_Str").replaceAll("String_Node_Str",cluster.getUserName());
        RecipeScript recipeScript=new RecipeScript(script,POST_CLUSTER_INSTALL);
        Recipe recipe=recipeBuilder.buildRecipes("String_Node_Str",Collections.singletonList(recipeScript)).get(0);
        hostGroup.addRecipe(recipe);
        break;
      }
    }
  }
 catch (  IOException e) {
    LOGGER.warn("String_Node_Str",e);
  }
}
Program: 63841
Project: 63841
Buggy source:
public void executePostAmbariStartRecipes(Stack stack,Set<HostGroup> hostGroups) throws CloudbreakException {
  Orchestrator orchestrator=stack.getOrchestrator();
  if (shouldExecuteRecipeOnStack(stack,hostGroups,orchestrator)) {
    orchestratorRecipeExecutor.postAmbariStartRecipes(stack);
  }
}

Fixed version (ground truth):
public void executePostAmbariStartRecipes(Stack stack,Set<HostGroup> hostGroups) throws CloudbreakException {
  Orchestrator orchestrator=stack.getOrchestrator();
  if ((stack.getCluster() != null && stack.getCluster().getLdapConfig() != null) || recipesFound(hostGroups,POST_AMBARI_START) && recipesSupportedOnOrchestrator(orchestrator)) {
    orchestratorRecipeExecutor.postAmbariStartRecipes(stack);
  }
}
Program: 63842
Project: 63842
Buggy source:
private void addSmartSenseRecipe(Stack stack,Set<HostGroup> hostGroups){
  try {
    Cluster cluster=stack.getCluster();
    String blueprintText=cluster.getBlueprint().getBlueprintText();
    if (smartsenseConfigurationLocator.smartsenseConfigurable(smartSenseSubscriptionService.getDefault())) {
      for (      HostGroup hostGroup : hostGroups) {
        if (isComponentPresent(blueprintText,"String_Node_Str",hostGroup)) {
          String script=FileReaderUtils.readFileFromClasspath("String_Node_Str");
          RecipeScript recipeScript=new RecipeScript(script,RecipeType.POST_CLUSTER_INSTALL);
          Recipe recipe=recipeBuilder.buildRecipes("String_Node_Str",Collections.singletonList(recipeScript)).get(0);
          hostGroup.addRecipe(recipe);
          break;
        }
      }
    }
  }
 catch (  IOException e) {
    LOGGER.warn("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void addSmartSenseRecipe(Stack stack,Set<HostGroup> hostGroups){
  try {
    Cluster cluster=stack.getCluster();
    String blueprintText=cluster.getBlueprint().getBlueprintText();
    if (smartsenseConfigurationLocator.smartsenseConfigurable(smartSenseSubscriptionService.getDefault())) {
      for (      HostGroup hostGroup : hostGroups) {
        if (isComponentPresent(blueprintText,"String_Node_Str",hostGroup)) {
          String script=FileReaderUtils.readFileFromClasspath("String_Node_Str");
          RecipeScript recipeScript=new RecipeScript(script,POST_CLUSTER_INSTALL);
          Recipe recipe=recipeBuilder.buildRecipes("String_Node_Str",Collections.singletonList(recipeScript)).get(0);
          hostGroup.addRecipe(recipe);
          break;
        }
      }
    }
  }
 catch (  IOException e) {
    LOGGER.warn("String_Node_Str",e);
  }
}
Program: 63843
Project: 63843
Buggy source:
private boolean shouldExecuteRecipeOnStack(Stack stack,Set<HostGroup> hostGroups,Orchestrator orchestrator) throws CloudbreakException {
  return ((stack.getCluster() != null && stack.getCluster().getLdapConfig() != null) || recipesFound(hostGroups)) && recipesSupportedOnOrchestrator(orchestrator);
}

Fixed version (ground truth):
private boolean shouldExecuteRecipeOnStack(Set<HostGroup> hostGroups,Orchestrator orchestrator,RecipeType recipeType) throws CloudbreakException {
  return (recipesFound(hostGroups,recipeType)) && recipesSupportedOnOrchestrator(orchestrator);
}
Program: 63844
Project: 63844
Buggy source:
public boolean canProcessExecutionFailure(Exception e){
  return getNodesWithErrors(e).isPresent();
}

Fixed version (ground truth):
public boolean canProcessExecutionFailure(Exception e){
  return getNodesWithErrors(e).isPresent() && e.getMessage().contains("String_Node_Str");
}
Program: 63849
Project: 63849
Buggy source:
private String getRecipeExecutionFaiureMessage(Stack stack,CloudbreakOrchestratorFailedException e){
  if (!recipeExecutionFailureCollector.canProcessExecutionFailure(e)) {
    return e.getMessage();
  }
  Map<HostGroup,List<RecipeModel>> recipeMap=getHostgroupToRecipeMap(hostGroupService.getByCluster(stack.getCluster().getId()));
  Set<RecipeExecutionFailure> failures=recipeExecutionFailureCollector.collectErrors((CloudbreakOrchestratorException)e.getCause().getCause(),recipeMap,instanceGroupService.findByStackId(stack.getId()));
  StringBuilder messagePrefix=new StringBuilder("String_Node_Str");
  String message=failures.stream().map(failure -> new StringBuilder("String_Node_Str").append(failure.getRecipe().getName()).append("String_Node_Str").append("String_Node_Str").append(failure.getInstanceMetaData().getInstanceGroup().getGroupName()).append("String_Node_Str").append("String_Node_Str").append(failure.getInstanceMetaData().getDiscoveryFQDN()).toString()).collect(Collectors.joining("String_Node_Str"));
  return messagePrefix.append(message).toString();
}

Fixed version (ground truth):
private String getRecipeExecutionFaiureMessage(Stack stack,CloudbreakOrchestratorFailedException e){
  if (!recipeExecutionFailureCollector.canProcessExecutionFailure(e)) {
    return e.getMessage();
  }
  Map<HostGroup,List<RecipeModel>> recipeMap=getHostgroupToRecipeMap(hostGroupService.getByCluster(stack.getCluster().getId()));
  Set<RecipeExecutionFailure> failures=recipeExecutionFailureCollector.collectErrors((CloudbreakOrchestratorException)e.getCause().getCause(),recipeMap,instanceGroupService.findByStackId(stack.getId()));
  StringBuilder messagePrefix=new StringBuilder("String_Node_Str");
  String message=failures.stream().map(failure -> new StringBuilder("String_Node_Str").append(failure.getRecipe().getName()).append("String_Node_Str").append("String_Node_Str").append(failure.getInstanceMetaData().getInstanceGroup().getGroupName()).append("String_Node_Str").append("String_Node_Str").append(failure.getInstanceMetaData().getDiscoveryFQDN()).append(']').toString()).collect(Collectors.joining("String_Node_Str"));
  return messagePrefix.append(message).toString();
}
Program: 63851
Project: 63851
Buggy source:
public void executePostRecipesOnNewHosts(Long stackId,String hostGroupName) throws CloudbreakException {
  Stack stack=stackService.getByIdWithLists(stackId);
  LOGGER.info("String_Node_Str");
  recipeEngine.executePostInstall(stack);
}

Fixed version (ground truth):
public void executePostRecipesOnNewHosts(Long stackId) throws CloudbreakException {
  Stack stack=stackService.getByIdWithLists(stackId);
  LOGGER.info("String_Node_Str");
  recipeEngine.executePostInstallRecipes(stack,hostGroupService.getByCluster(stack.getCluster().getId()));
}
Program: 63852
Project: 63852
Buggy source:
@Override public void accept(Event<UpscalePostRecipesRequest> event){
  UpscalePostRecipesRequest request=event.getData();
  UpscalePostRecipesResult result;
  try {
    clusterUpscaleService.executePostRecipesOnNewHosts(request.getStackId(),request.getHostGroupName());
    result=new UpscalePostRecipesResult(request);
  }
 catch (  Exception e) {
    result=new UpscalePostRecipesResult(e.getMessage(),e,request);
  }
  eventBus.notify(result.selector(),new Event<>(event.getHeaders(),result));
}

Fixed version (ground truth):
@Override public void accept(Event<UpscalePostRecipesRequest> event){
  UpscalePostRecipesRequest request=event.getData();
  UpscalePostRecipesResult result;
  try {
    clusterUpscaleService.executePostRecipesOnNewHosts(request.getStackId());
    result=new UpscalePostRecipesResult(request);
  }
 catch (  Exception e) {
    result=new UpscalePostRecipesResult(e.getMessage(),e,request);
  }
  eventBus.notify(result.selector(),new Event<>(event.getHeaders(),result));
}
Program: 63854
Project: 63854
Buggy source:
private String getRecipeExecutionFaiureMessage(Stack stack,CloudbreakOrchestratorFailedException e){
  if (!recipeExecutionFailureCollector.canProcessExecutionFailure(e)) {
    return e.getMessage();
  }
  Map<HostGroup,List<RecipeModel>> recipeMap=getHostgroupToRecipeMap(hostGroupService.getByCluster(stack.getCluster().getId()));
  Set<RecipeExecutionFailure> failures=recipeExecutionFailureCollector.collectErrors((CloudbreakOrchestratorException)e.getCause().getCause(),recipeMap,instanceGroupService.findByStackId(stack.getId()));
  StringBuilder message=new StringBuilder("String_Node_Str");
  failures.forEach(failure -> message.append("String_Node_Str").append(failure.getRecipe().getName()).append("String_Node_Str").append("String_Node_Str").append(failure.getInstanceMetaData().getInstanceGroup().getGroupName()).append("String_Node_Str").append("String_Node_Str").append(failure.getInstanceMetaData().getDiscoveryFQDN()).append("String_Node_Str"));
  return message.toString();
}

Fixed version (ground truth):
private String getRecipeExecutionFaiureMessage(Stack stack,CloudbreakOrchestratorFailedException e){
  if (!recipeExecutionFailureCollector.canProcessExecutionFailure(e)) {
    return e.getMessage();
  }
  Map<HostGroup,List<RecipeModel>> recipeMap=getHostgroupToRecipeMap(hostGroupService.getByCluster(stack.getCluster().getId()));
  Set<RecipeExecutionFailure> failures=recipeExecutionFailureCollector.collectErrors((CloudbreakOrchestratorException)e.getCause().getCause(),recipeMap,instanceGroupService.findByStackId(stack.getId()));
  StringBuilder messagePrefix=new StringBuilder("String_Node_Str");
  String message=failures.stream().map(failure -> new StringBuilder("String_Node_Str").append(failure.getRecipe().getName()).append("String_Node_Str").append("String_Node_Str").append(failure.getInstanceMetaData().getInstanceGroup().getGroupName()).append("String_Node_Str").append("String_Node_Str").append(failure.getInstanceMetaData().getDiscoveryFQDN()).append(']').toString()).collect(Collectors.joining("String_Node_Str"));
  return messagePrefix.append(message).toString();
}
Program: 63855
Project: 63855
Buggy source:
public void executePreTerminationRecipes(Stack stack,Set<HostGroup> hostGroups,Set<String> hostNames) throws CloudbreakException {
  Orchestrator orchestrator=stack.getOrchestrator();
  if (recipesFound(hostGroups,RecipeType.PRE_TERMINATION) && recipesSupportedOnOrchestrator(orchestrator)) {
    orchestratorRecipeExecutor.preTerminationRecipes(stack,hostNames);
  }
}

Fixed version (ground truth):
public void executePreTerminationRecipes(Stack stack,Set<HostGroup> hostGroups,Set<String> hostNames) throws CloudbreakException {
  Orchestrator orchestrator=stack.getOrchestrator();
  if (shouldExecuteRecipeOnStack(hostGroups,orchestrator,PRE_TERMINATION)) {
    orchestratorRecipeExecutor.preTerminationRecipes(stack,hostNames);
  }
}
Program: 63856
Project: 63856
Buggy source:
public void executePreAmbariStartRecipes(Stack stack,Set<HostGroup> hostGroups) throws CloudbreakException {
  Orchestrator orchestrator=stack.getOrchestrator();
  if (shouldExecuteRecipeOnStack(stack,hostGroups,orchestrator)) {
    orchestratorRecipeExecutor.preAmbariStartRecipes(stack);
  }
}

Fixed version (ground truth):
public void executePreAmbariStartRecipes(Stack stack,Set<HostGroup> hostGroups) throws CloudbreakException {
  Orchestrator orchestrator=stack.getOrchestrator();
  if (shouldExecuteRecipeOnStack(hostGroups,orchestrator,PRE_AMBARI_START)) {
    orchestratorRecipeExecutor.preAmbariStartRecipes(stack);
  }
}
Program: 63857
Project: 63857
Buggy source:
private void addContainerExecutorScripts(Stack stack,Set<HostGroup> hostGroups){
  try {
    Cluster cluster=stack.getCluster();
    if (cluster != null && ExecutorType.CONTAINER.equals(cluster.getExecutorType())) {
      for (      HostGroup hostGroup : hostGroups) {
        String script=FileReaderUtils.readFileFromClasspath("String_Node_Str");
        RecipeScript recipeScript=new RecipeScript(script,RecipeType.POST_CLUSTER_INSTALL);
        Recipe recipe=recipeBuilder.buildRecipes("String_Node_Str",Collections.singletonList(recipeScript)).get(0);
        hostGroup.addRecipe(recipe);
      }
    }
  }
 catch (  IOException e) {
    LOGGER.warn("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void addContainerExecutorScripts(Stack stack,Set<HostGroup> hostGroups){
  try {
    Cluster cluster=stack.getCluster();
    if (cluster != null && ExecutorType.CONTAINER.equals(cluster.getExecutorType())) {
      for (      HostGroup hostGroup : hostGroups) {
        String script=FileReaderUtils.readFileFromClasspath("String_Node_Str");
        RecipeScript recipeScript=new RecipeScript(script,POST_CLUSTER_INSTALL);
        Recipe recipe=recipeBuilder.buildRecipes("String_Node_Str",Collections.singletonList(recipeScript)).get(0);
        hostGroup.addRecipe(recipe);
      }
    }
  }
 catch (  IOException e) {
    LOGGER.warn("String_Node_Str",e);
  }
}
Program: 63858
Project: 63858
Buggy source:
private void addHDFSRecipe(Cluster cluster,String blueprintText,Set<HostGroup> hostGroups){
  try {
    for (    HostGroup hostGroup : hostGroups) {
      if (isComponentPresent(blueprintText,"String_Node_Str",hostGroup)) {
        String script=FileReaderUtils.readFileFromClasspath("String_Node_Str").replaceAll("String_Node_Str",cluster.getUserName());
        RecipeScript recipeScript=new RecipeScript(script,RecipeType.POST_CLUSTER_INSTALL);
        Recipe recipe=recipeBuilder.buildRecipes("String_Node_Str",Collections.singletonList(recipeScript)).get(0);
        hostGroup.addRecipe(recipe);
        break;
      }
    }
  }
 catch (  IOException e) {
    LOGGER.warn("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void addHDFSRecipe(Cluster cluster,String blueprintText,Set<HostGroup> hostGroups){
  try {
    for (    HostGroup hostGroup : hostGroups) {
      if (isComponentPresent(blueprintText,"String_Node_Str",hostGroup)) {
        String script=FileReaderUtils.readFileFromClasspath("String_Node_Str").replaceAll("String_Node_Str",cluster.getUserName());
        RecipeScript recipeScript=new RecipeScript(script,POST_CLUSTER_INSTALL);
        Recipe recipe=recipeBuilder.buildRecipes("String_Node_Str",Collections.singletonList(recipeScript)).get(0);
        hostGroup.addRecipe(recipe);
        break;
      }
    }
  }
 catch (  IOException e) {
    LOGGER.warn("String_Node_Str",e);
  }
}
Program: 63859
Project: 63859
Buggy source:
public void executePostAmbariStartRecipes(Stack stack,Set<HostGroup> hostGroups) throws CloudbreakException {
  Orchestrator orchestrator=stack.getOrchestrator();
  if (shouldExecuteRecipeOnStack(stack,hostGroups,orchestrator)) {
    orchestratorRecipeExecutor.postAmbariStartRecipes(stack);
  }
}

Fixed version (ground truth):
public void executePostAmbariStartRecipes(Stack stack,Set<HostGroup> hostGroups) throws CloudbreakException {
  Orchestrator orchestrator=stack.getOrchestrator();
  if ((stack.getCluster() != null && stack.getCluster().getLdapConfig() != null) || recipesFound(hostGroups,POST_AMBARI_START) && recipesSupportedOnOrchestrator(orchestrator)) {
    orchestratorRecipeExecutor.postAmbariStartRecipes(stack);
  }
}
Program: 63860
Project: 63860
Buggy source:
private void addSmartSenseRecipe(Stack stack,Set<HostGroup> hostGroups){
  try {
    Cluster cluster=stack.getCluster();
    String blueprintText=cluster.getBlueprint().getBlueprintText();
    if (smartSenseConfigProvider.smartSenseIsConfigurable(blueprintText)) {
      for (      HostGroup hostGroup : hostGroups) {
        if (isComponentPresent(blueprintText,"String_Node_Str",hostGroup)) {
          String script=FileReaderUtils.readFileFromClasspath("String_Node_Str");
          RecipeScript recipeScript=new RecipeScript(script,RecipeType.POST_CLUSTER_INSTALL);
          Recipe recipe=recipeBuilder.buildRecipes("String_Node_Str",Collections.singletonList(recipeScript)).get(0);
          hostGroup.addRecipe(recipe);
          break;
        }
      }
    }
  }
 catch (  IOException e) {
    LOGGER.warn("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void addSmartSenseRecipe(Stack stack,Set<HostGroup> hostGroups){
  try {
    Cluster cluster=stack.getCluster();
    String blueprintText=cluster.getBlueprint().getBlueprintText();
    if (smartSenseConfigProvider.smartSenseIsConfigurable(blueprintText)) {
      for (      HostGroup hostGroup : hostGroups) {
        if (isComponentPresent(blueprintText,"String_Node_Str",hostGroup)) {
          String script=FileReaderUtils.readFileFromClasspath("String_Node_Str");
          RecipeScript recipeScript=new RecipeScript(script,POST_CLUSTER_INSTALL);
          Recipe recipe=recipeBuilder.buildRecipes("String_Node_Str",Collections.singletonList(recipeScript)).get(0);
          hostGroup.addRecipe(recipe);
          break;
        }
      }
    }
  }
 catch (  IOException e) {
    LOGGER.warn("String_Node_Str",e);
  }
}
Program: 63861
Project: 63861
Buggy source:
private boolean shouldExecuteRecipeOnStack(Stack stack,Set<HostGroup> hostGroups,Orchestrator orchestrator) throws CloudbreakException {
  return ((stack.getCluster() != null && stack.getCluster().getLdapConfig() != null) || recipesFound(hostGroups)) && recipesSupportedOnOrchestrator(orchestrator);
}

Fixed version (ground truth):
private boolean shouldExecuteRecipeOnStack(Set<HostGroup> hostGroups,Orchestrator orchestrator,RecipeType recipeType) throws CloudbreakException {
  return (recipesFound(hostGroups,recipeType)) && recipesSupportedOnOrchestrator(orchestrator);
}
Program: 63862
Project: 63862
Buggy source:
public boolean canProcessExecutionFailure(Exception e){
  if (e.getCause() != null && e.getCause() instanceof CloudbreakOrchestratorException) {
    return !((CloudbreakOrchestratorException)e.getCause()).getNodesWithErrors().isEmpty();
  }
 else   if (e.getCause() != null && e.getCause().getCause() != null && e.getCause().getCause() instanceof CloudbreakOrchestratorException) {
    return !((CloudbreakOrchestratorException)e.getCause().getCause()).getNodesWithErrors().isEmpty();
  }
  return false;
}

Fixed version (ground truth):
public boolean canProcessExecutionFailure(Exception e){
  return getNodesWithErrors(e).isPresent() && e.getMessage().contains("String_Node_Str");
}
Program: 63865
Project: 63865
Buggy source:
@Override public boolean isValid(RDSConfigRequest request,ConstraintValidatorContext context){
  boolean supportedScenario=false;
  Optional<DatabaseVendor> vendorByJdbcUrl=DatabaseVendor.getVendorByJdbcUrl(request);
  Optional<SupportedExternalDatabaseServiceEntry> serviceEntry=SupportedDatabaseProvider.supportedExternalDatabases().stream().filter(item -> item.getName().equals(request.getType()) || item.getDisplayName().equals(request.getType())).findFirst();
  if (serviceEntry.isPresent() && vendorByJdbcUrl.isPresent()) {
    Optional<SupportedDatabaseEntry> databaseEntry=serviceEntry.get().getDatabases().stream().filter(item -> item.getDatabaseName().equals(vendorByJdbcUrl.get().name())).findFirst();
    if (databaseEntry.isPresent()) {
      supportedScenario=true;
    }
 else {
      String message=String.format("String_Node_Str" + "String_Node_Str",serviceEntry.get().getDatabases().stream().map(SupportedDatabaseEntry::getDatabaseName).collect(Collectors.toList()).stream().collect(Collectors.joining("String_Node_Str")),request.getType());
      ValidatorUtil.addConstraintViolation(context,message,"String_Node_Str");
    }
  }
  return supportedScenario;
}

Fixed version (ground truth):
@Override public boolean isValid(RDSConfigRequest request,ConstraintValidatorContext context){
  boolean supportedScenario=false;
  Optional<DatabaseVendor> vendorByJdbcUrl=DatabaseVendor.getVendorByJdbcUrl(request);
  Optional<SupportedExternalDatabaseServiceEntry> serviceEntry=SupportedDatabaseProvider.supportedExternalDatabases().stream().filter(item -> item.getName().toLowerCase().equals(request.getType().toLowerCase()) || item.getDisplayName().toLowerCase().equals(request.getType().toLowerCase())).findFirst();
  if (!serviceEntry.isPresent()) {
    serviceEntry=SupportedDatabaseProvider.getOthers();
  }
  if (serviceEntry.isPresent() && vendorByJdbcUrl.isPresent()) {
    Optional<SupportedDatabaseEntry> databaseEntry=serviceEntry.get().getDatabases().stream().filter(item -> item.getDatabaseName().equals(vendorByJdbcUrl.get().name())).findFirst();
    if (databaseEntry.isPresent()) {
      supportedScenario=true;
    }
 else {
      String message=String.format("String_Node_Str" + "String_Node_Str",serviceEntry.get().getDatabases().stream().map(SupportedDatabaseEntry::getDatabaseName).collect(Collectors.toList()).stream().collect(Collectors.joining("String_Node_Str")),request.getType());
      ValidatorUtil.addConstraintViolation(context,message,"String_Node_Str");
    }
  }
  return supportedScenario;
}
Program: 63867
Project: 63867
Buggy source:
@Query("String_Node_Str") HostGroup findHostGroupsByInstanceGroupName(@Param("String_Node_Str") Long clusterId,@Param("String_Node_Str") String instanceGroupName);

Fixed version (ground truth):
@EntityGraph(value="String_Node_Str",type=EntityGraph.EntityGraphType.LOAD) @Query("String_Node_Str") HostGroup findHostGroupsByInstanceGroupName(@Param("String_Node_Str") Long clusterId,@Param("String_Node_Str") String instanceGroupName);
Program: 63868
Project: 63868
Buggy source:
@Query("String_Node_Str") Set<HostGroup> findHostGroupsInCluster(@Param("String_Node_Str") Long clusterId);

Fixed version (ground truth):
@EntityGraph(value="String_Node_Str",type=EntityGraph.EntityGraphType.LOAD) @Query("String_Node_Str") Set<HostGroup> findHostGroupsInCluster(@Param("String_Node_Str") Long clusterId);
Program: 63869
Project: 63869
Buggy source:
@Query("String_Node_Str") HostGroup findHostGroupInClusterByName(@Param("String_Node_Str") Long clusterId,@Param("String_Node_Str") String hostGroupName);

Fixed version (ground truth):
@EntityGraph(value="String_Node_Str",type=EntityGraph.EntityGraphType.LOAD) @Query("String_Node_Str") HostGroup findHostGroupInClusterByName(@Param("String_Node_Str") Long clusterId,@Param("String_Node_Str") String hostGroupName);
Program: 63870
Project: 63870
Buggy source:
@Query("String_Node_Str") Set<HostGroup> findAllHostGroupsByRecipe(@Param("String_Node_Str") Long recipeId);

Fixed version (ground truth):
@EntityGraph(value="String_Node_Str",type=EntityGraph.EntityGraphType.LOAD) @Query("String_Node_Str") Set<HostGroup> findAllHostGroupsByRecipe(@Param("String_Node_Str") Long recipeId);
Program: 63871
Project: 63871
Buggy source:
@Override public void updateStatus(Long stackId,StatusRequest statusRequest){
  Stack stack=stackService.getByIdWithLists(stackId);
  Cluster cluster=stack.getCluster();
  if (cluster == null) {
    throw new BadRequestException(String.format("String_Node_Str",stack.getName()));
  }
switch (statusRequest) {
case SYNC:
    sync(stack);
  break;
case STOPPED:
stop(stack,cluster);
break;
case STARTED:
start(stack,cluster);
break;
default :
throw new BadRequestException("String_Node_Str");
}
}

Fixed version (ground truth):
@Override public void updateStatus(Stack stack,StatusRequest statusRequest){
  Cluster cluster=stack.getCluster();
  if (cluster == null) {
    throw new BadRequestException(String.format("String_Node_Str",stack.getName()));
  }
switch (statusRequest) {
case SYNC:
    sync(stack);
  break;
case STOPPED:
stop(stack,cluster);
break;
case STARTED:
start(stack,cluster);
break;
default :
throw new BadRequestException("String_Node_Str");
}
}
Program: 63872
Project: 63872
Buggy source:
void updateStatus(Long stackId,StatusRequest statusRequest);

Fixed version (ground truth):
void updateStatus(Stack stack,StatusRequest statusRequest);
Program: 63873
Project: 63873
Buggy source:
private void start(Stack stack,Cluster cluster,boolean updateCluster){
  if (stack.isAvailable()) {
    String statusDesc=cloudbreakMessagesService.getMessage(Msg.STACK_START_IGNORED.code());
    LOGGER.info(statusDesc);
    eventService.fireCloudbreakEvent(stack.getId(),AVAILABLE.name(),statusDesc);
  }
 else   if ((!stack.isStopped() || (cluster != null && !cluster.isStopped())) && !stack.isStartFailed()) {
    throw new BadRequestException(String.format("String_Node_Str",stack.getName()));
  }
 else   if (stack.isStopped() || stack.isStartFailed()) {
    stackUpdater.updateStackStatus(stack.getId(),DetailedStackStatus.START_REQUESTED);
    flowManager.triggerStackStart(stack.getId());
    if (updateCluster && cluster != null) {
      ambariClusterService.updateStatus(stack.getId(),StatusRequest.STARTED);
    }
  }
}

Fixed version (ground truth):
private void start(Stack stack,Cluster cluster,boolean updateCluster){
  if (stack.isAvailable()) {
    String statusDesc=cloudbreakMessagesService.getMessage(Msg.STACK_START_IGNORED.code());
    LOGGER.info(statusDesc);
    eventService.fireCloudbreakEvent(stack.getId(),AVAILABLE.name(),statusDesc);
  }
 else   if ((!stack.isStopped() || (cluster != null && !cluster.isStopped())) && !stack.isStartFailed()) {
    throw new BadRequestException(String.format("String_Node_Str",stack.getName()));
  }
 else   if (stack.isStopped() || stack.isStartFailed()) {
    Stack startStack=stackUpdater.updateStackStatus(stack.getId(),DetailedStackStatus.START_REQUESTED);
    flowManager.triggerStackStart(stack.getId());
    if (updateCluster && cluster != null) {
      ambariClusterService.updateStatus(startStack,StatusRequest.STARTED);
    }
  }
}
Program: 63874
Project: 63874
Buggy source:
@Query("String_Node_Str") HostGroup findHostGroupsByInstanceGroupName(@Param("String_Node_Str") Long clusterId,@Param("String_Node_Str") String instanceGroupName);

Fixed version (ground truth):
@EntityGraph(value="String_Node_Str",type=EntityGraph.EntityGraphType.LOAD) @Query("String_Node_Str") HostGroup findHostGroupsByInstanceGroupName(@Param("String_Node_Str") Long clusterId,@Param("String_Node_Str") String instanceGroupName);
Program: 63875
Project: 63875
Buggy source:
@Query("String_Node_Str") Set<HostGroup> findHostGroupsInCluster(@Param("String_Node_Str") Long clusterId);

Fixed version (ground truth):
@EntityGraph(value="String_Node_Str",type=EntityGraph.EntityGraphType.LOAD) @Query("String_Node_Str") Set<HostGroup> findHostGroupsInCluster(@Param("String_Node_Str") Long clusterId);
Program: 63876
Project: 63876
Buggy source:
@Query("String_Node_Str") HostGroup findHostGroupInClusterByName(@Param("String_Node_Str") Long clusterId,@Param("String_Node_Str") String hostGroupName);

Fixed version (ground truth):
@EntityGraph(value="String_Node_Str",type=EntityGraph.EntityGraphType.LOAD) @Query("String_Node_Str") HostGroup findHostGroupInClusterByName(@Param("String_Node_Str") Long clusterId,@Param("String_Node_Str") String hostGroupName);
Program: 63877
Project: 63877
Buggy source:
@Query("String_Node_Str") Set<HostGroup> findAllHostGroupsByRecipe(@Param("String_Node_Str") Long recipeId);

Fixed version (ground truth):
@EntityGraph(value="String_Node_Str",type=EntityGraph.EntityGraphType.LOAD) @Query("String_Node_Str") Set<HostGroup> findAllHostGroupsByRecipe(@Param("String_Node_Str") Long recipeId);