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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,189 views 13 19
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot