From 0240fafedb8db900aa01380f724819abb720f9cf Mon Sep 17 00:00:00 2001 From: heck Date: Wed, 8 Jul 2020 05:21:54 +0200 Subject: [PATCH] Avoid retry if callback not set is still ...dirty. the commit comment goes on, REMEMBER TO USE hg log -v now and then again :) // if this happens (no callback registered // we simply return "" // it will fail // this repeats MaxRetries times (currentluy hardcoded to 3) // Then the orig call will return with the PEP_STATUS (most likely PEP_PASSPHRASE_REQUIRED) --- src/foundation/pEp/jniadapter/AbstractEngine.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/foundation/pEp/jniadapter/AbstractEngine.java b/src/foundation/pEp/jniadapter/AbstractEngine.java index 137fee2..92adbd2 100644 --- a/src/foundation/pEp/jniadapter/AbstractEngine.java +++ b/src/foundation/pEp/jniadapter/AbstractEngine.java @@ -166,6 +166,8 @@ abstract class AbstractEngine extends UniquelyIdentifiable implements AutoClosea } public void setPassphraseRequiredCallback(Sync.PassphraseRequiredCallback passphraseRequiredCallback) { + System.out.println("passphraseRequiredCallback has been registered to:" + passphraseRequiredCallback.toString() + " on engine ObjID: " + getId()); + this.passphraseRequiredCallback = passphraseRequiredCallback; } @@ -194,10 +196,15 @@ abstract class AbstractEngine extends UniquelyIdentifiable implements AutoClosea public byte[] passphraseRequiredFromC() { String ret = ""; if (passphraseRequiredCallback != null) { + System.out.println("calling passphraseRequiredCallback on engine ObjID:" + getId()); ret = passphraseRequiredCallback.passphraseRequired(); } else { - // should never happen - assert false: "passphraseRequiredFromC called without callback registered"; + System.out.println("no callback registered on engine ObjID:" + getId()); + // if this happens (no callback registered + // we simply return "" + // it will fail + // this repeats MaxRetries times (currentluy hardcoded to 3) + // Then the orig call will return with the PEP_STATUS (most likely PEP_PASSPHRASE_REQUIRED) } return toUTF8(ret); }