mapbox-java icon indicating copy to clipboard operation
mapbox-java copied to clipboard

MapboxGeocoding - Not a JSON Array - Error processing response

Open nstele opened this issue 6 years ago • 2 comments

I've tried to get some results from MapboxGeocoding query but I'm getting this response: java.lang.IllegalStateException: Not a JSON Array: {"type":"Point","coordinates":[-95.36812,29.761636]}

Gradle:

mapboxAnnotationPluginVersion = '0.5.0'
mapboxServicesVersion = '4.7.0' .  (Also tried with 4.6.0 and 4.8.0)
mapboxVersion = '8.2.0'
Screen Shot 2019-09-13 at 09 59 18 Screen Shot 2019-09-13 at 10 00 06

Expected Behavior

Current Behavior

Getting : java.lang.IllegalStateException: Not a JSON Array: {"type":"Point","coordinates":[-95.36812,29.761636]}

Possible Solution

Steps to Reproduce

  1. Hardcoded a string (valid address) on query parameter
  2. Execute de code above in the screenshots
  3. Get the response error parsing

Context (Environment)

Detailed Description

Possible Implementation

nstele avatar Sep 13 '19 13:09 nstele

@nstele Thanks for your feedback! I could not reproduce the issue locally with the current information. I have the following test code with mapboxServicesVersion = '4.7.0' and the logs seems to be correct.

   MapboxGeocoding mapboxGeocoding = MapboxGeocoding.builder()
           .accessToken(AC_TOKEN)
           .query("701 Brazos St Suite 504")
           .build();
 
   mapboxGeocoding.enqueueCall(new Callback<GeocodingResponse>() {
     @Override
     public void onResponse(Call<GeocodingResponse> call, Response<GeocodingResponse> response) {
       System.out.println("response: " + response.body().features());
     }

     @Override
     public void onFailure(Call<GeocodingResponse> call, Throwable throwable) {
       System.out.println("error: " + throwable.getMessage());
     }
   });

Could you provide the full stack trace and maybe more info about your setup? Thanks!

pengdev avatar Sep 17 '19 13:09 pengdev

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

stale[bot] avatar Mar 15 '20 14:03 stale[bot]