Skip to content

Commit

Permalink
Remove workaround for ObjectAccessControl collections bug (#1283)
Browse files Browse the repository at this point in the history
  • Loading branch information
mziccard authored Sep 27, 2016
1 parent dba9ca9 commit 8db5ed3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 39 deletions.
2 changes: 1 addition & 1 deletion google-cloud-storage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-storage</artifactId>
<version>v1-rev82-1.22.0</version>
<version>v1-rev85-1.22.0</version>
<scope>compile</scope>
<exclusions>
<exclusion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,32 +93,6 @@ public class DefaultStorageRpc implements StorageRpc {
private final Storage storage;

private static final long MEGABYTE = 1024L * 1024L;
private static final Function<Object, ObjectAccessControl> FROM_OBJECT_TO_ACL_FUNCTION =
new Function<Object, ObjectAccessControl>() {
@Override
@SuppressWarnings("unchecked")
public ObjectAccessControl apply(Object obj) {
ObjectAccessControl acl = new ObjectAccessControl();
Map<String, ?> map = (Map<String, ?>) obj;
for (Map.Entry<String, ?> entry : map.entrySet()) {
String key = entry.getKey();
switch (key) {
case "projectTeam":
ObjectAccessControl.ProjectTeam projectTeam = new ObjectAccessControl.ProjectTeam();
projectTeam.putAll((Map<String, ?>) 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();
Expand Down Expand Up @@ -785,11 +759,7 @@ public ObjectAccessControl patchDefaultAcl(ObjectAccessControl acl) {
@Override
public List<ObjectAccessControl> 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);
}
Expand Down Expand Up @@ -852,13 +822,9 @@ public ObjectAccessControl patchAcl(ObjectAccessControl acl) {
@Override
public List<ObjectAccessControl> 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);
}
Expand Down

0 comments on commit 8db5ed3

Please sign in to comment.