File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public final class BackupId {
3030
private final String backup;
3131

3232
BackupId(InstanceId instanceId, String backup) {
33-
this.instanceId = instanceId;
34-
this.backup = backup;
33+
this.instanceId = Preconditions.checkNotNull(instanceId);
34+
this.backup = Preconditions.checkNotNull(backup);
3535
}
3636

3737
/** Returns the instance id for this backup. */
@@ -81,6 +81,7 @@ public String toString() {
8181
* @throws IllegalArgumentException if {@code name} does not conform to the expected pattern
8282
*/
8383
static BackupId of(String name) {
84+
Preconditions.checkNotNull(name);
8485
Map<String, String> parts = NAME_TEMPLATE.match(name);
8586
Preconditions.checkArgument(
8687
parts != null, "Name should conform to pattern %s: %s", NAME_TEMPLATE, name);
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public final class DatabaseId {
3131
private final String database;
3232

3333
DatabaseId(InstanceId instanceId, String database) {
34-
this.instanceId = instanceId;
35-
this.database = database;
34+
this.instanceId = Preconditions.checkNotNull(instanceId);
35+
this.database = Preconditions.checkNotNull(database);
3636
}
3737

3838
/** Returns the instance id for this databse. */
@@ -82,6 +82,7 @@ public String toString() {
8282
* @throws IllegalArgumentException if {@code name} does not conform to the expected pattern
8383
*/
8484
static DatabaseId of(String name) {
85+
Preconditions.checkNotNull(name);
8586
Map<String, String> parts = NAME_TEMPLATE.match(name);
8687
Preconditions.checkArgument(
8788
parts != null, "Name should conform to pattern %s: %s", NAME_TEMPLATE, name);
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public final class InstanceConfigId {
3030
private final String instanceConfig;
3131

3232
InstanceConfigId(String project, String instanceConfig) {
33-
this.project = project;
34-
this.instanceConfig = instanceConfig;
33+
this.project = Preconditions.checkNotNull(project);
34+
this.instanceConfig = Preconditions.checkNotNull(instanceConfig);
3535
}
3636

3737
/** Returns project of this instane config. */
@@ -80,6 +80,7 @@ public String toString() {
8080
* pattern.
8181
*/
8282
static InstanceConfigId of(String name) {
83+
Preconditions.checkNotNull(name);
8384
Map<String, String> parts = NAME_TEMPLATE.match(name);
8485
Preconditions.checkArgument(
8586
parts != null, "Name should confirm to pattern %s: %s", NAME_TEMPLATE, name);
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public final class InstanceId {
3030
private final String instance;
3131

3232
InstanceId(String project, String instance) {
33-
this.project = project;
34-
this.instance = instance;
33+
this.project = Preconditions.checkNotNull(project);
34+
this.instance = Preconditions.checkNotNull(instance);
3535
}
3636

3737
/** Returns the instance ID. */
@@ -79,6 +79,7 @@ public String toString() {
7979
* pattern.
8080
*/
8181
static InstanceId of(String name) {
82+
Preconditions.checkNotNull(name);
8283
Map<String, String> parts = NAME_TEMPLATE.match(name);
8384
Preconditions.checkArgument(
8485
parts != null, "Name should conform to pattern %s: %s", NAME_TEMPLATE, name);
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,12 @@ static class SessionId {
4444
private final String name;
4545

4646
private SessionId(DatabaseId db, String name) {
47-
this.db = db;
48-
this.name = name;
47+
this.db = Preconditions.checkNotNull(db);
48+
this.name = Preconditions.checkNotNull(name);
4949
}
5050

5151
static SessionId of(String name) {
52+
Preconditions.checkNotNull(name);
5253
Map<String, String> parts = NAME_TEMPLATE.match(name);
5354
Preconditions.checkArgument(
5455
parts != null, "Name should conform to pattern %s: %s", NAME_TEMPLATE, name);

0 commit comments

Comments
 (0)