This is an automated email from the ASF dual-hosted git repository.

hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git


The following commit(s) were added to refs/heads/main by this push:
     new e33681e4fc Fix #6102 (#6228)
e33681e4fc is described below

commit e33681e4fcb47b8ac0988722189292e00d8489b3
Author: Sergio Ramazzina <[email protected]>
AuthorDate: Sat Dec 27 10:31:34 2025 +0100

    Fix #6102 (#6228)
    
    * Fix #6102 - Simple Evaluation: string comparison with null always return 
success
    
    * Fix #6102 - Add simple integration test
---
 .../ROOT/pages/workflow/actions/simpleeval.adoc    |   5 +-
 ...0010-simpleeval-stringequal-targetvar-unset.hwf | 170 +++++++++++++++++++++
 integration-tests/actions/main-0010-simpleval.hwf  | 125 +++++++++++++++
 .../actions/simpleeval/ActionSimpleEval.java       |   3 +-
 .../simpleeval/messages/messages_en_US.properties  |   6 +-
 .../simpleeval/messages/messages_it_IT.properties  |  28 ++--
 6 files changed, 315 insertions(+), 22 deletions(-)

diff --git 
a/docs/hop-user-manual/modules/ROOT/pages/workflow/actions/simpleeval.adoc 
b/docs/hop-user-manual/modules/ROOT/pages/workflow/actions/simpleeval.adoc
index 9be2c7da3f..479765684c 100644
--- a/docs/hop-user-manual/modules/ROOT/pages/workflow/actions/simpleeval.adoc
+++ b/docs/hop-user-manual/modules/ROOT/pages/workflow/actions/simpleeval.adoc
@@ -48,6 +48,7 @@ The green (success) hop will be called if the condition was 
evaluated successful
 |Field name|The field to evaluate
 |Type|Data type.
 2+|Success On
+|Success when source variable set| The action will always success if the 
source variable was set otherwise it will fail.
 |Success condition a|
 * If value equal to
 * If value different from
@@ -73,8 +74,8 @@ The green (success) hop will be called if the condition was 
evaluated successful
 |Source: Evaluate|Variable|Select this to evaluate a variable set before
 |Source: Variable name|e. g. {openvar}VAR1{closevar}|Enter the variable name 
using the usual syntax
 |Source: Type|String, Number etc.|The type of your variable
-|Success on: Success when variable set||When this option is selected, the true 
path is followed when the variable is set.
-Note: The workflow action checks if the variable is defined, so an empty or 
null value is also true.
+|Success on: Success when source variable set||When this option is selected, 
the true path is followed when the source variable is set.
+Note: The workflow action checks if the source variable is defined, so an 
empty or null value is also true.
 When testing this within Hop you need to delete the line with the variable in 
the variables section of the Execute a workflow window.
 And remember: Once this variable is set, the variable keeps existing, even 
when deleting it from the list.
 |Success On: Success condition|Equal/Non equal/etc.|Select the condition to be 
met for a successful result
diff --git 
a/integration-tests/actions/0010-simpleeval-stringequal-targetvar-unset.hwf 
b/integration-tests/actions/0010-simpleeval-stringequal-targetvar-unset.hwf
new file mode 100644
index 0000000000..1b3e244ddb
--- /dev/null
+++ b/integration-tests/actions/0010-simpleeval-stringequal-targetvar-unset.hwf
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<workflow>
+  <name>0010-simpleeval-stringequal-targetvar-unset</name>
+  <name_sync_with_filename>Y</name_sync_with_filename>
+  <description/>
+  <extended_description/>
+  <workflow_version/>
+  <workflow_status>0</workflow_status>
+  <created_user>-</created_user>
+  <created_date>2025/12/01 18:27:46.025</created_date>
+  <modified_user>-</modified_user>
+  <modified_date>2025/12/01 18:27:46.025</modified_date>
+  <parameters>
+    <parameter>
+      <name>src_var</name>
+      <default_value>PLACEHOLDER</default_value>
+      <description/>
+    </parameter>
+    <parameter>
+      <name>wrk_var</name>
+      <default_value/>
+      <description/>
+    </parameter>
+  </parameters>
+  <actions>
+    <action>
+      <name>Start</name>
+      <description/>
+      <type>SPECIAL</type>
+      <attributes/>
+      <DayOfMonth>1</DayOfMonth>
+      <doNotWaitOnFirstExecution>N</doNotWaitOnFirstExecution>
+      <hour>12</hour>
+      <intervalMinutes>60</intervalMinutes>
+      <intervalSeconds>0</intervalSeconds>
+      <minutes>0</minutes>
+      <repeat>N</repeat>
+      <schedulerType>0</schedulerType>
+      <weekDay>1</weekDay>
+      <parallel>N</parallel>
+      <xloc>48</xloc>
+      <yloc>128</yloc>
+      <attributes_hac/>
+    </action>
+    <action>
+      <name>Simple evaluation</name>
+      <description/>
+      <type>SIMPLE_EVAL</type>
+      <attributes/>
+      <comparevalue>${wrk_var}</comparevalue>
+      <fieldtype>string</fieldtype>
+      <successbooleancondition>true</successbooleancondition>
+      <successcondition>equal</successcondition>
+      <successnumbercondition>equal</successnumbercondition>
+      <successwhenvarset>N</successwhenvarset>
+      <valuetype>variable</valuetype>
+      <variablename>${src_var}</variablename>
+      <parallel>N</parallel>
+      <xloc>384</xloc>
+      <yloc>128</yloc>
+      <attributes_hac/>
+    </action>
+    <action>
+      <name>Write to log</name>
+      <description/>
+      <type>WRITE_TO_LOG</type>
+      <attributes/>
+      <loglevel>Basic</loglevel>
+      <logmessage>variable 1 src_var :${src_var}
+variable 2 wrk_var:${wrk_var}</logmessage>
+      <logsubject/>
+      <parallel>N</parallel>
+      <xloc>208</xloc>
+      <yloc>128</yloc>
+      <attributes_hac/>
+    </action>
+    <action>
+      <name>Success</name>
+      <description/>
+      <type>SUCCESS</type>
+      <attributes/>
+      <parallel>N</parallel>
+      <xloc>656</xloc>
+      <yloc>128</yloc>
+      <attributes_hac/>
+    </action>
+    <action>
+      <name>Abort workflow</name>
+      <description/>
+      <type>ABORT</type>
+      <attributes/>
+      <always_log_rows>N</always_log_rows>
+      <parallel>N</parallel>
+      <xloc>384</xloc>
+      <yloc>256</yloc>
+      <attributes_hac/>
+    </action>
+    <action>
+      <name>Write to log 2</name>
+      <description/>
+      <type>WRITE_TO_LOG</type>
+      <attributes/>
+      <loglevel>Basic</loglevel>
+      <logmessage>Evaluation fails as expected: test passed</logmessage>
+      <logsubject>Evaluation Result</logsubject>
+      <parallel>N</parallel>
+      <xloc>512</xloc>
+      <yloc>128</yloc>
+      <attributes_hac/>
+    </action>
+  </actions>
+  <hops>
+    <hop>
+      <from>Start</from>
+      <to>Write to log</to>
+      <enabled>Y</enabled>
+      <evaluation>Y</evaluation>
+      <unconditional>Y</unconditional>
+    </hop>
+    <hop>
+      <from>Write to log</from>
+      <to>Simple evaluation</to>
+      <enabled>Y</enabled>
+      <evaluation>Y</evaluation>
+      <unconditional>Y</unconditional>
+    </hop>
+    <hop>
+      <from>Simple evaluation</from>
+      <to>Abort workflow</to>
+      <enabled>Y</enabled>
+      <evaluation>Y</evaluation>
+      <unconditional>N</unconditional>
+    </hop>
+    <hop>
+      <from>Simple evaluation</from>
+      <to>Write to log 2</to>
+      <enabled>Y</enabled>
+      <evaluation>N</evaluation>
+      <unconditional>N</unconditional>
+    </hop>
+    <hop>
+      <from>Write to log 2</from>
+      <to>Success</to>
+      <enabled>Y</enabled>
+      <evaluation>Y</evaluation>
+      <unconditional>N</unconditional>
+    </hop>
+  </hops>
+  <notepads>
+  </notepads>
+  <attributes/>
+</workflow>
diff --git a/integration-tests/actions/main-0010-simpleval.hwf 
b/integration-tests/actions/main-0010-simpleval.hwf
new file mode 100644
index 0000000000..f6006fd2eb
--- /dev/null
+++ b/integration-tests/actions/main-0010-simpleval.hwf
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<workflow>
+  <name>main-0010-simpleval</name>
+  <name_sync_with_filename>Y</name_sync_with_filename>
+  <description/>
+  <extended_description/>
+  <workflow_version/>
+  <created_user>-</created_user>
+  <created_date>2021/05/05 18:31:44.849</created_date>
+  <modified_user>-</modified_user>
+  <modified_date>2021/05/05 18:31:44.849</modified_date>
+  <parameters>
+    </parameters>
+  <actions>
+    <action>
+      <name>Start</name>
+      <description/>
+      <type>SPECIAL</type>
+      <attributes/>
+      <DayOfMonth>1</DayOfMonth>
+      <doNotWaitOnFirstExecution>N</doNotWaitOnFirstExecution>
+      <hour>12</hour>
+      <intervalMinutes>60</intervalMinutes>
+      <intervalSeconds>0</intervalSeconds>
+      <minutes>0</minutes>
+      <repeat>N</repeat>
+      <schedulerType>0</schedulerType>
+      <weekDay>1</weekDay>
+      <parallel>N</parallel>
+      <xloc>128</xloc>
+      <yloc>96</yloc>
+      <attributes_hac/>
+    </action>
+    <action>
+      <name>0010-simpleeval-stringequal-targetvar-unset.hwf</name>
+      <description/>
+      <type>WORKFLOW</type>
+      <attributes/>
+      <add_date>N</add_date>
+      <add_time>N</add_time>
+      <create_parent_folder>N</create_parent_folder>
+      <exec_per_row>N</exec_per_row>
+      
<filename>${PROJECT_HOME}/0010-simpleeval-stringequal-targetvar-unset.hwf</filename>
+      <loglevel>Nothing</loglevel>
+      <parameters>
+        <pass_all_parameters>Y</pass_all_parameters>
+      </parameters>
+      <params_from_previous>N</params_from_previous>
+      <run_configuration>local</run_configuration>
+      <set_append_logfile>N</set_append_logfile>
+      <set_logfile>N</set_logfile>
+      <wait_until_finished>Y</wait_until_finished>
+      <parallel>N</parallel>
+      <xloc>368</xloc>
+      <yloc>96</yloc>
+      <attributes_hac/>
+    </action>
+    <action>
+      <name>Success</name>
+      <description/>
+      <type>SUCCESS</type>
+      <attributes/>
+      <parallel>N</parallel>
+      <xloc>656</xloc>
+      <yloc>96</yloc>
+      <attributes_hac/>
+    </action>
+    <action>
+      <name>Abort workflow</name>
+      <description/>
+      <type>ABORT</type>
+      <attributes/>
+      <always_log_rows>N</always_log_rows>
+      <message>Simple eval: String comparison to unset variable 
failed</message>
+      <parallel>N</parallel>
+      <xloc>368</xloc>
+      <yloc>224</yloc>
+      <attributes_hac/>
+    </action>
+  </actions>
+  <hops>
+    <hop>
+      <from>Start</from>
+      <to>0010-simpleeval-stringequal-targetvar-unset.hwf</to>
+      <enabled>Y</enabled>
+      <evaluation>Y</evaluation>
+      <unconditional>Y</unconditional>
+    </hop>
+    <hop>
+      <from>0010-simpleeval-stringequal-targetvar-unset.hwf</from>
+      <to>Success</to>
+      <enabled>Y</enabled>
+      <evaluation>Y</evaluation>
+      <unconditional>N</unconditional>
+    </hop>
+    <hop>
+      <from>0010-simpleeval-stringequal-targetvar-unset.hwf</from>
+      <to>Abort workflow</to>
+      <enabled>Y</enabled>
+      <evaluation>N</evaluation>
+      <unconditional>N</unconditional>
+    </hop>
+  </hops>
+  <notepads>
+  </notepads>
+  <attributes/>
+</workflow>
diff --git 
a/plugins/actions/simpleeval/src/main/java/org/apache/hop/workflow/actions/simpleeval/ActionSimpleEval.java
 
b/plugins/actions/simpleeval/src/main/java/org/apache/hop/workflow/actions/simpleeval/ActionSimpleEval.java
index 05a8899faf..760e74bfaf 100644
--- 
a/plugins/actions/simpleeval/src/main/java/org/apache/hop/workflow/actions/simpleeval/ActionSimpleEval.java
+++ 
b/plugins/actions/simpleeval/src/main/java/org/apache/hop/workflow/actions/simpleeval/ActionSimpleEval.java
@@ -451,8 +451,7 @@ public class ActionSimpleEval extends ActionBase implements 
Cloneable, IAction {
             success = (sourcevalue.equals(realCompareValue));
             if (valueType == ValueType.VARIABLE && !success && 
Utils.isEmpty(realCompareValue)) {
               // make the empty value evaluate to true when compared to a not 
set variable
-              String key = StringUtil.getVariableName(variableName);
-              if (System.getProperty(key) == null) {
+              if (resolve(variableName) == null) {
                 success = true;
               }
             }
diff --git 
a/plugins/actions/simpleeval/src/main/resources/org/apache/hop/workflow/actions/simpleeval/messages/messages_en_US.properties
 
b/plugins/actions/simpleeval/src/main/resources/org/apache/hop/workflow/actions/simpleeval/messages/messages_en_US.properties
index 0d7cb09af8..c23a8640db 100644
--- 
a/plugins/actions/simpleeval/src/main/resources/org/apache/hop/workflow/actions/simpleeval/messages/messages_en_US.properties
+++ 
b/plugins/actions/simpleeval/src/main/resources/org/apache/hop/workflow/actions/simpleeval/messages/messages_en_US.properties
@@ -69,10 +69,8 @@ ActionSimpleEval.SuccessWhenNotEndWith.Label=If value not 
end with
 ActionSimpleEval.SuccessWhenNotInList.Label=if value not in list
 ActionSimpleEval.SuccessWhenNotStartWith.Label=If value not start with
 ActionSimpleEval.SuccessWhenRegExp.Label=If value valid regex
-ActionSimpleEval.successWhenSet.Label=Success if variable set
-ActionSimpleEval.SuccessWhenSet.Label=Success when variable set
-ActionSimpleEval.SuccessWhenSet.Tooltip=Success when the variable is set
-ActionSimpleEval.successWhenSet.Tooltip=The action will success if the 
variable was set\notherwise it will fail.
+ActionSimpleEval.SuccessWhenSet.Label=Success when source variable set
+ActionSimpleEval.SuccessWhenSet.Tooltip=The action will always success if the 
source variable was set\notherwise it will fail.
 ActionSimpleEval.SuccessWhenSmallOrEqualThan.Label=If value is smaller or equal
 ActionSimpleEval.SuccessWhenSmallThan.Label=If value is small than
 ActionSimpleEval.SuccessWhenStartWith.Label=If value starts with
diff --git 
a/plugins/actions/simpleeval/src/main/resources/org/apache/hop/workflow/actions/simpleeval/messages/messages_it_IT.properties
 
b/plugins/actions/simpleeval/src/main/resources/org/apache/hop/workflow/actions/simpleeval/messages/messages_it_IT.properties
index 2c02f490cf..5cd4e5bb7a 100644
--- 
a/plugins/actions/simpleeval/src/main/resources/org/apache/hop/workflow/actions/simpleeval/messages/messages_it_IT.properties
+++ 
b/plugins/actions/simpleeval/src/main/resources/org/apache/hop/workflow/actions/simpleeval/messages/messages_it_IT.properties
@@ -20,26 +20,26 @@
 ActionSimpleEval.CheckingVariable=Controllo della variabile [{0}] ...
 ActionSimpleEval.CompareValue.Label=Valore
 ActionSimpleEval.CompareValue.Tooltip=Valore
-ActionSimpleEval.Error.FieldNotExist=impossibile trovare il campo [{0}] nel 
precedente risultato di action\!
-ActionSimpleEval.Error.IncorrectDates=Date incorrette\! {0} (min) deve essere 
prima di {1} (max)\!
-ActionSimpleEval.Error.IncorrectNumbers=Numeri incorretti\! [{0}] (min) deve 
essere prima di [{1}] (max)\!
-ActionSimpleEval.Error.NoRows=Il risultato precedente \u00E8 vuoto\!
+ActionSimpleEval.Error.FieldNotExist=impossibile trovare il campo [{0}] 
nell''insieme dei risultati precedente\!
+ActionSimpleEval.Error.IncorrectDates=Date non corrette\! {0} (min) deve 
essere prima di {1} (max)\!
+ActionSimpleEval.Error.IncorrectNumbers=Numeri non corretti\! [{0}] (min) deve 
essere prima di [{1}] (max)\!
+ActionSimpleEval.Error.NoRows=L''insieme dei  precedente \u00E8 vuoto\!
 ActionSimpleEval.Error.UnparsableBoolean=Errore nella conversione al valore 
boolean [{0}]\! Errore {1}
 ActionSimpleEval.Error.UnparsableDate=Impossibile convertire il valore {0} in 
data\!
 ActionSimpleEval.Error.UnparsableNumber=Impossibile convertire il valore [{0}] 
in numero\! {1}
-ActionSimpleEval.Error.VariableMissing=Manca il nome della variabile\!
-ActionSimpleEval.EvalPreviousField.Label=Campo dal precedente risultato
+ActionSimpleEval.Error.VariableMissing=Nome variabile mancante\!
+ActionSimpleEval.EvalPreviousField.Label=Campo dal precedente insieme dei 
risultati
 ActionSimpleEval.EvalVariable.Label=Variabile
 ActionSimpleEval.FieldName.Label=Nome campo
 ActionSimpleEval.FieldName.Tooltip=Nome campo
 ActionSimpleEval.FieldType.Label=Tipo
 ActionSimpleEval.FieldTypeBoolean.Label=Booleano
-ActionSimpleEval.FieldTypeDateTime.Label=Data e orario
+ActionSimpleEval.FieldTypeDateTime.Label=Data e ora
 ActionSimpleEval.FieldTypeNumber.Label=Numero
 ActionSimpleEval.FieldTypeString.Label=Stringa
-ActionSimpleEval.Log.ArgFromPrevious.Found=Trovate [{0}] righe dal precedente 
risultato
-ActionSimpleEval.Log.CompareWithValue=Comparazione del valore entrante [{0}] 
col valore [{1}]...
-ActionSimpleEval.Log.CompareWithValues=Comparazione del valore entrante [{0}] 
(min) e [{1}] (max)...
+ActionSimpleEval.Log.ArgFromPrevious.Found=Trovate [{0}] righe dall''insieme 
dei risultati precedente
+ActionSimpleEval.Log.CompareWithValue=Confronto del valore entrante [{0}] col 
valore [{1}]...
+ActionSimpleEval.Log.CompareWithValues=Confronto del valore entrante [{0}] 
(min) e [{1}] (max)...
 ActionSimpleEval.Log.ValueToevaluate=Il valore da valutare \u00E8 {0}
 ActionSimpleEval.Mask.Label=Maschera
 ActionSimpleEval.MaxValue.Label=Max
@@ -67,8 +67,8 @@ ActionSimpleEval.SuccessWhenNotEndWith.Label=Se il valore non 
finisce con
 ActionSimpleEval.SuccessWhenNotInList.Label=se il valore non \u00E8 nella lista
 ActionSimpleEval.SuccessWhenNotStartWith.Label=Se il valore non inizia con
 ActionSimpleEval.SuccessWhenRegExp.Label=Se il valore \u00E8 una regex valida
-ActionSimpleEval.SuccessWhenSet.Label=Successo se la variabile \u00E8 impostata
-ActionSimpleEval.SuccessWhenSet.Tooltip=La action avr\u00E0 successo se la 
variabile \u00E8 stata impostata, altrimenti fallir\u00E0.
+ActionSimpleEval.SuccessWhenSet.Label=Successo se variabile sorgente impostata
+ActionSimpleEval.SuccessWhenSet.Tooltip=La action avr\u00E0 sempre successo se 
la variabile sorgente \u00E8 stato impostata, altrimenti fallir\u00E0.
 ActionSimpleEval.SuccessWhenSmallOrEqualThan.Label=Se il valore \u00E8 minore 
o uguale
 ActionSimpleEval.SuccessWhenSmallThan.Label=Se il valore \u00E8 minore di
 ActionSimpleEval.SuccessWhenStartWith.Label=Se il valore inizia con
@@ -78,5 +78,5 @@ ActionSimpleEval.Title=Valutazione semplice
 ActionSimpleEval.ValueType.Label=Valuta
 ActionSimpleEval.Variable.Label=Nome variabile
 ActionSimpleEval.Variable.Tooltip=Nome variabile
-ActionSimpleEval.VariableNotSet=ActionSimpleEval.VariableNotSet\=Variabile 
[{0}] non \u00E8 stata impostata\!
-ActionSimpleEval.VariableSet=ActionSimpleEval.VariableNotSet\=Variabile [{0}] 
\u00E8 stata impostata\!
+ActionSimpleEval.VariableNotSet=ActionSimpleEval.VariableNotSet\=Variabile 
[{0}] non impostata\!
+ActionSimpleEval.VariableSet=ActionSimpleEval.VariableNotSet\=Variabile [{0}] 
impostata\!

Reply via email to