]
Heiko Braun reassigned JBPM-2127:
---------------------------------
Assignee: Tom Baeyens
Can't use addInputStream() to deploy a process
----------------------------------------------
Key: JBPM-2127
URL:
https://jira.jboss.org/jira/browse/JBPM-2127
Project: JBoss jBPM
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: PVM
Affects Versions: jBPM 4.0.0 Alpha2
Environment: winxp
Reporter: Xu Huisheng
Assignee: Tom Baeyens
Fix For: jBPM 4.0.0.Beta1
The following codes will cause an Exception, that inputStream is already closed:
List<ProcessDefinition> processDefinitions = processService.createDeployment()
.addInputStream("process.jpdl.xml",
this.getClass().getResourceAsStream("/process.jpdl.xml"))
.deploy()
.getProcessDefinitions();
The exception info is like this:
Caused by: java.io.IOException: Stream closed
at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:14)
at java.io.BufferedInputStream.read(BufferedInputStream.java:308)
at java.io.FilterInputStream.read(FilterInputStream.java:90)
at org.jbpm.pvm.internal.util.IoUtil.transfer(IoUtil.java:55)
If I use addResource() instead of addInputStream(), then the deployment will success.
I read the code of jBPM-4.0.0.Alpha2 and find the execute() method of
org.jbpm.pvm.internal.xml.Parser always close the inputstream after parse it. But on next
step of deploy, the SaveDeploy should read attachment bytes from the inputstream. Then the
Exception occured.
I find the openStream() of org.jbpm.pvm.internal.stream.InputStreamInput always return
the same inputStream, however the openStream() of
org.jbpm.pvm.internal.stream.ResourceStreamInput will create a new inputstream every time,
so it won't cause the problem.
I think this is may be the reason.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: