github-advanced-security[bot] commented on code in PR #757: URL: https://github.com/apache/incubator-baremaps/pull/757#discussion_r1387213867
########## baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightTranslations.java: ########## @@ -0,0 +1,108 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to you under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.baremaps.workflow.tasks; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.HashMap; +import java.util.stream.Collectors; +import org.apache.baremaps.openstreetmap.postgres.PostgresNodeRepository; +import org.apache.baremaps.openstreetmap.postgres.PostgresRelationRepository; +import org.apache.baremaps.openstreetmap.postgres.PostgresWayRepository; +import org.apache.baremaps.workflow.Task; +import org.apache.baremaps.workflow.WorkflowContext; + +public record ImportDaylightTranslations(Path file, Object database) implements Task { + + record Group(String type, Long id, String name) { + + } + + record Line(String type, Long id, String name, String attributeKey, String attributeValue) { + + public Group group() { + return new Group(type, id, name); + } + + public static Line parse(String line) { + var parts = line.split("\t"); + var type = parts[0]; + var id = Long.parseLong(parts[1]); Review Comment: ## Missing catch of NumberFormatException Potential uncaught 'java.lang.NumberFormatException'. [Show more details](https://github.com/apache/incubator-baremaps/security/code-scanning/831) ########## baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightFeatures.java: ########## @@ -0,0 +1,112 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to you under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.baremaps.workflow.tasks; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.nio.file.Path; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.apache.baremaps.openstreetmap.postgres.PostgresNodeRepository; +import org.apache.baremaps.openstreetmap.postgres.PostgresRelationRepository; +import org.apache.baremaps.openstreetmap.postgres.PostgresWayRepository; +import org.apache.baremaps.utils.ProjectionTransformer; +import org.apache.baremaps.workflow.Task; +import org.apache.baremaps.workflow.WorkflowContext; +import org.locationtech.jts.geom.GeometryFactory; +import org.locationtech.jts.io.WKTReader; + +public record ImportDaylightFeatures(Path file, Object database) implements Task { + + record Feature( + @JsonProperty("osm_type") String type, + @JsonProperty("osm_id") Long id, + @JsonProperty("tags") Map<String, Object> tags, + @JsonProperty("wkt") String wkt, + @JsonProperty("category") String category) { + + } + + @Override + public void execute(WorkflowContext context) throws Exception { + var datasource = context.getDataSource(database); + var geometryFactory = new GeometryFactory(); + var wktReader = new WKTReader(geometryFactory); Review Comment: ## Unread local variable Variable 'WKTReader wktReader' is never read. [Show more details](https://github.com/apache/incubator-baremaps/security/code-scanning/832) ########## baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ImportDaylightFeatures.java: ########## @@ -0,0 +1,112 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to you under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.baremaps.workflow.tasks; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.nio.file.Path; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.apache.baremaps.openstreetmap.postgres.PostgresNodeRepository; +import org.apache.baremaps.openstreetmap.postgres.PostgresRelationRepository; +import org.apache.baremaps.openstreetmap.postgres.PostgresWayRepository; +import org.apache.baremaps.utils.ProjectionTransformer; +import org.apache.baremaps.workflow.Task; +import org.apache.baremaps.workflow.WorkflowContext; +import org.locationtech.jts.geom.GeometryFactory; +import org.locationtech.jts.io.WKTReader; + +public record ImportDaylightFeatures(Path file, Object database) implements Task { + + record Feature( + @JsonProperty("osm_type") String type, + @JsonProperty("osm_id") Long id, + @JsonProperty("tags") Map<String, Object> tags, + @JsonProperty("wkt") String wkt, + @JsonProperty("category") String category) { + + } + + @Override + public void execute(WorkflowContext context) throws Exception { + var datasource = context.getDataSource(database); + var geometryFactory = new GeometryFactory(); + var wktReader = new WKTReader(geometryFactory); + var projectionTransformer = new ProjectionTransformer(4326, 3857); Review Comment: ## Unread local variable Variable 'ProjectionTransformer projectionTransformer' is never read. [Show more details](https://github.com/apache/incubator-baremaps/security/code-scanning/833) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
