Page 1 of 1

Thymeleaf Exception while saving HTML content from admin

Posted: Fri Nov 08, 2013 12:17 pm
by sp.prakash
Hello,

I am trying to enter HTML content for structured content objects and I am getting the below exception when I click on save. Can someone help me how to solve this issue..

java.lang.NumberFormatException java.math.BigDecimal.<init>(Unknown Source) java.math.BigDecimal.<init>(Unknown Source) org.thymeleaf.standard.expression.NumberLiteralExpression.<init>(NumberLiteralExpression.java:55) org.thymeleaf.standard.expression.NumberLiteralExpression.parseNumberLiteral(NumberLiteralExpression.java:73) org.thymeleaf.standard.expression.SimpleExpression.decomposeSimpleExpressions(SimpleExpression.java:101) org.thymeleaf.standard.expression.SimpleExpression.decomposeSimpleExpressions(SimpleExpression.java:61) org.thymeleaf.standard.expression.Expression.parse(Expression.java:73) org.thymeleaf.standard.expression.MessageExpression.computeBase(MessageExpression.java:196) org.thymeleaf.standard.expression.MessageExpression.parseMessage(MessageExpression.java:179) org.thymeleaf.standard.expression.SimpleExpression.decomposeSimpleExpressions(SimpleExpression.java:190) org.thymeleaf.standard.expression.SimpleExpression.decomposeSimpleExpressions(SimpleExpression.java:61) org.thymeleaf.standard.expression.Expression.parse(Expression.java:73) org.thymeleaf.standard.expression.StandardExpressionParser.parseExpression(StandardExpressionParser.java:184) org.thymeleaf.standard.expression.StandardExpressionParser.parseExpression(StandardExpressionParser.java:72) org.thymeleaf.standard.expression.StandardExpressionProcessor.parseExpression(StandardExpressionProcessor.java:55) org.thymeleaf.standard.expression.StandardExpressionProcessor.processExpression(StandardExpressionProcessor.java:164) org.thymeleaf.standard.inliner.StandardTextTextInliner.processTextInline(StandardTextTextInliner.java:97) org.thymeleaf.standard.inliner.StandardTextTextInliner.inline(StandardTextTextInliner.java:64) org.thymeleaf.standard.processor.text.StandardTextInliningTextProcessor.processTextNode(StandardTextInliningTextProcessor.java:93) org.thymeleaf.processor.text.AbstractTextNodeProcessor.doProcess(AbstractTextNodeProcessor.java:69) org.thymeleaf.processor.AbstractProcessor.process(AbstractProcessor.java:212) org.thymeleaf.dom.Node.applyNextProcessor(Node.java:991) org.thymeleaf.dom.Node.processNode(Node.java:946) org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:656) org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:639) org.thymeleaf.dom.Node.processNode(Node.java:965) org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:656) org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:639) org.thymeleaf.dom.Node.processNode(Node.java:965) org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:656) org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:639) org.thymeleaf.dom.Node.processNode(Node.java:965) org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:656) org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:639) org.thymeleaf.dom.Node.processNode(Node.java:965) org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:656) org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:639) org.thymeleaf.dom.Node.processNode(Node.java:965) org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:656) org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:639) org.thymeleaf.dom.Node.processNode(Node.java:965) org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:656) org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:639) org.thymeleaf.dom.Node.processNode(Node.java:965) org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:656) org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:639) org.thymeleaf.dom.Node.processNode(Node.java:965) org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:656) org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:639) org.thymeleaf.dom.Node.processNode(Node.java:965) org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:656) org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:639) org.thymeleaf.dom.Node.processNode(Node.java:965) org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:656) org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:639) org.thymeleaf.dom.Node.processNode(Node.java:965) org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:656) org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:639) org.thymeleaf.dom.Node.processNode(Node.java:965) org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:656) org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:639) org.thymeleaf.dom.Node.processNode(Node.java:965) org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java:656) org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java:639) org.thymeleaf.dom.Node.processNode(Node.java:965) org.thymeleaf.dom.Document.process(Document.java:93) org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1244) org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1149) org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1096) org.thymeleaf.spring3.view.ThymeleafView.renderFragment(ThymeleafView.java:259) org.thymeleaf.spring3.view.ThymeleafView.render(ThymeleafView.java:179) org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1208) org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:992) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:939) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936) org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838) javax.servlet.http.HttpServlet.service(HttpServlet.java:754) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812) javax.servlet.http.HttpServlet.service(HttpServlet.java:847) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) org.broadleafcommerce.openadmin.web.compatibility.JSCompatibilityRequestFilter.doFilterInternal(JSCompatibilityRequestFilter.java:37) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.broadleafcommerce.openadmin.security.AdminSandBoxFilter.doFilterInternal(AdminSandBoxFilter.java:70) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.broadleafcommerce.common.web.util.PrecompressedArtifactFilter.doFilter(PrecompressedArtifactFilter.java:85) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192) org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:166) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:108) org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118) org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:91) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.broadleafcommerce.common.security.handler.CsrfFilter.doFilter(CsrfFilter.java:82) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.access.channel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:144) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

Regards,
-sp.prakash

Re: Thymeleaf Exception while saving HTML content from admin

Posted: Fri Nov 08, 2013 12:21 pm
by sp.prakash
Forgot to mention in previous post - I am getting this error on BLC-3.0.3-GA version. Initially I used to get different error which is fixed as part of https://github.com/BroadleafCommerce/Br ... issues/469 in BLC-3.0.3-GA release. But since then I upgraded to 3.0.3 I am getting this thymeleaf exception.

Regards,
sp.prakash

Re: Thymeleaf Exception while saving HTML content from admin

Posted: Mon Nov 11, 2013 11:27 am
by phillipuniverse
Please open an issue for this on GitHub and notate the steps to reliably reproduce.

Re: Thymeleaf Exception while saving HTML content from admin

Posted: Wed Nov 13, 2013 4:33 am
by sp.prakash
@phillipuniverse - We figured out this issue. We are getting this exception when trying to save anchor tag with empty href value. Ex: <a href="" />. Either we need to completely remove the href attribute / put some dummy value like '#'. We found this when tracked down in debug mode. And we were able to see the proper error message (given below) in the validation object.

Code: Select all

codes [1) The a tag contained an attribute that we could not process. The href attribute had a value of "". This value could not be accepted for security reasons. We have chosen to remove this attribute from the tag and leave everything else in place so that we could process the input.

Note - classpath:antisamy-myspace-1.4.4.xml policy in effect. Set a new policy file to modify validation behavior/strictness..entityForm.htmlContent,1) The a tag contained an attribute that we could not process. The href attribute had a value of "". This value could not be accepted for security reasons. We have chosen to remove this attribute from the tag and leave everything else in place so that we could process the input.


But somehow this is not passed to UI and we are displaying the thymeleaf exception which misleading the end user. It would be nice if we display this validation error in the UI instead of stack trace.

Regards,
-spprakash.