Skip to content

NullPointerException in TransactionExceptionHandler #2256

Description

@cmaan

Starting with google-cloud-datastore:1.2.1, a user exception thrown within a datastore transaction (runInTransaction) triggers a NullPointerException in com.google.cloud.datastore.TransactionExceptionHandler. The original exception is swallowed.

For reference, a minimal build.gradle which triggers the problem on gradle run is:

import com.google.cloud.datastore.DatastoreOptions;
buildscript {
repositories {
mavenCentral()
maven {
url "https://jitpack.io"
}
}
dependencies {
//classpath "com.google.cloud:google-cloud-datastore:1.2.0" // works
classpath "com.google.cloud:google-cloud-datastore:1.2.1" // breaks
//classpath "com.google.cloud:google-cloud-datastore:1.2.2" // breaks
//classpath "com.github.GoogleCloudPlatform.google-cloud-java:google-cloud-datastore:95f0dd7eb3b7b360ce51b1930c1f75cc2bb91140" // breaks
}
}
task run() {
def ds = DatastoreOptions.newBuilder()
.build()
.getService();
ds.runInTransaction({ rw ->
throw new RuntimeException("foobar");
});
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions