2

I'm trying to query ALM defects with a filter condition, but I get the below exception. The same URL is working fine when accessed through a browser.

java.io.IOException: Server returned HTTP response code: 500 for URL:
http://ealm11.mycomp.com:80/qcbin/rest/domains/TESTING/projects/2014/defects?query={owner['das'  or 'john' or 'kim'];status[Assigned]}&fields=id    at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at
sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1491)
    at java.security.AccessController.doPrivileged(Native Method)   at
sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1485)
    at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1139)

Also, if the URL does not have the "or" condition in one of the param values as below

http://ealm11.mycomp.com:80/qcbin/rest/domains/TESTING/projects/2014/defects?query={owner['das'];status[Assigned]}&fields=id

it's working but when i introduce "or" conditions, java is throwing the above error.

pnuts
  • 58,317
  • 11
  • 87
  • 139
J28
  • 1,080
  • 3
  • 15
  • 25
  • What is the response if you put the query from java in your browser? Now you are comparing red apples with green apples :) – Salandur Feb 05 '14 at 21:12
  • See http://stackoverflow.com/questions/3432263/java-io-ioexception-server-returned-http-response-code-500 – Raedwald Feb 05 '14 at 21:12
  • @Salandur The URL which is causing exception in Java works fine in my browser. – J28 Feb 06 '14 at 03:37

2 Answers2

2

Have you tried with a "%20" for spaces in the URL?

http://ealm11.mycomp.com:80/qcbin/rest/domains/TESTING/projects/2014/defects?query={owner['das'%20or%20'john'%20or%20'kim'];status[Assigned]}&fields=id
Alvin Bunk
  • 7,621
  • 3
  • 29
  • 45
0

Errorcodes from 500 and upwards are errors at serverside.

This means you can't do anything against it.

But in fact I think, it should be a 406 Bad Request and you did a malformed request and the server has an error which throws an exception.

Are you sure, that OR is valid for this request?

Update You may need to urlencode your query (only true for the query part). Browser are encoding automatic, java not.

Christian Kuetbach
  • 15,850
  • 5
  • 43
  • 79