cancel
Showing results for 
Search instead for 
Did you mean: 

Error in getValue from Expression

nandoztx
Champ in-the-making
Champ in-the-making
Hi everyone!
I have a problem in getValue from Expression attrib in JavaDeletegate implemented class.
When Expression attrib don't has value, so, attrib.getValue(execution) throw an exception like as:
org.activiti.engine.ActivitiException: Unknown property used in expression.

My example:
in service:
private Expression nome;
in bpmn20.xml
<activiti:field name="name" expression="${nome}" />

my application thrown an exception only when my name attrib is empty…
but.. why?
my expression "name" is not empty:


String nameValue = null;
      if(name != null) {
         nameValue = (String) name.getValue(execution);
         person.setName(nameValue);
      }

Thank's in advance!
2 REPLIES 2

nandoztx
Champ in-the-making
Champ in-the-making
I solve this with a workaround:
before endEvent, run a scriptTask to check if processVar is setted:


<scriptTask id="anything" scriptFormat="groovy">
<script>
try { personName; } catch (MissingPropertyException mpe) { personName = ""; }
</script>
</scriptTask>

I don't know if activiti will fix this in nexts releases, but, it works for now.

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
Activiti cannot fix it afaik. It is a EL issue. A none existing process variable is used, EL give you an exception. Try setting it to 'null' or '' instead of not having it at all. Catching the error in Activiti is impossible since there can be no differentiation between a not existing property and e.g. a typo (and thus a non-existing property)