From 3629584949ad2cbaa88bedcfc0edb5b496cceea3 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 3 Mar 2022 02:42:33 +0100 Subject: [PATCH 1/6] chore(deps): update dependency com.google.cloud:libraries-bom to v24.4.0 (#837) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud:libraries-bom](https://cloud.google.com/java/docs/bom) ([source](https://togithub.com/GoogleCloudPlatform/cloud-opensource-java)) | `24.3.0` -> `24.4.0` | [![age](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/24.4.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/24.4.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/24.4.0/compatibility-slim/24.3.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/com.google.cloud:libraries-bom/24.4.0/confidence-slim/24.3.0)](https://docs.renovatebot.com/merge-confidence/) | --- ### Configuration 📅 **Schedule**: At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/java-storage-nio). --- samples/snippets/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 48f6e235..a2532575 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -30,7 +30,7 @@ com.google.cloud libraries-bom - 24.3.0 + 24.4.0 pom import From 6a2262b0101ae215fb063099ee98d21c85f5a598 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 3 Mar 2022 02:08:23 +0000 Subject: [PATCH 2/6] chore(main): release 0.123.23-SNAPSHOT (#839) :robot: I have created a release *beep* *boop* --- ### Updating meta-information for bleeding-edge SNAPSHOT release. --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- google-cloud-nio-examples/pom.xml | 4 ++-- google-cloud-nio-retrofit/pom.xml | 4 ++-- google-cloud-nio/pom.xml | 4 ++-- pom.xml | 2 +- samples/snapshot/pom.xml | 2 +- versions.txt | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/google-cloud-nio-examples/pom.xml b/google-cloud-nio-examples/pom.xml index 2184c7ce..d059782d 100644 --- a/google-cloud-nio-examples/pom.xml +++ b/google-cloud-nio-examples/pom.xml @@ -2,7 +2,7 @@ 4.0.0 google-cloud-nio-examples - 0.123.22 + 0.123.23-SNAPSHOT jar Google Cloud NIO Examples https://github.com/googleapis/java-storage-nio @@ -13,7 +13,7 @@ com.google.cloud google-cloud-nio-parent - 0.123.22 + 0.123.23-SNAPSHOT diff --git a/google-cloud-nio-retrofit/pom.xml b/google-cloud-nio-retrofit/pom.xml index cda0437c..15044102 100644 --- a/google-cloud-nio-retrofit/pom.xml +++ b/google-cloud-nio-retrofit/pom.xml @@ -2,7 +2,7 @@ 4.0.0 google-cloud-nio-retrofit - 0.123.22 + 0.123.23-SNAPSHOT jar Google Cloud NIO Retrofit Example https://github.com/googleapis/java-storage-nio @@ -12,7 +12,7 @@ com.google.cloud google-cloud-nio-parent - 0.123.22 + 0.123.23-SNAPSHOT google-cloud-nio-retrofit diff --git a/google-cloud-nio/pom.xml b/google-cloud-nio/pom.xml index 32b38be6..7df83e01 100644 --- a/google-cloud-nio/pom.xml +++ b/google-cloud-nio/pom.xml @@ -2,7 +2,7 @@ 4.0.0 google-cloud-nio - 0.123.22 + 0.123.23-SNAPSHOT jar Google Cloud NIO https://github.com/googleapis/java-storage-nio @@ -12,7 +12,7 @@ com.google.cloud google-cloud-nio-parent - 0.123.22 + 0.123.23-SNAPSHOT google-cloud-nio diff --git a/pom.xml b/pom.xml index 3ee17e36..81c61dd5 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-nio-parent pom - 0.123.22 + 0.123.23-SNAPSHOT Storage Parent https://github.com/googleapis/java-storage-nio diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index f0c15c04..bf17af43 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-nio - 0.123.22 + 0.123.23-SNAPSHOT diff --git a/versions.txt b/versions.txt index 7b2cf5cb..2b8d1e60 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-cloud-nio:0.123.22:0.123.22 \ No newline at end of file +google-cloud-nio:0.123.22:0.123.23-SNAPSHOT \ No newline at end of file From e84e35053eb858cea95ffa4ba77d64ed64e12740 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 3 Mar 2022 21:27:02 +0100 Subject: [PATCH 3/6] chore(deps): update dependency com.google.cloud:google-cloud-nio to v0.123.22 (#842) --- samples/install-without-bom/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index 36e88d25..a9155b0f 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -29,7 +29,7 @@ com.google.cloud google-cloud-nio - 0.123.21 + 0.123.22 From 3c7e095256ab7d62f0758ce4ecfb4ebfbbfc423d Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 3 Mar 2022 15:34:01 -0500 Subject: [PATCH 4/6] chore: fix license header in build.bat (#1363) (#840) * chore: fix license header in build.bat * chore: add disctribution field for setup-java action Source-Link: https://github.com/googleapis/synthtool/commit/4fea5f40a9075f3ba205ede0b453010cf080e194 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:df8d7b2cc0dbc65871e7edd86601901a0612b272fa3f7f0eb590c5c53aa5f92e Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- .github/workflows/samples.yaml | 1 + .kokoro/build.bat | 30 +++++++++++++++--------------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 53941094..3473042c 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest - digest: sha256:e3746f84955528d0fe24bf2e4df89875d6ce5a036af01b9c326d61a38838523a + digest: sha256:df8d7b2cc0dbc65871e7edd86601901a0612b272fa3f7f0eb590c5c53aa5f92e diff --git a/.github/workflows/samples.yaml b/.github/workflows/samples.yaml index de737e92..912ed8b2 100644 --- a/.github/workflows/samples.yaml +++ b/.github/workflows/samples.yaml @@ -23,6 +23,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-java@v3 with: + distribution: zulu java-version: 8 - name: Run checkstyle run: mvn -P lint --quiet --batch-mode checkstyle:check diff --git a/.kokoro/build.bat b/.kokoro/build.bat index cc602c9e..067cf4a4 100644 --- a/.kokoro/build.bat +++ b/.kokoro/build.bat @@ -1,18 +1,18 @@ +:: Copyright 2022 Google LLC +:: +:: Licensed under the Apache License, Version 2.0 (the "License"); +:: you may not use this file except in compliance with the License. +:: You may obtain a copy of the License at +:: +:: http://www.apache.org/licenses/LICENSE-2.0 +:: +:: Unless required by applicable law or agreed to in writing, software +:: distributed under the License is distributed on an "AS IS" BASIS, +:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +:: See the License for the specific language governing permissions and +:: limitations under the License. +:: Github action job to test core java library features on +:: downstream client libraries before they are released. :: See documentation in type-shell-output.bat -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Github action job to test core java library features on -# downstream client libraries before they are released. "C:\Program Files\Git\bin\bash.exe" %~dp0build.sh From 9f30db3ccca16121fc5260334d603f8d272af2d9 Mon Sep 17 00:00:00 2001 From: Sydney Munro <97561403+sydney-munro@users.noreply.github.com> Date: Fri, 4 Mar 2022 12:07:04 -0800 Subject: [PATCH 5/6] fix: Requester pays to check reason and fallback to error message validation (#841) * fix: Requester pays to check reason and fallback to error message validation --- .../nio/CloudStorageFileSystemProvider.java | 5 +++- .../storage/contrib/nio/it/ITGcsNio.java | 27 +++++++------------ 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageFileSystemProvider.java b/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageFileSystemProvider.java index f6a344be..1ad0e08b 100644 --- a/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageFileSystemProvider.java +++ b/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageFileSystemProvider.java @@ -967,7 +967,10 @@ public boolean requesterPays(String bucketName) { Boolean isRP = storage.get(bucketName).requesterPays(); return isRP != null && isRP.booleanValue(); } catch (StorageException ex) { - if (ex.getCode() == 400 && ex.getMessage().contains("Bucket is requester pays")) { + if (ex.getReason().equals("userProjectMissing")) { + return true; + // fallback to checking the error code and error message. + } else if (ex.getCode() == 400 && ex.getMessage().contains("requester pays")) { return true; } throw ex; diff --git a/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/it/ITGcsNio.java b/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/it/ITGcsNio.java index 871c3f94..55a341d4 100644 --- a/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/it/ITGcsNio.java +++ b/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/it/ITGcsNio.java @@ -75,7 +75,6 @@ import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -176,7 +175,6 @@ private static void fillRequesterPaysFile(Storage storage, String fname, int siz // Start of tests related to the "requester pays" feature @Test - @Ignore("TODO: https://github.com/googleapis/java-storage-nio/issues/824") public void testFileExistsRequesterPaysNoUserProject() throws IOException { CloudStorageFileSystem testBucket = getRequesterPaysBucket(false, ""); Path path = testBucket.getPath(SML_FILE); @@ -190,7 +188,6 @@ public void testFileExistsRequesterPaysNoUserProject() throws IOException { } @Test - @Ignore("TODO: https://github.com/googleapis/java-storage-nio/issues/824") public void testFileExistsRequesterPays() throws IOException { CloudStorageFileSystem testBucket = getRequesterPaysBucket(false, project); Path path = testBucket.getPath(SML_FILE); @@ -199,7 +196,6 @@ public void testFileExistsRequesterPays() throws IOException { } @Test - @Ignore("TODO: https://github.com/googleapis/java-storage-nio/issues/824") public void testFileExistsRequesterPaysWithAutodetect() throws IOException { CloudStorageFileSystem testBucket = getRequesterPaysBucket(true, project); Path path = testBucket.getPath(SML_FILE); @@ -208,7 +204,6 @@ public void testFileExistsRequesterPaysWithAutodetect() throws IOException { } @Test - @Ignore("TODO: https://github.com/googleapis/java-storage-nio/issues/824") public void testCantCreateWithoutUserProject() throws IOException { CloudStorageFileSystem testBucket = getRequesterPaysBucket(false, ""); Path path = testBucket.getPath(TMP_FILE); @@ -230,7 +225,6 @@ public void testCanCreateWithUserProject() throws IOException { } @Test - @Ignore("TODO: https://github.com/googleapis/java-storage-nio/issues/824") public void testCantReadWithoutUserProject() throws IOException { CloudStorageFileSystem testBucket = getRequesterPaysBucket(false, ""); Path path = testBucket.getPath(SML_FILE); @@ -252,7 +246,6 @@ public void testCanReadWithUserProject() throws IOException { } @Test - @Ignore("TODO: https://github.com/googleapis/java-storage-nio/issues/824") public void testCantCopyWithoutUserProject() throws IOException { CloudStorageFileSystem testRPBucket = getRequesterPaysBucket(false, ""); CloudStorageFileSystem testBucket = getTestBucket(); @@ -285,10 +278,7 @@ private void innerTestCantCopyWithoutUserProject( // normal StorageException. } catch (HttpResponseException hex) { Assert.assertEquals(description, hex.getStatusCode(), 400); - Assert.assertTrue( - description, - hex.getMessage() - .contains("Bucket is requester pays bucket but no user project provided")); + Assert.assertTrue(description, hex.getMessage().contains("requester pays")); } catch (StorageException ex) { assertIsRequesterPaysException(description, ex); } @@ -314,7 +304,6 @@ public void testCanCopyWithUserProject() throws IOException { } @Test - @Ignore("TODO: https://github.com/googleapis/java-storage-nio/issues/824") public void testAutodetectWhenRequesterPays() throws IOException { CloudStorageFileSystem testRPBucket = getRequesterPaysBucket(true, project); Assert.assertEquals( @@ -338,18 +327,20 @@ public void testAutodetectWhenNotRequesterPays() throws IOException { ""); } + @Test + public void testAutoDetectNoUserProject() throws IOException { + CloudStorageFileSystem testBucket = getRequesterPaysBucket(false, ""); + Assert.assertTrue(testBucket.provider().requesterPays(testBucket.bucket())); + } + private void assertIsRequesterPaysException(String message, StorageException ex) { Assert.assertEquals(message, ex.getCode(), 400); - Assert.assertTrue( - message, - ex.getMessage().contains("Bucket is requester pays bucket but no user project provided")); + Assert.assertTrue(message, ex.getMessage().contains("requester pays")); } private void assertIsRequesterPaysException(String message, IOException ioex) { Assert.assertTrue(message, ioex.getMessage().startsWith("400")); - Assert.assertTrue( - message, - ioex.getMessage().contains("Bucket is requester pays bucket but no user project provided")); + Assert.assertTrue(message, ioex.getMessage().contains("requester pays")); } // End of tests related to the "requester pays" feature From 24a200a70313a1b67e671784e01277a3a565eb58 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Fri, 4 Mar 2022 12:24:46 -0800 Subject: [PATCH 6/6] chore(main): release 0.123.23 (#843) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 7 +++++++ google-cloud-nio-examples/pom.xml | 4 ++-- google-cloud-nio-retrofit/pom.xml | 4 ++-- google-cloud-nio/pom.xml | 4 ++-- pom.xml | 2 +- samples/snapshot/pom.xml | 2 +- versions.txt | 2 +- 7 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e353369..10861dc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [0.123.23](https://github.com/googleapis/java-storage-nio/compare/v0.123.22...v0.123.23) (2022-03-04) + + +### Bug Fixes + +* Requester pays to check reason and fallback to error message validation ([#841](https://github.com/googleapis/java-storage-nio/issues/841)) ([9f30db3](https://github.com/googleapis/java-storage-nio/commit/9f30db3ccca16121fc5260334d603f8d272af2d9)) + ### [0.123.22](https://github.com/googleapis/java-storage-nio/compare/v0.123.21...v0.123.22) (2022-03-02) diff --git a/google-cloud-nio-examples/pom.xml b/google-cloud-nio-examples/pom.xml index d059782d..16e73fc8 100644 --- a/google-cloud-nio-examples/pom.xml +++ b/google-cloud-nio-examples/pom.xml @@ -2,7 +2,7 @@ 4.0.0 google-cloud-nio-examples - 0.123.23-SNAPSHOT + 0.123.23 jar Google Cloud NIO Examples https://github.com/googleapis/java-storage-nio @@ -13,7 +13,7 @@ com.google.cloud google-cloud-nio-parent - 0.123.23-SNAPSHOT + 0.123.23 diff --git a/google-cloud-nio-retrofit/pom.xml b/google-cloud-nio-retrofit/pom.xml index 15044102..2858dc10 100644 --- a/google-cloud-nio-retrofit/pom.xml +++ b/google-cloud-nio-retrofit/pom.xml @@ -2,7 +2,7 @@ 4.0.0 google-cloud-nio-retrofit - 0.123.23-SNAPSHOT + 0.123.23 jar Google Cloud NIO Retrofit Example https://github.com/googleapis/java-storage-nio @@ -12,7 +12,7 @@ com.google.cloud google-cloud-nio-parent - 0.123.23-SNAPSHOT + 0.123.23 google-cloud-nio-retrofit diff --git a/google-cloud-nio/pom.xml b/google-cloud-nio/pom.xml index 7df83e01..8b09c335 100644 --- a/google-cloud-nio/pom.xml +++ b/google-cloud-nio/pom.xml @@ -2,7 +2,7 @@ 4.0.0 google-cloud-nio - 0.123.23-SNAPSHOT + 0.123.23 jar Google Cloud NIO https://github.com/googleapis/java-storage-nio @@ -12,7 +12,7 @@ com.google.cloud google-cloud-nio-parent - 0.123.23-SNAPSHOT + 0.123.23 google-cloud-nio diff --git a/pom.xml b/pom.xml index 81c61dd5..60822a78 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-nio-parent pom - 0.123.23-SNAPSHOT + 0.123.23 Storage Parent https://github.com/googleapis/java-storage-nio diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index bf17af43..9520b29b 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -28,7 +28,7 @@ com.google.cloud google-cloud-nio - 0.123.23-SNAPSHOT + 0.123.23 diff --git a/versions.txt b/versions.txt index 2b8d1e60..b707c847 100644 --- a/versions.txt +++ b/versions.txt @@ -1,4 +1,4 @@ # Format: # module:released-version:current-version -google-cloud-nio:0.123.22:0.123.23-SNAPSHOT \ No newline at end of file +google-cloud-nio:0.123.23:0.123.23 \ No newline at end of file