Program: 62164
Project: 62164
Buggy source:
private void setNodeCapabilityProperty(FlowExecutionContext context,LocationResourceTemplate locationResourceTemplate,NodeTemplate nodeTemplate,String capabilityName,DeploymentMatchingConfiguration matchingConfiguration) throws ConstraintViolationException, ConstraintValueDoNotMatchPropertyTypeException {
  Capability locationResourceCapability=locationResourceTemplate.getTemplate().getCapabilities().get(capabilityName);
  if (locationResourceCapability == null) {
    throw new NotFoundException("String_Node_Str" + capabilityName + "String_Node_Str"+ nodeTemplateId+ "String_Node_Str"+ locationResourceTemplate.getTemplate().getType()+ "String_Node_Str");
  }
  PropertyDefinition propertyDefinition=ToscaContext.getOrFail(CapabilityType.class,locationResourceCapability.getType()).getProperties().get(propertyName);
  if (propertyDefinition == null) {
    throw new NotFoundException("String_Node_Str" + propertyName + "String_Node_Str"+ capabilityName+ "String_Node_Str"+ locationResourceCapability.getType()+ "String_Node_Str");
  }
  AbstractPropertyValue locationResourcePropertyValue=locationResourceTemplate.getTemplate().getCapabilities().get(capabilityName).getProperties().get(propertyName);
  ensureNotSet(locationResourcePropertyValue,"String_Node_Str",propertyName,propertyValue);
  AbstractPropertyValue originalNodePropertyValue=safe(nodeTemplate.getCapabilities().get(capabilityName).getProperties()).get(propertyName);
  ensureNotSet(originalNodePropertyValue,"String_Node_Str",propertyName,propertyValue);
  propertyService.setCapabilityPropertyValue(nodeTemplate.getCapabilities().get(capabilityName),propertyDefinition,propertyName,propertyValue);
  NodePropsOverride nodePropsOverride=getNodePropsOverride(matchingConfiguration);
  if (nodePropsOverride.getCapabilities().get(capabilityName) == null) {
    nodePropsOverride.getCapabilities().put(capabilityName,new NodeCapabilitiesPropsOverride());
  }
  nodePropsOverride.getCapabilities().get(capabilityName).getProperties().put(propertyName,nodeTemplate.getCapabilities().get(capabilityName).getProperties().get(propertyName));
  context.saveConfiguration(matchingConfiguration);
}

Fixed version (ground truth):
private void setNodeCapabilityProperty(FlowExecutionContext context,LocationResourceTemplate locationResourceTemplate,NodeTemplate nodeTemplate,String capabilityName,DeploymentMatchingConfiguration matchingConfiguration) throws ConstraintViolationException, ConstraintValueDoNotMatchPropertyTypeException {
  Capability locationResourceCapability=locationResourceTemplate.getTemplate().getCapabilities().get(capabilityName);
  if (locationResourceCapability == null) {
    throw new NotFoundException("String_Node_Str" + capabilityName + "String_Node_Str"+ nodeTemplateId+ "String_Node_Str"+ locationResourceTemplate.getTemplate().getType()+ "String_Node_Str");
  }
  PropertyDefinition propertyDefinition=ToscaContext.getOrFail(CapabilityType.class,locationResourceCapability.getType()).getProperties().get(propertyName);
  if (propertyDefinition == null) {
    throw new NotFoundException("String_Node_Str" + propertyName + "String_Node_Str"+ capabilityName+ "String_Node_Str"+ locationResourceCapability.getType()+ "String_Node_Str");
  }
  AbstractPropertyValue locationResourcePropertyValue=locationResourceTemplate.getTemplate().getCapabilities().get(capabilityName).getProperties().get(propertyName);
  ensureNotSet(locationResourcePropertyValue,"String_Node_Str",propertyName,propertyValue);
  AbstractPropertyValue originalNodePropertyValue=safe(nodeTemplate.getCapabilities().get(capabilityName).getProperties()).get(propertyName);
  ensureNotSet(originalNodePropertyValue,"String_Node_Str",propertyName,propertyValue);
  ConstraintPropertyService.checkPropertyConstraint(propertyName,propertyValue,propertyDefinition);
  NodePropsOverride nodePropsOverride=getNodePropsOverride(matchingConfiguration);
  if (nodePropsOverride.getCapabilities().get(capabilityName) == null) {
    nodePropsOverride.getCapabilities().put(capabilityName,new NodeCapabilitiesPropsOverride());
  }
  nodePropsOverride.getCapabilities().get(capabilityName).getProperties().put(propertyName,PropertyService.asPropertyValue(propertyValue));
  context.saveConfiguration(matchingConfiguration);
}