Program: 149384
Project: 149384
Buggy source:
private List<JSONObject> createBoxStack(String scope,String boxId){
  JSONObject box=findBox(boxId);
  if (box == null) {
    return Collections.EMPTY_LIST;
  }
  List<JSONObject> boxStack=new ArrayList<JSONObject>();
  JSONObject stackBox=new JSONObject();
  String icon=null;
  if (box.containsKey("String_Node_Str")) {
    icon=box.getString("String_Node_Str");
  }
  if (icon == null || icon.isEmpty()) {
    icon="String_Node_Str";
  }
 else   if (icon.charAt(0) != '/') {
    icon='/' + icon;
  }
  stackBox.put("String_Node_Str",box.getString("String_Node_Str"));
  stackBox.put("String_Node_Str",box.getString("String_Node_Str"));
  stackBox.put("String_Node_Str",client.getEndpointUrl() + icon);
  boxStack.add(stackBox);
  JSONArray stackBoxVariables=new JSONArray();
  JSONArray variables=box.getJSONArray("String_Node_Str");
  List<JSONObject> boxVariables=new ArrayList<JSONObject>();
  for (  Object json : variables) {
    JSONObject variable=(JSONObject)json;
    String varScope=(String)variable.get("String_Node_Str");
    if (varScope != null && !varScope.isEmpty()) {
      String fullScope=scope.isEmpty() ? varScope : scope + '.' + varScope;
      if (findOverriddenVariable(variable.getString("String_Node_Str"),scope) == null) {
        JSONObject overriddenVariable=JSONObject.fromObject(variable);
        overriddenVariable.put("String_Node_Str",fullScope);
        overriddenVariables.add(variable);
      }
    }
 else     if (variable.getString("String_Node_Str").equals("String_Node_Str")) {
      boxVariables.add(variable);
    }
 else {
      JSONObject stackBoxVariable=JSONObject.fromObject(variable);
      stackBoxVariable.put("String_Node_Str",scope);
      JSONObject overriddenVariable=findOverriddenVariable(stackBoxVariable.getString("String_Node_Str"),scope);
      if (overriddenVariable != null) {
        stackBoxVariable.put("String_Node_Str",overriddenVariable.get("String_Node_Str"));
      }
      stackBoxVariables.add(stackBoxVariable);
    }
  }
  stackBox.put("String_Node_Str",stackBoxVariables);
  for (  JSONObject boxVariable : boxVariables) {
    String variableName=boxVariable.getString("String_Node_Str");
    boxStack.addAll(createBoxStack(scope.isEmpty() ? variableName : scope + '.' + variableName,boxVariable.getString("String_Node_Str")));
  }
  return boxStack;
}

Fixed version (ground truth):
private List<JSONObject> createBoxStack(String scope,String boxId){
  JSONObject box=findBox(boxId);
  if (box == null) {
    return Collections.EMPTY_LIST;
  }
  List<JSONObject> boxStack=new ArrayList<JSONObject>();
  JSONObject stackBox=new JSONObject();
  String icon=null;
  if (box.containsKey("String_Node_Str")) {
    icon=box.getString("String_Node_Str");
  }
  if (icon == null || icon.isEmpty()) {
    icon="String_Node_Str";
  }
 else   if (icon.charAt(0) != '/') {
    icon='/' + icon;
  }
  stackBox.put("String_Node_Str",box.getString("String_Node_Str"));
  stackBox.put("String_Node_Str",box.getString("String_Node_Str"));
  stackBox.put("String_Node_Str",client.getEndpointUrl() + icon);
  boxStack.add(stackBox);
  JSONArray stackBoxVariables=new JSONArray();
  JSONArray variables=box.getJSONArray("String_Node_Str");
  List<JSONObject> boxVariables=new ArrayList<JSONObject>();
  for (  Object json : variables) {
    JSONObject variable=(JSONObject)json;
    String varScope=(String)variable.get("String_Node_Str");
    if (varScope != null && !varScope.isEmpty()) {
      String fullScope=scope.isEmpty() ? varScope : scope + '.' + varScope;
      if (findOverriddenVariable(variable.getString("String_Node_Str"),scope) == null) {
        JSONObject overriddenVariable=JSONObject.fromObject(variable);
        overriddenVariable.put("String_Node_Str",fullScope);
        overriddenVariables.add(overriddenVariable);
      }
    }
 else     if (variable.getString("String_Node_Str").equals("String_Node_Str")) {
      boxVariables.add(variable);
    }
 else {
      JSONObject stackBoxVariable=JSONObject.fromObject(variable);
      stackBoxVariable.put("String_Node_Str",scope);
      JSONObject overriddenVariable=findOverriddenVariable(stackBoxVariable.getString("String_Node_Str"),scope);
      if (overriddenVariable != null) {
        stackBoxVariable.put("String_Node_Str",overriddenVariable.get("String_Node_Str"));
      }
      stackBoxVariables.add(stackBoxVariable);
    }
  }
  stackBox.put("String_Node_Str",stackBoxVariables);
  for (  JSONObject boxVariable : boxVariables) {
    String variableName=boxVariable.getString("String_Node_Str");
    boxStack.addAll(createBoxStack(scope.isEmpty() ? variableName : scope + '.' + variableName,boxVariable.getString("String_Node_Str")));
  }
  return boxStack;
}