Skip to content

Commit d281046

Browse files
committed
build: fix windows related builds
1 parent 45b1185 commit d281046

7 files changed

Lines changed: 9 additions & 17 deletions

File tree

google-cloud-storage/src/main/java/com/google/cloud/storage/Bucket.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,9 +1140,8 @@ public boolean deleteDefaultAcl(Entity entity) {
11401140
*
11411141
* @return {@code true} if the bucket lifecycle rules were deleted.
11421142
* @throws StorageException upon failure
1143-
* @throws IOException
11441143
*/
1145-
public boolean deleteLifecycleRules() throws IOException {
1144+
public boolean deleteLifecycleRules() {
11461145
return storage.deleteLifecycleRules(getName());
11471146
}
11481147

google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import com.google.common.collect.Iterables;
3737
import com.google.common.collect.Lists;
3838
import com.google.common.io.BaseEncoding;
39-
import java.io.IOException;
4039
import java.io.InputStream;
4140
import java.io.Serializable;
4241
import java.net.URL;
@@ -2861,9 +2860,8 @@ Blob create(
28612860
* @param bucket name of the bucket.
28622861
* @return {@code true} if the bucket lifecycle rules were deleted.
28632862
* @throws StorageException upon failure
2864-
* @throws IOException
28652863
*/
2866-
boolean deleteLifecycleRules(String bucket) throws IOException;
2864+
boolean deleteLifecycleRules(String bucket);
28672865

28682866
/**
28692867
* Creates a new default blob ACL entry on the specified bucket.

google-cloud-storage/src/main/java/com/google/cloud/storage/StorageImpl.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@
4040
import com.google.api.services.storage.model.StorageObject;
4141
import com.google.api.services.storage.model.TestIamPermissionsResponse;
4242
import com.google.auth.ServiceAccountSigner;
43-
import com.google.auth.oauth2.GoogleCredentials;
44-
import com.google.auth.oauth2.ServiceAccountCredentials;
4543
import com.google.cloud.BaseService;
4644
import com.google.cloud.BatchResult;
4745
import com.google.cloud.PageImpl;
@@ -68,7 +66,6 @@
6866
import com.google.common.io.BaseEncoding;
6967
import com.google.common.primitives.Ints;
7068
import java.io.ByteArrayInputStream;
71-
import java.io.IOException;
7269
import java.io.InputStream;
7370
import java.io.UnsupportedEncodingException;
7471
import java.net.MalformedURLException;
@@ -1022,16 +1019,15 @@ public Boolean call() {
10221019
}
10231020

10241021
@Override
1025-
public boolean deleteLifecycleRules(final String bucket) throws IOException {
1022+
public boolean deleteLifecycleRules(final String bucket) {
10261023
final com.google.api.services.storage.model.Bucket bucketPb = BucketInfo.of(bucket).toPb();
1027-
final ServiceAccountCredentials serviceAccount =
1028-
(ServiceAccountCredentials) GoogleCredentials.getApplicationDefault();
1024+
final ServiceAccount serviceAccount = getServiceAccount(getOptions().getProjectId());
10291025
try {
10301026
return runWithRetries(
10311027
new Callable<Boolean>() {
10321028
@Override
10331029
public Boolean call() {
1034-
return storageRpc.deleteLifecycleRules(bucketPb, serviceAccount.getClientEmail());
1030+
return storageRpc.deleteLifecycleRules(bucketPb, serviceAccount.getEmail());
10351031
}
10361032
},
10371033
getOptions().getRetrySettings(),

google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/StorageRpc.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import com.google.cloud.ServiceRpc;
3131
import com.google.cloud.Tuple;
3232
import com.google.cloud.storage.StorageException;
33-
import java.io.IOException;
3433
import java.io.InputStream;
3534
import java.io.OutputStream;
3635
import java.util.List;
@@ -261,7 +260,6 @@ public int hashCode() {
261260
*
262261
* @return {@code true} if the bucket lifecycle rules were deleted.
263262
* @throws StorageException upon failure
264-
* @throws IOException
265263
*/
266264
boolean deleteLifecycleRules(Bucket bucket, String serviceAccount);
267265

google-cloud-storage/src/test/java/com/google/cloud/storage/BucketTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
import com.google.common.collect.Lists;
4646
import com.google.common.io.BaseEncoding;
4747
import java.io.ByteArrayInputStream;
48-
import java.io.IOException;
4948
import java.io.InputStream;
5049
import java.security.Key;
5150
import java.util.Collections;
@@ -705,7 +704,7 @@ public void testDeleteDefaultAcl() throws Exception {
705704
}
706705

707706
@Test
708-
public void testDeleteLifecycleRules() throws IOException {
707+
public void testDeleteLifecycleRules() {
709708
expect(storage.getOptions()).andReturn(mockOptions).times(1);
710709
expect(storage.deleteLifecycleRules(BUCKET_INFO.getName())).andReturn(true);
711710
replay(storage);

google-cloud-storage/src/test/java/com/google/cloud/storage/StorageImplTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2721,6 +2721,8 @@ public void testDeleteDefaultBucketAcl() {
27212721

27222722
@Test
27232723
public void testDeleteLifecyclesRulesOfBucket() throws IOException {
2724+
EasyMock.expect(storageRpcMock.getServiceAccount("projectId"))
2725+
.andReturn(SERVICE_ACCOUNT.toPb());
27242726
EasyMock.expect(
27252727
storageRpcMock.deleteLifecycleRules(
27262728
EasyMock.isA(com.google.api.services.storage.model.Bucket.class),

google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITStorageTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2968,7 +2968,7 @@ public void testDeleteLifecycleRules()
29682968
bucket =
29692969
storage.get(lifeCycleRuleBucket, BucketGetOption.fields(Storage.BucketField.values()));
29702970
assertNull(bucket.getLifecycleRules());
2971-
} catch (StorageException | IOException ex) {
2971+
} catch (StorageException ex) {
29722972
throw ex;
29732973
} finally {
29742974
RemoteStorageHelper.forceDelete(storage, lifeCycleRuleBucket, 5, TimeUnit.SECONDS);

0 commit comments

Comments
 (0)