mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 17:19:39 +02:00
Don't reinvent methods in HashManager
use the existing API from StringUtils instead. Also rename StringUtils.toBytes() to 'toUtf8Bytes()'.
This commit is contained in:
parent
6565618840
commit
2a97d7c5ea
8 changed files with 91 additions and 105 deletions
|
@ -303,7 +303,7 @@ public abstract class SASLMechanism implements Comparable<SASLMechanism> {
|
|||
protected abstract SASLMechanism newInstance();
|
||||
|
||||
protected static byte[] toBytes(String string) {
|
||||
return StringUtils.toBytes(string);
|
||||
return StringUtils.toUtf8Bytes(string);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,7 +42,7 @@ public class MD5 {
|
|||
}
|
||||
|
||||
public static byte[] bytes(String string) {
|
||||
return bytes(StringUtils.toBytes(string));
|
||||
return bytes(StringUtils.toUtf8Bytes(string));
|
||||
}
|
||||
|
||||
public static String hex(byte[] bytes) {
|
||||
|
@ -50,7 +50,7 @@ public class MD5 {
|
|||
}
|
||||
|
||||
public static String hex(String string) {
|
||||
return hex(StringUtils.toBytes(string));
|
||||
return hex(StringUtils.toUtf8Bytes(string));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public class SHA1 {
|
|||
}
|
||||
|
||||
public static byte[] bytes(String string) {
|
||||
return bytes(StringUtils.toBytes(string));
|
||||
return bytes(StringUtils.toUtf8Bytes(string));
|
||||
}
|
||||
|
||||
public static String hex(byte[] bytes) {
|
||||
|
@ -51,7 +51,7 @@ public class SHA1 {
|
|||
}
|
||||
|
||||
public static String hex(String string) {
|
||||
return hex(StringUtils.toBytes(string));
|
||||
return hex(StringUtils.toUtf8Bytes(string));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -244,7 +244,7 @@ public class StringUtils {
|
|||
return new String(hexChars);
|
||||
}
|
||||
|
||||
public static byte[] toBytes(String string) {
|
||||
public static byte[] toUtf8Bytes(String string) {
|
||||
try {
|
||||
return string.getBytes(StringUtils.UTF8);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.jxmpp.stringprep.XmppStringprepException;
|
|||
public class DigestMd5SaslTest extends AbstractSaslTest {
|
||||
|
||||
protected static final String challenge = "realm=\"xmpp.org\",nonce=\"jgGgnz+cQcmyVaAs2n88kQ==\",qop=\"auth\",charset=utf-8,algorithm=md5-sess";
|
||||
protected static final byte[] challengeBytes = StringUtils.toBytes(challenge);
|
||||
protected static final byte[] challengeBytes = StringUtils.toUtf8Bytes(challenge);
|
||||
|
||||
public DigestMd5SaslTest(SASLMechanism saslMechanism) {
|
||||
super(saslMechanism);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue