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

This widget could not be displayed.

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);

This widget could not be displayed.

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
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

197 views 1 3
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