Commit a79b795a authored by Szabolcs Gyurko's avatar Szabolcs Gyurko
Browse files

Fixed checkstyle error and a possible NPE inside a lambda function

parent e4b27ff7
Pipeline #330 failed with stage
in 9 seconds
......@@ -67,16 +67,16 @@ public class ComponentDefinitionToNodeConverter implements Converter<ComponentDe
node.getProperties().addAll(componentDefinition.getProperties().stream()
.flatMap(p -> {
final List<NodeProperty> converted = ((List<NodeProperty>) conversionService.convert(p,
TypeDescriptor.valueOf(ComponentDefinition.ComponentDefinitionProperty.class),
TypeDescriptor.collection(List.class, TypeDescriptor.valueOf(NodeProperty.class))));
final List<NodeProperty> converted = (List<NodeProperty>) conversionService.convert(p,
TypeDescriptor.valueOf(ComponentDefinition.ComponentDefinitionProperty.class),
TypeDescriptor.collection(List.class, TypeDescriptor.valueOf(NodeProperty.class)));
if (converted != null)
return converted.stream();
if (converted != null)
return converted.stream();
return Stream.empty();
}
).collect(Collectors.toList())
return Stream.empty();
})
.collect(Collectors.toList())
);
return node;
......
......@@ -36,6 +36,7 @@ import org.springframework.stereotype.Component;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.jeff_cms.jeff.web.Constants.META;
import static com.jeff_cms.jeff.web.Constants.TITLE;
......@@ -68,11 +69,18 @@ public class PageToNodeConverter implements Converter<Page, Node> {
node.getProperties().add(meta);
node.getProperties().addAll(page.getComponents().stream()
.flatMap(c -> ((List<NodeProperty>) conversionService.convert(
c,
TypeDescriptor.valueOf(com.jeff_cms.jeff.web.model.Component.class),
TypeDescriptor.collection(List.class, TypeDescriptor.valueOf(NodeProperty.class))
)).stream())
.flatMap(c -> {
final List<NodeProperty> converted = (List<NodeProperty>) conversionService.convert(
c,
TypeDescriptor.valueOf(com.jeff_cms.jeff.web.model.Component.class),
TypeDescriptor.collection(List.class, TypeDescriptor.valueOf(NodeProperty.class))
);
if (converted != null)
return converted.stream();
return Stream.empty();
})
.collect(Collectors.toList())
);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment