diff --git a/samples/snippets/src/main/java/com/example/storage/bucket/CreateBucketPubSubNotification.java b/samples/snippets/src/main/java/com/example/storage/bucket/CreateBucketPubSubNotification.java index f68f0e2fa..da2b3b3d1 100644 --- a/samples/snippets/src/main/java/com/example/storage/bucket/CreateBucketPubSubNotification.java +++ b/samples/snippets/src/main/java/com/example/storage/bucket/CreateBucketPubSubNotification.java @@ -58,7 +58,8 @@ public static void createBucketPubSubNotification( .setPayloadFormat(payloadFormat) .build(); Notification notification = storage.createNotification(bucketName, notificationInfo); - System.out.println("Successfully created notification for topic " + notification.getTopic()); + String topic = notification.getTopic(); + System.out.println("Successfully created notification for topic " + topic); } } // [END storage_create_bucket_notifications]