Program: 34707
Project: 34707
Buggy source:
/** 
 * {@inheritDoc} 
 */
public Object validate(ValidationHelper helper,Context context,String key,String $ref){
  if ($ref != null && !$ref.isEmpty()) {
    if ($ref.contains("String_Node_Str") || $ref.contains("String_Node_Str") || $ref.contains("String_Node_Str")|| $ref.contains("String_Node_Str")|| $ref.startsWith("String_Node_Str")|| $ref.startsWith("String_Node_Str")) {
      return null;
    }
 else {
      boolean validRefStruct=true;
      String[] references=$ref.split("String_Node_Str");
      if (!($ref.startsWith("String_Node_Str") && references.length == 4)) {
        validRefStruct=false;
      }
      if (validRefStruct) {
        Components components=context.getModel().getComponents();
        if (components == null) {
          final String message=Tr.formatMessage(tc,"String_Node_Str",$ref);
          helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR,context.getLocation(),message));
          return null;
        }
        for (int i=2; i < ((references.length) - 1); i++) {
          String name=references[i + 1];
switch (references[i]) {
case "String_Node_Str":
            Map<String,Schema> schemas=components.getSchemas();
          if (schemas != null && schemas.containsKey(name)) {
            return schemas.get(name);
          }
 else {
            final String message=Tr.formatMessage(tc,"String_Node_Str",$ref);
            helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR,context.getLocation(),message));
            break;
          }
case "String_Node_Str":
        Map<String,APIResponse> responses=components.getResponses();
      if (responses != null && responses.containsKey(name)) {
        return responses.get(name);
      }
 else {
        final String message=Tr.formatMessage(tc,"String_Node_Str",$ref);
        helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR,context.getLocation(),message));
        break;
      }
case "String_Node_Str":
    Map<String,Parameter> parameters=components.getParameters();
  if (parameters != null && parameters.containsKey(name)) {
    return parameters.get(name);
  }
 else {
    final String message=Tr.formatMessage(tc,"String_Node_Str",$ref);
    helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR,context.getLocation(),message));
    break;
  }
case "String_Node_Str":
Map<String,Example> examples=components.getExamples();
if (examples != null && examples.containsKey(name)) {
return examples.get(name);
}
 else {
final String message=Tr.formatMessage(tc,"String_Node_Str",$ref);
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR,context.getLocation(),message));
break;
}
case "String_Node_Str":
Map<String,RequestBody> requestBodies=components.getRequestBodies();
if (requestBodies != null && requestBodies.containsKey(name)) {
return requestBodies.get(name);
}
 else {
final String message=Tr.formatMessage(tc,"String_Node_Str",$ref);
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR,context.getLocation(),message));
break;
}
case "String_Node_Str":
Map<String,Header> headers=components.getHeaders();
if (headers != null && headers.containsKey(name)) {
return headers.get(name);
}
 else {
final String message=Tr.formatMessage(tc,"String_Node_Str",$ref);
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR,context.getLocation(),message));
break;
}
case "String_Node_Str":
Map<String,SecurityScheme> securitySchemes=components.getSecuritySchemes();
if (securitySchemes != null && securitySchemes.containsKey(name)) {
return securitySchemes.get(name);
}
 else {
final String message=Tr.formatMessage(tc,"String_Node_Str",$ref);
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR,context.getLocation(),message));
break;
}
case "String_Node_Str":
Map<String,Link> links=components.getLinks();
if (links != null && links.containsKey(name)) {
return links.get(name);
}
 else {
final String message=Tr.formatMessage(tc,"String_Node_Str",$ref);
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR,context.getLocation(),message));
break;
}
default :
final String message=Tr.formatMessage(tc,"String_Node_Str",$ref);
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR,context.getLocation(),message));
break;
}
}
}
 else {
final String message=Tr.formatMessage(tc,"String_Node_Str",$ref);
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR,context.getLocation(),message));
}
}
}
 else {
final String message=Tr.formatMessage(tc,"String_Node_Str");
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR,context.getLocation(),message));
}
return null;
}

Fixed version (ground truth):
public Object validate(ValidationHelper helper,Context context,String key,String $ref){
  if ($ref != null && !$ref.trim().isEmpty()) {
    if (!$ref.startsWith("String_Node_Str")) {
      return null;
    }
 else {
      boolean validRefStruct=true;
      String[] references=$ref.split("String_Node_Str");
      if (!($ref.startsWith("String_Node_Str") && references.length == 4)) {
        validRefStruct=false;
      }
      if (validRefStruct) {
        Components components=context.getModel().getComponents();
        if (components == null) {
          final String message=Tr.formatMessage(tc,"String_Node_Str",$ref);
          helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR,context.getLocation(),message));
          return null;
        }
        for (int i=2; i < ((references.length) - 1); i++) {
          String name=references[i + 1];
switch (references[i]) {
case "String_Node_Str":
            Map<String,Schema> schemas=components.getSchemas();
          if (schemas != null && schemas.containsKey(name)) {
            return schemas.get(name);
          }
 else {
            final String message=Tr.formatMessage(tc,"String_Node_Str",$ref);
            helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR,context.getLocation(),message));
            break;
          }
case "String_Node_Str":
        Map<String,APIResponse> responses=components.getResponses();
      if (responses != null && responses.containsKey(name)) {
        return responses.get(name);
      }
 else {
        final String message=Tr.formatMessage(tc,"String_Node_Str",$ref);
        helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR,context.getLocation(),message));
        break;
      }
case "String_Node_Str":
    Map<String,Parameter> parameters=components.getParameters();
  if (parameters != null && parameters.containsKey(name)) {
    return parameters.get(name);
  }
 else {
    final String message=Tr.formatMessage(tc,"String_Node_Str",$ref);
    helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR,context.getLocation(),message));
    break;
  }
case "String_Node_Str":
Map<String,Example> examples=components.getExamples();
if (examples != null && examples.containsKey(name)) {
return examples.get(name);
}
 else {
final String message=Tr.formatMessage(tc,"String_Node_Str",$ref);
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR,context.getLocation(),message));
break;
}
case "String_Node_Str":
Map<String,RequestBody> requestBodies=components.getRequestBodies();
if (requestBodies != null && requestBodies.containsKey(name)) {
return requestBodies.get(name);
}
 else {
final String message=Tr.formatMessage(tc,"String_Node_Str",$ref);
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR,context.getLocation(),message));
break;
}
case "String_Node_Str":
Map<String,Header> headers=components.getHeaders();
if (headers != null && headers.containsKey(name)) {
return headers.get(name);
}
 else {
final String message=Tr.formatMessage(tc,"String_Node_Str",$ref);
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR,context.getLocation(),message));
break;
}
case "String_Node_Str":
Map<String,SecurityScheme> securitySchemes=components.getSecuritySchemes();
if (securitySchemes != null && securitySchemes.containsKey(name)) {
return securitySchemes.get(name);
}
 else {
final String message=Tr.formatMessage(tc,"String_Node_Str",$ref);
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR,context.getLocation(),message));
break;
}
case "String_Node_Str":
Map<String,Link> links=components.getLinks();
if (links != null && links.containsKey(name)) {
return links.get(name);
}
 else {
final String message=Tr.formatMessage(tc,"String_Node_Str",$ref);
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR,context.getLocation(),message));
break;
}
default :
final String message=Tr.formatMessage(tc,"String_Node_Str",$ref);
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR,context.getLocation(),message));
break;
}
}
}
 else {
final String message=Tr.formatMessage(tc,"String_Node_Str",$ref);
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR,context.getLocation(),message));
}
}
}
 else {
final String message=Tr.formatMessage(tc,"String_Node_Str");
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR,context.getLocation(),message));
}
return null;
}