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

Naming a form text field with a numeric value prevents its validation

    Details

      Description

      Steps to reproduce

      1. Create a new form.
      2. Add a text field with following configuration:
        1. Label: a number (ex. '1234')
        2. Required: true
        3. Validation: Is not email
        4. Error message: ex. 'The email is not valid'
      3. Add the form to a page and navigate to that page.
      4. Copy and paste following email address: check@junkmail.net
      5. Click on submit button.

      Expected behaviour:

      • Form is submitted.

      Observed behaviour:

      • Error message is showed and form is not submitted.

      For master
      Adding the following log level category:

      ALL -> com.liferay.dynamic.data.mapping.form.evaluator.internal.helper.DDMFormEvaluatorHelper
      

      allows to log an exception in Liferay's log:

      DEBUG [http-nio-8080-exec-3][DDMFormEvaluatorHelper:424] com.liferay.dynamic.data.mapping.expression.DDMExpressionException: java.lang.ClassCastException: java.math.BigDecimal cannot be cast to java.lang.String 
      com.liferay.dynamic.data.mapping.expression.DDMExpressionException: java.lang.ClassCastException: java.math.BigDecimal cannot be cast to java.lang.String 
      	at com.liferay.dynamic.data.mapping.expression.internal.DDMExpressionImpl.evaluate(DDMExpressionImpl.java:73) 
      	at com.liferay.dynamic.data.mapping.form.evaluator.internal.helper.DDMFormEvaluatorHelper.evaluateExpression(DDMFormEvaluatorHelper.java:212) 
      	at com.liferay.dynamic.data.mapping.form.evaluator.internal.helper.DDMFormEvaluatorHelper.validateField(DDMFormEvaluatorHelper.java:420) 
      	at java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1696) 
      	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580) 
      	at com.liferay.dynamic.data.mapping.form.evaluator.internal.helper.DDMFormEvaluatorHelper.validateFields(DDMFormEvaluatorHelper.java:479) 
      	at com.liferay.dynamic.data.mapping.form.evaluator.internal.helper.DDMFormEvaluatorHelper.evaluate(DDMFormEvaluatorHelper.java:123) 
      	at com.liferay.dynamic.data.mapping.form.evaluator.internal.DDMFormEvaluatorImpl.evaluate(DDMFormEvaluatorImpl.java:82) 
      	at com.liferay.dynamic.data.mapping.form.renderer.internal.DDMFormPagesTemplateContextFactory._evaluate(DDMFormPagesTemplateContextFactory.java:353) 
      	at com.liferay.dynamic.data.mapping.form.renderer.internal.DDMFormPagesTemplateContextFactory.create(DDMFormPagesTemplateContextFactory.java:85) 
      	at com.liferay.dynamic.data.mapping.form.renderer.internal.servlet.DDMFormContextProviderServlet.createDDMFormPagesTemplateContext(DDMFormContextProviderServlet.java:136) 
      	at com.liferay.dynamic.data.mapping.form.renderer.internal.servlet.DDMFormContextProviderServlet.doPost(DDMFormContextProviderServlet.java:187) 
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) 
      	at com.liferay.dynamic.data.mapping.form.renderer.internal.servlet.DDMFormContextProviderServlet.service(DDMFormContextProviderServlet.java:76) 
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) 
      	at org.eclipse.equinox.http.servlet.internal.registration.EndpointRegistration.service(EndpointRegistration.java:153) 
      	at org.eclipse.equinox.http.servlet.internal.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:50) 
      	at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:144) 
      	at com.liferay.portal.servlet.filters.authverifier.AuthVerifierFilter.processFilter(AuthVerifierFilter.java:188) 
      	at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:49) 
      	at org.eclipse.equinox.http.servlet.internal.registration.FilterRegistration.doFilter(FilterRegistration.java:121) 
      	at org.eclipse.equinox.http.servlet.internal.servlet.FilterChainImpl.doFilter(FilterChainImpl.java:45) 
      	at org.eclipse.equinox.http.servlet.internal.servlet.ResponseStateHandler.processRequest(ResponseStateHandler.java:70) 
      	at org.eclipse.equinox.http.servlet.internal.context.DispatchTargets.doDispatch(DispatchTargets.java:120) 
      	at org.eclipse.equinox.http.servlet.internal.HttpServiceRuntimeImpl.doDispatch(HttpServiceRuntimeImpl.java:373) 
      	at org.eclipse.equinox.http.servlet.internal.servlet.ProxyServlet.service(ProxyServlet.java:70) 
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) 
      	at com.liferay.portal.module.framework.ModuleFrameworkServletAdapter.service(ModuleFrameworkServletAdapter.java:51) 
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) 
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) 
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 
      	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) 
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:119) 
      	at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:144) 
      	at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:103) 
      	at com.liferay.portal.apio.internal.architect.servlet.filter.APIDocumentationFilter.processFilter(APIDocumentationFilter.java:74) 
      	at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:49) 
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207) 
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112) 
      	at com.liferay.portal.servlet.filters.password.modified.PasswordModifiedFilter.processFilter(PasswordModifiedFilter.java:57) 
      	at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:49) 
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207) 
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112) 
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:188) 
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96) 
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:188) 
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96) 
      	at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176) 
      	at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145) 
      	at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92) 
      	at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:389) 
      	at com.liferay.portal.servlet.filters.urlrewrite.UrlRewriteFilter.processFilter(UrlRewriteFilter.java:65) 
      	at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:49) 
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:207) 
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:112) 
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:168) 
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96) 
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:168) 
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96) 
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:188) 
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96) 
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:101) 
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) 
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) 
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) 
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) 
      	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:491) 
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) 
      	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) 
      	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) 
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) 
      	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) 
      	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) 
      	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:764) 
      	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1388) 
      	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) 
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
      	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) 
      	at java.lang.Thread.run(Thread.java:748) 
      Caused by: java.lang.ClassCastException: java.math.BigDecimal cannot be cast to java.lang.String 
      	at com.liferay.dynamic.data.mapping.form.evaluator.internal.function.IsEmailAddressFunction.apply(IsEmailAddressFunction.java:30) 
      	at com.liferay.dynamic.data.mapping.expression.internal.DDMExpressionEvaluatorVisitor.visitFunctionCallExpression(DDMExpressionEvaluatorVisitor.java:185) 
      	at com.liferay.dynamic.data.mapping.expression.internal.parser.DDMExpressionParser$FunctionCallExpressionContext.accept(DDMExpressionParser.java:1638) 
      	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:72) 
      	at com.liferay.dynamic.data.mapping.expression.internal.parser.DDMExpressionBaseVisitor.visitToFunctionCallExpression(DDMExpressionBaseVisitor.java:278) 
      	at com.liferay.dynamic.data.mapping.expression.internal.parser.DDMExpressionParser$ToFunctionCallExpressionContext.accept(DDMExpressionParser.java:1482) 
      	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:72) 
      	at com.liferay.dynamic.data.mapping.expression.internal.parser.DDMExpressionBaseVisitor.visitPrimary(DDMExpressionBaseVisitor.java:138) 
      	at com.liferay.dynamic.data.mapping.expression.internal.parser.DDMExpressionParser$PrimaryContext.accept(DDMExpressionParser.java:1371) 
      	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:72) 
      	at com.liferay.dynamic.data.mapping.expression.internal.parser.DDMExpressionBaseVisitor.visitToNumericUnaryExpression(DDMExpressionBaseVisitor.java:318) 
      	at com.liferay.dynamic.data.mapping.expression.internal.parser.DDMExpressionParser$ToNumericUnaryExpressionContext.accept(DDMExpressionParser.java:1200) 
      	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:72) 
      	at com.liferay.dynamic.data.mapping.expression.internal.parser.DDMExpressionBaseVisitor.visitToMultOrDiv(DDMExpressionBaseVisitor.java:38) 
      	at com.liferay.dynamic.data.mapping.expression.internal.parser.DDMExpressionParser$ToMultOrDivContext.accept(DDMExpressionParser.java:1095) 
      	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:72) 
      	at com.liferay.dynamic.data.mapping.expression.internal.parser.DDMExpressionBaseVisitor.visitToAdditionOrSubtractionEpression(DDMExpressionBaseVisitor.java:258) 
      	at com.liferay.dynamic.data.mapping.expression.internal.parser.DDMExpressionParser$ToAdditionOrSubtractionEpressionContext.accept(DDMExpressionParser.java:864) 
      	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:72) 
      	at com.liferay.dynamic.data.mapping.expression.internal.parser.DDMExpressionBaseVisitor.visitToBooleanOperandExpression(DDMExpressionBaseVisitor.java:68) 
      	at com.liferay.dynamic.data.mapping.expression.internal.parser.DDMExpressionParser$ToBooleanOperandExpressionContext.accept(DDMExpressionParser.java:751) 
      	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:72) 
      	at com.liferay.dynamic.data.mapping.expression.internal.parser.DDMExpressionBaseVisitor.visitToBooleanUnaryExpression(DDMExpressionBaseVisitor.java:178) 
      	at com.liferay.dynamic.data.mapping.expression.internal.parser.DDMExpressionParser$ToBooleanUnaryExpressionContext.accept(DDMExpressionParser.java:601) 
      	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:72) 
      	at com.liferay.dynamic.data.mapping.expression.internal.parser.DDMExpressionBaseVisitor.visitToComparisonExpression(DDMExpressionBaseVisitor.java:398) 
      	at com.liferay.dynamic.data.mapping.expression.internal.parser.DDMExpressionParser$ToComparisonExpressionContext.accept(DDMExpressionParser.java:404) 
      	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:72) 
      	at com.liferay.dynamic.data.mapping.expression.internal.parser.DDMExpressionBaseVisitor.visitToEqualityExpression(DDMExpressionBaseVisitor.java:238) 
      	at com.liferay.dynamic.data.mapping.expression.internal.parser.DDMExpressionParser$ToEqualityExpressionContext.accept(DDMExpressionParser.java:292) 
      	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:72) 
      	at com.liferay.dynamic.data.mapping.expression.internal.parser.DDMExpressionBaseVisitor.visitToLogicalAndExpression(DDMExpressionBaseVisitor.java:128) 
      	at com.liferay.dynamic.data.mapping.expression.internal.parser.DDMExpressionParser$ToLogicalAndExpressionContext.accept(DDMExpressionParser.java:157) 
      	at com.liferay.dynamic.data.mapping.expression.internal.DDMExpressionEvaluatorVisitor.visitExpression(DDMExpressionEvaluatorVisitor.java:131) 
      	at com.liferay.dynamic.data.mapping.expression.internal.parser.DDMExpressionParser$ExpressionContext.accept(DDMExpressionParser.java:105) 
      	at com.liferay.dynamic.data.mapping.expression.internal.DDMExpressionImpl.evaluate(DDMExpressionImpl.java:67) 
      	... 81 more 
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                louis.zhang Louis Zhang (Inactive)
                Reporter:
                sergio.alonso Sergio Alonso
                Participants of an Issue:
                Recent user:
                Clarissa Velazquez
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  43 weeks, 6 days ago

                  Packages

                  Version Package
                  7.1.3 CE GA4
                  7.1.10 DXP FP11
                  7.1.X
                  Master