Skip to content

Commit

Permalink
chore: address comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
arpan14 committed Jan 3, 2024
1 parent 922f47b commit 0bf6f87
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 0bf6f87

Please sign in to comment.