This is an automated email from the ASF dual-hosted git repository. bchapuis pushed a commit to branch sonar in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git
commit b519420b3c3c5fa5ac6568ff38fd5791b621cf3c Author: Bertil Chapuis <[email protected]> AuthorDate: Thu Jun 13 00:09:07 2024 +0200 Fix boxed boolean check --- .../main/java/org/apache/baremaps/workflow/tasks/ImportOsmPbf.java | 4 +++- .../java/org/apache/baremaps/openstreetmap/stream/ConsumerUtils.java | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmPbf.java b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmPbf.java index cf3809b6..df8689e3 100644 --- a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmPbf.java +++ b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportOsmPbf.java @@ -34,6 +34,8 @@ import org.apache.baremaps.workflow.Task; import org.apache.baremaps.workflow.WorkflowContext; import org.locationtech.jts.geom.Coordinate; +import static java.lang.Boolean.TRUE; + /** * Import an OSM PBF file into a database. */ @@ -81,7 +83,7 @@ public class ImportOsmPbf implements Task { var wayRepository = new WayRepository(datasource); var relationRepository = new RelationRepository(datasource); - if (replaceExisting) { + if (TRUE.equals(replaceExisting)) { // Drop the existing tables headerRepository.drop(); nodeRepository.drop(); diff --git a/baremaps-openstreetmap/src/main/java/org/apache/baremaps/openstreetmap/stream/ConsumerUtils.java b/baremaps-openstreetmap/src/main/java/org/apache/baremaps/openstreetmap/stream/ConsumerUtils.java index 45afc0c7..91350f9b 100644 --- a/baremaps-openstreetmap/src/main/java/org/apache/baremaps/openstreetmap/stream/ConsumerUtils.java +++ b/baremaps-openstreetmap/src/main/java/org/apache/baremaps/openstreetmap/stream/ConsumerUtils.java @@ -21,6 +21,7 @@ package org.apache.baremaps.openstreetmap.stream; import java.util.function.Consumer; import java.util.function.Function; +import java.util.function.UnaryOperator; /** Utility methods for dealing with consumers. */ public class ConsumerUtils { @@ -46,7 +47,7 @@ public class ConsumerUtils { * @param <T> the type * @return the function */ - public static <T> Function<T, T> consumeThenReturn(Consumer<T> consumer) { + public static <T> UnaryOperator<T> consumeThenReturn(Consumer<T> consumer) { return t -> { consumer.accept(t); return t;
