Empty diagram produces xml parse error

Description

When I create a new empty diagram, the initial parse does not produce an error. If I close it and reopen it, I get the following parse error:

10:22:12,791 [main] ERROR org.activiti.bpmn.converter.BpmnXMLConverter - Error reading XML document
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: Premature end of file.
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:594)
at org.activiti.bpmn.converter.BpmnXMLConverter.convertToBpmnModel(BpmnXMLConverter.java:260)
at org.activiti.designer.eclipse.editor.ActivitiDiagramEditor.setInput(ActivitiDiagramEditor.java:321)
at org.eclipse.graphiti.ui.editor.DiagramEditor.init(DiagramEditor.java:217)
at org.activiti.designer.eclipse.editor.ActivitiDiagramEditor.init(ActivitiDiagramEditor.java:125)
at org.eclipse.ui.internal.EditorReference.initialize(EditorReference.java:359)
...

(see attachment for full stack trace).

It appears that the file input argument in org.activiti.designer.eclipse.editor.ActivitiDiagramEditor.init() is of type ActivitiDiagramEditorInput when first created, but is org.eclipse.ui.part.FileEditorInput upon reopening. If I reopen a diagram with elements, it works fine even though it is FileEditorInput because there are elements to parse. Should there be a check for an empty diagram before setInput is called to parse?

Note that I only see the error when the application is launched from within a workspace as an Eclipse application. I do not see it in the standard error log, only in the console view.

Environment

I am using:
5.14.1 Activiti Designer
Kepler release: Version: 4.3.1 Build id: M20130911-1000
Windows 7 Enterprise SP 1 on a 64 bit system.

Assignee

Tijs Rademakers

Reporter

Lori Small

Labels

None

Components

Fix versions

Affects versions

Priority

Minor
Configure