I’m trying to convert issue to Json, but i had “Stackoverflow” when using latest version jackson.databind or “Conflicting getter definitions for property” when using codehouse.jackson.xc.
On the old jira version it worked (6.2.7), updated to 7.11.2 and later it stopped working.
Now my code looks like this:
public String getIssuePresentation(Issue issue) throws IOException, URISyntaxException {
ApplicationUser loggedInUser = jiraAuthenticationContext.getLoggedInUser();
IssueBean issueBean = getIssueBean(issue);
com.fasterxml.jackson.databind.ObjectMapper mapper = new com.fasterxml.jackson.databind.ObjectMapper();
mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY);
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
mapper.setAnnotationIntrospector(new com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector(mapper.getTypeFactory()));
mapper.setSerializationInclusion(Include.NON_NULL);
return mapper1.writeValueAsString(issueBean);
}
private IssueBean getIssueBean(Issue issue) {
BeanBuilderFactory beanBuilderFactory = ComponentAccessor
.getOSGiComponentInstanceOfType(BeanBuilderFactory.class);
JiraBaseUrls jiraBaseUrls = ComponentAccessor.getComponent(JiraBaseUrls.class);
UriBuilder uriBuilder = UriBuilder.fromPath(jiraBaseUrls.restApi2BaseUrl());
IssueBeanBuilder2 issueBeanBuilder = beanBuilderFactory
.newIssueBeanBuilder2(IncludedFields.includeAllByDefault(null), "expand", uriBuilder);
return issueBeanBuilder.build(issue);
}
I tried using com.atlassian.adapter.jackson.ObjectMapper, and that works, but there is no “issueTypeLink" values in “issuelinks”.