HPCC-10194: For all Java function result handling, ensure that a returned NULL value (instead of an actual object) is coerced into the appropriate value (empty string, empty set, etc.).

Also add explicit DeleteLocalRef() JNI calls for references created and used solely within tight loops to reduce the possibility of large structures (such as large SET OF STRING values being passed) bumping into frame memory guards.