1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 06:12:05 +01:00

Fix DNSUtil.setDaneProvider()

Fixes SMACK-820.
This commit is contained in:
Florian Schmaus 2018-06-12 19:06:18 +02:00
parent 9e865fe6ab
commit 37b5260cdd
2 changed files with 17 additions and 1 deletions

View file

@ -72,7 +72,7 @@ public class DNSUtil {
* @param daneProvider
*/
public static void setDaneProvider(SmackDaneProvider daneProvider) {
daneProvider = Objects.requireNonNull(daneProvider);
DNSUtil.daneProvider = Objects.requireNonNull(daneProvider);
}
/**

View file

@ -19,6 +19,8 @@ package org.jivesoftware.smack.util;
import static org.junit.Assert.assertEquals;
import org.jivesoftware.smack.util.DNSUtil.DomainType;
import org.jivesoftware.smack.util.dns.SmackDaneProvider;
import org.jivesoftware.smack.util.dns.SmackDaneVerifier;
import org.junit.Test;
@ -33,4 +35,18 @@ public class DnsUtilTest {
assertEquals(DNSUtil.XMPP_SERVER_DNS_SRV_PREFIX, server.srvPrefix.ace);
}
private static final SmackDaneProvider DNS_UTIL_TEST_DANE_PROVIDER = new SmackDaneProvider() {
@Override
public SmackDaneVerifier newInstance() {
throw new AssertionError();
}
};
@Test
public void daneProviderTest() {
DNSUtil.setDaneProvider(DNS_UTIL_TEST_DANE_PROVIDER);
SmackDaneProvider currentDaneProvider = DNSUtil.getDaneProvider();
assertEquals(DNS_UTIL_TEST_DANE_PROVIDER, currentDaneProvider);
}
}