From 8db5ed3d741f2e8cccd188d009558771b6c89cbe Mon Sep 17 00:00:00 2001 From: Marco Ziccardi Date: Tue, 27 Sep 2016 15:18:21 +0200 Subject: [PATCH] Remove workaround for ObjectAccessControl collections bug (#1283) --- google-cloud-storage/pom.xml | 2 +- .../cloud/storage/spi/DefaultStorageRpc.java | 42 ++----------------- 2 files changed, 5 insertions(+), 39 deletions(-) diff --git a/google-cloud-storage/pom.xml b/google-cloud-storage/pom.xml index f43e772d278d..3e700aa0f1b7 100644 --- a/google-cloud-storage/pom.xml +++ b/google-cloud-storage/pom.xml @@ -25,7 +25,7 @@ com.google.apis google-api-services-storage - v1-rev82-1.22.0 + v1-rev85-1.22.0 compile diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/DefaultStorageRpc.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/DefaultStorageRpc.java index 5620b333ed34..54e4447ebff5 100644 --- a/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/DefaultStorageRpc.java +++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/spi/DefaultStorageRpc.java @@ -93,32 +93,6 @@ public class DefaultStorageRpc implements StorageRpc { private final Storage storage; private static final long MEGABYTE = 1024L * 1024L; - private static final Function FROM_OBJECT_TO_ACL_FUNCTION = - new Function() { - @Override - @SuppressWarnings("unchecked") - public ObjectAccessControl apply(Object obj) { - ObjectAccessControl acl = new ObjectAccessControl(); - Map map = (Map) obj; - for (Map.Entry entry : map.entrySet()) { - String key = entry.getKey(); - switch (key) { - case "projectTeam": - ObjectAccessControl.ProjectTeam projectTeam = new ObjectAccessControl.ProjectTeam(); - projectTeam.putAll((Map) entry.getValue()); - acl.set(key, projectTeam); - break; - case "generation": - acl.set(entry.getKey(), Long.parseLong((String) entry.getValue())); - break; - default: - acl.set(entry.getKey(), entry.getValue()); - break; - } - } - return acl; - } - }; public DefaultStorageRpc(StorageOptions options) { HttpTransport transport = options.httpTransportFactory().create(); @@ -785,11 +759,7 @@ public ObjectAccessControl patchDefaultAcl(ObjectAccessControl acl) { @Override public List listDefaultAcls(String bucket) { try { - // TODO(mziccard) remove when https://github.com/google/google-api-java-client/issues/1022 is - // fixed - return Lists.transform( - storage.defaultObjectAccessControls().list(bucket).execute().getItems(), - FROM_OBJECT_TO_ACL_FUNCTION); + return storage.defaultObjectAccessControls().list(bucket).execute().getItems(); } catch (IOException ex) { throw translate(ex); } @@ -852,13 +822,9 @@ public ObjectAccessControl patchAcl(ObjectAccessControl acl) { @Override public List listAcls(String bucket, String object, Long generation) { try { - // TODO(mziccard) remove when https://github.com/google/google-api-java-client/issues/1022 is - // fixed - return Lists.transform( - storage.objectAccessControls().list(bucket, object) - .setGeneration(generation) - .execute().getItems(), - FROM_OBJECT_TO_ACL_FUNCTION); + return storage.objectAccessControls().list(bucket, object) + .setGeneration(generation) + .execute().getItems(); } catch (IOException ex) { throw translate(ex); }