Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependency on BindingContextFactory #909

Merged
merged 1 commit into from
Oct 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
import com.mapbox.core.utils.MapboxUtils;
import com.mapbox.core.utils.TextUtils;
import com.mapbox.geojson.Point;
import com.sun.xml.internal.ws.spi.db.BindingContextFactory;

import java.io.IOException;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;

import okhttp3.ResponseBody;
import retrofit2.Call;
Expand Down Expand Up @@ -184,14 +184,14 @@ private void errorDidOccur(@Nullable Callback<DirectionsResponse> callback,
Converter<ResponseBody, DirectionsError> errorConverter =
getRetrofit().responseBodyConverter(DirectionsError.class, new Annotation[0]);
if (callback == null) {
BindingContextFactory.LOGGER.log(
Logger.getLogger(MapboxDirections.class.getName()).log(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of duplicating Logger.getLogger(MapboxDirections.class.getName()) several times, could you extract it as a local private class-level variable instead?

Level.WARNING, "Failed to complete your request and callback is null");
} else {
try {
callback.onFailure(getCall(),
new Throwable(errorConverter.convert(response.errorBody()).message()));
} catch (IOException ioException) {
BindingContextFactory.LOGGER.log(
Logger.getLogger(MapboxDirections.class.getName()).log(
Level.WARNING, "Failed to complete your request. ", ioException);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
import com.mapbox.core.utils.TextUtils;
import com.mapbox.geojson.Point;

import com.sun.xml.internal.ws.spi.db.BindingContextFactory;

import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Callback;
Expand All @@ -40,6 +38,7 @@
import java.util.List;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;


/**
Expand Down Expand Up @@ -187,14 +186,14 @@ private void errorDidOccur(@Nullable Callback<MapMatchingResponse> callback,
Converter<ResponseBody, MapMatchingError> errorConverter =
getRetrofit().responseBodyConverter(MapMatchingError.class, new Annotation[0]);
if (callback == null) {
BindingContextFactory.LOGGER.log(
Logger.getLogger(MapboxMapMatching.class.getName()).log(
Level.WARNING, "Failed to complete your request and callback is null");
} else {
try {
callback.onFailure(getCall(),
new Throwable(errorConverter.convert(response.errorBody()).message()));
} catch (IOException ioException) {
BindingContextFactory.LOGGER.log(
Logger.getLogger(MapboxMapMatching.class.getName()).log(
Level.WARNING, "Failed to complete your request. ", ioException);
}
}
Expand Down