valb3r / flowable-bpmn-intellij-plugin

Flowable, Activiti, Camunda BPMN engines process editor plugin for IntelliJ. Pure Kotlin (and some Java)
https://plugins.jetbrains.com/plugin/14318-flowable-bpmn-visualizer
MIT License
157 stars 31 forks source link

KotlinNullPointerException on show diagram #310

Open sshmakov opened 2 years ago

sshmakov commented 2 years ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Open IDEA with project
  2. Open file created in Camunda Modeler 4.10.0
  3. Open tab BPMN-Camunda-Modeler - is empty.
  4. Click on splitter in the tab, pull down
  5. Click on upper (black) diagram space
  6. See error "IDE error occured"
kotlin.KotlinNullPointerException
    at com.valb3r.bpmn.intellij.plugin.core.events.ProcessModelUpdateEventsKt.updateEventsRegistry(ProcessModelUpdateEvents.kt:24)
    at com.valb3r.bpmn.intellij.plugin.core.state.CurrentStateProvider.handleUpdates(CurrentState.kt:95)
    at com.valb3r.bpmn.intellij.plugin.core.state.CurrentStateProvider.currentState(CurrentState.kt:82)
    at com.valb3r.bpmn.intellij.plugin.core.render.Canvas.updatePropertyVisualizer(Canvas.kt:422)
    at com.valb3r.bpmn.intellij.plugin.core.render.Canvas.click(Canvas.kt:207)
    at com.valb3r.bpmn.intellij.plugin.core.MouseEventHandler.mouseClicked(MouseEventHandler.kt:39)
    at java.desktop/java.awt.Component.processMouseEvent(Component.java:6655)
    at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3345)
    at java.desktop/java.awt.Component.processEvent(Component.java:6417)
    at java.desktop/java.awt.Container.processEvent(Container.java:2263)
    at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5027)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4859)
    at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
    at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4556)
    at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
    at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2784)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4859)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:778)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:751)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:749)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:748)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:885)
    at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:814)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:751)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:441)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:825)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:440)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:794)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:492)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

BPMN definition

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
                  xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
                  xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn"
                  xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
                  xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1jttrhw"
                  targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.10.0"
                  modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0">
    <bpmn:collaboration id="Collaboration_08ihe8v">
        <bpmn:participant id="Participant_08qxl1c" name="Блок 1" processRef="Process_11x80og"/>
        <bpmn:participant id="Participant_1r6dfm5" name="Блок 2" processRef="Process_1bob2uo"/>
        <bpmn:messageFlow id="Flow_04eygga" sourceRef="Activity_0yjqh32" targetRef="Event_16u4j0x"/>
        <bpmn:messageFlow id="Flow_0mxccca" sourceRef="Activity_1gcz8pp" targetRef="Event_1m1jnrs"/>
    </bpmn:collaboration>
    <bpmn:process id="Process_11x80og" isExecutable="true">
        <bpmn:startEvent id="StartEvent_1">
            <bpmn:outgoing>Flow_1cef2ar</bpmn:outgoing>
        </bpmn:startEvent>
        <bpmn:task id="Activity_1gcz8pp">
            <bpmn:incoming>Flow_1cef2ar</bpmn:incoming>
            <bpmn:outgoing>Flow_01dxkqk</bpmn:outgoing>
        </bpmn:task>
        <bpmn:exclusiveGateway id="Gateway_1xn0v06" default="Flow_0632kdh">
            <bpmn:extensionElements>
                <camunda:properties>
                    <camunda:property/>
                </camunda:properties>
            </bpmn:extensionElements>
            <bpmn:incoming>Flow_01dxkqk</bpmn:incoming>
            <bpmn:outgoing>Flow_0632kdh</bpmn:outgoing>
        </bpmn:exclusiveGateway>
        <bpmn:task id="Activity_0yjqh32">
            <bpmn:incoming>Flow_0632kdh</bpmn:incoming>
            <bpmn:outgoing>Flow_1c24alz</bpmn:outgoing>
        </bpmn:task>
        <bpmn:sequenceFlow id="Flow_1cef2ar" sourceRef="StartEvent_1" targetRef="Activity_1gcz8pp"/>
        <bpmn:sequenceFlow id="Flow_01dxkqk" sourceRef="Activity_1gcz8pp" targetRef="Gateway_1xn0v06"/>
        <bpmn:sequenceFlow id="Flow_0632kdh" sourceRef="Gateway_1xn0v06" targetRef="Activity_0yjqh32"/>
        <bpmn:task id="Activity_0hz5fxo">
            <bpmn:incoming>Flow_1c24alz</bpmn:incoming>
        </bpmn:task>
        <bpmn:sequenceFlow id="Flow_1c24alz" sourceRef="Activity_0yjqh32" targetRef="Activity_0hz5fxo"/>
    </bpmn:process>
    <bpmn:process id="Process_1bob2uo" isExecutable="false">
        <bpmn:laneSet id="LaneSet_1kcw22r">
            <bpmn:lane id="Lane_1hhry9z">
                <bpmn:flowNodeRef>Event_1m1jnrs</bpmn:flowNodeRef>
                <bpmn:flowNodeRef>Gateway_1f0i8b5</bpmn:flowNodeRef>
                <bpmn:flowNodeRef>Event_16u4j0x</bpmn:flowNodeRef>
            </bpmn:lane>
            <bpmn:lane id="Lane_1fkrhrc" name="line 2">
                <bpmn:flowNodeRef>Activity_0dqbj0d</bpmn:flowNodeRef>
            </bpmn:lane>
        </bpmn:laneSet>
        <bpmn:sequenceFlow id="Flow_0ur7jkd" sourceRef="Event_1m1jnrs" targetRef="Gateway_1f0i8b5"/>
        <bpmn:sequenceFlow id="Flow_1npjzde" sourceRef="Gateway_1f0i8b5" targetRef="Activity_0dqbj0d"/>
        <bpmn:startEvent id="Event_1m1jnrs">
            <bpmn:outgoing>Flow_0ur7jkd</bpmn:outgoing>
            <bpmn:messageEventDefinition id="MessageEventDefinition_1kczqzp"/>
        </bpmn:startEvent>
        <bpmn:sequenceFlow id="Flow_17mwfuh" sourceRef="Event_16u4j0x" targetRef="Gateway_1f0i8b5"/>
        <bpmn:exclusiveGateway id="Gateway_1f0i8b5">
            <bpmn:incoming>Flow_0ur7jkd</bpmn:incoming>
            <bpmn:incoming>Flow_17mwfuh</bpmn:incoming>
            <bpmn:outgoing>Flow_1npjzde</bpmn:outgoing>
        </bpmn:exclusiveGateway>
        <bpmn:startEvent id="Event_16u4j0x">
            <bpmn:outgoing>Flow_17mwfuh</bpmn:outgoing>
            <bpmn:messageEventDefinition id="MessageEventDefinition_1z0gbil"/>
        </bpmn:startEvent>
        <bpmn:task id="Activity_0dqbj0d">
            <bpmn:incoming>Flow_1npjzde</bpmn:incoming>
        </bpmn:task>
    </bpmn:process>
    <bpmndi:BPMNDiagram id="BPMNDiagram_1">
        <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_08ihe8v">
            <bpmndi:BPMNShape id="Participant_08qxl1c_di" bpmnElement="Participant_08qxl1c" isHorizontal="true">
                <dc:Bounds x="129" y="100" width="761" height="250"/>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNEdge id="Flow_1c24alz_di" bpmnElement="Flow_1c24alz">
                <di:waypoint x="630" y="177"/>
                <di:waypoint x="690" y="177"/>
            </bpmndi:BPMNEdge>
            <bpmndi:BPMNEdge id="Flow_0632kdh_di" bpmnElement="Flow_0632kdh">
                <di:waypoint x="475" y="177"/>
                <di:waypoint x="530" y="177"/>
            </bpmndi:BPMNEdge>
            <bpmndi:BPMNEdge id="Flow_01dxkqk_di" bpmnElement="Flow_01dxkqk">
                <di:waypoint x="370" y="177"/>
                <di:waypoint x="425" y="177"/>
            </bpmndi:BPMNEdge>
            <bpmndi:BPMNEdge id="Flow_1cef2ar_di" bpmnElement="Flow_1cef2ar">
                <di:waypoint x="215" y="177"/>
                <di:waypoint x="270" y="177"/>
            </bpmndi:BPMNEdge>
            <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
                <dc:Bounds x="179" y="159" width="36" height="36"/>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape id="Activity_1gcz8pp_di" bpmnElement="Activity_1gcz8pp">
                <dc:Bounds x="270" y="137" width="100" height="80"/>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape id="Gateway_1xn0v06_di" bpmnElement="Gateway_1xn0v06" isMarkerVisible="true">
                <dc:Bounds x="425" y="152" width="50" height="50"/>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape id="Activity_0yjqh32_di" bpmnElement="Activity_0yjqh32">
                <dc:Bounds x="530" y="137" width="100" height="80"/>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape id="Activity_0hz5fxo_di" bpmnElement="Activity_0hz5fxo">
                <dc:Bounds x="690" y="137" width="100" height="80"/>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape id="Participant_1r6dfm5_di" bpmnElement="Participant_1r6dfm5" isHorizontal="true">
                <dc:Bounds x="129" y="350" width="761" height="440"/>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape id="Lane_1hhry9z_di" bpmnElement="Lane_1hhry9z" isHorizontal="true">
                <dc:Bounds x="159" y="350" width="731" height="220"/>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape id="Lane_1fkrhrc_di" bpmnElement="Lane_1fkrhrc" isHorizontal="true">
                <dc:Bounds x="159" y="570" width="731" height="220"/>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNEdge id="Flow_17mwfuh_di" bpmnElement="Flow_17mwfuh">
                <di:waypoint x="462" y="390"/>
                <di:waypoint x="400" y="390"/>
                <di:waypoint x="400" y="425"/>
            </bpmndi:BPMNEdge>
            <bpmndi:BPMNEdge id="Flow_1npjzde_di" bpmnElement="Flow_1npjzde">
                <di:waypoint x="400" y="475"/>
                <di:waypoint x="400" y="670"/>
                <di:waypoint x="480" y="670"/>
            </bpmndi:BPMNEdge>
            <bpmndi:BPMNEdge id="Flow_0ur7jkd_di" bpmnElement="Flow_0ur7jkd">
                <di:waypoint x="248" y="440"/>
                <di:waypoint x="312" y="440"/>
                <di:waypoint x="312" y="450"/>
                <di:waypoint x="375" y="450"/>
            </bpmndi:BPMNEdge>
            <bpmndi:BPMNShape id="Event_1s6870a_di" bpmnElement="Event_1m1jnrs">
                <dc:Bounds x="212" y="422" width="36" height="36"/>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape id="Gateway_1f0i8b5_di" bpmnElement="Gateway_1f0i8b5" isMarkerVisible="true">
                <dc:Bounds x="375" y="425" width="50" height="50"/>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape id="Event_16u4j0x_di" bpmnElement="Event_16u4j0x">
                <dc:Bounds x="462" y="372" width="36" height="36"/>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNShape id="Activity_0dqbj0d_di" bpmnElement="Activity_0dqbj0d">
                <dc:Bounds x="480" y="630" width="100" height="80"/>
            </bpmndi:BPMNShape>
            <bpmndi:BPMNEdge id="Flow_04eygga_di" bpmnElement="Flow_04eygga">
                <di:waypoint x="580" y="217"/>
                <di:waypoint x="580" y="295"/>
                <di:waypoint x="480" y="295"/>
                <di:waypoint x="480" y="372"/>
            </bpmndi:BPMNEdge>
            <bpmndi:BPMNEdge id="Flow_0mxccca_di" bpmnElement="Flow_0mxccca">
                <di:waypoint x="330" y="217"/>
                <di:waypoint x="330" y="320"/>
                <di:waypoint x="230" y="320"/>
                <di:waypoint x="230" y="422"/>
            </bpmndi:BPMNEdge>
        </bpmndi:BPMNPlane>
    </bpmndi:BPMNDiagram>
</bpmn:definitions>

Expected behavior Diagram shown

Screenshots bpmn-error

IntelliJ version (please complete the following information):

Additional context JAVA_HOME=C:\Program Files\AdoptOpenJDK\jdk-15.0.2.7-hotspot

valb3r commented 2 years ago

@sshmakov Thanks for feedback, while the bug is present and exception should not happen, I think you misunderstood usage of the plugin, please have a look at: https://www.youtube.com/watch?v=8-_XmOlEyXM In short, to open diagram, you need to click View BPMN (Camunda) Diagram in popup menu: Peek 2022-02-16 09-09