Uploaded image for project: 'Spring for Android'
  1. Spring for Android
  2. ANDROID-102

SimpleClientHttpResponse throws null pointer exception

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 1.0.0.RELEASE
    • Fix Version/s: 1.0.1.RELEASE
    • Component/s: rest-template
    • Labels:
      None
    • Environment:
      Wndows, using Android emulator

      Description

      During processing a response from the server the SimpleClientHttpResponse throws NullPointerException:
      08-31 19:25:12.906: E/AndroidRuntime(2437): Caused by: java.lang.NullPointerException
      08-31 19:25:12.906: E/AndroidRuntime(2437): at org.springframework.http.client.SimpleClientHttpResponse.getStatusCode(SimpleClientHttpResponse.java:62)
      08-31 19:25:12.906: E/AndroidRuntime(2437): at org.springframework.web.client.DefaultResponseErrorHandler.hasError(DefaultResponseErrorHandler.java:46)
      08-31 19:25:12.906: E/AndroidRuntime(2437): at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:476)
      08-31 19:25:12.906: E/AndroidRuntime(2437): at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:438)
      08-31 19:25:12.906: E/AndroidRuntime(2437): at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:414)

      A reason seems to be that IOException thrown returns null from call to getLocalizedMessage():
      if (ex.getLocalizedMessage().equals(AUTHENTICATION_ERROR))

      { return HttpStatus.UNAUTHORIZED; }

      else

      { throw ex; }

      BTW, what will getLocalizedMessage() return if locale is not English?

        Attachments

          Activity

            People

            • Assignee:
              rclarkson Roy Clarkson
              Reporter:
              leonidvlad Leonid Vladimirov
            • Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: