Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-25001

REST plugin fails for issues with attachments which have non-String properties

    XMLWordPrintable

Details

    Description

      REST plugin currently assumes that all custom properties are strings:

      public class PropertySetAdapter extends XmlAdapter<Map<String, String>, PropertySet>
      {
      ...
      
          @Override
          public HashMap<String, String> marshal(final PropertySet propertySet)
          {
              final HashMap<String, String> map = new HashMap<String, String>();
              final Collection<String> keys = propertySet.getKeys();
              for (String key : keys)
              {
                  map.put(key, propertySet.getString(key));
              }
              return map;
          }
      ...
      }
      
      

      In case of e.g. Apache JIRA instance it supposedly uses non-String properties which leads to:

      /rest/api/latest/issue/ISSUEKEYHERE [jira.rest.exception.ExceptionInterceptor] Returning internal server error in response
      java.lang.reflect.InvocationTargetException
      	at sun.reflect.GeneratedMethodAccessor1586.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$ResponseOutInvoker$1.invoke(DispatchProviderHelper.java:206)
      	at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$1.intercept(DispatchProviderHelper.java:90)
      	at com.atlassian.plugins.rest.common.interceptor.impl.DefaultMethodInvocation.invoke(DefaultMethodInvocation.java:61)
      	at com.atlassian.jira.rest.exception.ExceptionInterceptor.intercept(ExceptionInterceptor.java:59)
      	at com.atlassian.plugins.rest.common.interceptor.impl.DefaultMethodInvocation.invoke(DefaultMethodInvocation.java:61)
      	at com.atlassian.jira.rest.v2.issue.scope.RequestScopeInterceptor.intercept(RequestScopeInterceptor.java:42)
      	at com.atlassian.plugins.rest.common.interceptor.impl.DefaultMethodInvocation.invoke(DefaultMethodInvocation.java:61)
      	at com.atlassian.plugins.rest.common.expand.interceptor.ExpandInterceptor.intercept(ExpandInterceptor.java:38)
      	at com.atlassian.plugins.rest.common.interceptor.impl.DefaultMethodInvocation.invoke(DefaultMethodInvocation.java:61)
      	at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper.invokeMethodWithInterceptors(DispatchProviderHelper.java:98)
      	at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper.access$100(DispatchProviderHelper.java:28)
      	at com.atlassian.plugins.rest.common.interceptor.impl.DispatchProviderHelper$ResponseOutInvoker._dispatch(DispatchProviderHelper.java:202)
      	at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
      	at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:163)
      ....
      Caused by: com.opensymphony.module.propertyset.InvalidPropertyTypeException
      	at com.opensymphony.module.propertyset.ofbiz.OFBizPropertySet.get(OFBizPropertySet.java:273)
      	at com.opensymphony.module.propertyset.AbstractPropertySet.getString(AbstractPropertySet.java:305)
      	at com.atlassian.jira.rest.v2.issue.PropertySetAdapter.marshal(PropertySetAdapter.java:32)
      	at com.atlassian.jira.rest.v2.issue.AttachmentBeanBuilder.build(AttachmentBeanBuilder.java:95)
      	at com.atlassian.jira.rest.v2.issue.IssueResource$3.get(IssueResource.java:905)
      	at com.atlassian.jira.rest.v2.issue.IssueResource$3.get(IssueResource.java:902)
      	at com.atlassian.jira.util.collect.TransformingIterator.next(TransformingIterator.java:38)
      	at com.atlassian.jira.util.collect.CollectionUtil.foreach(CollectionUtil.java:43)
      	at com.atlassian.jira.util.collect.CollectionUtil.toList(CollectionUtil.java:72)
      	at com.atlassian.jira.util.collect.CollectionUtil.transform(CollectionUtil.java:141)
      	at com.atlassian.jira.util.collect.CollectionUtil.transform(CollectionUtil.java:163)
      	at com.atlassian.jira.rest.v2.issue.IssueResource.addAttachments(IssueResource.java:901)
      	at com.atlassian.jira.rest.v2.issue.IssueResource.createIssue(IssueResource.java:881)
      	at com.atlassian.jira.rest.v2.issue.IssueResource.getIssue(IssueResource.java:683)
      

      See https://issues.apache.org/jira/browse/INFRA-3750 for more details.

      Attachments

        Activity

          People

            tcampbell Trevor Campbell (Inactive)
            wseliga Wojtek Seliga (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: