From: "Adam Heath" <[email protected]>
Why do SimpleMethod.java and ModelScreen.java both do
context.put("null", GenericEntity.NULL_FIELD)?
For ModelScreen.java.renderScreenString(), and SimpleMethod.exec()
I just can say that it's there for age, at least since we came out of ASF
incubation.
ModelScreen.java.renderScreenString(), the comment says
// make sure the "null" object is in there for entity ops
in SimpleMethod.exec(), I read
// always put the null field object in as "null"
methodContext.putEnv("null", GenericEntity.NULL_FIELD);
methodContext.putEnv("nullField", GenericEntity.NULL_FIELD);
I guess it's also related to entity ops.
I agree that the use of GenericEntity.NULL_FIELD in relation with null is not
consistent in OFBiz and that's an issue. I already
crossed it working on
https://issues.apache.org/jira/browse/OFBIZ-4602 (totally unrelated though;
there is a discrepancy between entitysync and services)
That changes *all* null
values in freemarker into that static instance, even when the target
type of the variable is *not* going to be part of some entity-like map.
If I remove both of those calls(actually, remove one, change the other
to place it as "nullField"), then the broken ordermgr link given earlier
starts to finally work. And, I think that even the nullField constant
should not be removed, as NullField should only be used internally by
the entity engine.
From ScreenRenderer.populateBasicContext(), where I read
// make sure the "nullField" object is in there for entity ops; note this is
nullField and not null because as null causes problems
in FreeMarker and such...
context.put("nullField", GenericEntity.NULL_FIELD);
I think you are heading in the right direction. But I wonder if you will not
discover other issues (like I did with OFBIZ-4602)
HTH
Jacques