Results 1 to 10 of 16

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

Hybrid View

  1. #1

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

    I just upgraded from Spring for Android 1.0.0 M4 to RC1 and now I am gettting the following exception when trying to call my rest service the second time (first call works ok..):

    Code:
    java.lang.IllegalArgumentException: No matching constant for [-1]
    03-08 18:23:09.204 D/UnoMobil(  584): 	at org.springframework.http.HttpStatus.valueOf(HttpStatus.java:380)
    03-08 18:23:09.204 D/UnoMobil(  584): 	at org.springframework.http.client.SimpleClientHttpResponse.getStatusCode(SimpleClientHttpResponse.java:49)
    03-08 18:23:09.204 D/UnoMobil(  584): 	at org.springframework.web.client.DefaultResponseErrorHandler.hasError(DefaultResponseErrorHandler.java:46)
    03-08 18:23:09.204 D/UnoMobil(  584): 	at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:457)
    03-08 18:23:09.204 D/UnoMobil(  584): 	at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:419)
    03-08 18:23:09.204 D/UnoMobil(  584): 	at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:395)
    03-08 18:23:09.204 D/UnoMobil(  584): 	at no.asp.as.unomobil.services.rest.DeliveryService.getDeliveries(DeliveryService.java:38)
    03-08 18:23:09.204 D/UnoMobil(  584): 	at no.asp.as.unomobil.tasks.DeliveryListTask.doInBackground(DeliveryListTask.java:56)
    03-08 18:23:09.204 D/UnoMobil(  584): 	at no.asp.as.unomobil.tasks.DeliveryListTask.doInBackground(DeliveryListTask.java:23)
    03-08 18:23:09.204 D/UnoMobil(  584): 	at android.os.AsyncTask$2.call(AsyncTask.java:252)
    03-08 18:23:09.204 D/UnoMobil(  584): 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
    03-08 18:23:09.204 D/UnoMobil(  584): 	at java.util.concurrent.FutureTask.run(FutureTask.java:137)
    03-08 18:23:09.204 D/UnoMobil(  584): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1081)
    03-08 18:23:09.204 D/UnoMobil(  584): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:574)
    03-08 18:23:09.204 D/UnoMobil(  584): 	at java.lang.Thread.run(Thread.java:1020)

    What am I missing?


    Regards,

    BTJ
    Someone wrote:
    "I understand that if you play a Windows CD backwards you hear strange Satanic messages"
    To which someone replied:
    "It's even worse than that; play it forwards and it installs Windows"

  2. #2

    Default

    Ok, if I use HttpComponentsClientHttpRequestFactory instead of the default SimpleClientHttpRequestFactory then it works.... Does this mean the default should not be used or?

    BTJ
    Someone wrote:
    "I understand that if you play a Windows CD backwards you hear strange Satanic messages"
    To which someone replied:
    "It's even worse than that; play it forwards and it installs Windows"

  3. #3
    Join Date
    Nov 2010
    Posts
    174

    Default

    Hi, on which version of Android are you testing or running? It sounds like you reusing the same RestTemplate object when you make a "second request", is that correct? Any more details would be appreciated. As a workaround you can certainly use the HttpComponents client. Thanks!
    Roy Clarkson
    Spring Mobile Projects Lead

  4. #4

    Default

    I was testing under Android 3.2...
    Also I thought about reusing the RestTemplate and now I became a bit unsure... I was certain I didn't reuse the RestTemplate but now I have to check again...

    Btw, what are the pros and cons of using the HttpComponent vs SimpleClient?


    BTJ
    Someone wrote:
    "I understand that if you play a Windows CD backwards you hear strange Satanic messages"
    To which someone replied:
    "It's even worse than that; play it forwards and it installs Windows"

  5. #5
    Join Date
    Nov 2010
    Posts
    174

    Default

    You should be able to reuse a RestTemplate object to make multiple requests. Google recommends using the standard J2SE facilities in Gingerbread and newer because of functionality improvements and bug fixes. In the RC1 release, Spring for Android now defaults to this in Gingerbread and newer. Here is a some additional information from Google:

    http://android-developers.blogspot.c...p-clients.html
    Roy Clarkson
    Spring Mobile Projects Lead

  6. #6

    Default

    So, any explanation to why I get IllegalArgumentException?

    BTJ
    Someone wrote:
    "I understand that if you play a Windows CD backwards you hear strange Satanic messages"
    To which someone replied:
    "It's even worse than that; play it forwards and it installs Windows"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •