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

IllegalArgumentException: No matching constant for [-1] after upgrading from M4 to RC

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 1.0.0.RC1
    • Fix Version/s: 2.0.0.M1
    • Component/s: rest-template
    • Labels:
      None
    • Environment:
      Honeycomb

      Description

      An issue was reported in the forum that upgrading to RC1 resulted in the IllegalArgumentException. Switching to use the HttpComponentsClientHttpRequestFactory resolves the issue. Prior to RC1, Rest Template defaulted to the HttpComponentsClientHttpRequestFactory, but now in versions greater than Froyo (2.2), it defaults to SimpleClientHttpRequestFactory. It may be that SimpleClientHttpRequestFactory was not working in any of the previous versions either. Here is the reported Rest Template construction being used:

      HttpHeaders requestHeaders = new HttpHeaders();
      List<MediaType> acceptableMediaTypesXml = new ArrayList<MediaType>();
      acceptableMediaTypesXml.add(MediaType.APPLICATION_XML);
      requestHeaders.set("WsUsername", "username");
      requestHeaders.set("WsPassword", "password");
      requestHeaders.setAcceptEncoding(ContentCodingType.GZIP);
      if (ticket != null)

      { requestHeaders.set("Ticket", ticket); }

      requestHeaders.set("TerminalID", UnoMobilApplication.getTerminalId());
      restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory()); // since default doesn't work...
      requestHeaders.setAccept(acceptableMediaTypesXml);
      HttpEntity<?> requestEntity = new HttpEntity<String>(id, requestHeaders);
      ResponseEntity<DeliveryList> responseEntity = restTemplate.exchange(url + "deliveries/" + id, HttpMethod.GET, requestEntity, DeliveryList.class);
      return responseEntity.getBody();

        Attachments

          Activity

            People

            • Assignee:
              rclarkson Roy Clarkson
              Reporter:
              rclarkson Roy Clarkson
            • Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: