Program: 44648
Project: 44648
Buggy source:
private Response saveTaxonomyByIdOrName(@PathParam("String_Node_Str") String taxonomyIdOrName,String requestContent,String httpMethod){
  Taxonomy taxonomyToBeSaved=astroboaClient.getImportService().importTaxonomy(requestContent,false);
  Taxonomy existedTaxonomy=astroboaClient.getTaxonomyService().getTaxonomy(taxonomyIdOrName,ResourceRepresentationType.TAXONOMY_INSTANCE,FetchLevel.ENTITY,false);
  boolean taxonomyIdHasBeenProvided=CmsConstants.UUIDPattern.matcher(taxonomyIdOrName).matches();
  boolean entityIsNew=false;
  if (taxonomyIdHasBeenProvided) {
    if (taxonomyToBeSaved.getId() == null) {
      taxonomyToBeSaved.setId(taxonomyIdOrName);
    }
  }
 else {
    if (taxonomyToBeSaved.getName() == null) {
      taxonomyToBeSaved.setName(taxonomyIdOrName);
    }
  }
  if (existedTaxonomy != null) {
    if (taxonomyToBeSaved.getId() == null) {
      taxonomyToBeSaved.setId(existedTaxonomy.getId());
    }
 else {
      if (!StringUtils.equals(existedTaxonomy.getId(),taxonomyToBeSaved.getId())) {
        logger.warn("String_Node_Str",new Object[]{httpMethod,taxonomyIdOrName,existedTaxonomy.getId(),taxonomyToBeSaved.getId()});
        throw new WebApplicationException(HttpURLConnection.HTTP_BAD_REQUEST);
      }
    }
  }
 else {
    if (taxonomyToBeSaved.getName() != null && !taxonomyIdHasBeenProvided && !StringUtils.equals(taxonomyIdOrName,taxonomyToBeSaved.getName())) {
      logger.warn("String_Node_Str",new Object[]{httpMethod,taxonomyIdOrName,taxonomyToBeSaved.getName()});
      throw new WebApplicationException(HttpURLConnection.HTTP_BAD_REQUEST);
    }
    entityIsNew=true;
  }
  return saveTaxonomySource(taxonomyToBeSaved.xml(false),httpMethod,entityIsNew);
}

Fixed version (ground truth):
private Response saveTaxonomyByIdOrName(@PathParam("String_Node_Str") String taxonomyIdOrName,String requestContent,String httpMethod){
  Taxonomy taxonomyToBeSaved=astroboaClient.getImportService().importTaxonomy(requestContent,false);
  Taxonomy existedTaxonomy=astroboaClient.getTaxonomyService().getTaxonomy(taxonomyIdOrName,ResourceRepresentationType.TAXONOMY_INSTANCE,FetchLevel.ENTITY,false);
  boolean taxonomyIdHasBeenProvided=CmsConstants.UUIDPattern.matcher(taxonomyIdOrName).matches();
  boolean entityIsNew=existedTaxonomy == null;
  if (taxonomyIdHasBeenProvided) {
    if (taxonomyToBeSaved.getId() == null) {
      taxonomyToBeSaved.setId(taxonomyIdOrName);
    }
  }
 else {
    if (taxonomyToBeSaved.getName() == null) {
      taxonomyToBeSaved.setName(taxonomyIdOrName);
    }
  }
  if (existedTaxonomy != null) {
    if (taxonomyToBeSaved.getId() == null) {
      taxonomyToBeSaved.setId(existedTaxonomy.getId());
    }
 else {
      if (!StringUtils.equals(existedTaxonomy.getId(),taxonomyToBeSaved.getId())) {
        logger.warn("String_Node_Str",new Object[]{httpMethod,taxonomyIdOrName,existedTaxonomy.getId(),taxonomyToBeSaved.getId()});
        throw new WebApplicationException(HttpURLConnection.HTTP_BAD_REQUEST);
      }
    }
  }
 else {
    if (taxonomyToBeSaved.getName() != null && !taxonomyIdHasBeenProvided && !StringUtils.equals(taxonomyIdOrName,taxonomyToBeSaved.getName())) {
      logger.warn("String_Node_Str",new Object[]{httpMethod,taxonomyIdOrName,taxonomyToBeSaved.getName()});
      throw new WebApplicationException(HttpURLConnection.HTTP_BAD_REQUEST);
    }
  }
  return saveTaxonomySource(taxonomyToBeSaved.xml(false),httpMethod,entityIsNew);
}