Buggy code:
public class OCommandExecutorScript extends OCommandExecutorAbstract implements OCommandDistributedReplicateRequest { private static final int MAX_DELAY = 100 ; protected OCommandScript request ; protected DISTRIBUTED_EXECUTION_MODE executionMode = DISTRIBUTED_EXECUTION_MODE . LOCAL ; public OCommandExecutorScript ( ) { } @ SuppressWarnings ( "unchecked" ) public OCommandExecutorScript parse ( final OCommandRequest iRequest ) { } public OCommandDistributedReplicateRequest . DISTRIBUTED_EXECUTION_MODE getDistributedExecutionMode ( ) { } public Object execute ( final Map < Object , Object > iArgs ) { } public Object executeInContext ( final OCommandContext iContext , final Map < Object , Object > iArgs ) { } public boolean isIdempotent ( ) { } protected Object executeJsr223Script ( final String language , final OCommandContext iContext , final Map < Object , Object > iArgs ) { } protected Object executeSQL ( ) { } @ Override protected void throwSyntaxErrorException ( String iText ) { } protected Object executeSQLScript ( final String iText , final ODatabaseDocument db ) throws IOException { } private List < String > splitBySemicolon ( String lastLine ) { } private boolean evaluateIfCondition ( String lastCommand ) { } private boolean isIfCondition ( String iCommand ) { } protected void waitForNextRetry ( ) { } private Object executeCommand ( final String lastCommand , final ODatabaseDocument db ) { } private Object toMap ( Object parameters ) { } private Object executeReturn ( String lastCommand , Object lastResult ) { final String variable = lastCommand . substring ( "return<seq2seq4repair_space>" . length ( ) ) . trim ( ) ; if ( variable . equalsIgnoreCase ( "NULL" ) ) lastResult = null ; else if ( variable . startsWith ( "$" ) ) lastResult = getContext ( ) . getVariable ( variable ) ; else if ( ( variable . startsWith ( "[" ) ) && ( variable . endsWith ( "]" ) ) ) { final List < String > items = new ArrayList < String > ( ) ; OStringSerializerHelper . getCollection ( variable , 0 , items ) ; final List < Object > result = new ArrayList < Object > ( items . size ( ) ) ; for ( int i = 0 ; i < ( items . size ( ) ) ; ++ i ) { String item = items . get ( i ) ; Object res ; if ( item . startsWith ( "$" ) ) res = getContext ( ) . getVariable ( item ) ; else <START_BUG> res = item ; <END_BUG> if ( ( OMultiValue . isMultiValue ( res ) ) && ( ( OMultiValue . getSize ( res ) ) == 1 ) ) res = OMultiValue . getFirstValue ( res ) ; result . add ( res ) ; } lastResult = result ; checkIsRecordResultSet ( lastResult ) ; } else if ( ( variable . startsWith ( "{" ) ) && ( variable . endsWith ( "}" ) ) ) { final Map < String , String > map = OStringSerializerHelper . getMap ( variable ) ; final Map < Object , Object > result = new HashMap < Object , Object > ( map . size ( ) ) ; for ( Map . Entry < String , String > entry : map . entrySet ( ) ) { String stringKey = entry . getKey ( ) ; if ( stringKey == null ) continue ; stringKey = stringKey . trim ( ) ; Object key ; if ( stringKey . startsWith ( "$" ) ) key = getContext ( ) . getVariable ( stringKey ) ; else key = stringKey ; if ( ( OMultiValue . isMultiValue ( key ) ) && ( ( OMultiValue . getSize ( key ) ) == 1 ) ) key = OMultiValue . getFirstValue ( key ) ; String stringValue = entry . getValue ( ) ; if ( stringValue == null ) continue ; stringValue = stringValue . trim ( ) ; Object value ; if ( stringValue . toString ( ) . startsWith ( "$" ) ) value = getContext ( ) . getVariable ( stringValue ) ; else value = stringValue ; result . put ( key , value ) ; } lastResult = result ; checkIsRecordResultSet ( lastResult ) ; } else { lastResult = new OSQLPredicate ( variable ) . evaluate ( context ) ; checkIsRecordResultSet ( lastResult ) ; } return lastResult ; } private void checkIsRecordResultSet ( Object result ) { } private void executeSleep ( String lastCommand ) { } private Object executeLet ( final String lastCommand , final ODatabaseDocument db ) { } @ Override public QUORUM_TYPE getQuorumType ( ) { } }

Fix:
res = new OSQLPredicate ( item ) . evaluate ( context ) ;