Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-102631

DDMFormPortlet does not handle DDMFormValuesValidationException.MustSetValidValue

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: 7.1.10.1 SP1, 7.2.0 GA1, 7.2.10 DXP FP1, Master
    • Fix Version/s: Master
    • Component/s: Forms

      Description

      The DDMFormPortlet class handles the case of DDMFormValuesValidationException.RequiredValue being thrown but not DDMFormValuesValidationException.MustSetValidValue:

      DDMFormPortlet.java
      if (cause instanceof DDMFormValuesValidationException) {
      	if (cause instanceof
      			DDMFormValuesValidationException.RequiredValue) {
      
      		SessionErrors.add(actionRequest, cause.getClass(), cause);
      	}
      	else {
      		SessionErrors.add(
      			actionRequest, DDMFormValuesValidationException.class);
      	}
      }
      

      In needs to handle DDMFormValuesValidationException.MustSetValidValue since it is supported in the JSP:

      view.jsp
      	<liferay-ui:error exception="<%= DDMFormValuesValidationException.MustSetValidValue.class %>">
      		<%
      		DDMFormValuesValidationException.MustSetValidValue msvv = (DDMFormValuesValidationException.MustSetValidValue)errorException;
      		%>
      		<liferay-ui:message arguments="<%= HtmlUtil.escape(msvv.getFieldName()) %>" key="validation-failed-for-field-x" translateArguments="<%= false %>" />
      	</liferay-ui:error>
      

      The fix would be to add an or condition:

      DDMFormPortlet.java
      if (cause instanceof DDMFormValuesValidationException) {
      	if ((cause instanceof
      			DDMFormValuesValidationException.RequiredValue) || {
      	    (cause instanceof
      			DDMFormValuesValidationException.MustSetValidValue)) {
      		SessionErrors.add(actionRequest, cause.getClass(), cause);
      	}
      	else {
      		SessionErrors.add(
      			actionRequest, DDMFormValuesValidationException.class);
      	}
      }
      

        Attachments

          Activity

            People

            • Assignee:
              brian.chan Brian Chan
              Reporter:
              neil.griffin Neil Griffin
              Participants of an Issue:
              Recent user:
              Brian Chan
              Engineering Assignee:
              Neil Griffin
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                21 weeks ago

                Packages

                Version Package
                Master