Create Attachment fails when providing no taskId but processInstanceId

XMLWordPrintable

    • Type: Bug Report
    • Resolution: Fixed
    • Priority: L3 - Default
    • 7.11.0, 7.9.10, 7.10.3, 7.11.0-alpha2
    • Affects Version/s: 7.9.5, 7.8.12, 7.10.0-alpha5
    • Component/s: None

      Scenario:
      Multiple executions exist during the attachment creation for a process instance.

      Example API call:

      TaskService taskService = processEngine.getTaskService();
      taskService.createAttachment(uploadContentType, null, processInstanceId, uploadFileName, description, fileInputStream);
      

      Current behavior:
      An exception is thrown:

      org.camunda.bpm.engine.ProcessEngineException: processInstances does not have 1 elements
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_181]
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_181]
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_181]
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_181]
      	at org.camunda.bpm.engine.impl.util.EnsureUtil.generateException(EnsureUtil.java:344) ~[camunda-engine-7.8.0.jar:7.8.0]
      	at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNumberOfElements(EnsureUtil.java:311) ~[camunda-engine-7.8.0.jar:7.8.0]
      	at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNumberOfElements(EnsureUtil.java:299) ~[camunda-engine-7.8.0.jar:7.8.0]
      	at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNumberOfElements(EnsureUtil.java:294) ~[camunda-engine-7.8.0.jar:7.8.0]
      	at org.camunda.bpm.engine.impl.cmd.CreateAttachmentCmd.execute(CreateAttachmentCmd.java:74) ~[camunda-engine-7.8.0.jar:7.8.0]
      	at org.camunda.bpm.engine.impl.cmd.CreateAttachmentCmd.execute(CreateAttachmentCmd.java:43) ~[camunda-engine-7.8.0.jar:7.8.0]
      

      Expected behavior:
      The attachment is created successfully.

      Hints: The exception is caused by the class CreateAttachmentCMD

      A workaround is to provide an empty String instead of null as taskId but then the operationLogManager is never called (the task of the taskId is never validated).

        This is the controller panel for Smart Panels app

              Assignee:
              Unassigned
              Reporter:
              Thomas Weber
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: