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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Posted 10 hours ago in Jira

We want to know what Jira Service Desk apps you're using!

Hi Community! My name is Amir and I’m on the Jira Service Desk product marketing team at Atlassian. Our team would love to understand how you’re leveraging our ecosystem for Jira Service Desk. Wha...

33 views 0 5
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