protected void addStepFailureContextData ( StepExecutionResult stepResult , ExecutionContextImpl . Builder builder ) { HashMap < String , String > resultData = new HashMap <> ( ) ; if ( null != stepResult . getFailureData ( ) ) { //convert values to string for ( final Map . Entry < String , Object > entry : stepResult . getFailureData ( ) . entrySet ( ) ) { resultData . put ( entry . getKey ( ) , entry . getValue ( ) . toString ( ) ) ; } } FailureReason reason = stepResult . getFailureReason ( ) ; if ( null == reason ) { reason = StepFailureReason . Unknown ; } resultData . put ( "reason" , reason . toString ( ) ) ; String message = stepResult . getFailureMessage ( ) ; if ( null == message ) { message = "No message" ; } resultData . put ( "message" , message ) ; //add to data context builder . setContext ( "result" , resultData ) ; }
Add step result failure information to the data context