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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Wednesday in Jira

Join our webinar: How 1B+ feature flag events helped us build the new Jira

Every time you release software, there's a bit of risk – that there's a bug, that something breaks, or that the feature doesn't resonate with customers. Feature flagging helps make high stakes s...

136 views 0 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