2525import java .io .IOException ;
2626import java .io .InputStream ;
2727import java .io .OutputStream ;
28+ import java .lang .reflect .InvocationTargetException ;
2829import java .lang .reflect .Method ;
2930import java .net .URL ;
3031import java .net .URLConnection ;
@@ -129,6 +130,7 @@ private static boolean loadLibraryAndroid(String libname) {
129130 return false ;
130131 }
131132
133+ //noinspection TryWithIdenticalCatches
132134 try {
133135 Class <?> context = Class .forName ("android.content.Context" );
134136 if (BoxStore .relinker == null ) {
@@ -141,10 +143,17 @@ private static boolean loadLibraryAndroid(String libname) {
141143 Method loadLibrary = BoxStore .relinker .getClass ().getMethod ("loadLibrary" , context , String .class , String .class );
142144 loadLibrary .invoke (BoxStore .relinker , BoxStore .context , libname , BoxStore .JNI_VERSION );
143145 }
144- } catch (ReflectiveOperationException e ) {
145- // note: do not catch Exception as it will swallow ReLinker exceptions useful for debugging
146+ } catch (NoSuchMethodException e ) {
147+ return false ;
148+ } catch (IllegalAccessException e ) {
149+ return false ;
150+ } catch (InvocationTargetException e ) {
151+ return false ;
152+ } catch (ClassNotFoundException e ) {
146153 return false ;
147154 }
155+ // note: do not catch Exception as it will swallow ReLinker exceptions useful for debugging
156+ // note: can't catch ReflectiveOperationException, is K+ (19+) on Android
148157
149158 return true ;
150159 }
0 commit comments