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.

有帮助吗?

解决方案

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

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top