Difference between DeploymentBuilderImpl.add* methods
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2013 01:32 PM
I have always assumed that the various DeploymentBuilderImpl.add* methods were equivalent but apparently in 5.13 SNAPSHOT they are not (I have not gone back to check earlier versions).
Specifically this deploys correctly:
and this does not:
Note that
It all comes down to this line in BpmnDeployer:
Apparently because my resource is named 'test' it will never be parsed or the process definition stored! If I call it 'test.bpmn' all is well.
So what is the intent on this line? I suppose someone was trying to protect against an attempt to parse a non-BPMN resource but if I do feed a garbage string into the parser it gives a pretty reasonable exception (org.activiti.engine.ActivitiException: Error parsing XML).
Anyone object to simply removing the check?
Cheers,
Tim
Specifically this deploys correctly:
Deployment deployment = createDeployment().addClasspathResource(resource).deploy();
and this does not:
String resourceName = "test"; InputStream inputStream = ReflectUtil.getResourceAsStream(resource); byte[] bytes = IoUtil.readInputStream(inputStream, resourceName); Deployment deployment = deploy((DeploymentBuilderImpl) createDeployment() .addString(resourceName, definition.trim()));
Note that
resource
is the same in both cases. To be honest I was already pretty close by the time I figured this out having first spent ages investigating how I must have corrupted the String on the wire somehow!It all comes down to this line in BpmnDeployer:
if (isBpmnResource(resourceName)) { … parse the resource etc.. }
Apparently because my resource is named 'test' it will never be parsed or the process definition stored! If I call it 'test.bpmn' all is well.
So what is the intent on this line? I suppose someone was trying to protect against an attempt to parse a non-BPMN resource but if I do feed a garbage string into the parser it gives a pretty reasonable exception (org.activiti.engine.ActivitiException: Error parsing XML).
Anyone object to simply removing the check?
Cheers,
Tim
Labels:
- Labels:
-
Archive
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2013 05:37 AM
Hi Tim, sorry for the late response. Really busy lately.
Regarding your problem: yes it has hit me too in the past.
The problem is that in theory, you can upload any resource to a deployment (images, word docs, etc.) and they will all be stored in the database for later retrieval.
Maybe is a dedicated, new method, specifically for the process xml is a good solution (not breaking backwards compatibility)?
Regarding your problem: yes it has hit me too in the past.
The problem is that in theory, you can upload any resource to a deployment (images, word docs, etc.) and they will all be stored in the database for later retrieval.
Maybe is a dedicated, new method, specifically for the process xml is a good solution (not breaking backwards compatibility)?
