AnsweredAssumed Answered

Difference between DeploymentBuilderImpl.add* methods

Question asked by tstephen on May 17, 2013
Latest reply on May 22, 2013 by jbarrez
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:

      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
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?