Program: 28580
Project: 28580
Buggy source:
private JsonElement findAndReplaceValues(JsonElement jsonDataValue,ParserContext parserContext,LayoutHandler handler,String attributeName,ProteusView proteusView,JsonObject viewJsonObject,int childIndex){
  boolean failed=false;
  String attributeValue=jsonDataValue.getAsString();
  DataProteusView dataProteusView=(DataProteusView)proteusView;
  if (attributeValue != null && !"String_Node_Str".equals(attributeValue) && (attributeValue.charAt(0) == ProteusConstants.DATA_PREFIX || attributeValue.charAt(0) == ProteusConstants.REGEX_PREFIX)) {
    if (attributeValue.charAt(0) == ProteusConstants.REGEX_PREFIX) {
      Matcher regexMatcher=ProteusConstants.REGEX_PATTERN.matcher(attributeValue);
      String finalValue=attributeValue;
      while (regexMatcher.find()) {
        String matchedString=regexMatcher.group(0);
        String bindingName;
        if (regexMatcher.group(3) != null) {
          String dataPath=regexMatcher.group(3);
          try {
            finalValue=finalValue.replace(matchedString,Utils.getElementFromData(dataPath,parserContext.getDataContext().getDataProvider(),parserContext.getDataContext().getIndex()).getAsString());
          }
 catch (          JsonNullException|NoSuchDataPathException|InvalidDataPathException e) {
            Log.e(TAG + "String_Node_Str",e.getMessage());
            finalValue=dataPath;
            failed=true;
          }
          bindingName=dataPath;
        }
 else {
          String dataPath=regexMatcher.group(1);
          String formatterName=regexMatcher.group(2);
          String formattedValue;
          try {
            formattedValue=format(Utils.getElementFromData(dataPath,parserContext.getDataContext().getDataProvider(),parserContext.getDataContext().getIndex()),formatterName);
          }
 catch (          JsonNullException|NoSuchDataPathException|InvalidDataPathException e) {
            Log.e(TAG + "String_Node_Str",e.getMessage());
            formattedValue=dataPath;
            failed=true;
          }
          finalValue=finalValue.replace(matchedString,formattedValue);
          bindingName=dataPath;
        }
        addBinding(dataProteusView,bindingName,attributeName,attributeValue,handler,true);
      }
      finalValue=finalValue.substring(1);
      jsonDataValue=new JsonPrimitive(finalValue);
    }
 else     if (attributeValue.charAt(0) == ProteusConstants.DATA_PREFIX) {
      JsonElement elementFromData;
      try {
        elementFromData=Utils.getElementFromData(attributeValue.substring(1),parserContext.getDataContext().getDataProvider(),childIndex);
      }
 catch (      JsonNullException|NoSuchDataPathException|InvalidDataPathException e) {
        Log.e(TAG + "String_Node_Str",e.getMessage());
        failed=true;
        elementFromData=new JsonPrimitive(ProteusConstants.DATA_NULL);
      }
      if (elementFromData != null) {
        jsonDataValue=elementFromData;
      }
      addBinding(dataProteusView,attributeValue.substring(1),attributeName,attributeValue,handler,false);
    }
  }
  if (dataProteusView.getView() != null) {
    if (failed) {
      if (viewJsonObject != null && !viewJsonObject.isJsonNull() && viewJsonObject.get(Attributes.View.Visibility.getName()) != null) {
        String visibility=viewJsonObject.get(Attributes.View.Visibility.getName()).getAsString();
        if (ProteusConstants.DATA_VISIBILITY.equals(visibility)) {
          dataProteusView.getView().setVisibility(View.INVISIBLE);
        }
      }
 else {
        dataProteusView.getView().setVisibility(View.GONE);
      }
    }
 else     if (dataProteusView.isViewUpdating()) {
      dataProteusView.getView().setVisibility(View.VISIBLE);
    }
  }
  return jsonDataValue;
}

Fixed version (ground truth):
private JsonElement findAndReplaceValues(JsonElement jsonDataValue,ParserContext parserContext,LayoutHandler handler,String attributeName,ProteusView proteusView,JsonObject viewJsonObject,int childIndex){
  boolean failed=false;
  String attributeValue=jsonDataValue.getAsString();
  DataProteusView dataProteusView=(DataProteusView)proteusView;
  if (attributeValue != null && !"String_Node_Str".equals(attributeValue) && (attributeValue.charAt(0) == ProteusConstants.DATA_PREFIX || attributeValue.charAt(0) == ProteusConstants.REGEX_PREFIX)) {
    if (attributeValue.charAt(0) == ProteusConstants.REGEX_PREFIX) {
      Matcher regexMatcher=ProteusConstants.REGEX_PATTERN.matcher(attributeValue);
      String finalValue=attributeValue;
      while (regexMatcher.find()) {
        String matchedString=regexMatcher.group(0);
        String bindingName;
        if (regexMatcher.group(3) != null) {
          String dataPath=regexMatcher.group(3);
          try {
            finalValue=finalValue.replace(matchedString,Utils.getElementFromData(dataPath,parserContext.getDataContext().getDataProvider(),parserContext.getDataContext().getIndex()).getAsString());
          }
 catch (          JsonNullException|NoSuchDataPathException|InvalidDataPathException e) {
            Log.e(TAG + "String_Node_Str",e.getMessage());
            finalValue=dataPath;
            failed=true;
          }
          bindingName=dataPath;
        }
 else {
          String dataPath=regexMatcher.group(1);
          String formatterName=regexMatcher.group(2);
          String formattedValue;
          try {
            formattedValue=format(Utils.getElementFromData(dataPath,parserContext.getDataContext().getDataProvider(),parserContext.getDataContext().getIndex()),formatterName);
          }
 catch (          JsonNullException|NoSuchDataPathException|InvalidDataPathException e) {
            Log.e(TAG + "String_Node_Str",e.getMessage());
            formattedValue=dataPath;
            failed=true;
          }
          finalValue=finalValue.replace(matchedString,formattedValue);
          bindingName=dataPath;
        }
        addBinding(dataProteusView,bindingName,attributeName,attributeValue,handler,true);
      }
      finalValue=finalValue.substring(1);
      jsonDataValue=new JsonPrimitive(finalValue);
    }
 else     if (attributeValue.charAt(0) == ProteusConstants.DATA_PREFIX) {
      JsonElement elementFromData;
      try {
        elementFromData=Utils.getElementFromData(attributeValue.substring(1),parserContext.getDataContext().getDataProvider(),childIndex);
      }
 catch (      JsonNullException|NoSuchDataPathException|InvalidDataPathException e) {
        Log.e(TAG + "String_Node_Str",e.getMessage());
        failed=true;
        elementFromData=new JsonPrimitive(ProteusConstants.DATA_NULL);
      }
      if (elementFromData != null) {
        jsonDataValue=elementFromData;
      }
      addBinding(dataProteusView,attributeValue.substring(1),attributeName,attributeValue,handler,false);
    }
    if (dataProteusView.getView() != null) {
      if (failed) {
        if (viewJsonObject != null && !viewJsonObject.isJsonNull() && viewJsonObject.get(Attributes.View.Visibility.getName()) != null) {
          String visibility=viewJsonObject.get(Attributes.View.Visibility.getName()).getAsString();
          if (ProteusConstants.DATA_VISIBILITY.equals(visibility)) {
            dataProteusView.getView().setVisibility(View.INVISIBLE);
          }
        }
 else {
          dataProteusView.getView().setVisibility(View.GONE);
        }
      }
 else       if (dataProteusView.isViewUpdating()) {
        dataProteusView.getView().setVisibility(View.VISIBLE);
      }
    }
  }
  return jsonDataValue;
}