When I use com.atlassian.jira:jira-rest-java-client-core:5.0.4 to get issue transitions.
The client report exception:
Caused by: org.codehaus.jettison.json.JSONException: JSONObject["fields"] not found. at org.codehaus.jettison.json.JSONObject.get(JSONObject.java:360)
at org.codehaus.jettison.json.JSONObject.getJSONObject(JSONObject.java:454)
at com.atlassian.jira.rest.client.internal.json.TransitionJsonParserV5.parse(TransitionJsonParserV5.java:33)
My jira server is Jira (v6.4.7#64022-sha1:4cb2968)
Hi @雷,
The exception indicate that you are trying to access JSONObject property called "fields". This might be caused if your rest response doesn't have a property named fields.
Before accessing the JSON object check the response status code. If it is different from 200, the rest response don't have fields, instead it tries to tell you that some form of error has occurred in the response.
Hope this helps!
Hello again,
I don't think that this is a bug in jira-rest-java-client, it is simply a GIGO(Garbage In Garbage Out) principle. If you give a bad request to jira rest api, It will give you incorrect result.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello again @雷,
Sorry for the late reply. I have seen your query parameter and what I observed is that you didn't use expand parameter.
You should append &expand=transitions.fields to your query parameter.
Hope this helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am also getting same error. However, I am using jql and in code I am getting the error. How to include expand in it. expand is not available in jql.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.