Buggy code:
public abstract class AbstractStep { private Map < String , Object > sessionMap ; private FieldPropertiesMap outputParams ; private FieldPropertiesMap inputParams ; private FieldPropertiesMap overrideInputParams ; protected TaskStepDTO taskStepData ; private boolean doVariableSubstitution = true ; protected StringBuilder strLogger ; private transient ConsoleHandler cHandler = null ; private transient MemoryHandler mHandler = null ; private transient Level loggingLevel = Level . FINE ; private LogListener logListener ; public static final ThreadLocal < Logger > LOGGER = new ThreadLocal < Logger > ( ) { @ Override protected Logger initialValue ( ) { } } ; public void beforeTaskStart ( ) { } private void setLoggingLevel ( Logger taskLogger ) { } public static FieldPropertiesMap listInputParams ( Class < ? extends Object > task , Map < String , String > values ) { } public static FieldPropertiesMap listOutputParams ( Class < ? extends Object > task , Map < String , String > values ) { } public static AbstractStep getTask ( TaskStepDTO stepDTO ) { } public abstract boolean run ( ) { } public boolean execute ( ) throws Exception { } private void substituteParams ( ) throws Exception { } private void substituteParams ( FieldPropertiesMap inputParams ) throws Exception { Map < String , String > variablesMap = new HashMap < > ( ) ; sessionMap . forEach ( ( s , o ) -> variablesMap . put ( s , o . toString ( ) ) ) ; Field [ ] fields = getClass ( ) . getDeclaredFields ( ) ; for ( Field field : fields ) { if ( field . isAnnotationPresent ( InputParam . class ) ) { InputParam ann = field . getAnnotation ( InputParam . class ) ; try { field . setAccessible ( true ) ; if ( ( inputParams . get ( field . getName ( ) ) ) != null ) { String fieldValue = inputParams . get ( field . getName ( ) ) . getValue ( ) ; if ( ( fieldValue . length ( ) ) >= 1 ) { if ( fieldValue . startsWith ( "$" ) ) { fieldValue = fieldValue . substring ( 1 ) ; fieldValue = ( ( String ) ( getSessionObject ( fieldValue ) ) ) ; } <START_BUG> if ( ( doVariableSubstitution ) && ( fieldValue . contains ( "#{" ) ) ) { <END_BUG> fieldValue = AbstractStep . substituteSessionVariables ( fieldValue , variablesMap ) ; if ( ann . substitute ( ) ) { fieldValue = AbstractStep . substituteEnvVariables ( fieldValue ) ; } } if ( field . getType ( ) . getSimpleName ( ) . equals ( "String" ) ) { field . set ( this , fieldValue ) ; } else if ( field . getType ( ) . getSimpleName ( ) . equals ( "int" ) ) { int tmp = Integer . parseInt ( fieldValue ) ; field . set ( this , tmp ) ; } else if ( field . getType ( ) . getSimpleName ( ) . equals ( "Date" ) ) { SimpleDateFormat sdf = new SimpleDateFormat ( "dd-MMM-yyyy" ) ; field . set ( this , sdf . parse ( fieldValue ) ) ; } else if ( field . getType ( ) . getSimpleName ( ) . equals ( "double" ) ) { double tmp = Double . parseDouble ( fieldValue ) ; field . set ( this , tmp ) ; } else if ( field . getType ( ) . getSimpleName ( ) . equals ( "boolean" ) ) { boolean tmp = Boolean . parseBoolean ( fieldValue ) ; field . set ( this , tmp ) ; } } } } catch ( IllegalArgumentException | IllegalAccessException | ParseException e ) { e . printStackTrace ( ) ; AbstractStep . LOGGER . get ( ) . severe ( e . toString ( ) ) ; throw e ; } } } } public void substituteResult ( ) { } public static String substituteVariables2 ( String inputString , Map < String , Object > variables , String errorIdentifier ) { } public static String substituteEnvVariables ( String template ) { } public static String substituteSessionVariables ( String template , Map < String , String > variables ) { } public static String substituteVariables ( String template , Map < String , String > variables , String regex ) { } public static List < String > getVariablesFromTemplate ( String template ) { } public static List < String > getVariablesFromString ( String inputString ) { } public String getMemoryLogs ( ) { } protected void loadSessionVariables ( Map < String , String > variableMap ) { } public void afterTaskFinish ( ) { } public Map < String , Object > getSessionMap ( ) { } public void setSessionMap ( Map < String , Object > sessionMap ) { } public FieldPropertiesMap getOutputParams ( ) { } public void setOutputParams ( FieldPropertiesMap outputParams ) { } public FieldPropertiesMap getInputParams ( ) { } public void setInputParams ( FieldPropertiesMap inputParams ) { } public FieldPropertiesMap getOverrideInputParams ( ) { } public void setOverrideInputParams ( FieldPropertiesMap overrideInputParams ) { } public Object getSessionObject ( String key ) { } public void setSessionObject ( String key , Object obj ) { } public void setTaskStepData ( TaskStepDTO taskStepData ) { } public TaskStepDTO getTaskStepData ( ) { } public void addLogListener ( LogListener logListener ) { } public void removeLogListener ( LogListener logListener ) { } }

Fix:
if ( doVariableSubstitution ) {