AnsweredAssumed Answered

NPE retrieving a blob local task variable

Question asked by hyapit on Jun 27, 2013
Latest reply on Jul 17, 2013 by frederikheremans1
Hi guys,

I'm getting a NullPointerException executing HistoricTaskInstance.getTaskLocalVariables() when I have a task variables with blobs as their values. This is 5.13

It seems like Context.getCommandContext() returns null, because the context threadlocal is not set for executing thread. Is this expected or a bug? Advice?

Here's the stack trace:
   at org.activiti.engine.impl.persistence.entity.ByteArrayRef.ensureInitialized(
   at org.activiti.engine.impl.persistence.entity.ByteArrayRef.getBytes(
   at org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity.getBytes(
   at org.activiti.engine.impl.variable.ByteArrayType.getValue(
   at org.activiti.engine.impl.variable.SerializableType.getValue(
   at org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity.getValue(
   at org.activiti.engine.impl.persistence.entity.HistoricTaskInstanceEntity.getTaskLocalVariables(

This is where it's throwing NPE:
private void ensureInitialized() {
    if (id != null && entity == null) {
      entity = Context.getCommandContext()
      name = entity.getName();