Commit 6f78f94c authored by Nate Fischer's avatar Nate Fischer Committed by Commit Bot

Android: create SafeBrowsingApiHandler with declared constructor

No change to logic.

This uses getDeclaredConstructor() when creating the
SafeBrowsingApiHandler, since this provides more information in case an
exception is thrown.

This resolves an errorprone compile warning.

Test: ninja system_webview_apk (fewer compile warnings)
Change-Id: Icdaf2aadf6fbd16fb298b140f3918b51a5fd2d43
Reviewed-on: https://chromium-review.googlesource.com/780761Reviewed-by: default avatarVarun Khaneja <vakh@chromium.org>
Commit-Queue: Nate Fischer <ntfschr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#518397}
parent 2d06761b
......@@ -9,6 +9,8 @@ import org.chromium.base.Log;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
import java.lang.reflect.InvocationTargetException;
/**
* Helper for calling GMSCore Safe Browsing API from native code.
*/
......@@ -39,8 +41,9 @@ public final class SafeBrowsingApiBridge {
private static SafeBrowsingApiHandler create() {
SafeBrowsingApiHandler handler;
try {
handler = sHandler.newInstance();
} catch (NullPointerException | InstantiationException | IllegalAccessException e) {
handler = sHandler.getDeclaredConstructor().newInstance();
} catch (NullPointerException | InstantiationException | IllegalAccessException
| NoSuchMethodException | InvocationTargetException e) {
Log.e(TAG, "Failed to init handler: " + e.getMessage());
return null;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment