private void checkBucketName(String name) throws InvalidBucketNameException {
  if (name == null) {
    throw new InvalidBucketNameException(NULL_STRING,"null bucket name");
  }
  if (name.length() < 3 || name.length() > 63) {
    String msg="bucket name must be at least 3 and no more than 63 characters long";
    throw new InvalidBucketNameException(name,msg);
  }
  if (name.matches("\\.\\.")) {
    String msg="bucket name cannot contain successive periods. For more information refer " + "http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html";
    throw new InvalidBucketNameException(name,msg);
  }
  if (!name.matches("^[a-z0-9][a-z0-9\\.\\-]+[a-z0-9]$")) {
    String msg="bucket name does not follow Amazon S3 standards. For more information refer " + "http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html";
    throw new InvalidBucketNameException(name,msg);
  }
}

private void checkBucketName ( String name ) throws InvalidBucketNameException { if ( name == null ) { throw new InvalidBucketNameException ( NULL_STRING , "null bucket name" ) ; } if ( name . length ( ) < 3 || name . length ( ) > 63 ) { String msg = "bucket name must be at least 3 and no more than 63 characters long" ; throw new InvalidBucketNameException ( name , msg ) ; } if ( name . matches ( "\\.\\." ) ) { String msg = "bucket name cannot contain successive periods. For more information refer " + "http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html" ; throw new InvalidBucketNameException ( name , msg ) ; } if ( ! name . matches ( "^[a-z0-9][a-z0-9\\.\\-]+[a-z0-9]$" ) ) { String msg = "bucket name does not follow Amazon S3 standards. For more information refer " + "http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html" ; throw new InvalidBucketNameException ( name , msg ) ; } }
validates if given bucket name is dns compatible .
