Program: 171261
Project: 171261
Buggy source:
private String getSVGWithHandledPattern(String s,String pattern){
  if (!s.contains("String_Node_Str")) {
    return s;
  }
  if (!this.isPatternAvailable) {
    this.isPatternAvailable=true;
  }
  if (pattern == null || pattern == "String_Node_Str") {
    return s;
  }
  String returnable;
  int patternLayerStartIndex=s.indexOf("String_Node_Str");
  int patternLayerEndIndex=s.indexOf("String_Node_Str",patternLayerStartIndex);
  String newClipMask="String_Node_Str";
  int firstShapeStartIndex=s.indexOf("String_Node_Str",patternLayerStartIndex);
  int lastShapeEndIndex=firstShapeStartIndex;
  boolean continueSetUp=true;
  while (continueSetUp) {
    int currentShapeStartIndex=s.indexOf("String_Node_Str",lastShapeEndIndex);
    int currentShapeEndIndex=s.indexOf("String_Node_Str",currentShapeStartIndex);
    if (currentShapeEndIndex > patternLayerEndIndex || currentShapeEndIndex == -1 || currentShapeStartIndex == -1) {
      continueSetUp=false;
    }
 else {
      newClipMask=newClipMask + s.substring(currentShapeStartIndex,currentShapeEndIndex) + "String_Node_Str";
      lastShapeEndIndex=currentShapeEndIndex;
    }
  }
  newClipMask=newClipMask + "String_Node_Str";
  returnable=s.substring(0,s.indexOf("String_Node_Str")) + "String_Node_Str" + newClipMask;
  String loadedPattern;
  try {
    File patternFile=new File(System.getProperty("String_Node_Str") + "String_Node_Str" + pattern.toLowerCase()+ "String_Node_Str");
    List<String> lines=Files.readAllLines(patternFile.toPath());
    StringBuilder sb=new StringBuilder();
    for (    String line : lines) {
      sb.append(line);
    }
    loadedPattern=sb.toString();
  }
 catch (  IOException e) {
    e.printStackTrace();
    return s;
  }
  String newPattern="String_Node_Str";
  int firstPatternShapeStartIndex=loadedPattern.indexOf("String_Node_Str");
  int firstRectStartIndex=loadedPattern.indexOf("String_Node_Str");
  if ((firstRectStartIndex != -1 && firstRectStartIndex < firstPatternShapeStartIndex) || firstPatternShapeStartIndex == -1) {
    firstPatternShapeStartIndex=firstRectStartIndex;
  }
  int lastPatternShapeEndIndex=firstPatternShapeStartIndex;
  boolean continuePatternSetUp=true;
  while (continuePatternSetUp) {
    int currentShapeStartIndex=loadedPattern.indexOf("String_Node_Str",lastPatternShapeEndIndex);
    int currentRectStartIndex=loadedPattern.indexOf("String_Node_Str",lastPatternShapeEndIndex);
    if ((currentRectStartIndex != -1 && currentRectStartIndex < currentShapeStartIndex) || currentShapeStartIndex == -1) {
      currentShapeStartIndex=currentRectStartIndex;
    }
    int currentShapeEndIndex=loadedPattern.indexOf("String_Node_Str",currentShapeStartIndex);
    if (currentShapeEndIndex == -1 || currentShapeStartIndex == -1) {
      continuePatternSetUp=false;
    }
 else {
      newPattern=newPattern + loadedPattern.substring(currentShapeStartIndex,currentShapeEndIndex) + "String_Node_Str"+ "String_Node_Str";
      lastPatternShapeEndIndex=currentShapeEndIndex;
    }
  }
  returnable=returnable + s.substring(s.indexOf("String_Node_Str"),firstShapeStartIndex) + newPattern+ s.substring(patternLayerEndIndex);
  return returnable;
}

Fixed version (ground truth):
private String getSVGWithHandledPattern(String s,String pattern){
  if (!s.contains("String_Node_Str")) {
    return s;
  }
  if (!this.isPatternAvailable) {
    this.isPatternAvailable=true;
  }
  if (pattern == null || pattern.equals("String_Node_Str")) {
    return s;
  }
  String returnable;
  int patternLayerStartIndex=s.indexOf("String_Node_Str");
  int patternLayerEndIndex=s.indexOf("String_Node_Str",patternLayerStartIndex);
  String newClipMask="String_Node_Str";
  int firstShapeStartIndex=s.indexOf("String_Node_Str",patternLayerStartIndex);
  int lastShapeEndIndex=firstShapeStartIndex;
  boolean continueSetUp=true;
  while (continueSetUp) {
    int currentShapeStartIndex=s.indexOf("String_Node_Str",lastShapeEndIndex);
    int currentShapeEndIndex=s.indexOf("String_Node_Str",currentShapeStartIndex);
    if (currentShapeEndIndex > patternLayerEndIndex || currentShapeEndIndex == -1 || currentShapeStartIndex == -1) {
      continueSetUp=false;
    }
 else {
      newClipMask=newClipMask + s.substring(currentShapeStartIndex,currentShapeEndIndex) + "String_Node_Str";
      lastShapeEndIndex=currentShapeEndIndex;
    }
  }
  newClipMask=newClipMask + "String_Node_Str";
  returnable=s.substring(0,s.indexOf("String_Node_Str")) + "String_Node_Str" + newClipMask;
  String loadedPattern;
  try {
    File patternFile=new File(System.getProperty("String_Node_Str") + "String_Node_Str" + pattern.toLowerCase()+ "String_Node_Str");
    List<String> lines=Files.readAllLines(patternFile.toPath());
    StringBuilder sb=new StringBuilder();
    for (    String line : lines) {
      sb.append(line);
    }
    loadedPattern=sb.toString();
  }
 catch (  IOException e) {
    e.printStackTrace();
    return s;
  }
  String newPattern="String_Node_Str";
  int firstPatternShapeStartIndex=loadedPattern.indexOf("String_Node_Str");
  int firstRectStartIndex=loadedPattern.indexOf("String_Node_Str");
  if ((firstRectStartIndex != -1 && firstRectStartIndex < firstPatternShapeStartIndex) || firstPatternShapeStartIndex == -1) {
    firstPatternShapeStartIndex=firstRectStartIndex;
  }
  int lastPatternShapeEndIndex=firstPatternShapeStartIndex;
  boolean continuePatternSetUp=true;
  while (continuePatternSetUp) {
    int currentShapeStartIndex=loadedPattern.indexOf("String_Node_Str",lastPatternShapeEndIndex);
    int currentRectStartIndex=loadedPattern.indexOf("String_Node_Str",lastPatternShapeEndIndex);
    if ((currentRectStartIndex != -1 && currentRectStartIndex < currentShapeStartIndex) || currentShapeStartIndex == -1) {
      currentShapeStartIndex=currentRectStartIndex;
    }
    int currentShapeEndIndex=loadedPattern.indexOf("String_Node_Str",currentShapeStartIndex);
    if (currentShapeEndIndex == -1 || currentShapeStartIndex == -1) {
      continuePatternSetUp=false;
    }
 else {
      newPattern=newPattern + loadedPattern.substring(currentShapeStartIndex,currentShapeEndIndex) + "String_Node_Str"+ "String_Node_Str";
      lastPatternShapeEndIndex=currentShapeEndIndex;
    }
  }
  returnable=returnable + s.substring(s.indexOf("String_Node_Str"),firstShapeStartIndex) + newPattern+ s.substring(patternLayerEndIndex);
  return returnable;
}