diff --git a/samples/snippets/src/main/java/com/example/spanner/v2/CreateDatabaseWithDefaultLeaderSample.java b/samples/snippets/src/main/java/com/example/spanner/v2/CreateDatabaseWithDefaultLeaderSample.java index becc921cc33..89e9fc7e8ed 100644 --- a/samples/snippets/src/main/java/com/example/spanner/v2/CreateDatabaseWithDefaultLeaderSample.java +++ b/samples/snippets/src/main/java/com/example/spanner/v2/CreateDatabaseWithDefaultLeaderSample.java @@ -32,7 +32,7 @@ public class CreateDatabaseWithDefaultLeaderSample { static void createDatabaseWithDefaultLeader() throws IOException { // TODO(developer): Replace these variables before running the sample. - final String instanceName = "my-instance-name"; + final String instanceName = "projects/my-project/instances/my-instance-id"; final String databaseId = "my-database-name"; final String defaultLeader = "my-default-leader"; createDatabaseWithDefaultLeader(instanceName, databaseId, defaultLeader); diff --git a/samples/snippets/src/main/java/com/example/spanner/v2/CreateInstanceExample.java b/samples/snippets/src/main/java/com/example/spanner/v2/CreateInstanceExample.java index 7da3b4cde94..d77ca83adf5 100644 --- a/samples/snippets/src/main/java/com/example/spanner/v2/CreateInstanceExample.java +++ b/samples/snippets/src/main/java/com/example/spanner/v2/CreateInstanceExample.java @@ -18,7 +18,6 @@ //[START spanner_create_instance] import com.google.api.gax.longrunning.OperationFuture; -import com.google.cloud.spanner.SpannerExceptionFactory; import com.google.cloud.spanner.admin.instance.v1.InstanceAdminClient; import com.google.cloud.spanner.admin.instance.v1.InstanceAdminSettings; import com.google.spanner.admin.instance.v1.CreateInstanceMetadata; @@ -72,10 +71,8 @@ static void createInstance(String projectId, String instanceId) throws IOExcepti System.out.printf( "Error: Creating instance %s failed with error message %s%n", instance.getName(), e.getMessage()); - throw SpannerExceptionFactory.asSpannerException(e); } catch (InterruptedException e) { System.out.println("Error: Waiting for createInstance operation to finish was interrupted"); - throw SpannerExceptionFactory.propagateInterrupt(e); } } } diff --git a/samples/snippets/src/test/java/com/example/spanner/v2/CreateInstanceSampleIT.java b/samples/snippets/src/test/java/com/example/spanner/v2/CreateInstanceSampleIT.java index 1a37b38df84..60c53ab80eb 100644 --- a/samples/snippets/src/test/java/com/example/spanner/v2/CreateInstanceSampleIT.java +++ b/samples/snippets/src/test/java/com/example/spanner/v2/CreateInstanceSampleIT.java @@ -32,7 +32,7 @@ public void testCreateInstance() throws Exception { // Runs sample final String out = SampleRunner.runSample(() -> - CreateInstanceSample.createInstance(projectId, instanceId) + CreateInstanceExample.createInstance(projectId, instanceId) ); assertTrue(