Program: 62208
Project: 62208
Buggy source:
/** 
 * Update the value of a property.
 * @param environmentId The id of the environment for which to update the deployment topology.
 * @param nodeTemplateId The id of the node template to update (this must be a substituted node).
 * @param propertyName The name of the property for which to update the value.
 * @param propertyValue The new value of the property.
 */
public void updateProperty(String environmentId,String nodeTemplateId,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);
    PropertyDefinition propertyDefinition=deploymentConfiguration.getAvailableSubstitutions().getSubstitutionTypes().getNodeTypes().get(locationResourceTemplate.getTemplate().getType()).getProperties().get(propertyName);
    if (propertyDefinition == null) {
      throw new NotFoundException("String_Node_Str" + propertyName + "String_Node_Str"+ nodeTemplateId+ "String_Node_Str"+ locationResourceTemplate.getTemplate().getType()+ "String_Node_Str");
    }
    AbstractPropertyValue locationResourcePropertyValue=locationResourceTemplate.getTemplate().getProperties().get(propertyName);
    buildConstaintException(locationResourcePropertyValue,propertyDefinition,"String_Node_Str",propertyName,propertyValue);
    NodeTemplate originalNode=deploymentTopology.getOriginalNodes().get(nodeTemplateId);
    buildConstaintException(originalNode.getProperties().get(propertyName),propertyDefinition,"String_Node_Str",propertyName,propertyValue);
    propertyService.setPropertyValue(substitutedNode,propertyDefinition,propertyName,propertyValue);
    alienDAO.save(deploymentTopology);
  }
  finally {
    ToscaContext.destroy();
  }
}

Fixed version (ground truth):
/** 
 * Update the value of a property.
 * @param environmentId The id of the environment for which to update the deployment topology.
 * @param nodeTemplateId The id of the node template to update (this must be a substituted node).
 * @param propertyName The name of the property for which to update the value.
 * @param propertyValue The new value of the property.
 */
public void updateProperty(String environmentId,String nodeTemplateId,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);
    PropertyDefinition propertyDefinition=deploymentConfiguration.getAvailableSubstitutions().getSubstitutionTypes().getNodeTypes().get(locationResourceTemplate.getTemplate().getType()).getProperties().get(propertyName);
    if (propertyDefinition == null) {
      throw new NotFoundException("String_Node_Str" + propertyName + "String_Node_Str"+ nodeTemplateId+ "String_Node_Str"+ locationResourceTemplate.getTemplate().getType()+ "String_Node_Str");
    }
    AbstractPropertyValue locationResourcePropertyValue=locationResourceTemplate.getTemplate().getProperties().get(propertyName);
    buildConstaintException(locationResourcePropertyValue,"String_Node_Str",propertyName,propertyValue);
    NodeTemplate originalNode=deploymentTopology.getOriginalNodes().get(nodeTemplateId);
    buildConstaintException(originalNode.getProperties().get(propertyName),"String_Node_Str",propertyName,propertyValue);
    propertyService.setPropertyValue(substitutedNode,propertyDefinition,propertyName,propertyValue);
    alienDAO.save(deploymentTopology);
  }
  finally {
    ToscaContext.destroy();
  }
}