summaryrefslogtreecommitdiffstats
path: root/src/nfc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nfc')
-rw-r--r--src/nfc/qnearfieldtarget_android.cpp9
-rw-r--r--src/nfc/qnearfieldtarget_android_p.h2
2 files changed, 6 insertions, 5 deletions
diff --git a/src/nfc/qnearfieldtarget_android.cpp b/src/nfc/qnearfieldtarget_android.cpp
index 891ce3fc..850f8b4d 100644
--- a/src/nfc/qnearfieldtarget_android.cpp
+++ b/src/nfc/qnearfieldtarget_android.cpp
@@ -304,12 +304,12 @@ void NearFieldTarget::checkIsTargetLost()
QString techStr = m_techList.first();
QAndroidJniObject tagTech = getTagTechnology(techStr);
tagTech.callMethod<void>("connect");
- if (catchJavaExceptions()) {
+ if (catchJavaExceptions(false)) {
handleTargetLost();
return;
}
tagTech.callMethod<void>("close");
- if (catchJavaExceptions())
+ if (catchJavaExceptions(false))
handleTargetLost();
}
@@ -436,11 +436,12 @@ QByteArray NearFieldTarget::jbyteArrayToQByteArray(const jbyteArray &byteArray)
return resultArray;
}
-bool NearFieldTarget::catchJavaExceptions() const
+bool NearFieldTarget::catchJavaExceptions(bool verbose) const
{
QAndroidJniEnvironment env;
if (env->ExceptionCheck()) {
- env->ExceptionDescribe();
+ if (verbose)
+ env->ExceptionDescribe();
env->ExceptionClear();
return true;
}
diff --git a/src/nfc/qnearfieldtarget_android_p.h b/src/nfc/qnearfieldtarget_android_p.h
index 73f2499c..d0304ec4 100644
--- a/src/nfc/qnearfieldtarget_android_p.h
+++ b/src/nfc/qnearfieldtarget_android_p.h
@@ -93,7 +93,7 @@ protected:
void handleTargetLost();
QAndroidJniObject getTagTechnology(const QString &tech) const;
QByteArray jbyteArrayToQByteArray(const jbyteArray &byteArray) const;
- bool catchJavaExceptions() const;
+ bool catchJavaExceptions(bool verbose = true) const;
protected:
QAndroidJniObject m_intent;