Skip to content

Commit 9f4e258

Browse files
committed
Fix codestyle with sbt-jcheckstyle
1 parent 045d6c2 commit 9f4e258

File tree

93 files changed

+3468
-1989
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+3468
-1989
lines changed
Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package org.msgpack.core;
22

3-
import static org.msgpack.core.Preconditions.*;
3+
import static org.msgpack.core.Preconditions.checkArgument;
44

55
/**
66
* Header of the Extension types
77
*/
8-
public class ExtensionTypeHeader {
8+
public class ExtensionTypeHeader
9+
{
910
private final byte type;
1011
private final int length;
1112

@@ -21,45 +22,52 @@ public class ExtensionTypeHeader {
2122
* ...
2223
* }
2324
* </pre>
25+
*
2426
* @param type extension type (byte). You can check the valid byte range with {@link #checkedCastToByte(int)} method.
2527
* @param length extension type data length
2628
*/
27-
public ExtensionTypeHeader(byte type, int length) {
29+
public ExtensionTypeHeader(byte type, int length)
30+
{
2831
checkArgument(length >= 0, "length must be >= 0");
2932
this.type = type;
3033
this.length = length;
3134
}
3235

33-
public static byte checkedCastToByte(int code) {
36+
public static byte checkedCastToByte(int code)
37+
{
3438
checkArgument(Byte.MIN_VALUE <= code && code <= Byte.MAX_VALUE, "Extension type code must be within the range of byte");
3539
return (byte) code;
3640
}
3741

38-
public byte getType() {
42+
public byte getType()
43+
{
3944
return type;
4045
}
4146

42-
public int getLength() {
47+
public int getLength()
48+
{
4349
return length;
4450
}
4551

4652
@Override
47-
public int hashCode() {
53+
public int hashCode()
54+
{
4855
return (type + 31) * 31 + length;
4956
}
5057

5158
@Override
52-
public boolean equals(Object obj) {
53-
if(obj instanceof ExtensionTypeHeader) {
59+
public boolean equals(Object obj)
60+
{
61+
if (obj instanceof ExtensionTypeHeader) {
5462
ExtensionTypeHeader other = (ExtensionTypeHeader) obj;
5563
return this.type == other.type && this.length == other.length;
5664
}
5765
return false;
5866
}
5967

6068
@Override
61-
public String toString() {
69+
public String toString()
70+
{
6271
return String.format("ExtensionTypeHeader(type:%d, length:%,d)", type, length);
6372
}
64-
6573
}

msgpack-core/src/main/java/org/msgpack/core/MessageFormat.java

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
import org.msgpack.core.annotations.VisibleForTesting;
55
import org.msgpack.value.ValueType;
66

7-
87
/**
98
* Describes the list of the message format types defined in the MessagePack specification.
109
*/
11-
public enum MessageFormat {
12-
10+
public enum MessageFormat
11+
{
1312
// INT7
1413
POSFIXINT(ValueType.INTEGER),
1514
// MAP4
@@ -50,52 +49,59 @@ public enum MessageFormat {
5049
ARRAY32(ValueType.ARRAY),
5150
MAP16(ValueType.MAP),
5251
MAP32(ValueType.MAP),
53-
NEGFIXINT(ValueType.INTEGER)
54-
;
52+
NEGFIXINT(ValueType.INTEGER);
5553

54+
private static final MessageFormat[] formatTable = new MessageFormat[256];
5655
private final ValueType valueType;
5756

58-
private MessageFormat(ValueType valueType) {
57+
private MessageFormat(ValueType valueType)
58+
{
5959
this.valueType = valueType;
6060
}
6161

6262
/**
6363
* Retruns the ValueType corresponding to this MessageFormat
64+
*
6465
* @return value type
6566
* @throws MessageFormatException if this == NEVER_USED type
6667
*/
67-
public ValueType getValueType() throws MessageFormatException {
68-
if(this == NEVER_USED)
68+
public ValueType getValueType()
69+
throws MessageFormatException
70+
{
71+
if (this == NEVER_USED) {
6972
throw new MessageFormatException("Cannot convert NEVER_USED to ValueType");
73+
}
7074
return valueType;
7175
}
7276

73-
private final static MessageFormat[] formatTable = new MessageFormat[256];
74-
7577
static {
7678
// Preparing a look up table for converting byte values into MessageFormat types
77-
for(int b = 0; b <= 0xFF; ++b) {
79+
for (int b = 0; b <= 0xFF; ++b) {
7880
MessageFormat mf = toMessageFormat((byte) b);
7981
formatTable[b] = mf;
8082
}
8183
}
8284

8385
/**
8486
* Returns a MessageFormat type of the specified byte value
87+
*
8588
* @param b MessageFormat of the given byte
8689
* @return
8790
*/
88-
public static MessageFormat valueOf(final byte b) {
91+
public static MessageFormat valueOf(final byte b)
92+
{
8993
return formatTable[b & 0xFF];
9094
}
9195

9296
/**
9397
* Converting a byte value into MessageFormat. For faster performance, use {@link #valueOf}
98+
*
9499
* @param b MessageFormat of the given byte
95100
* @return
96101
*/
97102
@VisibleForTesting
98-
static MessageFormat toMessageFormat(final byte b) {
103+
static MessageFormat toMessageFormat(final byte b)
104+
{
99105
if (Code.isPosFixInt(b)) {
100106
return POSFIXINT;
101107
}
@@ -177,5 +183,4 @@ static MessageFormat toMessageFormat(final byte b) {
177183
return NEVER_USED;
178184
}
179185
}
180-
181186
}

msgpack-core/src/main/java/org/msgpack/core/MessageFormatException.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,21 @@
1818
/**
1919
* Thrown when the input message pack format is invalid
2020
*/
21-
public class MessageFormatException extends MessagePackException {
22-
23-
public MessageFormatException(Throwable e) {
21+
public class MessageFormatException
22+
extends MessagePackException
23+
{
24+
public MessageFormatException(Throwable e)
25+
{
2426
super(e);
2527
}
2628

27-
28-
public MessageFormatException(String message) {
29+
public MessageFormatException(String message)
30+
{
2931
super(message);
3032
}
3133

32-
public MessageFormatException(String message, Throwable cause) {
34+
public MessageFormatException(String message, Throwable cause)
35+
{
3336
super(message, cause);
3437
}
3538
}

msgpack-core/src/main/java/org/msgpack/core/MessageIntegerOverflowException.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,41 @@
1717

1818
import java.math.BigInteger;
1919

20-
2120
/**
2221
* This error is thrown when the user tries to read an integer value
2322
* using a smaller types. For example, calling MessageUnpacker.unpackInt() for an integer value
2423
* that is larger than Integer.MAX_VALUE will cause this exception.
2524
*/
26-
public class MessageIntegerOverflowException extends MessageTypeException {
25+
public class MessageIntegerOverflowException
26+
extends MessageTypeException
27+
{
2728
private final BigInteger bigInteger;
2829

29-
public MessageIntegerOverflowException(BigInteger bigInteger) {
30+
public MessageIntegerOverflowException(BigInteger bigInteger)
31+
{
3032
super();
3133
this.bigInteger = bigInteger;
3234
}
3335

34-
public MessageIntegerOverflowException(long value) {
36+
public MessageIntegerOverflowException(long value)
37+
{
3538
this(BigInteger.valueOf(value));
3639
}
3740

38-
public MessageIntegerOverflowException(String message, BigInteger bigInteger) {
41+
public MessageIntegerOverflowException(String message, BigInteger bigInteger)
42+
{
3943
super(message);
4044
this.bigInteger = bigInteger;
4145
}
4246

43-
public BigInteger getBigInteger() {
47+
public BigInteger getBigInteger()
48+
{
4449
return bigInteger;
4550
}
4651

4752
@Override
48-
public String getMessage() {
53+
public String getMessage()
54+
{
4955
return bigInteger.toString();
5056
}
5157
}

0 commit comments

Comments
 (0)