Program: 44646
Project: 44646
Buggy source:
private void populateSystemName() throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
  String systemName=contentObject.getSystemName();
  if (StringUtils.isBlank(systemName)) {
    systemName=retrieveContentObjectProfileTitle();
    if (StringUtils.isBlank(systemName)) {
      systemName=JcrNodeUtils.getYearMonthDayPathForContentObjectNode(contentObjectNode) + contentObjectNode.getUUID();
    }
    systemName=context.getCmsRepositoryEntityUtils().fixSystemName(systemName);
    contentObject.setSystemName(systemName);
  }
  if (!context.getCmsRepositoryEntityUtils().isValidSystemName(systemName)) {
    throw new RepositoryException("String_Node_Str" + systemName + "String_Node_Str"+ CmsConstants.SYSTEM_NAME_REG_EXP);
  }
  if (foundAtLeastOneMoreContentObjectWithSameSystemName(systemName)) {
    systemName=context.getCmsRepositoryEntityUtils().fixSystemName(retrieveContentObjectProfileTitle() + "String_Node_Str" + contentObject.getId());
    if (foundAtLeastOneMoreContentObjectWithSameSystemName(systemName)) {
      throw new CmsNonUniqueContentObjectSystemNameException("String_Node_Str" + systemName);
    }
 else {
      logger.warn("String_Node_Str",new Object[]{contentObject.getId(),systemName,contentObject.getSystemName()});
      contentObject.setSystemName(systemName);
    }
  }
  JcrNodeUtils.addSimpleProperty(SaveMode.UPDATE_ALL,contentObjectNode,CmsBuiltInItem.SystemName,systemName,session.getValueFactory(),ValueType.String);
}

Fixed version (ground truth):
private void populateSystemName() throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
  String systemName=contentObject.getSystemName();
  if (StringUtils.isBlank(systemName)) {
    if (contentObjectNode.hasProperty(CmsBuiltInItem.SystemName.getJcrName())) {
      systemName=contentObjectNode.getProperty(CmsBuiltInItem.SystemName.getJcrName()).getString();
      if (!context.getCmsRepositoryEntityUtils().isValidSystemName(systemName)) {
        throw new RepositoryException("String_Node_Str" + systemName + "String_Node_Str"+ CmsConstants.SYSTEM_NAME_REG_EXP);
      }
      contentObject.setSystemName(systemName);
      return;
    }
    systemName=retrieveContentObjectProfileTitle();
    if (StringUtils.isBlank(systemName)) {
      systemName=JcrNodeUtils.getYearMonthDayPathForContentObjectNode(contentObjectNode) + contentObjectNode.getUUID();
    }
    systemName=context.getCmsRepositoryEntityUtils().fixSystemName(systemName);
    contentObject.setSystemName(systemName);
  }
  if (!context.getCmsRepositoryEntityUtils().isValidSystemName(systemName)) {
    throw new RepositoryException("String_Node_Str" + systemName + "String_Node_Str"+ CmsConstants.SYSTEM_NAME_REG_EXP);
  }
  if (foundAtLeastOneMoreContentObjectWithSameSystemName(systemName)) {
    systemName=context.getCmsRepositoryEntityUtils().fixSystemName(retrieveContentObjectProfileTitle() + "String_Node_Str" + contentObject.getId());
    if (foundAtLeastOneMoreContentObjectWithSameSystemName(systemName)) {
      throw new CmsNonUniqueContentObjectSystemNameException("String_Node_Str" + systemName);
    }
 else {
      logger.warn("String_Node_Str",new Object[]{contentObject.getId(),systemName,contentObject.getSystemName()});
      contentObject.setSystemName(systemName);
    }
  }
  JcrNodeUtils.addSimpleProperty(SaveMode.UPDATE_ALL,contentObjectNode,CmsBuiltInItem.SystemName,systemName,session.getValueFactory(),ValueType.String);
}