Skip to content

Commit

Permalink
Apply formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosnils committed Jan 19, 2015
1 parent 24380c7 commit e281942
Show file tree
Hide file tree
Showing 16 changed files with 607 additions and 621 deletions.
2 changes: 1 addition & 1 deletion src/main/java/redis/clients/jedis/BinaryClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private byte[][] joinParameters(byte[] first, byte[][] rest) {
public void setPassword(final String password) {
this.password = password;
}

public void setDb(int db) {
this.db = db;
}
Expand Down
18 changes: 10 additions & 8 deletions src/main/java/redis/clients/jedis/BinaryJedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ public BinaryJedis(final String host, final int port, final int timeout) {
client.setConnectionTimeout(timeout);
client.setSoTimeout(timeout);
}

public BinaryJedis(final String host, final int port, final int connectionTimeout, final int soTimeout) {

public BinaryJedis(final String host, final int port, final int connectionTimeout,
final int soTimeout) {
client = new Client(host, port);
client.setConnectionTimeout(connectionTimeout);
client.setSoTimeout(soTimeout);
Expand All @@ -73,18 +74,19 @@ public BinaryJedis(final URI uri, final int timeout) {
client.setConnectionTimeout(timeout);
client.setSoTimeout(timeout);
}

public BinaryJedis(final URI uri, final int connectionTimeout, final int soTimeout) {
initializeClientFromURI(uri);
client.setConnectionTimeout(connectionTimeout);
client.setSoTimeout(soTimeout);
}

private void initializeClientFromURI(URI uri) {
if(!JedisURIHelper.isValid(uri)) {
throw new InvalidURIException(String.format("Cannot open Redis connection due invalid URI. %s", uri.toString()));
if (!JedisURIHelper.isValid(uri)) {
throw new InvalidURIException(String.format(
"Cannot open Redis connection due invalid URI. %s", uri.toString()));
}

client = new Client(uri.getHost(), uri.getPort());

String password = JedisURIHelper.getPassword(uri);
Expand Down Expand Up @@ -389,7 +391,7 @@ public String select(final int index) {
client.select(index);
String statusCodeReply = client.getStatusCodeReply();
client.setDb(index);

return statusCodeReply;
}

Expand Down Expand Up @@ -2963,7 +2965,7 @@ public Long scriptExists(byte[] sha1) {
a[0] = sha1;
return scriptExists(a).get(0);
}

public List<Long> scriptExists(byte[]... sha1) {
client.scriptExists(sha1);
return client.getIntegerMultiBulkReply();
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/redis/clients/jedis/BuilderFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public Map<String, String> build(Object data) {
final Iterator<Object> iterator = flatHash.iterator();
while (iterator.hasNext()) {
hash.put(SafeEncoder.encode((byte[]) iterator.next()),
String.valueOf((Long) iterator.next()));
String.valueOf((Long) iterator.next()));
}

return hash;
Expand Down Expand Up @@ -285,8 +285,7 @@ public String toString() {
}

private Object evalResult(Object result) {
if (result instanceof byte[])
return SafeEncoder.encode((byte[]) result);
if (result instanceof byte[]) return SafeEncoder.encode((byte[]) result);

if (result instanceof List<?>) {
List<?> list = (List<?>) result;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/redis/clients/jedis/Connection.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,19 @@ public Socket getSocket() {
public int getConnectionTimeout() {
return connectionTimeout;
}

public int getSoTimeout() {
return soTimeout;
}

public void setConnectionTimeout(int connectionTimeout) {
this.connectionTimeout = connectionTimeout;
}

public void setSoTimeout(int soTimeout) {
this.soTimeout = soTimeout;
}

public void setTimeoutInfinite() {
try {
if (!isConnected()) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/redis/clients/jedis/Jedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public Jedis(final String host, final int port) {
public Jedis(final String host, final int port, final int timeout) {
super(host, port, timeout);
}

public Jedis(final String host, final int port, final int connectionTimeout, final int soTimeout) {
super(host, port, connectionTimeout, soTimeout);
}
Expand All @@ -53,7 +53,7 @@ public Jedis(URI uri) {
public Jedis(final URI uri, final int timeout) {
super(uri, timeout);
}

public Jedis(final URI uri, final int connectionTimeout, final int soTimeout) {
super(uri, connectionTimeout, soTimeout);
}
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/redis/clients/jedis/JedisFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ public JedisFactory(final String host, final int port, final int timeout, final
this.database = database;
this.clientName = clientName;
}

public JedisFactory(final URI uri, final int timeout, final String clientName) {
if(!JedisURIHelper.isValid(uri)) {
throw new InvalidURIException(String.format("Cannot open Redis connection due invalid URI. %s", uri.toString()));
if (!JedisURIHelper.isValid(uri)) {
throw new InvalidURIException(String.format(
"Cannot open Redis connection due invalid URI. %s", uri.toString()));
}

this.hostAndPort.set(new HostAndPort(uri.getHost(), uri.getPort()));
this.timeout = timeout;
this.password = JedisURIHelper.getPassword(uri);
Expand Down
21 changes: 11 additions & 10 deletions src/main/java/redis/clients/jedis/JedisShardInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public String toString() {
private int port;
private String password = null;
private String name = null;
//Default Redis DB
// Default Redis DB
private int db = 0;

public String getHost() {
Expand Down Expand Up @@ -72,7 +72,7 @@ public JedisShardInfo(String host, int port, int connectionTimeout, int soTimeou
this.connectionTimeout = connectionTimeout;
this.soTimeout = soTimeout;
}

public JedisShardInfo(String host, String name, int port, int timeout, int weight) {
super(weight);
this.host = host;
Expand All @@ -84,10 +84,11 @@ public JedisShardInfo(String host, String name, int port, int timeout, int weigh

public JedisShardInfo(URI uri) {
super(Sharded.DEFAULT_WEIGHT);
if(!JedisURIHelper.isValid(uri)) {
throw new InvalidURIException(String.format("Cannot open Redis connection due invalid URI. %s", uri.toString()));
if (!JedisURIHelper.isValid(uri)) {
throw new InvalidURIException(String.format(
"Cannot open Redis connection due invalid URI. %s", uri.toString()));
}

this.host = uri.getHost();
this.port = uri.getPort();
this.password = JedisURIHelper.getPassword(uri);
Expand All @@ -105,23 +106,23 @@ public void setPassword(String auth) {
public int getConnectionTimeout() {
return connectionTimeout;
}

public void setConnectionTimeout(int connectionTimeout) {
this.connectionTimeout = connectionTimeout;
}

public int getSoTimeout() {
return soTimeout;
}

public void setSoTimeout(int soTimeout) {
this.soTimeout = soTimeout;
}

public String getName() {
return name;
}

public int getDb() {
return db;
}
Expand Down
Loading

0 comments on commit e281942

Please sign in to comment.