Skip to content

Commit 9358ad8

Browse files
committed
Reformat code
1 parent ba05b7e commit 9358ad8

6 files changed

Lines changed: 34 additions & 35 deletions

File tree

src/main/java/com/maxmind/db/Decoder.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ final class Decoder {
2828

2929
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
3030

31-
private static final int[] POINTER_VALUE_OFFSETS = { 0, 0, 1 << 11, (1 << 19) + ((1) << 11), 0 };
31+
private static final int[] POINTER_VALUE_OFFSETS = {0, 0, 1 << 11, (1 << 19) + ((1) << 11), 0};
3232

3333
// XXX - This is only for unit testings. We should possibly make a
3434
// constructor to set this
@@ -132,14 +132,14 @@ private JsonNode decode() throws IOException {
132132
int size = ctrlByte & 0x1f;
133133
if (size >= 29) {
134134
switch (size) {
135-
case 29:
136-
size = 29 + buffer.get();
137-
break;
138-
case 30:
139-
size = 285 + decodeInteger(2);
140-
break;
141-
default:
142-
size = 65821 + decodeInteger(3);
135+
case 29:
136+
size = 29 + buffer.get();
137+
break;
138+
case 30:
139+
size = 285 + decodeInteger(2);
140+
break;
141+
default:
142+
size = 65821 + decodeInteger(3);
143143
}
144144
}
145145

src/main/java/com/maxmind/db/Network.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public final class Network {
1414
/**
1515
* Construct a <code>Network</code>
1616
*
17-
* @param ipAddress An IP address in the network. This does not have to be
18-
* the first address in the network.
17+
* @param ipAddress An IP address in the network. This does not have to be
18+
* the first address in the network.
1919
* @param prefixLength The prefix length for the network.
2020
*/
2121
public Network(InetAddress ipAddress, int prefixLength) {

src/main/java/com/maxmind/db/Reader.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.maxmind.db;
22

3+
import com.fasterxml.jackson.databind.JsonNode;
4+
35
import java.io.Closeable;
46
import java.io.File;
57
import java.io.IOException;
@@ -8,8 +10,6 @@
810
import java.nio.ByteBuffer;
911
import java.util.concurrent.atomic.AtomicReference;
1012

11-
import com.fasterxml.jackson.databind.JsonNode;
12-
1313
/**
1414
* Instances of this class provide a reader for the MaxMind DB format. IP
1515
* addresses can be looked up using the <code>get</code> method.
@@ -59,7 +59,7 @@ public Reader(File database) throws IOException {
5959
* GeoIP2 database file.
6060
*
6161
* @param database the MaxMind DB file to use.
62-
* @param cache backing cache instance
62+
* @param cache backing cache instance
6363
* @throws IOException if there is an error opening or reading from the file.
6464
*/
6565
public Reader(File database, NodeCache cache) throws IOException {
@@ -82,7 +82,7 @@ public Reader(InputStream source) throws IOException {
8282
* {@link FileMode#MEMORY}, without using a <code>File</code> instance.
8383
*
8484
* @param source the InputStream that contains the MaxMind DB file.
85-
* @param cache backing cache instance
85+
* @param cache backing cache instance
8686
* @throws IOException if there is an error reading from the Stream.
8787
*/
8888
public Reader(InputStream source, NodeCache cache) throws IOException {
@@ -109,7 +109,7 @@ public Reader(File database, FileMode fileMode) throws IOException {
109109
*
110110
* @param database the MaxMind DB file to use.
111111
* @param fileMode the mode to open the file with.
112-
* @param cache backing cache instance
112+
* @param cache backing cache instance
113113
* @throws IOException if there is an error opening or reading from the file.
114114
*/
115115
public Reader(File database, FileMode fileMode, NodeCache cache) throws IOException {
@@ -144,6 +144,7 @@ private Reader(BufferHolder bufferHolder, String name, NodeCache cache) throws I
144144
public JsonNode get(InetAddress ipAddress) throws IOException {
145145
return getRecord(ipAddress).getData();
146146
}
147+
147148
/**
148149
* Looks up <code>ipAddress</code> in the MaxMind DB.
149150
*
@@ -291,7 +292,6 @@ public Metadata getMetadata() {
291292
}
292293

293294
/**
294-
/**
295295
* <p>
296296
* Closes the database.
297297
* </p>

src/main/java/com/maxmind/db/Record.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ public final class Record {
1414
/**
1515
* Create a new record.
1616
*
17-
* @param data the data for the record in the database.
18-
* @param ipAddress the IP address used in the lookup.
17+
* @param data the data for the record in the database.
18+
* @param ipAddress the IP address used in the lookup.
1919
* @param prefixLength the network prefix length associated with the record in the database.
2020
*/
21-
public Record( JsonNode data, InetAddress ipAddress, int prefixLength) {
21+
public Record(JsonNode data, InetAddress ipAddress, int prefixLength) {
2222
this.data = data;
2323
this.network = new Network(ipAddress, prefixLength);
2424
}
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/**
22
* @author greg
3-
*
43
*/
54
package com.maxmind.db;

src/test/java/com/maxmind/db/DecoderTest.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -273,19 +273,19 @@ private static Map<ObjectNode, byte[]> maps() {
273273
ObjectNode one = om.createObjectNode();
274274
one.put("en", "Foo");
275275
maps.put(one, new byte[]{(byte) 0xe1, /* en */0x42, 0x65, 0x6e,
276-
/* Foo */0x43, 0x46, 0x6f, 0x6f});
276+
/* Foo */0x43, 0x46, 0x6f, 0x6f});
277277

278278
ObjectNode two = om.createObjectNode();
279279
two.put("en", "Foo");
280280
two.put("zh", "人");
281281
maps.put(two, new byte[]{(byte) 0xe2,
282-
/* en */
282+
/* en */
283283
0x42, 0x65, 0x6e,
284-
/* Foo */
284+
/* Foo */
285285
0x43, 0x46, 0x6f, 0x6f,
286-
/* zh */
286+
/* zh */
287287
0x42, 0x7a, 0x68,
288-
/* 人 */
288+
/* 人 */
289289
0x43, (byte) 0xe4, (byte) 0xba, (byte) 0xba});
290290

291291
ObjectNode nested = om.createObjectNode();
@@ -294,11 +294,11 @@ private static Map<ObjectNode, byte[]> maps() {
294294
maps.put(nested, new byte[]{(byte) 0xe1, /* name */
295295
0x44, 0x6e, 0x61, 0x6d, 0x65, (byte) 0xe2,/* en */
296296
0x42, 0x65, 0x6e,
297-
/* Foo */
297+
/* Foo */
298298
0x43, 0x46, 0x6f, 0x6f,
299-
/* zh */
299+
/* zh */
300300
0x42, 0x7a, 0x68,
301-
/* 人 */
301+
/* 人 */
302302
0x43, (byte) 0xe4, (byte) 0xba, (byte) 0xba});
303303

304304
ObjectNode guess = om.createObjectNode();
@@ -308,11 +308,11 @@ private static Map<ObjectNode, byte[]> maps() {
308308
guess.set("languages", languages);
309309
maps.put(guess, new byte[]{(byte) 0xe1,/* languages */
310310
0x49, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x73,
311-
/* array */
311+
/* array */
312312
0x2, 0x4,
313-
/* en */
313+
/* en */
314314
0x42, 0x65, 0x6e,
315-
/* zh */
315+
/* zh */
316316
0x42, 0x7a, 0x68});
317317

318318
return maps;
@@ -325,16 +325,16 @@ private static Map<ArrayNode, byte[]> arrays() {
325325
ArrayNode f1 = om.createArrayNode();
326326
f1.add("Foo");
327327
arrays.put(f1, new byte[]{0x1, 0x4,
328-
/* Foo */
328+
/* Foo */
329329
0x43, 0x46, 0x6f, 0x6f});
330330

331331
ArrayNode f2 = om.createArrayNode();
332332
f2.add("Foo");
333333
f2.add("人");
334334
arrays.put(f2, new byte[]{0x2, 0x4,
335-
/* Foo */
335+
/* Foo */
336336
0x43, 0x46, 0x6f, 0x6f,
337-
/* 人 */
337+
/* 人 */
338338
0x43, (byte) 0xe4, (byte) 0xba, (byte) 0xba});
339339

340340
ArrayNode empty = om.createArrayNode();

0 commit comments

Comments
 (0)