Buggy code:
class TraceGenerator extends ThreadWithException < XTrace > { private Map < Component , Long > componentsObservationTime ; private Map < Sequence , Integer > observationsCounter ; private Set < Sequence > tokens ; private Process process ; private String caseId ; private SimulationConfiguration parameters ; private NoiseProcessor noiseProcessor ; public TraceGenerator ( Process process , String caseId , SimulationConfiguration parameters ) { } public XTrace getGeneratedTrace ( ) { } @ Override protected XTrace runWithException ( ) throws InvalidScript { } private void processFlowObject ( Sequence source , FlowObject object , XTrace trace , long traceProgressiveTime ) throws InvalidScript { long executionDuration = recordEventExecution ( object , trace , traceProgressiveTime ) ; componentsObservationTime . put ( object , ( traceProgressiveTime + executionDuration ) ) ; if ( observationsCounter . containsKey ( source ) ) { observationsCounter . put ( source , ( ( observationsCounter . get ( source ) ) + 1 ) ) ; } else { observationsCounter . put ( source , 1 ) ; } if ( ( ( object instanceof Task ) || ( object instanceof ExclusiveGateway ) ) || ( object instanceof StartEvent ) ) { if ( ( tokens ) != null ) { tokens . remove ( source ) ; } Set < Pair < FlowObject , Double > > outgoing = new HashSet < Pair < FlowObject , Double > > ( ) ; for ( FlowObject o : object . getOutgoingObjects ( ) ) { Sequence target = process . getSequence ( object , o ) ; if ( ( observationsCounter . containsKey ( target ) ) && ( ( observationsCounter . get ( target ) ) > ( parameters . getMaximumLoopCycles ( ) ) ) ) { outgoing . add ( new Pair < FlowObject , Double > ( o , 0.001 ) ) ; } else { outgoing . add ( new Pair < FlowObject , Double > ( o , 1.0 ) ) ; } } FlowObject next = SetUtils . getRandomWeighted ( outgoing ) ; if ( next instanceof Task ) { Set < DataObject > dataObjs = ( ( Task ) ( next ) ) . getDataObjects ( REQUIRED ) ; <START_BUG> if ( ( dataObjs . size ( ) ) > 0 ) { <END_BUG> recordEventAttributes ( trace , dataObjs , trace . get ( ( ( trace . size ( ) ) - 1 ) ) ) ; } } Sequence sequenceToNext = process . getSequence ( object , next ) ; tokens . add ( sequenceToNext ) ; processFlowObject ( sequenceToNext , next , trace , ( traceProgressiveTime + executionDuration ) ) ; } else if ( object instanceof ParallelGateway ) { if ( ( object . getOutgoingObjects ( ) . size ( ) ) > 1 ) { if ( ( tokens ) != null ) { tokens . remove ( source ) ; } for ( FlowObject next : object . getOutgoingObjects ( ) ) { tokens . add ( process . getSequence ( object , next ) ) ; } for ( FlowObject next : SetUtils . randomizeSet ( object . getOutgoingObjects ( ) ) ) { Sequence sequenceToNext = process . getSequence ( object , next ) ; processFlowObject ( sequenceToNext , next , trace , traceProgressiveTime ) ; } } else if ( ( object . getIncomingObjects ( ) . size ( ) ) > 1 ) { boolean observedAll = true ; Set < Long > incomingTimestamps = new HashSet < Long > ( ) ; for ( FlowObject fo : object . getIncomingObjects ( ) ) { Sequence sequenceToNext = process . getSequence ( fo , object ) ; if ( ! ( tokens . contains ( sequenceToNext ) ) ) { observedAll = false ; break ; } else { incomingTimestamps . add ( componentsObservationTime . get ( fo ) ) ; } } if ( observedAll ) { for ( FlowObject fo : object . getIncomingObjects ( ) ) { Sequence token = process . getSequence ( fo , object ) ; tokens . remove ( token ) ; } Long maxProgressive = Collections . max ( incomingTimestamps ) ; FlowObject next = SetUtils . getRandom ( object . getOutgoingObjects ( ) ) ; Sequence sequenceToNext = process . getSequence ( object , next ) ; tokens . add ( sequenceToNext ) ; processFlowObject ( sequenceToNext , next , trace , maxProgressive ) ; } } } } private long recordEventExecution ( FlowObject object , XTrace trace , long traceProgressiveTime ) throws InvalidScript { } private void recordEventAttributes ( XTrace trace , Set < DataObject > dataObjects , XEvent ... events ) throws InvalidScript { } }

Fix:
if ( ( ( dataObjs . size ( ) ) > 0 ) && ( ( trace . size ( ) ) > 1 ) ) {