code: static String validateBucketName(String bucketName) {
  
      // If the name ends with /, remove it.
      bucketName = FileInfo.convertToFilePath(bucketName);
  
      if (Strings.isNullOrEmpty(bucketName)) {
        throw new IllegalArgumentException(
            "Google Cloud Storage bucket name cannot be empty.");
      }
  
      if (!BUCKET_NAME_CHAR_MATCHER.matchesAllOf(bucketName)) {
        throw new IllegalArgumentException(
            String.format(
                "Invalid bucket name '%s': bucket name must contain only 'a-z0-9_.-' characters.",
                bucketName));
      }
  
      return bucketName;
    }
docs: Validate the given bucket name to make sure that it can be used
  as a part of a file system path.
  
  Note: this is not designed to duplicate the exact checks that GCS
  would perform on the server side. We make some checks
  that are relevant to using GCS as a file system.
  
  @param bucketName Bucket name to check.