From 82b0de598c307eb6ae6e3625ed9e07ee50a7cbea Mon Sep 17 00:00:00 2001 From: dfirova <93149631+dfirova@users.noreply.github.com> Date: Wed, 5 Oct 2022 17:42:16 +0300 Subject: [PATCH] samples(fix): bug fix, wrong projectId. (#575) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://togithub.com/googleapis/java-retail/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes # ☕️ If you write sample code, please follow the [samples format]( https://togithub.com/GoogleCloudPlatform/java-docs-samples/blob/main/SAMPLE_FORMAT.md). --- .../src/main/java/product/CrudProduct.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/retail/interactive-tutorials/src/main/java/product/CrudProduct.java b/retail/interactive-tutorials/src/main/java/product/CrudProduct.java index c40183016cc..16d98723219 100644 --- a/retail/interactive-tutorials/src/main/java/product/CrudProduct.java +++ b/retail/interactive-tutorials/src/main/java/product/CrudProduct.java @@ -21,6 +21,7 @@ package product; import com.google.api.gax.rpc.NotFoundException; +import com.google.cloud.ServiceOptions; import com.google.cloud.retail.v2.CreateProductRequest; import com.google.cloud.retail.v2.DeleteProductRequest; import com.google.cloud.retail.v2.GetProductRequest; @@ -37,7 +38,7 @@ public class CrudProduct { public static void main(String[] args) throws IOException { // TODO(developer): Set projectId to your Google Cloud Platform project ID. - String projectId = "my-project"; + String projectId = ServiceOptions.getDefaultProjectId(); String generatedProductId = UUID.randomUUID().toString(); String branchName = String.format(