From 5ca2b081fe8089990dd87c5d9081d90ed170283a Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Mon, 17 Jun 2019 21:59:13 +0200 Subject: [PATCH] [androidcontentfileengine] Catch SecurityException during file opening resolver.openFileDescriptor throws a SecurityException when the caller doesn't have sufficient permissions to access the URL. This will make an application crash. We should handle this case gracefully and report it to the user. I'm unsure if there is a better way to do this than simply logging the exception. Change-Id: I36bfbd3e398c8176e57042a27740aa15bce63a7c Reviewed-by: BogDan Vatra --- src/android/jar/src/org/qtproject/qt5/android/QtNative.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java index 9679fd40f4..c33d5016ce 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java @@ -178,6 +178,9 @@ public class QtNative return fdDesc.detachFd(); } catch (FileNotFoundException e) { return -1; + } catch (SecurityException e) { + Log.e(QtTAG, "Exception when opening file", e); + return -1; } }