Program: 44647
Project: 44647
Buggy source:
private Response saveContentObjectByIdOrName(@PathParam("String_Node_Str") String contentObjectIdOrName,String requestContent,String httpMethod){
  boolean entityIsNew=false;
  ContentObject contentObjectToBeSaved=astroboaClient.getImportService().importContentObject(requestContent,false,true,false);
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str",contentObjectToBeSaved.xml(true));
  }
  if (CmsConstants.UUIDPattern.matcher(contentObjectIdOrName).matches()) {
    if (contentObjectToBeSaved.getId() == null) {
      contentObjectToBeSaved.setId(contentObjectIdOrName);
      entityIsNew=true;
    }
 else {
      if (!StringUtils.equals(contentObjectIdOrName,contentObjectToBeSaved.getId())) {
        logger.warn("String_Node_Str" + httpMethod + "String_Node_Str"+ contentObjectIdOrName+ "String_Node_Str"+ contentObjectToBeSaved.getId());
        throw new WebApplicationException(HttpURLConnection.HTTP_BAD_REQUEST);
      }
    }
  }
 else {
    ContentObject existedContentObject=null;
    ContentObjectCriteria contentObjectCriteria=CmsCriteriaFactory.newContentObjectCriteria();
    contentObjectCriteria.addSystemNameEqualsCriterion(contentObjectIdOrName);
    contentObjectCriteria.setOffsetAndLimit(0,1);
    CmsOutcome<ContentObject> cmsOutcome=astroboaClient.getContentService().searchContentObjects(contentObjectCriteria,ResourceRepresentationType.CONTENT_OBJECT_LIST);
    if (cmsOutcome.getCount() >= 1) {
      existedContentObject=(ContentObject)cmsOutcome.getResults().get(0);
    }
 else {
      entityIsNew=true;
    }
    if (contentObjectToBeSaved.getId() == null) {
      if (existedContentObject != null) {
        contentObjectToBeSaved.setId(existedContentObject.getId());
      }
    }
 else {
      if (existedContentObject != null) {
        if (!StringUtils.equals(existedContentObject.getId(),contentObjectToBeSaved.getId())) {
          logger.warn("String_Node_Str" + httpMethod + "String_Node_Str"+ contentObjectIdOrName+ "String_Node_Str"+ existedContentObject.getId()+ "String_Node_Str"+ contentObjectToBeSaved.getId());
          throw new WebApplicationException(HttpURLConnection.HTTP_BAD_REQUEST);
        }
      }
    }
  }
  return saveContentObject(contentObjectToBeSaved,httpMethod,requestContent,entityIsNew);
}

Fixed version (ground truth):
private Response saveContentObjectByIdOrName(@PathParam("String_Node_Str") String contentObjectIdOrName,String requestContent,String httpMethod){
  ContentObject contentObjectToBeSaved=astroboaClient.getImportService().importContentObject(requestContent,false,true,false);
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str",contentObjectToBeSaved.xml(true));
  }
  ContentObject existingObject=astroboaClient.getContentService().getContentObject(contentObjectIdOrName,ResourceRepresentationType.CONTENT_OBJECT_INSTANCE,FetchLevel.ENTITY,CacheRegion.NONE,null,false);
  boolean entityIsNew=existingObject == null;
  if (CmsConstants.UUIDPattern.matcher(contentObjectIdOrName).matches()) {
    if (contentObjectToBeSaved.getId() == null) {
      contentObjectToBeSaved.setId(contentObjectIdOrName);
    }
 else {
      if (!StringUtils.equals(contentObjectIdOrName,contentObjectToBeSaved.getId())) {
        logger.warn("String_Node_Str" + httpMethod + "String_Node_Str"+ contentObjectIdOrName+ "String_Node_Str"+ contentObjectToBeSaved.getId());
        throw new WebApplicationException(HttpURLConnection.HTTP_BAD_REQUEST);
      }
    }
  }
 else {
    if (contentObjectToBeSaved.getId() == null) {
      if (existingObject != null) {
        contentObjectToBeSaved.setId(existingObject.getId());
      }
    }
 else {
      if (existingObject != null) {
        if (!StringUtils.equals(existingObject.getId(),contentObjectToBeSaved.getId())) {
          logger.warn("String_Node_Str" + httpMethod + "String_Node_Str"+ contentObjectIdOrName+ "String_Node_Str"+ existingObject.getId()+ "String_Node_Str"+ contentObjectToBeSaved.getId());
          throw new WebApplicationException(HttpURLConnection.HTTP_BAD_REQUEST);
        }
      }
    }
  }
  return saveContentObject(contentObjectToBeSaved,httpMethod,requestContent,entityIsNew);
}