AnsweredAssumed Answered

4.2.c regression on custom constraint

Question asked by scouil on Jan 25, 2013
Latest reply on Mar 26, 2014 by darkstar1
I've developped a custom constraint extending the ListOfValuesConstraint.
It was running fine in 4.2.b and before but ends up giving me trouble in 4.2.c

The error happens when looking at the "Workflow Details" of a workflow containing a field based on that constraint.
I get a simple "Failure" popup and a log message including:

Caused by: java.lang.NullPointerException
        at org.alfresco.web.scripts.forms.FormUIGet.processFieldConstraintControl(FormUIGet.java:1956)


The problem seems to be that fieldConfig is null.
Previous version of the file didn't include this check using fieldConfig hence didn't trigger the bug.
The following changed the 7th of december in commit 44483 in the file org.alfresco.web.scripts.forms.FormUIGet.java by replacing

Collections.sort(optionsList, new OptionsComparator());

with

if (fieldConfig.isSorted())
{
    Collections.sort(optionsList, new OptionsComparator());
}


I don't really know what this fieldConfig corresponds to and if the spec marks it as mandatory (I tend to believe it's not since a check on it is made a few lines before) so I didn't report it on jira just yet.

PS: Removing the check altogether isn't an option since it would bring back this bug: https://issues.alfresco.com/jira/browse/ALF-16157

Outcomes