Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove workaround for ObjectAccessControl collections bug #1283

Merged
merged 1 commit into from
Sep 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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