Skip to content

Commit

Permalink
Fix review issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur- committed Jun 25, 2020
1 parent 33c2f65 commit 63563db
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.Collections;
import java.util.EnumSet;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.BinaryOperator;
Expand Down Expand Up @@ -47,13 +48,13 @@
*/
public final class JsonUtils {

private static ObjectMapper objectMapper = new ObjectMapper();
private static final ObjectMapper objectMapper = new ObjectMapper();

/**
* Collects a stream of JSON values to a JSON array.
*
* @author Vaadin Ltd
* @since 1.0
* @since 1.0
*/
private static final class JsonArrayCollector
implements Collector<JsonValue, JsonArray, JsonArray> {
Expand Down Expand Up @@ -289,9 +290,8 @@ public static <T> JsonObject createObject(Map<String, T> map,
* @return a JSON representation of the bean
*/
public static JsonObject beanToJson(Object bean) {
if (bean == null) {
throw new RuntimeException("Cannot convert null to a JSON object");
}
Objects.requireNonNull(bean, "Cannot convert null to a JSON object");

try {
return Json.parse(objectMapper.writeValueAsString(bean));
} catch (JsonProcessingException e) {
Expand Down

0 comments on commit 63563db

Please sign in to comment.