If the new value of a field of an entity is the same as the old value of an entity, calling update() causes an NPE. Here is an example code snippet.
def exampleUserAccount = ec.entity.makeFind("UserAccount").condition("username", "example.viewer").one();
exampleUserAccount.userFullName = "Example Viewer";
exampleUserAccount.update();
Here is the stack trace.
java.lang.NullPointerException: Cannot invoke method values() on null object
at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:77)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:32)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at java_util_Map$values.call(Unknown Source)
at org.moqui.impl.entity.EntityValueImpl.update(EntityValueImpl.groovy:385)
at org.moqui.entity.EntityValue$update.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
....
The solution might be adding the null check at line#385 in EntityValueImpl.groovy
if(dbValueMap) for (Object val in dbValueMap.values()) if (val != null) { dbValueMapFromDb = true; break }