diff --git a/android/src/main/java/org/conscrypt/Platform.java b/android/src/main/java/org/conscrypt/Platform.java index d60977bc2..c1bcd7828 100644 --- a/android/src/main/java/org/conscrypt/Platform.java +++ b/android/src/main/java/org/conscrypt/Platform.java @@ -255,8 +255,12 @@ private static void setSSLParametersOnImpl(SSLParameters params, SSLParametersIm Method m_getUseCipherSuitesOrder = params.getClass().getMethod("getUseCipherSuitesOrder"); impl.setUseCipherSuitesOrder((boolean) m_getUseCipherSuitesOrder.invoke(params)); - Method getNamedGroupsMethod = params.getClass().getMethod("getNamedGroups"); - impl.setNamedGroups((String[]) getNamedGroupsMethod.invoke(params)); + try { + Method getNamedGroupsMethod = params.getClass().getMethod("getNamedGroups"); + impl.setNamedGroups((String[]) getNamedGroupsMethod.invoke(params)); + } catch (NoSuchMethodException | IllegalArgumentException e) { + // Do nothing. + } } public static void setSSLParameters( @@ -327,8 +331,13 @@ private static void getSSLParametersFromImpl(SSLParameters params, SSLParameters params.getClass().getMethod("setUseCipherSuitesOrder", boolean.class); m_setUseCipherSuitesOrder.invoke(params, impl.getUseCipherSuitesOrder()); - Method setNamedGroupsMethod = params.getClass().getMethod("setNamedGroups", String[].class); - setNamedGroupsMethod.invoke(params, (Object[]) impl.getNamedGroups()); + try { + Method setNamedGroupsMethod = + params.getClass().getMethod("setNamedGroups", String[].class); + setNamedGroupsMethod.invoke(params, (Object) impl.getNamedGroups()); + } catch (NoSuchMethodException | IllegalArgumentException e) { + // Do nothing. + } } public static void getSSLParameters( diff --git a/platform/src/main/java/org/conscrypt/Platform.java b/platform/src/main/java/org/conscrypt/Platform.java index ec208cde6..716999899 100644 --- a/platform/src/main/java/org/conscrypt/Platform.java +++ b/platform/src/main/java/org/conscrypt/Platform.java @@ -167,8 +167,12 @@ static void setSSLParameters( impl.setEndpointIdentificationAlgorithm(params.getEndpointIdentificationAlgorithm()); impl.setUseCipherSuitesOrder(params.getUseCipherSuitesOrder()); - Method getNamedGroupsMethod = params.getClass().getMethod("getNamedGroups"); - impl.setNamedGroups((String[]) getNamedGroupsMethod.invoke(params)); + try { + Method getNamedGroupsMethod = params.getClass().getMethod("getNamedGroups"); + impl.setNamedGroups((String[]) getNamedGroupsMethod.invoke(params)); + } catch (NoSuchMethodException | IllegalArgumentException e) { + // Do nothing. + } List serverNames = params.getServerNames(); if (serverNames != null) { @@ -187,8 +191,13 @@ static void getSSLParameters( params.setEndpointIdentificationAlgorithm(impl.getEndpointIdentificationAlgorithm()); params.setUseCipherSuitesOrder(impl.getUseCipherSuitesOrder()); - Method setNamedGroupsMethod = params.getClass().getMethod("setNamedGroups", String[].class); - setNamedGroupsMethod.invoke(params, (Object[]) impl.getNamedGroups()); + try { + Method setNamedGroupsMethod = + params.getClass().getMethod("setNamedGroups", String[].class); + setNamedGroupsMethod.invoke(params, (Object) impl.getNamedGroups()); + } catch (NoSuchMethodException | IllegalArgumentException e) { + // Do nothing. + } if (impl.getUseSni() && AddressUtils.isValidSniHostname(socket.getHostname())) { params.setServerNames(Collections.singletonList( @@ -202,8 +211,12 @@ static void setSSLParameters( impl.setEndpointIdentificationAlgorithm(params.getEndpointIdentificationAlgorithm()); impl.setUseCipherSuitesOrder(params.getUseCipherSuitesOrder()); - Method getNamedGroupsMethod = params.getClass().getMethod("getNamedGroups"); - impl.setNamedGroups((String[]) getNamedGroupsMethod.invoke(params)); + try { + Method getNamedGroupsMethod = params.getClass().getMethod("getNamedGroups"); + impl.setNamedGroups((String[]) getNamedGroupsMethod.invoke(params)); + } catch (NoSuchMethodException | IllegalArgumentException e) { + // Do nothing. + } List serverNames = params.getServerNames(); if (serverNames != null) { @@ -222,8 +235,13 @@ static void getSSLParameters( params.setEndpointIdentificationAlgorithm(impl.getEndpointIdentificationAlgorithm()); params.setUseCipherSuitesOrder(impl.getUseCipherSuitesOrder()); - Method setNamedGroupsMethod = params.getClass().getMethod("setNamedGroups", String[].class); - setNamedGroupsMethod.invoke(params, (Object[]) impl.getNamedGroups()); + try { + Method setNamedGroupsMethod = + params.getClass().getMethod("setNamedGroups", String[].class); + setNamedGroupsMethod.invoke(params, (Object) impl.getNamedGroups()); + } catch (NoSuchMethodException | IllegalArgumentException e) { + // Do nothing. + } if (impl.getUseSni() && AddressUtils.isValidSniHostname(engine.getHostname())) { params.setServerNames(Collections.singletonList(