mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-12-06 21:21:08 +01:00
Use StandardCharsets.(UTF_8|US_ASCII)
This also gets rid of a ton of UnsupportedEncodingException s.
This commit is contained in:
parent
2a4d110b22
commit
d2f5efcb20
33 changed files with 125 additions and 227 deletions
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smack.sasl;
|
|||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -39,14 +39,14 @@ public class DigestMd5SaslTest extends AbstractSaslTest {
|
|||
super(saslMechanism);
|
||||
}
|
||||
|
||||
protected void runTest(boolean useAuthzid) throws SmackException, InterruptedException, XmppStringprepException, UnsupportedEncodingException {
|
||||
protected void runTest(boolean useAuthzid) throws SmackException, InterruptedException, XmppStringprepException {
|
||||
EntityBareJid authzid = null;
|
||||
if (useAuthzid) {
|
||||
authzid = JidCreate.entityBareFrom("shazbat@xmpp.org");
|
||||
}
|
||||
saslMechanism.authenticate("florian", "irrelevant", JidCreate.domainBareFrom("xmpp.org"), "secret", authzid, null);
|
||||
byte[] response = saslMechanism.evaluateChallenge(challengeBytes);
|
||||
String responseString = new String(response, StringUtils.UTF8);
|
||||
String responseString = new String(response, StandardCharsets.UTF_8);
|
||||
String[] responseParts = responseString.split(",");
|
||||
Map<String, String> responsePairs = new HashMap<String, String>();
|
||||
for (String part : responseParts) {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import static org.junit.Assert.assertEquals;
|
|||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
@ -72,15 +72,15 @@ public class StringUtilsTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testEncodeHex() throws UnsupportedEncodingException {
|
||||
public void testEncodeHex() {
|
||||
String input = "";
|
||||
String output = "";
|
||||
assertEquals(new String(StringUtils.encodeHex(input.getBytes(StringUtils.UTF8))),
|
||||
assertEquals(new String(StringUtils.encodeHex(input.getBytes(StandardCharsets.UTF_8))),
|
||||
output);
|
||||
|
||||
input = "foo bar 123";
|
||||
output = "666f6f2062617220313233";
|
||||
assertEquals(new String(StringUtils.encodeHex(input.getBytes(StringUtils.UTF8))),
|
||||
assertEquals(new String(StringUtils.encodeHex(input.getBytes(StandardCharsets.UTF_8))),
|
||||
output);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue