File tree Expand file tree Collapse file tree 2 files changed +7
-13
lines changed
src/main/java/redis/clients/jedis Expand file tree Collapse file tree 2 files changed +7
-13
lines changed Original file line number Diff line number Diff line change 11package redis .clients .jedis ;
22
33import java .io .IOException ;
4+ import java .nio .charset .Charset ;
5+ import java .nio .charset .StandardCharsets ;
46import java .util .ArrayList ;
57import java .util .List ;
68import java .util .Locale ;
@@ -29,7 +31,7 @@ public final class Protocol {
2931 public static final int DEFAULT_TIMEOUT = 2000 ;
3032 public static final int DEFAULT_DATABASE = 0 ;
3133
32- public static final String CHARSET = "UTF-8" ;
34+ public static final Charset CHARSET = StandardCharsets . UTF_8 ;
3335
3436 public static final byte DOLLAR_BYTE = '$' ;
3537 public static final byte ASTERISK_BYTE = '*' ;
Original file line number Diff line number Diff line change @@ -25,22 +25,14 @@ public static byte[][] encodeMany(final String... strs) {
2525 }
2626
2727 public static byte [] encode (final String str ) {
28- try {
29- if (str == null ) {
30- throw new IllegalArgumentException ("null value cannot be sent to redis" );
31- }
32- return str .getBytes (Protocol .CHARSET );
33- } catch (UnsupportedEncodingException e ) {
34- throw new JedisException (e );
28+ if (str == null ) {
29+ throw new IllegalArgumentException ("null value cannot be sent to redis" );
3530 }
31+ return str .getBytes (Protocol .CHARSET );
3632 }
3733
3834 public static String encode (final byte [] data ) {
39- try {
40- return new String (data , Protocol .CHARSET );
41- } catch (UnsupportedEncodingException e ) {
42- throw new JedisException (e );
43- }
35+ return new String (data , Protocol .CHARSET );
4436 }
4537
4638 /**
You can’t perform that action at this time.
0 commit comments