From fd0b1fe8ae564e70852fb75d487e67f5303a4c56 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Tue, 17 Dec 2024 22:47:28 +0100 Subject: [PATCH 1/4] Update protobuf, OSM parser and Google cloud tools --- application/pom.xml | 6 +++--- .../src/main/java/org/opentripplanner/osm/OsmParser.java | 4 ++-- .../src/main/java/org/opentripplanner/osm/OsmProvider.java | 2 +- .../updater/alert/GtfsRealtimeAlertsUpdater.java | 2 +- .../updater/trip/MqttGtfsRealtimeUpdater.java | 2 +- .../src/test/java/org/opentripplanner/GtfsTest.java | 2 +- gtfs-realtime-protobuf/pom.xml | 7 ++++++- pom.xml | 2 +- 8 files changed, 16 insertions(+), 11 deletions(-) diff --git a/application/pom.xml b/application/pom.xml index c3b4a6ee582..2a6e3043ba2 100644 --- a/application/pom.xml +++ b/application/pom.xml @@ -312,9 +312,9 @@ - org.openstreetmap.osmosis - osmosis-osm-binary - 0.48.3 + org.openstreetmap.pbf + osmpbf + 1.6.0 diff --git a/application/src/main/java/org/opentripplanner/osm/OsmParser.java b/application/src/main/java/org/opentripplanner/osm/OsmParser.java index 8a5f8e32448..4b443e6a505 100644 --- a/application/src/main/java/org/opentripplanner/osm/OsmParser.java +++ b/application/src/main/java/org/opentripplanner/osm/OsmParser.java @@ -1,11 +1,11 @@ package org.opentripplanner.osm; +import crosby.binary.BinaryParser; +import crosby.binary.Osmformat; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; -import org.openstreetmap.osmosis.osmbinary.BinaryParser; -import org.openstreetmap.osmosis.osmbinary.Osmformat; import org.opentripplanner.graph_builder.module.osm.OsmDatabase; import org.opentripplanner.osm.model.OsmMemberType; import org.opentripplanner.osm.model.OsmNode; diff --git a/application/src/main/java/org/opentripplanner/osm/OsmProvider.java b/application/src/main/java/org/opentripplanner/osm/OsmProvider.java index 597fd516b0e..91944a95b86 100644 --- a/application/src/main/java/org/opentripplanner/osm/OsmProvider.java +++ b/application/src/main/java/org/opentripplanner/osm/OsmProvider.java @@ -1,11 +1,11 @@ package org.opentripplanner.osm; +import crosby.binary.file.BlockInputStream; import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.time.ZoneId; -import org.openstreetmap.osmosis.osmbinary.file.BlockInputStream; import org.opentripplanner.datastore.api.DataSource; import org.opentripplanner.datastore.api.FileType; import org.opentripplanner.datastore.file.FileDataSource; diff --git a/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java b/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java index a5be5ef4185..de6383c6016 100644 --- a/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java @@ -68,7 +68,7 @@ protected void runPolling() { final FeedMessage feed = otpHttpClient.getAndMap( URI.create(url), this.headers.asMap(), - FeedMessage.PARSER::parseFrom + FeedMessage::parseFrom ); long feedTimestamp = feed.getHeader().getTimestamp(); diff --git a/application/src/main/java/org/opentripplanner/updater/trip/MqttGtfsRealtimeUpdater.java b/application/src/main/java/org/opentripplanner/updater/trip/MqttGtfsRealtimeUpdater.java index 20b49ed022f..0580cd4ea63 100644 --- a/application/src/main/java/org/opentripplanner/updater/trip/MqttGtfsRealtimeUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/trip/MqttGtfsRealtimeUpdater.java @@ -138,7 +138,7 @@ public void messageArrived(String topic, MqttMessage message) { UpdateIncrementality updateIncrementality = FULL_DATASET; try { // Decode message - GtfsRealtime.FeedMessage feedMessage = GtfsRealtime.FeedMessage.PARSER.parseFrom( + GtfsRealtime.FeedMessage feedMessage = GtfsRealtime.FeedMessage.parseFrom( message.getPayload() ); List feedEntityList = feedMessage.getEntityList(); diff --git a/application/src/test/java/org/opentripplanner/GtfsTest.java b/application/src/test/java/org/opentripplanner/GtfsTest.java index 5d548e4012c..05b7bfbf4f6 100644 --- a/application/src/test/java/org/opentripplanner/GtfsTest.java +++ b/application/src/test/java/org/opentripplanner/GtfsTest.java @@ -221,7 +221,7 @@ protected void setUp() throws Exception { try { InputStream inputStream = new FileInputStream(gtfsRealTime); - FeedMessage feedMessage = FeedMessage.PARSER.parseFrom(inputStream); + FeedMessage feedMessage = FeedMessage.parseFrom(inputStream); List feedEntityList = feedMessage.getEntityList(); List updates = new ArrayList<>(feedEntityList.size()); for (FeedEntity feedEntity : feedEntityList) { diff --git a/gtfs-realtime-protobuf/pom.xml b/gtfs-realtime-protobuf/pom.xml index e4465a4d366..d3c3305b9b2 100644 --- a/gtfs-realtime-protobuf/pom.xml +++ b/gtfs-realtime-protobuf/pom.xml @@ -11,10 +11,15 @@ gtfs-realtime-protobuf OpenTripPlanner - GTFS Realtime (protobuf) + + 4.28.3 + + com.google.protobuf protobuf-java + ${protobuf.version} @@ -46,7 +51,7 @@ - com.google.protobuf:protoc:3.22.0:exe:${os.detected.classifier} + com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier} diff --git a/pom.xml b/pom.xml index 27eada4007b..4108973c7ff 100644 --- a/pom.xml +++ b/pom.xml @@ -392,7 +392,7 @@ com.google.cloud libraries-bom - 26.48.0 + 26.51.0 pom import From 5cc681285d4ff5739a0aafe9895a3914f534c977 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Thu, 19 Dec 2024 16:15:40 +0100 Subject: [PATCH 2/4] Specify version in parent pom --- gtfs-realtime-protobuf/pom.xml | 4 ---- pom.xml | 7 ++++++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gtfs-realtime-protobuf/pom.xml b/gtfs-realtime-protobuf/pom.xml index d3c3305b9b2..dd3990207c9 100644 --- a/gtfs-realtime-protobuf/pom.xml +++ b/gtfs-realtime-protobuf/pom.xml @@ -11,15 +11,11 @@ gtfs-realtime-protobuf OpenTripPlanner - GTFS Realtime (protobuf) - - 4.28.3 - com.google.protobuf protobuf-java - ${protobuf.version} diff --git a/pom.xml b/pom.xml index 4108973c7ff..98cf77db29e 100644 --- a/pom.xml +++ b/pom.xml @@ -73,6 +73,7 @@ 2.0.15 1.27 4.0.5 + 4.28.3 UTF-8 opentripplanner/OpenTripPlanner @@ -485,7 +486,11 @@ java-snapshot-testing-junit5 2.3.0 - + + com.google.protobuf + protobuf-java + ${protobuf.version} + From 1518e38dd6f0ca9cc4656ce38dc9ccc009fdcef6 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Fri, 3 Jan 2025 10:44:48 +0100 Subject: [PATCH 3/4] Apply review feedback --- pom.xml | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/pom.xml b/pom.xml index 98cf77db29e..9cf7b514ce7 100644 --- a/pom.xml +++ b/pom.xml @@ -59,21 +59,23 @@ 176 + 32.1 2.53 2.18.2 + 4.0.5 3.1.9 5.11.4 - 1.14.1 - 5.6.0 1.5.12 9.12.0 - 2.0.16 + 1.14.1 2.0.15 - 1.27 - 4.0.5 + 5.6.0 4.28.3 + 1.27 + 2.0.16 + UTF-8 opentripplanner/OpenTripPlanner @@ -390,7 +392,7 @@ - + com.google.cloud libraries-bom 26.51.0 @@ -398,6 +400,18 @@ import + + com.google.protobuf + protobuf-java + ${protobuf.version} + + + + com.google.guava + guava + 33.3.1-jre + + org.slf4j @@ -420,11 +434,6 @@ trove4j 3.0.3 - - com.google.guava - guava - 33.3.1-jre - @@ -486,11 +495,7 @@ java-snapshot-testing-junit5 2.3.0 - - com.google.protobuf - protobuf-java - ${protobuf.version} - + From f53245fdef475829f5a14cca1795fcce3287cb1a Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Thu, 9 Jan 2025 16:35:49 +0100 Subject: [PATCH 4/4] Fix formatting --- .../updater/alert/GtfsRealtimeAlertsUpdater.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java b/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java index 604a721c57d..8deddd35b61 100644 --- a/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java +++ b/application/src/main/java/org/opentripplanner/updater/alert/GtfsRealtimeAlertsUpdater.java @@ -62,7 +62,7 @@ protected void runPolling() throws InterruptedException, ExecutionException { final FeedMessage feed = otpHttpClient.getAndMap( URI.create(url), this.headers.asMap(), - FeedMessage::parseFrom + FeedMessage::parseFrom ); long feedTimestamp = feed.getHeader().getTimestamp();