code: static void verifyItemDoesNotAlreadyExist(@Nonnull ItemGroup<?> parent, @Nonnull String newName, @CheckForNull Item variant) throws IllegalArgumentException, Failure {
          Item existing;
          try (ACLContext ctxt = ACL.as(ACL.SYSTEM)) {
              existing = parent.getItem(newName);
          }
          if (existing != null && existing != variant) {
              if (existing.hasPermission(Item.DISCOVER)) {
                  String prefix = parent.getFullName();
                  throw new IllegalArgumentException((prefix.isEmpty() ? "" : prefix + "/") + newName + " already exists");
              } else {
                  // Cannot hide its existence, so at least be as vague as possible.
                  throw new Failure("");
              }
          }
      }
docs: Securely check for the existence of an item before trying to create one with the same name.
  @param parent the folder where we are about to create/rename/move an item
  @param newName the proposed new name
  @param variant if not null, an existing item which we accept could be there
  @throws IllegalArgumentException if there is already something there, which you were supposed to know about
  @throws Failure if there is already something there but you should not be told details