Program: 62329
Project: 62329
Buggy source:
/** 
 * Update one property for a given @{IndexedCapabilityType} of a   {@link NodeTemplate}
 * @param topologyId The id of the topology that contains the node template for which to update a property.
 * @param nodeTemplateName The name of the node template for which to update a property.
 * @param capabilityId The name of the capability.
 * @param updatePropertyRequest The key and value of the property to update. When value is null => "reset" (load the default value).
 * @return a void rest response that contains no data if successful and an error if something goes wrong.
 */
@ApiOperation(value="String_Node_Str",notes="String_Node_Str") @RequestMapping(value="String_Node_Str",method=RequestMethod.POST,consumes=MediaType.APPLICATION_JSON_VALUE,produces=MediaType.APPLICATION_JSON_VALUE) @PreAuthorize("String_Node_Str") public RestResponse<ConstraintInformation> updateCapabilityPropertyValue(@PathVariable String topologyId,@PathVariable String nodeTemplateName,@PathVariable String capabilityId,@RequestBody UpdateIndexedTypePropertyRequest updatePropertyRequest){
  Topology topology=topologyServiceCore.getOrFail(topologyId);
  topologyService.checkEditionAuthorizations(topology);
  topologyService.throwsErrorIfReleased(topology);
  String propertyName=updatePropertyRequest.getPropertyName();
  String propertyValue=updatePropertyRequest.getPropertyValue();
  String capabilityType=updatePropertyRequest.getType();
  Map<String,IndexedCapabilityType> capabilityTypes=topologyServiceCore.getIndexedCapabilityTypesFromTopology(topology);
  if (!capabilityTypes.get(capabilityType).getProperties().containsKey(propertyName)) {
    throw new NotFoundException("String_Node_Str" + propertyName + "String_Node_Str"+ nodeTemplateName+ "String_Node_Str"+ capabilityType+ "String_Node_Str");
  }
  log.debug("String_Node_Str",propertyName,capabilityType,nodeTemplateName,topology.getId(),capabilityTypes.get(capabilityType).getProperties().get(propertyName),propertyValue);
  Map<String,NodeTemplate> nodeTemplates=topologyServiceCore.getNodeTemplates(topology);
  NodeTemplate nodeTemplate=topologyServiceCore.getNodeTemplate(topologyId,nodeTemplateName,nodeTemplates);
  Map<String,Capability> capabilities=nodeTemplate.getCapabilities();
  try {
    propertyService.setPropertyValue(capabilities.get(capabilityId).getProperties(),capabilityTypes.get(capabilityType).getProperties().get(propertyName),propertyName,propertyValue);
  }
 catch (  ConstraintValueDoNotMatchPropertyTypeException|ConstraintViolationException e) {
    return RestConstraintValidator.fromException(e,propertyName,propertyValue);
  }
  topologyServiceCore.save(topology);
  return RestResponseBuilder.<ConstraintInformation>builder().build();
}

Fixed version (ground truth):
/** 
 * Update one property for a given @{IndexedCapabilityType} of a   {@link NodeTemplate}
 * @param topologyId The id of the topology that contains the node template for which to update a property.
 * @param nodeTemplateName The name of the node template for which to update a property.
 * @param capabilityId The name of the capability.
 * @param updatePropertyRequest The key and value of the property to update. When value is null => "reset" (load the default value).
 * @return a void rest response that contains no data if successful and an error if something goes wrong.
 */
@ApiOperation(value="String_Node_Str",notes="String_Node_Str") @RequestMapping(value="String_Node_Str",method=RequestMethod.POST,consumes=MediaType.APPLICATION_JSON_VALUE,produces=MediaType.APPLICATION_JSON_VALUE) @PreAuthorize("String_Node_Str") public RestResponse<ConstraintInformation> updateCapabilityPropertyValue(@PathVariable String topologyId,@PathVariable String nodeTemplateName,@PathVariable String capabilityId,@RequestBody UpdateIndexedTypePropertyRequest updatePropertyRequest){
  Topology topology=topologyServiceCore.getOrFail(topologyId);
  topologyService.checkEditionAuthorizations(topology);
  topologyService.throwsErrorIfReleased(topology);
  String propertyName=updatePropertyRequest.getPropertyName();
  Object propertyValue=updatePropertyRequest.getPropertyValue();
  String capabilityType=updatePropertyRequest.getType();
  Map<String,IndexedCapabilityType> capabilityTypes=topologyServiceCore.getIndexedCapabilityTypesFromTopology(topology);
  if (!capabilityTypes.get(capabilityType).getProperties().containsKey(propertyName)) {
    throw new NotFoundException("String_Node_Str" + propertyName + "String_Node_Str"+ nodeTemplateName+ "String_Node_Str"+ capabilityType+ "String_Node_Str");
  }
  log.debug("String_Node_Str",propertyName,capabilityType,nodeTemplateName,topology.getId(),capabilityTypes.get(capabilityType).getProperties().get(propertyName),propertyValue);
  Map<String,NodeTemplate> nodeTemplates=topologyServiceCore.getNodeTemplates(topology);
  NodeTemplate nodeTemplate=topologyServiceCore.getNodeTemplate(topologyId,nodeTemplateName,nodeTemplates);
  Map<String,Capability> capabilities=nodeTemplate.getCapabilities();
  try {
    propertyService.setPropertyValue(capabilities.get(capabilityId).getProperties(),capabilityTypes.get(capabilityType).getProperties().get(propertyName),propertyName,propertyValue);
  }
 catch (  ConstraintValueDoNotMatchPropertyTypeException|ConstraintViolationException e) {
    return RestConstraintValidator.fromException(e,propertyName,propertyValue);
  }
  topologyServiceCore.save(topology);
  return RestResponseBuilder.<ConstraintInformation>builder().build();
}