@@ -317,6 +317,9 @@ void populateCondition(Rule.Condition condition) {
317
317
}
318
318
}
319
319
320
+ /**
321
+ * Builder for {@code BucketInfo}.
322
+ */
320
323
public abstract static class Builder {
321
324
/**
322
325
* Sets the bucket's name.
@@ -425,7 +428,9 @@ static final class BuilderImpl extends Builder {
425
428
private List <Acl > acl ;
426
429
private List <Acl > defaultAcl ;
427
430
428
- BuilderImpl () {}
431
+ BuilderImpl (String name ) {
432
+ this .name = name ;
433
+ }
429
434
430
435
BuilderImpl (BucketInfo bucketInfo ) {
431
436
id = bucketInfo .id ;
@@ -714,7 +719,7 @@ public int hashCode() {
714
719
715
720
@ Override
716
721
public boolean equals (Object obj ) {
717
- return obj .getClass ().equals (BucketInfo .class )
722
+ return obj != null && obj .getClass ().equals (BucketInfo .class )
718
723
&& Objects .equals (toPb (), ((BucketInfo ) obj ).toPb ());
719
724
}
720
725
@@ -799,11 +804,11 @@ public static BucketInfo of(String name) {
799
804
* Returns a {@code BucketInfo} builder where the bucket's name is set to the provided name.
800
805
*/
801
806
public static Builder builder (String name ) {
802
- return new BuilderImpl (). name ( name );
807
+ return new BuilderImpl (name );
803
808
}
804
809
805
810
static BucketInfo fromPb (com .google .api .services .storage .model .Bucket bucketPb ) {
806
- Builder builder = new BuilderImpl (). name ( bucketPb .getName ());
811
+ Builder builder = new BuilderImpl (bucketPb .getName ());
807
812
if (bucketPb .getId () != null ) {
808
813
builder .id (bucketPb .getId ());
809
814
}
0 commit comments