Skip to content

Commit

Permalink
fix(android): handle deprecation warnings (#7190)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Jan 17, 2024
1 parent cd58ba2 commit 06636d7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ public Plugin load() throws PluginLoadException {
}

try {
this.instance = this.pluginClass.newInstance();
this.instance = this.pluginClass.getDeclaredConstructor().newInstance();
return this.loadInstance(instance);
} catch (InstantiationException | IllegalAccessException ex) {
} catch (Exception ex) {
throw new PluginLoadException("Unable to load plugin instance. Ensure plugin is publicly accessible");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,10 @@ public void setSSLSocketFactory(Bridge bridge) {
try {
Class<?> sslPinningImpl = Class.forName("io.ionic.sslpinning.SSLPinning");
Method method = sslPinningImpl.getDeclaredMethod("getSSLSocketFactory", Bridge.class);
SSLSocketFactory sslSocketFactory = (SSLSocketFactory) method.invoke(sslPinningImpl.newInstance(), bridge);
SSLSocketFactory sslSocketFactory = (SSLSocketFactory) method.invoke(
sslPinningImpl.getDeclaredConstructor().newInstance(),
bridge
);
if (sslSocketFactory != null) {
((HttpsURLConnection) this.connection).setSSLSocketFactory(sslSocketFactory);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ private static Boolean isDomainExcludedFromSSL(Bridge bridge, URL url) {
try {
Class<?> sslPinningImpl = Class.forName("io.ionic.sslpinning.SSLPinning");
Method method = sslPinningImpl.getDeclaredMethod("isDomainExcluded", Bridge.class, URL.class);
return (Boolean) method.invoke(sslPinningImpl.newInstance(), bridge, url);
return (Boolean) method.invoke(sslPinningImpl.getDeclaredConstructor().newInstance(), bridge, url);
} catch (Exception ignored) {
return false;
}
Expand Down

0 comments on commit 06636d7

Please sign in to comment.