Alarm iteration script error

New to Foglight scripting and new to Groovy.

Been a Foglight admin for some time now and coder for much longer.

INn the script console I've been putting togethor a little something to iterate over all the current alarms. It's WIP and for now just breaks out when it finds a matching alarm then displays some details.

Now, if I comment out either  of the nested ifs that use contains it all works just fine. But if both are uncommented we get an error and stack thus

I'm a bit mystified and wondering if anyone knows something I'm missing. Which seems pretty likely Joy

TIA for any help anyone can provide!