Skip to content

Commit aa65288

Browse files
committed
build: format source code
1 parent 55e8293 commit aa65288

2 files changed

Lines changed: 41 additions & 34 deletions

File tree

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,48 @@
1+
/*
2+
* Jooby https://jooby.io
3+
* Apache License Version 2.0 https://jooby.io/LICENSE.txt
4+
* Copyright 2014 Edgar Espina
5+
*/
16
package io.jooby.internal;
27

3-
import edu.umd.cs.findbugs.annotations.NonNull;
4-
import io.jooby.Context;
5-
import io.jooby.ValueNode;
68
import java.util.List;
79
import java.util.Map;
810
import java.util.Set;
911
import java.util.TreeMap;
1012

13+
import edu.umd.cs.findbugs.annotations.NonNull;
14+
import io.jooby.Context;
15+
import io.jooby.ValueNode;
16+
1117
public class HeadersValue extends HashValue implements ValueNode {
1218

13-
public HeadersValue(final Context ctx) {
14-
super(ctx);
15-
}
19+
public HeadersValue(final Context ctx) {
20+
super(ctx);
21+
}
1622

17-
@Override
18-
protected Map<String, ValueNode> hash() {
19-
if (hash == EMPTY) {
20-
hash = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
21-
}
22-
return hash;
23-
}
23+
@Override
24+
protected Map<String, ValueNode> hash() {
25+
if (hash == EMPTY) {
26+
hash = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
27+
}
28+
return hash;
29+
}
2430

25-
@NonNull
26-
@Override
27-
public Map<String, String> toMap() {
28-
Map<String, String> map = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
29-
toMultimap().forEach((k, v) -> map.put(k, v.get(0)));
30-
return map;
31-
}
31+
@NonNull @Override
32+
public Map<String, String> toMap() {
33+
Map<String, String> map = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
34+
toMultimap().forEach((k, v) -> map.put(k, v.get(0)));
35+
return map;
36+
}
3237

33-
@NonNull
34-
@Override
35-
public Map<String, List<String>> toMultimap() {
36-
Map<String, List<String>> result = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
37-
Set<Map.Entry<String, ValueNode>> entries = hash.entrySet();
38-
for (Map.Entry<String, ValueNode> entry : entries) {
39-
ValueNode value = entry.getValue();
40-
result.putAll(value.toMultimap());
41-
}
42-
return result;
43-
}
38+
@NonNull @Override
39+
public Map<String, List<String>> toMultimap() {
40+
Map<String, List<String>> result = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
41+
Set<Map.Entry<String, ValueNode>> entries = hash.entrySet();
42+
for (Map.Entry<String, ValueNode> entry : entries) {
43+
ValueNode value = entry.getValue();
44+
result.putAll(value.toMultimap());
45+
}
46+
return result;
47+
}
4448
}

tests/src/test/java/io/jooby/test/Issue2357.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ public void headersShouldBeCaseInsensitive(ServerTestRunner runner) {
2929
Assertions.assertEquals("value1", ctx.headerMap().get("x-header1"));
3030
Assertions.assertEquals("value1", ctx.headerMap().get("X-HEADER1"));
3131
Assertions.assertEquals("value1", ctx.headerMap().get("X-hEaDeR1"));
32-
Assertions.assertEquals("value1", ctx.header().toMultimap().get("x-header1").get(0));
33-
Assertions.assertEquals("value1", ctx.header().toMultimap().get("X-HEADER1").get(0));
34-
Assertions.assertEquals("value1", ctx.header().toMultimap().get("X-hEaDeR1").get(0));
32+
Assertions.assertEquals(
33+
"value1", ctx.header().toMultimap().get("x-header1").get(0));
34+
Assertions.assertEquals(
35+
"value1", ctx.header().toMultimap().get("X-HEADER1").get(0));
36+
Assertions.assertEquals(
37+
"value1", ctx.header().toMultimap().get("X-hEaDeR1").get(0));
3538
return "OK";
3639
}))
3740
.ready(

0 commit comments

Comments
 (0)