Repository navigation
Conversation
Move network information to feed. Map back to station id in all APIs.
0850b6c to
342d4ab
Compare
|
Closes #3255 also |
|
This looks like a really good refactoring. |
|
I wondered for a long time why a station could have multiple networks. Was it only because it could be like that in OSM? |
Yes, That was the only usage for this possibility |
| public Boolean rentedVehicle; | ||
|
|
||
| public List<String> vehicleRentalNetworks = new ArrayList<>(); | ||
| public String vehicleRentalNetwork; |
There was a problem hiding this comment.
I would be the right thing to do but does this change the REST API?
There was a problem hiding this comment.
No, that class is an internal class, this is the model for the REST API
| @Override | ||
| public DataFetcher<Iterable<String>> networks() { | ||
| return environment -> getSource(environment).networks; | ||
| return environment -> List.of(getSource(environment).getNetwork()); |
There was a problem hiding this comment.
Good backwards-compatibility. 👍
| new T2<>("id", station.getStationId()), | ||
| new T2<>("name", station.name), | ||
| new T2<>("networks", String.join(",", station.networks)) | ||
| new T2<>("networks", station.getNetwork()) |
There was a problem hiding this comment.
Backwards-compatible. 👍
optionsome
left a comment
There was a problem hiding this comment.
The changes to smoove updater looked fine.
| * networks ("catch-all" network defined). | ||
| * Special case for "null" networks ("catch-all" network defined). | ||
| */ | ||
| if (stationNetworks == null || rentedNetworks == null) |
There was a problem hiding this comment.
Is it possible that there are stations with null network and stations with network information at the same time or should all stations have network information if one has?
There was a problem hiding this comment.
stationNetworks is never null. It could be previously, if an OSM station did not have it set. rentedNetworks however can be null, when travelling backwards in time, searching for a floating vehicle.
leonardehrenfried
left a comment
There was a problem hiding this comment.
This looks like a good PR and I would love to approve it but after having run it with our data set I get the following error when using the REST API:
15:23:57.622 ERROR (PlannerResource.java:96) System error
java.lang.NullPointerException: null
at org.opentripplanner.api.mapping.PlaceMapper.mapPlace(PlaceMapper.java:44) ~[otp.jar:1.1]
at org.opentripplanner.api.mapping.TripPlanMapper.mapTripPlan(TripPlanMapper.java:20) ~[otp.jar:1.1]
at org.opentripplanner.api.resource.PlannerResource.plan(PlannerResource.java:81) ~[otp.jar:1.1]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) ~[otp.jar:1.1]
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144) ~[otp.jar:1.1]
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161) ~[otp.jar:1.1]
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:205) ~[otp.jar:1.1]
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99) ~[otp.jar:1.1]
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389) ~[otp.jar:1.1]
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347) ~[otp.jar:1.1]
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102) ~[otp.jar:1.1]
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:308) ~[otp.jar:1.1]
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) ~[otp.jar:1.1]
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) ~[otp.jar:1.1]
at org.glassfish.jersey.internal.Errors.process(Errors.java:315) ~[otp.jar:1.1]
at org.glassfish.jersey.internal.Errors.process(Errors.java:297) ~[otp.jar:1.1]
at org.glassfish.jersey.internal.Errors.process(Errors.java:267) ~[otp.jar:1.1]
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) ~[otp.jar:1.1]
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:291) ~[otp.jar:1.1]
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1140) ~[otp.jar:1.1]
at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:375) ~[otp.jar:1.1]
at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:224) ~[otp.jar:1.1]
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565) ~[otp.jar:1.1]
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545) ~[otp.jar:1.1]
at java.base/java.lang.Thread.run(Thread.java:829) ~[na:na]
15:24:03.405 ERROR (PlannerResource.java:96) System error
java.lang.NullPointerException: null
at org.opentripplanner.api.mapping.PlaceMapper.mapPlace(PlaceMapper.java:44) ~[otp.jar:1.1]
at org.opentripplanner.api.mapping.TripPlanMapper.mapTripPlan(TripPlanMapper.java:20) ~[otp.jar:1.1]
at org.opentripplanner.api.resource.PlannerResource.plan(PlannerResource.java:81) ~[otp.jar:1.1]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) ~[otp.jar:1.1]
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144) ~[otp.jar:1.1]
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161) ~[otp.jar:1.1]
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:205) ~[otp.jar:1.1]
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99) ~[otp.jar:1.1]
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389) ~[otp.jar:1.1]
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347) ~[otp.jar:1.1]
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102) ~[otp.jar:1.1]
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:308) ~[otp.jar:1.1]
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) ~[otp.jar:1.1]
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) ~[otp.jar:1.1]
at org.glassfish.jersey.internal.Errors.process(Errors.java:315) ~[otp.jar:1.1]
at org.glassfish.jersey.internal.Errors.process(Errors.java:297) ~[otp.jar:1.1]
at org.glassfish.jersey.internal.Errors.process(Errors.java:267) ~[otp.jar:1.1]
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) ~[otp.jar:1.1]
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:291) ~[otp.jar:1.1]
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1140) ~[otp.jar:1.1]
at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:375) ~[otp.jar:1.1]
at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:224) ~[otp.jar:1.1]
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565) ~[otp.jar:1.1]
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545) ~[otp.jar:1.1]
at java.base/java.lang.Thread.run(Thread.java:829) ~[na:na]
Presumably a Place with a bikeShareId of null is being mapped.
Previously automatically mapped
leonardehrenfried
left a comment
There was a problem hiding this comment.
It works now. Thanks, @hannesj.
t2gran
left a comment
There was a problem hiding this comment.
The code changes look good from a code style and none functional requirements (NPE, threading, readability and so on).
|
This PR was discussed at todays developer meeting. @leonardehrenfried should test it and @t2gran should provide a code review - both tasks are done and this is reddy to be merged. |

Summary
Issue
closes #3597
Unit tests
Adapted existing tests. Added loading vehicle rental stations from CSV file, as static rental stations from OSM were previously used in tests.
Documentation
Removed reference to static vehicle rental stations from configuration.
Changelog
Updated