{
String[] pooledActors = null;
Object result = JbpmExpressionEvaluator.evaluate(pooledActorsExpression, executionContext);
if (result == null)
{
throw new JbpmException("pooled-actors expression '" + pooledActorsExpression + "' returned null");
}
if (result instanceof String[])
{
pooledActors = (String[])result;
}
else if (result instanceof Collection)
{
Collection<?> collection = (Collection<?>)result;
pooledActors = collection.toArray(new String[collection.size()]);
}
else if (result instanceof String)
{
List<String> pooledActorList = new ArrayList<String>();
StringTokenizer tokenizer = new StringTokenizer((String)result, ",");
while (tokenizer.hasMoreTokens())
{
pooledActorList.add(tokenizer.nextToken().trim());
}
pooledActors = pooledActorList.toArray(new String[pooledActorList.size()]);
}
else
{
throw new JbpmException("pooled-actors expression '" + pooledActorsExpression + "' didn't resolve to a comma separated String, a Collection or a String[]: '"
+ result + "' (" + result.getClass().getName() + ")");
}
assignable.setPooledActors(pooledActors);
}