You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: java-datastore/datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/it/ITDatastoreProtoClientTest.java
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -139,6 +139,9 @@ private static <V> V runWithRetry(
139
139
returnsubmittedFuture.get();
140
140
} catch (ExecutionExceptione) {
141
141
Throwablecause = e.getCause();
142
+
// submittedFuture.get() wraps any exception thrown during execution in an ExecutionException.
143
+
// We unwrap and rethrow the actual cause (Exception or Error) directly so that test failures
144
+
// report the root cause (e.g., DatastoreException or AssertionError) instead of the wrapper.
142
145
if (causeinstanceofException) {
143
146
throw (Exception) cause;
144
147
}
@@ -147,6 +150,7 @@ private static <V> V runWithRetry(
147
150
}
148
151
throwe;
149
152
} catch (InterruptedExceptione) {
153
+
// Restore the interrupted status before rethrowing, as per Java concurrency best practices.
Copy file name to clipboardExpand all lines: java-datastore/google-cloud-datastore-utils/src/test/java/com/google/datastore/utils/it/ITDatastoreProtoClientTest.java
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -135,6 +135,9 @@ private static <V> V runWithRetry(
135
135
returnsubmittedFuture.get();
136
136
} catch (ExecutionExceptione) {
137
137
Throwablecause = e.getCause();
138
+
// submittedFuture.get() wraps any exception thrown during execution in an ExecutionException.
139
+
// We unwrap and rethrow the actual cause (Exception or Error) directly so that test failures
140
+
// report the root cause (e.g., DatastoreException or AssertionError) instead of the wrapper.
138
141
if (causeinstanceofException) {
139
142
throw (Exception) cause;
140
143
}
@@ -143,6 +146,7 @@ private static <V> V runWithRetry(
143
146
}
144
147
throwe;
145
148
} catch (InterruptedExceptione) {
149
+
// Restore the interrupted status before rethrowing, as per Java concurrency best practices.
0 commit comments