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: Verified
    • Resolution: Unresolved
    • Affects Version/s: 7.1.10.1 SP1, 7.2.0 GA1, 7.2.10 DXP FP1
    • Fix Version/s: None
    • Component/s: Forms
    • Labels:
      None

      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:
              support-lep@liferay.com SE Support
              Reporter:
              neil.griffin Neil Griffin
              Participants of an Issue:
              Recent user:
              Liferay JIRA Bot
              Engineering Assignee:
              Neil Griffin
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Days since last comment:
                6 weeks, 1 day ago

                Packages

                Version Package