@@ -1303,37 +1303,37 @@ public void testSignUrlWithOptions() throws NoSuchAlgorithmException, InvalidKey
13031303
13041304 @ Test
13051305 public void testSignUrlForBlobWithSpecialChars () throws NoSuchAlgorithmException ,
1306- InvalidKeyException , SignatureException , UnsupportedEncodingException {
1306+ InvalidKeyException , SignatureException , UnsupportedEncodingException {
13071307 // List of chars under test were taken from
13081308 // https://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_reserved_characters
13091309 char [] specialChars =
13101310 new char []{'!' ,'#' ,'$' ,'&' ,'\'' ,'(' ,')' ,'*' ,'+' ,',' ,':' ,';' ,'=' ,'?' ,'@' ,'[' ,']' };
13111311 EasyMock .replay (storageRpcMock );
13121312 ServiceAccountAuthCredentials authCredentials =
1313- ServiceAccountAuthCredentials .createFor (ACCOUNT , privateKey );
1313+ ServiceAccountAuthCredentials .createFor (ACCOUNT , privateKey );
13141314 storage = options .toBuilder ().authCredentials (authCredentials ).build ().service ();
13151315
13161316 for (char specialChar : specialChars ) {
13171317 String blobName = "/a" + specialChar + "b" ;
13181318 URL url =
1319- storage .signUrl (BlobInfo .builder (BUCKET_NAME1 , blobName ).build (), 14 , TimeUnit .DAYS );
1319+ storage .signUrl (BlobInfo .builder (BUCKET_NAME1 , blobName ).build (), 14 , TimeUnit .DAYS );
13201320 String escapedBlobName = UrlEscapers .urlPathSegmentEscaper ().escape (blobName );
13211321 String stringUrl = url .toString ();
13221322 String expectedUrl = new StringBuilder ("https://storage.googleapis.com/" ).append (BUCKET_NAME1 )
1323- .append (escapedBlobName ).append ("?GoogleAccessId=" ).append (ACCOUNT ).append ("&Expires=" )
1324- .append (42L + 1209600 ).append ("&Signature=" ).toString ();
1323+ .append (escapedBlobName ).append ("?GoogleAccessId=" ).append (ACCOUNT ).append ("&Expires=" )
1324+ .append (42L + 1209600 ).append ("&Signature=" ).toString ();
13251325 assertTrue (stringUrl .startsWith (expectedUrl ));
13261326 String signature = stringUrl .substring (expectedUrl .length ());
13271327
13281328 StringBuilder signedMessageBuilder = new StringBuilder ();
13291329 signedMessageBuilder .append (HttpMethod .GET ).append ("\n \n \n " ).append (42L + 1209600 )
1330- .append ("\n /" ).append (BUCKET_NAME1 ).append (escapedBlobName );
1330+ .append ("\n /" ).append (BUCKET_NAME1 ).append (escapedBlobName );
13311331
13321332 Signature signer = Signature .getInstance ("SHA256withRSA" );
13331333 signer .initVerify (publicKey );
13341334 signer .update (signedMessageBuilder .toString ().getBytes (UTF_8 ));
13351335 assertTrue (signer .verify (BaseEncoding .base64 ().decode (
1336- URLDecoder .decode (signature , UTF_8 .name ()))));
1336+ URLDecoder .decode (signature , UTF_8 .name ()))));
13371337 }
13381338 }
13391339
0 commit comments