diff --git a/src/main/java/org/opentripplanner/graph_builder/module/GtfsModule.java b/src/main/java/org/opentripplanner/graph_builder/module/GtfsModule.java index ceb774c455d..6ac30734da4 100644 --- a/src/main/java/org/opentripplanner/graph_builder/module/GtfsModule.java +++ b/src/main/java/org/opentripplanner/graph_builder/module/GtfsModule.java @@ -1,3 +1,4 @@ + /* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of @@ -15,7 +16,6 @@ the License, or (at your option) any later version. import java.awt.*; import java.io.File; -import java.io.IOException; import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; @@ -95,9 +95,8 @@ public void buildGraph(Graph graph, HashMap, Object> extra) { MultiCalendarServiceImpl service = new MultiCalendarServiceImpl(); GtfsStopContext stopContext = new GtfsStopContext(); - - try { - for (GtfsBundle gtfsBundle : gtfsBundles) { + + for (GtfsBundle gtfsBundle : gtfsBundles) { // apply global defaults to individual GTFSBundles (if globals have been set) if (cacheDirectory != null && gtfsBundle.cacheDirectory == null) gtfsBundle.cacheDirectory = cacheDirectory; @@ -126,13 +125,10 @@ public void buildGraph(Graph graph, HashMap, Object> extra) { } if (gtfsBundle.linkStopsToParentStations) { hf.linkStopsToParentStations(graph); - } + } if (gtfsBundle.parentStationTransfers) { hf.createParentStationTransfers(); } - } - } catch (IOException e) { - throw new RuntimeException(e); } // We need to save the calendar service data so we can use it later @@ -149,9 +145,8 @@ public void buildGraph(Graph graph, HashMap, Object> extra) { * Private Methods ****/ - private void loadBundle(GtfsBundle gtfsBundle, Graph graph, GtfsMutableRelationalDao dao) - throws IOException { - + private void loadBundle(GtfsBundle gtfsBundle, Graph graph, GtfsMutableRelationalDao dao) { + try { StoreImpl store = new StoreImpl(dao); store.open(); LOG.info("reading {}", gtfsBundle.toString()); @@ -225,8 +220,12 @@ private void loadBundle(GtfsBundle gtfsBundle, Graph graph, GtfsMutableRelationa for (Pathway pathway : store.getAllEntitiesForType(Pathway.class)) { pathway.getId().setAgencyId(reader.getDefaultAgencyId()); } - store.close(); + } catch(Exception e) { + String msg=e.getMessage(); + System.out.println(msg); + throw new RuntimeException(e); + } } diff --git a/src/main/java/org/opentripplanner/updater/bike_rental/SmooveBikeRentalDataSource.java b/src/main/java/org/opentripplanner/updater/bike_rental/SmooveBikeRentalDataSource.java index be9bb5bf990..48ec1318849 100644 --- a/src/main/java/org/opentripplanner/updater/bike_rental/SmooveBikeRentalDataSource.java +++ b/src/main/java/org/opentripplanner/updater/bike_rental/SmooveBikeRentalDataSource.java @@ -59,8 +59,13 @@ public BikeRentalStation makeStation(JsonNode node) { try { station.y = Double.parseDouble(node.path("coordinates").asText().split(",")[0].trim()); station.x = Double.parseDouble(node.path("coordinates").asText().split(",")[1].trim()); - station.bikesAvailable = node.path("avl_bikes").asInt(); - station.spacesAvailable = node.path("free_slots").asInt(); + if (station.state.equals("Station on")) { + station.bikesAvailable = node.path("avl_bikes").asInt(); + station.spacesAvailable = node.path("free_slots").asInt(); + } else { + station.bikesAvailable = 0; + station.spacesAvailable = 0; + } return station; } catch (NumberFormatException e) { // E.g. coordinates is empty