fix deprecation warning. Class#newInstance deprecated since Java9

This commit is contained in:
xuwei-k
2018-09-27 12:25:08 +09:00
parent 96f8716417
commit 1b165fd230

View File

@@ -127,7 +127,11 @@ object LDAPUtil {
private def getSslProvider(): Provider = { private def getSslProvider(): Provider = {
val cachedInstance = provider.get() val cachedInstance = provider.get()
if (cachedInstance == null) { if (cachedInstance == null) {
val newInstance = Class.forName("com.sun.net.ssl.internal.ssl.Provider").newInstance().asInstanceOf[Provider] val newInstance = Class
.forName("com.sun.net.ssl.internal.ssl.Provider")
.getDeclaredConstructor()
.newInstance()
.asInstanceOf[Provider]
provider.compareAndSet(null, newInstance) provider.compareAndSet(null, newInstance)
newInstance newInstance
} else { } else {