java.lang.IllegalArgumentException Cannot apply format on null at thymeleaf.util.Validate.notNull

报错信息

  • 前端
While Error Page
This application has no explicit mapping for /error,so you are seeing this as a failback

There was an unexpected error(type=Internal Server Error,status=500)
Error formatting decimal with minimum integer digits = 1 and decimal digits
  • 后端
java.lang.IllegalArgumentException Cannot apply format on null
	at org.thymeleaf.util.Validate.notNull(Validate.java37) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.util.NumberUtils.format(NumberUtils.java59) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.expression.Numbers.formatDecimal(Numbers.java150) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na1.8.0_181]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java62) ~[na1.8.0_181]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java43) ~[na1.8.0_181]
	at java.lang.reflect.Method.invoke(Method.java498) ~[na1.8.0_181]
	at org.springframework.expression.spel.support.ReflectiveMethodExecutor.execute(ReflectiveMethodExecutor.java117) ~[spring-expression-4.3.14.RELEASE.jar4.3.14.RELEASE]
	at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java130) ~[spring-expression-4.3.14.RELEASE.jar4.3.14.RELEASE]
	at org.springframework.expression.spel.ast.MethodReference.access$000(MethodReference.java50) ~[spring-expression-4.3.14.RELEASE.jar4.3.14.RELEASE]
	at org.springframework.expression.spel.ast.MethodReference$MethodValueRef.getValue(MethodReference.java348) ~[spring-expression-4.3.14.RELEASE.jar4.3.14.RELEASE]
	at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java88) ~[spring-expression-4.3.14.RELEASE.jar4.3.14.RELEASE]
	at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java121) ~[spring-expression-4.3.14.RELEASE.jar4.3.14.RELEASE]
	at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java324) ~[spring-expression-4.3.14.RELEASE.jar4.3.14.RELEASE]
	at org.thymeleaf.spring4.expression.SpelVariableExpressionEvaluator.evaluate(SpelVariableExpressionEvaluator.java140) ~[thymeleaf-spring4-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.standard.expression.VariableExpression.executeVariable(VariableExpression.java154) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.standard.expression.SimpleExpression.executeSimple(SimpleExpression.java59) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.standard.expression.Expression.execute(Expression.java103) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.standard.expression.AdditionExpression.executeAddition(AdditionExpression.java92) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.standard.expression.ComplexExpression.executeComplex(ComplexExpression.java55) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.standard.expression.Expression.execute(Expression.java107) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.standard.expression.Expression.execute(Expression.java133) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.standard.expression.Expression.execute(Expression.java120) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.standard.processor.attr.AbstractStandardTextChildModifierAttrProcessor.getText(AbstractStandardTextChildModifierAttrProcessor.java68) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.processor.attr.AbstractTextChildModifierAttrProcessor.getModifiedChildren(AbstractTextChildModifierAttrProcessor.java59) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.processor.attr.AbstractChildrenModifierAttrProcessor.processAttribute(AbstractChildrenModifierAttrProcessor.java59) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.processor.attr.AbstractAttrProcessor.doProcess(AbstractAttrProcessor.java87) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.processor.AbstractProcessor.process(AbstractProcessor.java212) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.Node.applyNextProcessor(Node.java1017) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.Node.processNode(Node.java972) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java695) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java668) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.Node.processNode(Node.java990) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java695) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java668) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.Node.processNode(Node.java990) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java695) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java668) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.Node.processNode(Node.java990) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java695) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java668) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.Node.processNode(Node.java990) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java695) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java668) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.Node.processNode(Node.java990) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java695) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java668) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.Node.processNode(Node.java990) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java695) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java668) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.Node.processNode(Node.java990) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java695) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java668) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.Node.processNode(Node.java990) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java695) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java668) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.Node.processNode(Node.java990) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java695) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java668) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.Node.processNode(Node.java990) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.NestableNode.computeNextChild(NestableNode.java695) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.NestableNode.doAdditionalProcess(NestableNode.java668) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.Node.processNode(Node.java990) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.dom.Document.process(Document.java93) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.TemplateEngine.process(TemplateEngine.java1155) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.TemplateEngine.process(TemplateEngine.java1060) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.TemplateEngine.process(TemplateEngine.java1011) ~[thymeleaf-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.spring4.view.ThymeleafView.renderFragment(ThymeleafView.java335) ~[thymeleaf-spring4-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.thymeleaf.spring4.view.ThymeleafView.render(ThymeleafView.java190) ~[thymeleaf-spring4-2.1.6.RELEASE.jar2.1.6.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java1286) ~[spring-webmvc-4.3.14.RELEASE.jar4.3.14.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java1041) ~[spring-webmvc-4.3.14.RELEASE.jar4.3.14.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java984) ~[spring-webmvc-4.3.14.RELEASE.jar4.3.14.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java901) ~[spring-webmvc-4.3.14.RELEASE.jar4.3.14.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java970) ~[spring-webmvc-4.3.14.RELEASE.jar4.3.14.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java861) ~[spring-webmvc-4.3.14.RELEASE.jar4.3.14.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java635) ~[tomcat-embed-core-8.5.27.jar8.5.27]
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java846) ~[spring-webmvc-4.3.14.RELEASE.jar4.3.14.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java742) ~[tomcat-embed-core-8.5.27.jar8.5.27]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java231) ~[tomcat-embed-core-8.5.27.jar8.5.27]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java166) ~[tomcat-embed-core-8.5.27.jar8.5.27]
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java52) ~[tomcat-embed-websocket-8.5.27.jar8.5.27]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java193) ~[tomcat-embed-core-8.5.27.jar8.5.27]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java166) ~[tomcat-embed-core-8.5.27.jar8.5.27]
	at org.springframework.web.servlet.resource.ResourceUrlEncodingFilter.doFilter(ResourceUrlEncodingFilter.java59) ~[spring-webmvc-4.3.14.RELEASE.jar4.3.14.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java193) ~[tomcat-embed-core-8.5.27.jar8.5.27]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java166) ~[tomcat-embed-core-8.5.27.jar8.5.27]
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java99) ~[spring-web-4.3.14.RELEASE.jar4.3.14.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java107) ~[spring-web-4.3.14.RELEASE.jar4.3.14.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java193) ~[tomcat-embed-core-8.5.27.jar8.5.27]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java166) ~[tomcat-embed-core-8.5.27.jar8.5.27]
	at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java108) ~[spring-web-4.3.14.RELEASE.jar4.3.14.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java107) ~[spring-web-4.3.14.RELEASE.jar4.3.14.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java193) ~[tomcat-embed-core-8.5.27.jar8.5.27]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java166) ~[tomcat-embed-core-8.5.27.jar8.5.27]
	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java81) ~[spring-web-4.3.14.RELEASE.jar4.3.14.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java107) ~[spring-web-4.3.14.RELEASE.jar4.3.14.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java193) ~[tomcat-embed-core-8.5.27.jar8.5.27]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java166) ~[tomcat-embed-core-8.5.27.jar8.5.27]
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java197) ~[spring-web-4.3.14.RELEASE.jar4.3.14.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java107) ~[spring-web-4.3.14.RELEASE.jar4.3.14.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java193) ~[tomcat-embed-core-8.5.27.jar8.5.27]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java166) ~[tomcat-embed-core-8.5.27.jar8.5.27]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java199) ~[tomcat-embed-core-8.5.27.jar8.5.27]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java96) [tomcat-embed-core-8.5.27.jar8.5.27]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java504) [tomcat-embed-core-8.5.27.jar8.5.27]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java140) [tomcat-embed-core-8.5.27.jar8.5.27]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java81) [tomcat-embed-core-8.5.27.jar8.5.27]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java87) [tomcat-embed-core-8.5.27.jar8.5.27]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java342) [tomcat-embed-core-8.5.27.jar8.5.27]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java803) [tomcat-embed-core-8.5.27.jar8.5.27]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java66) [tomcat-embed-core-8.5.27.jar8.5.27]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java790) [tomcat-embed-core-8.5.27.jar8.5.27]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java1459) [tomcat-embed-core-8.5.27.jar8.5.27]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java49) [tomcat-embed-core-8.5.27.jar8.5.27]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java1149) [na1.8.0_181]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java624) [na1.8.0_181]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java61) [tomcat-embed-core-8.5.27.jar8.5.27]
	at java.lang.Thread.run(Thread.java748) [na1.8.0_181]

报错原因

<span th:text="'¥'+${#numbers.formatDecimal(skuLsInfo.price,1,2)}">¥5199.00</span>
  • skuLsInfo.price取不到值,导致报错

解决方法

<span th:text="'¥'+${skuLsInfo.price != null?#numbers.formatDecimal(skuLsInfo.price,1,2):'5199.00'}">¥5199.00</span>

  • 判断skuLsInfo.price是否为空之后再进行运算
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值