File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
src/main/java/b2SdkExamples Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,10 @@ public static void main(String... args) throws B2Exception {
19
19
// B2StorageClient client = B2StorageClientFactory.createDefaultFactory().create(USER_AGENT);
20
20
//set up B2 CLI
21
21
//and then use b2 get-account-info to get applicationKeyId and applicationKey to fill in here and run
22
- B2StorageClient client = B2StorageClientFactory .createDefaultFactory ().create (APPLICATION_KEY_ID , APPLICATION_KEY , USER_AGENT );
23
- B2ListBucketsResponse b2ListBucketsResponse = client .listBuckets ();
22
+ B2ListBucketsResponse b2ListBucketsResponse ;
23
+ try (B2StorageClient client = B2StorageClientFactory .createDefaultFactory ().create (APPLICATION_KEY_ID , APPLICATION_KEY , USER_AGENT )) {
24
+ b2ListBucketsResponse = client .listBuckets ();
25
+ }
24
26
List <B2Bucket > buckets = b2ListBucketsResponse .getBuckets ();
25
27
System .out .println ("buckets.size() is: " + buckets .size ());
26
28
for (B2Bucket b2Bucket : buckets ) {
You can’t perform that action at this time.
0 commit comments