Skip to content

Commit 18cbb77

Browse files
author
Ajay Kannan
committed
style fix
1 parent af94b53 commit 18cbb77

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

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

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import static java.nio.charset.StandardCharsets.UTF_8;
3232

3333
import com.google.api.services.storage.model.StorageObject;
34-
import com.google.auth.oauth2.GoogleCredentials;
3534
import com.google.auth.oauth2.ServiceAccountCredentials;
3635
import com.google.common.base.Function;
3736
import com.google.common.base.Functions;
@@ -43,7 +42,6 @@
4342
import com.google.common.hash.Hashing;
4443
import com.google.common.io.BaseEncoding;
4544
import com.google.common.primitives.Ints;
46-
import com.google.gcloud.AuthCredentials;
4745
import com.google.gcloud.AuthCredentials.ServiceAccountAuthCredentials;
4846
import com.google.gcloud.BaseService;
4947
import com.google.gcloud.ExceptionHandler;
@@ -562,18 +560,16 @@ public URL signUrl(BlobInfo blobInfo, long duration, TimeUnit unit, SignUrlOptio
562560
for (SignUrlOption option : options) {
563561
optionMap.put(option.option(), option.value());
564562
}
565-
ServiceAccountAuthCredentials serviceAccountAuthCred =
563+
ServiceAccountAuthCredentials authCred =
566564
(ServiceAccountAuthCredentials) optionMap.get(SignUrlOption.Option.SERVICE_ACCOUNT_CRED);
567-
ServiceAccountCredentials cred = (ServiceAccountCredentials) (serviceAccountAuthCred != null
568-
? serviceAccountAuthCred.credentials() : null);
569-
if (serviceAccountAuthCred == null) {
570-
AuthCredentials authCred = this.options().authCredentials();
571-
GoogleCredentials serviceCred =
572-
authCred != null ? authCred.credentials() : null;
565+
ServiceAccountCredentials cred =
566+
(ServiceAccountCredentials) (authCred != null ? authCred.credentials() : null);
567+
if (authCred == null) {
573568
checkArgument(
574-
serviceCred instanceof ServiceAccountCredentials,
569+
this.options().authCredentials() != null
570+
&& this.options().authCredentials().credentials() instanceof ServiceAccountCredentials,
575571
"Signing key was not provided and could not be derived");
576-
cred = (ServiceAccountCredentials) serviceCred;
572+
cred = (ServiceAccountCredentials) this.options().authCredentials().credentials();
577573
}
578574
// construct signature - see https://cloud.google.com/storage/docs/access-control#Signed-URLs
579575
StringBuilder stBuilder = new StringBuilder();

0 commit comments

Comments
 (0)