}
if(resourceName == null) {
throw new ActivitiIllegalArgumentException("resourceName is null");
}
ResourceEntity resource = commandContext
.getResourceEntityManager()
.findResourceByDeploymentIdAndResourceName(deploymentId, resourceName);
if(resource == null) {
if(commandContext.getDeploymentEntityManager().findDeploymentById(deploymentId) == null) {
throw new ActivitiObjectNotFoundException("deployment does not exist: " + deploymentId, Deployment.class);
}
else
{
throw new ActivitiObjectNotFoundException("no resource found with name '" + resourceName + "' in deployment '" + deploymentId + "'", InputStream.class);
}
}
return new ByteArrayInputStream(resource.getBytes());
}