Program: 62204
Project: 62204
Buggy source:
public void updateCapabilityProperty(String environmentId,String nodeTemplateId,String capabilityName,String propertyName,Object propertyValue) throws ConstraintViolationException, ConstraintValueDoNotMatchPropertyTypeException {
  DeploymentConfiguration deploymentConfiguration=getDeploymentConfiguration(environmentId);
  DeploymentTopology deploymentTopology=deploymentConfiguration.getDeploymentTopology();
  try {
    ToscaContext.init(deploymentTopology.getDependencies());
    NodeTemplate substitutedNode=deploymentTopology.getNodeTemplates().get(nodeTemplateId);
    if (substitutedNode == null) {
      throw new NotFoundException("String_Node_Str" + deploymentTopology.getId() + "String_Node_Str"+ nodeTemplateId+ "String_Node_Str");
    }
    String substitutionId=deploymentTopology.getSubstitutedNodes().get(nodeTemplateId);
    if (substitutionId == null) {
      throw new NotFoundException("String_Node_Str" + nodeTemplateId + "String_Node_Str"+ deploymentTopology.getId()+ "String_Node_Str");
    }
    LocationResourceTemplate locationResourceTemplate=deploymentConfiguration.getAvailableSubstitutions().getSubstitutionsTemplates().get(substitutionId);
    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");
    }
    CapabilityType capabilityType=deploymentConfiguration.getAvailableSubstitutions().getSubstitutionTypes().getCapabilityTypes().get(locationResourceCapability.getType());
    PropertyDefinition propertyDefinition=capabilityType.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);
    buildConstaintException(locationResourcePropertyValue,propertyDefinition,"String_Node_Str",propertyName,propertyValue);
    AbstractPropertyValue originalNodePropertyValue=deploymentTopology.getOriginalNodes().get(nodeTemplateId).getCapabilities().get(capabilityName).getProperties().get(propertyName);
    buildConstaintException(originalNodePropertyValue,propertyDefinition,"String_Node_Str",propertyName,propertyValue);
    propertyService.setCapabilityPropertyValue(substitutedNode.getCapabilities().get(capabilityName),propertyDefinition,propertyName,propertyValue);
    alienDAO.save(deploymentTopology);
  }
  finally {
    ToscaContext.destroy();
  }
}

Fixed version (ground truth):
public void updateCapabilityProperty(String environmentId,String nodeTemplateId,String capabilityName,String propertyName,Object propertyValue) throws ConstraintViolationException, ConstraintValueDoNotMatchPropertyTypeException {
  DeploymentConfiguration deploymentConfiguration=getDeploymentConfiguration(environmentId);
  DeploymentTopology deploymentTopology=deploymentConfiguration.getDeploymentTopology();
  try {
    ToscaContext.init(deploymentTopology.getDependencies());
    NodeTemplate substitutedNode=deploymentTopology.getNodeTemplates().get(nodeTemplateId);
    if (substitutedNode == null) {
      throw new NotFoundException("String_Node_Str" + deploymentTopology.getId() + "String_Node_Str"+ nodeTemplateId+ "String_Node_Str");
    }
    String substitutionId=deploymentTopology.getSubstitutedNodes().get(nodeTemplateId);
    if (substitutionId == null) {
      throw new NotFoundException("String_Node_Str" + nodeTemplateId + "String_Node_Str"+ deploymentTopology.getId()+ "String_Node_Str");
    }
    LocationResourceTemplate locationResourceTemplate=deploymentConfiguration.getAvailableSubstitutions().getSubstitutionsTemplates().get(substitutionId);
    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");
    }
    CapabilityType capabilityType=deploymentConfiguration.getAvailableSubstitutions().getSubstitutionTypes().getCapabilityTypes().get(locationResourceCapability.getType());
    PropertyDefinition propertyDefinition=capabilityType.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);
    buildConstaintException(locationResourcePropertyValue,"String_Node_Str",propertyName,propertyValue);
    AbstractPropertyValue originalNodePropertyValue=deploymentTopology.getOriginalNodes().get(nodeTemplateId).getCapabilities().get(capabilityName).getProperties().get(propertyName);
    buildConstaintException(originalNodePropertyValue,"String_Node_Str",propertyName,propertyValue);
    propertyService.setCapabilityPropertyValue(substitutedNode.getCapabilities().get(capabilityName),propertyDefinition,propertyName,propertyValue);
    alienDAO.save(deploymentTopology);
  }
  finally {
    ToscaContext.destroy();
  }
}