cancel
Showing results for 
Search instead for 
Did you mean: 

ProcessDiagramGenerator throws RasterFormatException

m2spring
Champ in-the-making
Champ in-the-making
The ProcessDiagramGenerator in 5.10 gives this on a BPMN created with Designer 5.9:
java.awt.image.RasterFormatException: (x + width) is outside raster
        at sun.awt.image.IntegerInterleavedRaster.createWritableChild(IntegerInterleavedRaster.java:450)
        at java.awt.image.BufferedImage.getSubimage(BufferedImage.java:1156)
        at org.activiti.engine.impl.bpmn.diagram.ProcessDiagramCanvas.generateImage(ProcessDiagramCanvas.java:173)
        at org.activiti.engine.impl.bpmn.diagram.ProcessDiagramGenerator.generateDiagram(ProcessDiagramGenerator.java:302)
        at org.activiti.engine.impl.bpmn.diagram.ProcessDiagramGenerator.generatePngDiagram(ProcessDiagramGenerator.java:263)
        at com.cisco.surf.activiti.tests.GenDiagTest.testGenDiag(GenDiagTest.java:45)
        …
Full project: https://github.com/jenkinsci/jenkow-plugin/tree/master/activiti-tests/gendiag
BPMN XML: https://github.com/jenkinsci/jenkow-plugin/blob/master/activiti-tests/gendiag/src/test/resources/dia...
GenDiagTest.java: https://github.com/jenkinsci/jenkow-plugin/blob/master/activiti-tests/gendiag/src/test/java/com/cisc...

Is this a bug or am I doing something wrong here?

Thanks!
-Max
6 REPLIES 6

trademak
Star Contributor
Star Contributor
Hi Max,

When do you get this error? I just added the bpmn in my Designer but it's working fine for me.

Best regards,

m2spring
Champ in-the-making
Champ in-the-making
Hi Tijs,

I get the error when I run the unit test of this project:
https://github.com/jenkinsci/jenkow-plugin/tree/master/activiti-tests/gendiag

The very purpose of this project is to make it easy for you to reproduce the test:

git clone git://github.com/jenkinsci/jenkow-plugin.git
cd jenkow-plugin/activiti-tests/gendiag
mvn clean test

Regards,
-Max

jbarrez
Star Contributor
Star Contributor
I remember I fixed such a bug for 5.11. Would you be able to test it with 5.11 now we have a branch for it?

m2spring
Champ in-the-making
Champ in-the-making
Running with 5.11 no longer gives the same exception, but it doesn't result in the correct diagram.
The resulting PNG is 10x10 pixels and empty.

I've modified my test code to follow the Activiti unit test template:
https://github.com/jenkinsci/jenkow-plugin/tree/master/activiti-tests/gendiag2

git clone git://github.com/jenkinsci/jenkow-plugin.git
cd jenkow-plugin/activiti-tests/gendiag2
mvn clean test
See resulting diagram: target/diag.png
Same happens with 5.12-SNAPSHOT.
-Max

jbarrez
Star Contributor
Star Contributor
I checked your code, and this line will never work:


  InputStream ds = ProcessDiagramGenerator.generatePngDiagram((ProcessDefinitionEntity)pDef);

Because the ProcessDiagramGenerator needs a 'deployed' version of the process. The process definition you pass doesn't have any parse info, and hence no diagram interchange information.

However, there is a much easier way to get the diagram, as it gets generated when you deploy:


InputStream ds = repoSvc.getResourceAsStream(d.getId(), "/diagrams/GenDiag.gendiag.png");
OutputStream os = new FileOutputStream("target/diag_joram.png");
IOUtils.copy(ds,os);
os.close();

That produces the diagram nicely using 5.11.

m2spring
Champ in-the-making
Champ in-the-making
Thanks Joram, this approach even works with 5.10.
Regards,
-Max