JRJC update fixversions

I try to update the fixversions. But I get Excepitons. How to do that

jira-rest-java-client-1.0.jar


final Transition resolveIssueTransition = getTransitionByName(transitions, "Edit Issue"); 
String[] versions = {"20975"};
Collection<FieldInput> fieldInputs = Arrays.asList(new FieldInput("fixVersions", versions));
final TransitionInput transitionInput = new TransitionInput(resolveIssueTransition.getId(), fieldInputs);        
jiraRestClient.getIssueClient().transition(issue.getTransitionsUri(), transitionInput, progressMonitor);

Exception in thread "main" com.atlassian.jira.rest.client.RestClientException: org.codehaus.jettison.json.JSONException: Cannot generate value - unknown type for me: class [Ljava.lang.String;
	at com.atlassian.jira.rest.client.internal.jersey.AbstractJerseyRestClient.invoke(AbstractJerseyRestClient.java:75)
	at com.atlassian.jira.rest.client.internal.jersey.JerseyIssueRestClient.transition(JerseyIssueRestClient.java:188)
	at RestClientTest.main(RestClientTest.java:419)
Caused by: org.codehaus.jettison.json.JSONException: Cannot generate value - unknown type for me: class [Ljava.lang.String;
	at com.atlassian.jira.rest.client.internal.json.gen.ComplexIssueInputFieldValueJsonGenerator.generateFieldValueForJson(ComplexIssueInputFieldValueJsonGenerator.java:59)
	at com.atlassian.jira.rest.client.internal.jersey.JerseyIssueRestClient$3.call(JerseyIssueRestClient.java:213)
	at com.atlassian.jira.rest.client.internal.jersey.JerseyIssueRestClient$3.call(JerseyIssueRestClient.java:188)
	at com.atlassian.jira.rest.client.internal.jersey.AbstractJerseyRestClient.invoke(AbstractJerseyRestClient.java:54)
	... 2 more

2 answers

I tried the follow Code and have now no exception but it does not do anything


final Transition resolveIssueTransition = getTransitionByName(transitions, "Edit Issue"); 
final Version fixVersion = getVersionByName(jiraRestClient.getProjectClient().getProject("ProjectId", pm).getVersions(), "VersionID");
List<ComplexIssueInputFieldValue> reportedVersions = new ArrayList<ComplexIssueInputFieldValue>();
for (Version version : issue.getFixVersions()) {
	reportedVersions.add(ComplexIssueInputFieldValue.with("fixVersions",version.getId()));
}
reportedVersions.add(ComplexIssueInputFieldValue.with("fixVersions",fixVersion.getId()));
List<FieldInput> fieldInputs = new ArrayList<FieldInput>();
fieldInputs.add(new FieldInput("fixVersions", reportedVersions));
final TransitionInput transitionInput = new TransitionInput(resolveIssueTransition.getId(), fieldInputs);        
jiraRestClient.getIssueClient().transition(issue.getTransitionsUri(), transitionInput, pm);

inside the List<ComplexIssueInputFieldValue>, data should be added as 

lstValue.add(ComplexIssueInputFieldValue.with("id",String.valueOf(id)));


Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,447 views 15 19
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you