Skip to content

Commit

Permalink
Fix code styles on MQTT codec classes
Browse files Browse the repository at this point in the history
  • Loading branch information
eincs authored and normanmaurer committed Aug 31, 2015
1 parent 9b45e9d commit acf1b0f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ public MqttConnectReturnCode connectReturnCode() {
return connectReturnCode;
}

public boolean isSessionPresent() { return sessionPresent; }
public boolean isSessionPresent() {
return sessionPresent;
}

@Override
public String toString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ public enum MqttConnectReturnCode {
CONNECTION_REFUSED_BAD_USER_NAME_OR_PASSWORD((byte) 0x04),
CONNECTION_REFUSED_NOT_AUTHORIZED((byte) 0x05);

private static final Map<Byte, MqttConnectReturnCode> valueToCodeMap;
private static final Map<Byte, MqttConnectReturnCode> VALUE_TO_CODE_MAP;

static {
final Map<Byte, MqttConnectReturnCode> valueMap = new HashMap<Byte, MqttConnectReturnCode>();
for (MqttConnectReturnCode code: values()) {
valueMap.put(code.byteValue, code);
}
valueToCodeMap = Collections.unmodifiableMap(valueMap);
VALUE_TO_CODE_MAP = Collections.unmodifiableMap(valueMap);
}

private final byte byteValue;
Expand All @@ -52,8 +52,8 @@ public byte byteValue() {
}

public static MqttConnectReturnCode valueOf(byte b) {
if (valueToCodeMap.containsKey(b)) {
return valueToCodeMap.get(b);
if (VALUE_TO_CODE_MAP.containsKey(b)) {
return VALUE_TO_CODE_MAP.get(b);
}
throw new IllegalArgumentException("unknown connect return code: " + (b & 0xFF));
}
Expand Down

0 comments on commit acf1b0f

Please sign in to comment.