When using the directions API like so:
builder = (...)
MapboxDirections client = builder.build();
client.enqueueCall(new Callback<DirectionsResponse>() {
@Override
public void onResponse(@NonNull Call<DirectionsResponse> call, @NonNull Response<DirectionsResponse> response) {
(...)
}
@Override
public void onFailure(@NonNull Call<DirectionsResponse> call, @NonNull Throwable throwable) {
(...)
}
});
if no route can be found, then onResponse will be called twice.
This is highly surprising/unexpected, and in our case, caused a crash.
Expected Behavior
This should be called only once.
Current Behavior
It is called twice.
Possible Solution
a return should be added right after this line:
https://github.com/mapbox/mapbox-java/blob/master/services-directions/src/main/java/com/mapbox/api/directions/v5/MapboxDirections.java#L161
Steps to Reproduce
A call should be made that results in a NoRoute response (for instance, 2.308538,48.852698 to 120.960515,23.69781).
See above.
Context (Environment)
In our case this produced a crash because we use an Rx SingleEmitter and onError must not be called twice.
Detailed Description
See "possible solution" above.
Possible Implementation
See "possible solution" above.
When using the directions API like so:
if no route can be found, then
onResponsewill be called twice.This is highly surprising/unexpected, and in our case, caused a crash.
Expected Behavior
This should be called only once.
Current Behavior
It is called twice.
Possible Solution
a
returnshould be added right after this line:https://github.com/mapbox/mapbox-java/blob/master/services-directions/src/main/java/com/mapbox/api/directions/v5/MapboxDirections.java#L161
Steps to Reproduce
A call should be made that results in a
NoRouteresponse (for instance, 2.308538,48.852698 to 120.960515,23.69781).See above.
Context (Environment)
In our case this produced a crash because we use an Rx
SingleEmitterandonErrormust not be called twice.Detailed Description
See "possible solution" above.
Possible Implementation
See "possible solution" above.