Skip to content

Commit 1206368

Browse files
author
Harry Chan
committed
jackson optimize if-else
Remove extra else in if-else in Jackson Module
1 parent f57be0f commit 1206368

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

modules/jooby-jackson/src/main/java/io/jooby/json/JacksonModule.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,14 @@ public JacksonModule module(Class<? extends Module> module) {
138138
if (body.isInMemory()) {
139139
if (type == JsonNode.class) {
140140
return mapper.readTree(body.bytes());
141-
} else {
142-
return mapper.readValue(body.bytes(), typeFactory.constructType(type));
143141
}
142+
return mapper.readValue(body.bytes(), typeFactory.constructType(type));
144143
} else {
145144
try (InputStream stream = body.stream()) {
146145
if (type == JsonNode.class) {
147146
return mapper.readTree(stream);
148-
} else {
149-
return mapper.readValue(stream, typeFactory.constructType(type));
150147
}
148+
return mapper.readValue(stream, typeFactory.constructType(type));
151149
}
152150
}
153151
}

0 commit comments

Comments
 (0)