Program: 62286
Project: 62286
Buggy source:
/** 
 * Create a new version for an application/topology template based on an existing topology.
 * @param delegateId The id of the application/topology template for which to create the version.
 * @param topologyToCloneId The id of the topology to clone for the version's topology.
 * @param version The number version of the new application version.
 */
public V createVersion(String delegateId,String topologyToCloneId,String version,String description,Topology providedTopology){
  if (isVersionNameExist(delegateId,version)) {
    throw new AlreadyExistException("String_Node_Str" + version + "String_Node_Str");
  }
  VersionUtil.parseVersion(version);
  V appVersion=buildVersionImplem();
  appVersion.setId(UUID.randomUUID().toString());
  appVersion.setDelegateId(delegateId);
  appVersion.setVersion(version);
  appVersion.setLatest(true);
  appVersion.setSnapshot(VersionUtil.isSnapshot(version));
  appVersion.setReleased(!VersionUtil.isSnapshot(version));
  appVersion.setDescription(description);
  Topology topology=null;
  if (providedTopology != null) {
    topology=providedTopology;
  }
 else {
    if (topologyToCloneId != null) {
      topology=alienDAO.findById(Topology.class,topologyToCloneId);
    }
 else {
      topology=new Topology();
    }
    topology.setId(UUID.randomUUID().toString());
  }
  topology.setDelegateId(delegateId);
  topology.setDelegateType(getDelegateClass().getSimpleName().toLowerCase());
  workflowBuilderService.initWorkflows(workflowBuilderService.buildTopologyContext(topology));
  if (!VersionUtil.isSnapshot(version)) {
    checkTopologyReleasable(topology);
  }
  topologyServiceCore.save(topology);
  appVersion.setTopologyId(topology.getId());
  alienDAO.save(appVersion);
  return appVersion;
}

Fixed version (ground truth):
/** 
 * Create a new version for an application/topology template based on an existing topology.
 * @param delegateId The id of the application/topology template for which to create the version.
 * @param topologyToCloneId The id of the topology to clone for the version's topology.
 * @param version The number version of the new application version.
 */
public V createVersion(String delegateId,String topologyToCloneId,String version,String description,Topology providedTopology){
  if (isVersionNameExist(delegateId,version)) {
    throw new AlreadyExistException("String_Node_Str" + version + "String_Node_Str");
  }
  VersionUtil.parseVersion(version);
  V appVersion=buildVersionImplem();
  appVersion.setId(UUID.randomUUID().toString());
  appVersion.setDelegateId(delegateId);
  appVersion.setVersion(version);
  appVersion.setLatest(true);
  appVersion.setSnapshot(VersionUtil.isSnapshot(version));
  appVersion.setReleased(!VersionUtil.isSnapshot(version));
  appVersion.setDescription(description);
  Topology topology=null;
  if (providedTopology != null) {
    topology=providedTopology;
  }
 else {
    if (topologyToCloneId != null) {
      topology=alienDAO.findById(Topology.class,topologyToCloneId);
    }
 else {
      topology=new Topology();
    }
    topology.setId(UUID.randomUUID().toString());
  }
  workflowBuilderService.initWorkflows(workflowBuilderService.buildTopologyContext(topology));
  if (!VersionUtil.isSnapshot(version)) {
    checkTopologyReleasable(topology);
  }
  topologyServiceCore.save(topology);
  appVersion.setTopologyId(topology.getId());
  alienDAO.save(appVersion);
  return appVersion;
}