Uploaded image for project: 'Jira Server and Data Center'
  1. Jira Server and Data Center
  2. JRASERVER-11458

The definition of the Interface AttachmentManager is inconsistent with ofbiz

    XMLWordPrintable

Details

    Description

      The definiton of the Interface AttachmentManager contains the following method

      public ChangeItemBean createAttachment(File file,
                                             String filename,
                                             String contentType,
                                             User remoteUser,
                                             org.ofbiz.core.entity.GenericValue issue,
                                             Map attachmentProperties,
                                             Date createdTime)
                                      throws AttachmentException,
                                             org.ofbiz.core.entity.GenericEntityException
      

      Actually the Date createdTime refers to java.util.Date but the underlying ofbiz layer does not support it. Instead of java.util.Date it can persist java.sql.Date which is a subclass of it. The following stack trace shows what happens with java.util.Date:

      org.ofbiz.core.entity.GenericNotImplementedException: Java type java.util.Date not currently supported. Sorry.
              at org.ofbiz.core.entity.jdbc.SqlJdbcUtil.getType(SqlJdbcUtil.java:720)
              at org.ofbiz.core.entity.jdbc.SqlJdbcUtil.setValue(SqlJdbcUtil.java:632)
              at org.ofbiz.core.entity.jdbc.SqlJdbcUtil.setValue(SqlJdbcUtil.java:601)
              at org.ofbiz.core.entity.jdbc.SqlJdbcUtil.setValues(SqlJdbcUtil.java:436)
              at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:114)
              at org.ofbiz.core.entity.GenericDAO.insert(GenericDAO.java:88)
              at org.ofbiz.core.entity.GenericHelperDAO.create(GenericHelperDAO.java:63)
              at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:470)
              at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:450)
              at org.ofbiz.core.entity.GenericValue.create(GenericValue.java:77)
              at com.atlassian.core.ofbiz.util.EntityUtils.createValue(EntityUtils.java:61)
              at com.atlassian.jira.issue.managers.DefaultAttachmentManager.createAttachment(DefaultAttachmentManager.java:101)
              at com.atlassian.jira.issue.managers.DefaultAttachmentManager.createAttachment(DefaultAttachmentManager.java:202)
              .....
      

      I suppose that the definition of the method (and the other createAttachment method) and the implementing class should be changed to java.sql.Date.

      Workaround

      Use java.sql.Date instead of java.util.Date

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              93aa57d606d0 Verhás István
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 1h
                  1h
                  Remaining:
                  Remaining Estimate - 1h
                  1h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified