Resolves #1235: Java: FDBExceptions are created successful operation completion (#1236)

The native function `NativeFuture::Future_getError` now returns `null` when the error code is 0 instead of an `FDBException` with a "Success" message and an error code of 0. This was only used in two places within the codebase; those two places now check for `null` errors and treats them like successes.
This commit is contained in:
Alec Grieser 2019-03-06 18:34:36 -08:00 committed by Alec Grieser
parent 5980276aea
commit 23f86132f5
No known key found for this signature in database
GPG Key ID: CAF63551C60D3462
4 changed files with 8 additions and 3 deletions

View File

@ -206,7 +206,11 @@ JNIEXPORT jthrowable JNICALL Java_com_apple_foundationdb_NativeFuture_Future_1ge
return JNI_NULL;
}
FDBFuture *sav = (FDBFuture *)future;
return getThrowable( jenv, fdb_future_get_error( sav ) );
fdb_error_t err = fdb_future_get_error( sav );
if( err )
return getThrowable( jenv, err );
else
return JNI_NULL;
}
JNIEXPORT jboolean JNICALL Java_com_apple_foundationdb_NativeFuture_Future_1isReady(JNIEnv *jenv, jobject, jlong future) {

View File

@ -37,7 +37,7 @@ class FutureResults extends NativeFuture<RangeResultInfo> {
protected RangeResultInfo getIfDone_internal(long cPtr) throws FDBException {
FDBException err = Future_getError(cPtr);
if(!err.isSuccess()) {
if(err != null && !err.isSuccess()) {
throw err;
}

View File

@ -34,7 +34,7 @@ class FutureVoid extends NativeFuture<Void> {
// with a get on the error and throw if the error is not success.
FDBException err = Future_getError(cPtr);
if(!err.isSuccess()) {
if(err != null && !err.isSuccess()) {
throw err;
}
return null;

View File

@ -12,6 +12,7 @@ Fixes
* The ``include`` command in fdbcli would falsly include all machines with IP addresses that
have the included IP address as a prefix (for example ``include 1.0.0.1`` would also include
``1.0.0.10``). `(PR #1121) <https://github.com/apple/foundationdb/pull/1121>`_
* Java: Succesful commits and range reads no longer create ``FDBException`` objects to reduce memory pressure. `(Issue #1235) <https://github.com/apple/foundationdb/issues/1235>`_
6.0.18
======