After programmatically creating a BPMN model using, the BpmnAutoLayout funtion should be used to add information about the layout to the model.
If the model contains an Association object to connect a TextAnnotation with an UserTask, a NPE occurs.
During the handleAssociations() method a targetVertex object should be filled by the following for-loop:
The targetVertex should be filled by the list of generatedVertices but this list does not contain objects of the type Artifact. Because TextAnnotation objects extend from the object Artifact, the targetRef is not found within the generatedVertices and therefore the targetVertex is null. This leads to an NPE later on.