Skip to content

Commit

Permalink
jdk9
Browse files Browse the repository at this point in the history
  • Loading branch information
leonchen83 committed Sep 24, 2017
1 parent fc7a74c commit ae21af1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public final class RedisURI implements Comparable<RedisURI>, Serializable {

private static final long serialVersionUID = 1L;

private final static char[] HEXDIGITS = {
private final static char[] HEX_DIGITS = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
};

Expand Down Expand Up @@ -286,7 +286,7 @@ private static String encode(String s) {

private static void appendEscape(StringBuilder sb, byte b) {
sb.append('%');
sb.append(HEXDIGITS[(b >> 4) & 0x0F]);
sb.append(HEXDIGITS[(b >> 0) & 0x0F]);
sb.append(HEX_DIGITS[(b >> 4) & 0x0F]);
sb.append(HEX_DIGITS[(b >> 0) & 0x0F]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,19 @@ public void handle(Replicator replicator) {
public void testURI() throws URISyntaxException, UnsupportedEncodingException {
String str = "redis:///test?" + URLEncoder.encode("新建文件夹", "UTF-8") + "=dump.rdb";
RedisURI uri = new RedisURI(str);
assertEquals(str, uri.toASCIIString());
assertEquals("dump.rdb", uri.parameters.get("新建文件夹"));
str = "redis:///test?" + URLEncoder.encode("新建文件夹", "UTF-8") + "=" + URLEncoder.encode("新建文件夹", "UTF-8");
uri = new RedisURI(str);
assertEquals(str, uri.toASCIIString());
assertEquals("新建文件夹", uri.parameters.get("新建文件夹"));
str = "redis:///test?key=value";
uri = new RedisURI(str);
assertEquals(str, uri.toASCIIString());
assertEquals("value", uri.parameters.get("key"));
str = "redis:///test?key=%20";
uri = new RedisURI(str);
assertEquals(str, uri.toASCIIString());
assertEquals(" ", uri.parameters.get("key"));
}
}

0 comments on commit ae21af1

Please sign in to comment.