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

[Storage/nio] Update variable naming. #4199

Merged
merged 1 commit into from
Dec 7, 2018
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
Original file line number Diff line number Diff line change
Expand Up @@ -907,11 +907,11 @@ public boolean requesterPays(String bucketName) {
// instead of true/false, this method returns true/null.
Boolean isRP = storage.get(bucketName).requesterPays();
return isRP != null && isRP.booleanValue();
} catch (StorageException sex) {
if (sex.getCode() == 400 && sex.getMessage().contains("Bucket is requester pays")) {
} catch (StorageException ex) {
if (ex.getCode() == 400 && ex.getMessage().contains("Bucket is requester pays")) {
return true;
}
throw sex;
throw ex;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ public void testFileExistsRequesterPaysNoUserProject() throws IOException {
// fails because we must pay for every access, including metadata.
Files.exists(path);
Assert.fail("It should have thrown an exception.");
} catch (StorageException sex) {
assertIsRequesterPaysException("testFileExistsRequesterPaysNoUserProject", sex);
} catch (StorageException ex) {
assertIsRequesterPaysException("testFileExistsRequesterPaysNoUserProject", ex);
}
}

Expand Down Expand Up @@ -196,8 +196,8 @@ public void testCantCreateWithoutUserProject() throws IOException {
// fails
Files.write(path, "I would like to write".getBytes());
Assert.fail("It should have thrown an exception.");
} catch (StorageException sex) {
assertIsRequesterPaysException("testCantCreateWithoutUserProject", sex);
} catch (StorageException ex) {
assertIsRequesterPaysException("testCantCreateWithoutUserProject", ex);
}
}

Expand All @@ -218,8 +218,8 @@ public void testCantReadWithoutUserProject() throws IOException {
// fails
Files.readAllBytes(path);
Assert.fail("It should have thrown an exception.");
} catch (StorageException sex) {
assertIsRequesterPaysException("testCantReadWithoutUserProject", sex);
} catch (StorageException ex) {
assertIsRequesterPaysException("testCantReadWithoutUserProject", ex);
}
}

Expand Down Expand Up @@ -269,8 +269,8 @@ private void innerTestCantCopyWithoutUserProject(
description,
hex.getMessage()
.contains("Bucket is requester pays bucket but no user project provided"));
} catch (StorageException sex) {
assertIsRequesterPaysException(description, sex);
} catch (StorageException ex) {
assertIsRequesterPaysException(description, ex);
}
}

Expand Down Expand Up @@ -317,11 +317,11 @@ public void testAutodetectWhenNotRequesterPays() throws IOException {
"");
}

private void assertIsRequesterPaysException(String message, StorageException sex) {
Assert.assertEquals(message, sex.getCode(), 400);
private void assertIsRequesterPaysException(String message, StorageException ex) {
Assert.assertEquals(message, ex.getCode(), 400);
Assert.assertTrue(
message,
sex.getMessage().contains("Bucket is requester pays bucket but no user project provided"));
ex.getMessage().contains("Bucket is requester pays bucket but no user project provided"));
}

// End of tests related to the "requester pays" feature
Expand Down