File tree Expand file tree Collapse file tree 1 file changed +2
-8
lines changed
dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Original file line number Diff line number Diff line change 2222import org .apache .dubbo .rpc .Invoker ;
2323import org .apache .dubbo .rpc .support .RpcUtils ;
2424
25- import java .io . UnsupportedEncodingException ;
25+ import java .nio . charset . StandardCharsets ;
2626import java .security .MessageDigest ;
2727import java .security .NoSuchAlgorithmException ;
2828import java .util .List ;
3333
3434/**
3535 * ConsistentHashLoadBalance
36- *
3736 */
3837public class ConsistentHashLoadBalance extends AbstractLoadBalance {
3938 public static final String NAME = "consistenthash" ;
@@ -126,12 +125,7 @@ private byte[] md5(String value) {
126125 throw new IllegalStateException (e .getMessage (), e );
127126 }
128127 md5 .reset ();
129- byte [] bytes ;
130- try {
131- bytes = value .getBytes ("UTF-8" );
132- } catch (UnsupportedEncodingException e ) {
133- throw new IllegalStateException (e .getMessage (), e );
134- }
128+ byte [] bytes = value .getBytes (StandardCharsets .UTF_8 );
135129 md5 .update (bytes );
136130 return md5 .digest ();
137131 }
You can’t perform that action at this time.
0 commit comments