Break apart multicatch clauses which widen type.
These widen to ReflectiveOperationException which is API 19+.
Bug: 77314423
Test: ./gradlew :webkit:lint
Change-Id: I9d4adb6c0d27eb730ea3bb1206461b8b241a1965
(cherry picked from commit 6df428b7364e9950b72473956550c94cd453a7f3)
diff --git a/webkit/src/main/java/androidx/webkit/WebViewCompat.java b/webkit/src/main/java/androidx/webkit/WebViewCompat.java
index 45def2e..bdd53c7 100644
--- a/webkit/src/main/java/androidx/webkit/WebViewCompat.java
+++ b/webkit/src/main/java/androidx/webkit/WebViewCompat.java
@@ -285,8 +285,13 @@
webviewPackageName = (String) webviewUpdateServiceClass.getMethod(
"getCurrentWebViewPackageName").invoke(null);
}
- } catch (ClassNotFoundException | IllegalAccessException | InvocationTargetException
- | NoSuchMethodException e) {
+ } catch (ClassNotFoundException e) {
+ return null;
+ } catch (IllegalAccessException e) {
+ return null;
+ } catch (InvocationTargetException e) {
+ return null;
+ } catch (NoSuchMethodException e) {
return null;
}
if (webviewPackageName == null) return null;
diff --git a/webkit/src/main/java/androidx/webkit/internal/WebViewGlueCommunicator.java b/webkit/src/main/java/androidx/webkit/internal/WebViewGlueCommunicator.java
index 22cc1f4..33ac145 100644
--- a/webkit/src/main/java/androidx/webkit/internal/WebViewGlueCommunicator.java
+++ b/webkit/src/main/java/androidx/webkit/internal/WebViewGlueCommunicator.java
@@ -65,12 +65,17 @@
return (InvocationHandler) createProviderFactoryMethod.invoke(null,
BoundaryInterfaceReflectionUtil.createInvocationHandlerFor(
new SupportLibraryInfo()));
- } catch (IllegalAccessException | InvocationTargetException | ClassNotFoundException
- | NoSuchMethodException e) {
- // TODO(gsennton) if this happens we should avoid throwing an exception! And probably
- // declare that the list of features supported by the WebView APK is empty.
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException(e);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ } catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
+ // TODO(gsennton) if the above happens we should avoid throwing an exception! And probably
+ // declare that the list of features supported by the WebView APK is empty.
}
private static WebViewProviderFactoryBoundaryInterface createGlueProviderFactory() {