(Posted this under discussion, but it was marked as spam, so trying here)
I am trying to set up Hygieia dashboard and while setting up the jira-collector (which has jira-rest-java-client-core v3.0.0 as a dependency) I came across the following error:
Caused by: org.codehaus.jettison.json.JSONException: JSONObject["type"] not found.
at org.codehaus.jettison.json.JSONObject.get(JSONObject.java:360) ~[jettison-1.1.jar!/:1.1]
at org.codehaus.jettison.json.JSONObject.getString(JSONObject.java:487) ~[jettison-1.1.jar!/:1.1]
at com.atlassian.jira.rest.client.internal.json.IssueJsonParser.parseSchema(IssueJsonParser.java:344) ~[jira-rest-java-client-core-3.0.0.jar!/:na]
at com.atlassian.jira.rest.client.internal.json.IssueJsonParser.parseFields(IssueJsonParser.java:309) ~[jira-rest-java-client-core-3.0.0.jar!/:na]
at com.atlassian.jira.rest.client.internal.json.IssueJsonParser.parse(IssueJsonParser.java:223) ~[jira-rest-java-client-core-3.0.0.jar!/:na]
at com.atlassian.jira.rest.client.internal.json.IssueJsonParser.parse(IssueJsonParser.java:88) ~[jira-rest-java-client-core-3.0.0.jar!/:na]
at com.atlassian.jira.rest.client.internal.json.GenericJsonArrayParser.parse(GenericJsonArrayParser.java:39) ~[jira-rest-java-client-core-3.0.0.jar!/:na]
at com.atlassian.jira.rest.client.internal.json.SearchResultJsonParser.parse(SearchResultJsonParser.java:40) ~[jira-rest-java-client-core-3.0.0.jar!/:na]
at com.atlassian.jira.rest.client.internal.json.SearchResultJsonParser.parse(SearchResultJsonParser.java:27) ~[jira-rest-java-client-core-3.0.0.jar!/:na]
at com.atlassian.jira.rest.client.internal.async.AbstractAsynchronousRestClient$1.handle(AbstractAsynchronousRestClient.java:145) ~[jira-rest-java-client-core-3.0.0.jar!/:na]
at com.atlassian.jira.rest.client.internal.async.AbstractAsynchronousRestClient$3.apply(AbstractAsynchronousRestClient.java:186) ~[jira-rest-java-client-core-3.0.0.jar!/:na]
The error thrown is from:
com.atlassian.jira.rest.client.internal.json.IssueJsonParser.parseSchema(IssueJsonParser.java:344)
and that line looks like:
(line 343) JSONObject fieldDefinition = json.getJSONObject(fieldId);
(line 344) res.put(fieldId, fieldDefinition.getString("type")); <<< res is a map returned by this method
The json object parsed by IssueJsonParser.parseSchema causing the exception looks like:
{"custom":"com.onresolve.jira.groovy.groovyrunner:scripted-field","customId":xxxxx}
which does not contain the field "type".
As IssueJsonParser.parseSchema is a private method only called by IssueJsonParser.parseFields, and that method is only concerned with values of type, "key":
res.add(new IssueField(key, namesMap.get(key), typesMap.get("key"), value != JSONObject.NULL ? value : null));
should IssueJsonParser.parseSchema check for "type" field prior to adding to the map, i.e.:
(line 344 becomes)
if (fieldDefinition.has("type")) {
res.put(fieldId, fieldDefinition.getString("type"));
}
or should com.onresolve.jira.groovy.groovyrunner:scripted-field be required to contain a "type" field?
Currently I am implementing the if-statement, but that requires me to maintain my own version of jrjc which I would rather avoid doing. I am new to Jira and jrjc so I was hoping start a discussion on whether adding the if-statement is most appropriate or if adding the "type" field is a better option. If the latter, how would one go about adding this field? Any help would be much appreciated, thanks.
Community moderators have prevented the ability to post new answers.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.