Closed
@sebright

Description

InstanceId.equals threw a NullPointerException when I accidentally set the project to null. I would have expected the exception to be thrown earlier, in the factory method.

Code example

@Test
public void test() {
  InstanceId instance1 = InstanceId.of("project", "instance-1");
  InstanceId instance2 = InstanceId.of(null, "instance-2");
  System.out.println(instance1.equals(instance2));
}

Stack trace

java.lang.NullPointerException
	at com.google.cloud.spanner.InstanceId.equals(InstanceId.java:66)
...

EDIT: I used google-cloud-spanner version 1.52.0.