java.lang.UnsupportedOperationException: Empty collection can‘t be reduced. 问题处理
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java.lang.UnsupportedOperationException: Empty collection can‘t be reduced. 问题处理相关的知识,希望对你有一定的参考价值。
java.lang.UnsupportedOperationException: Empty collection cant be reduced.
at com.fastonetech.billing.bill.service.NewBillService$Companion$calcRegionFees$2.invoke(NewBillService.kt:479) ~[classes/:na]
at com.fastonetech.billing.bill.service.NewBillService$Companion$calcRegionFees$2.invoke(NewBillService.kt:356) ~[classes/:na]
at arrow.optics.POptional$DefaultImpls.modify(Optional.kt:77) ~[arrow-optics-jvm.jar:na]
at arrow.optics.PLens$DefaultImpls.modify(Lens.kt:31) ~[arrow-optics-jvm.jar:na]
at arrow.optics.PLens$Companion$invoke$1.modify(Lens.kt:105) ~[arrow-optics-jvm.jar:na]
at com.fastonetech.billing.bill.service.NewBillService$Companion$calcRegionFees$1.invoke(NewBillService.kt:356) ~[classes/:na]
at com.fastonetech.billing.bill.service.NewBillService$Companion$calcRegionFees$1.invoke(NewBillService.kt:356) ~[classes/:na]
at arrow.core.Partials$partially2$1.invoke(partials.kt:13) ~[arrow-core-jvm.jar:na]
at com.fastonetech.billing.bill.service.NewBillService$Companion.calcRegionFees(NewBillService.kt:356) ~[classes/:na]
at com.fastonetech.billing.bill.service.NewBillService$Companion.access$calcRegionFees(NewBillService.kt:168) ~[classes/:na]
at com.fastonetech.billing.bill.service.NewBillService$Companion$buildBill$12.invoke(NewBillService.kt:210) ~[classes/:na]
at com.fastonetech.billing.bill.service.NewBillService$Companion$buildBill$12.invoke(NewBillService.kt:210) ~[classes/:na]
at arrow.core.AndThen1$andThen$1.invoke(composition-jvm.kt:115) ~[arrow-core-jvm.jar:na]
at arrow.core.AndThen1$Companion.loop(composition-jvm.kt:144) ~[arrow-core-jvm.jar:na]
at arrow.core.AndThen1.invoke(composition-jvm.kt:130) ~[arrow-core-jvm.jar:na]
at arrow.core.AndThen1$andThen$1.invoke(composition-jvm.kt:115) ~[arrow-core-jvm.jar:na]
at arrow.core.AndThen1$Companion.loop(composition-jvm.kt:144) ~[arrow-core-jvm.jar:na]
at arrow.core.AndThen1.invoke(composition-jvm.kt:130) ~[arrow-core-jvm.jar:na]
at arrow.core.AndThen1$andThen$1.invoke(composition-jvm.kt:115) ~[arrow-core-jvm.jar:na]
at arrow.core.AndThen1$Companion.loop(composition-jvm.kt:144) ~[arrow-core-jvm.jar:na]
at arrow.core.AndThen1.invoke(composition-jvm.kt:130) ~[arrow-core-jvm.jar:na]
at com.fastonetech.billing.bill.service.NewBillService$Companion.buildBill(NewBillService.kt:198) ~[classes/:na]
at com.fastonetech.billing.bill.service.NewBillService.create(NewBillService.kt:133) ~[classes/:na]
at com.fastonetech.billing.bill.service.NewBillService.getUserBill(NewBillService.kt:88) ~[classes/:na]
at com.fastonetech.billing.bill.service.NewBillService$$FastClassBySpringCGLIB$$c6d25100.invoke(<generated>) ~[classes/:na]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.3.12.jar:5.3.12]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689) ~[spring-aop-5.3.12.jar:5.3.12]
at com.fastonetech.billing.bill.service.NewBillService$$EnhancerBySpringCGLIB$$70e0bb65.getUserBill(<generated>) ~[classes/:na]
at com.fastonetech.billing.bill.controller.BillController.getByMonth(BillController.kt:106) ~[classes/:na]
at jdk.internal.reflect.GeneratedMethodAccessor164.invoke(Unknown Source) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-5.3.12.jar:5.3.12]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150) ~[spring-web-5.3.12.jar:5.3.12]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) ~[spring-webmvc-5.3.12.jar:5.3.12]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) ~[spring-webmvc-5.3.12.jar:5.3.12]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.12.jar:5.3.12]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.12.jar:5.3.12]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067) ~[spring-webmvc-5.3.12.jar:5.3.12]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963) ~[spring-webmvc-5.3.12.jar:5.3.12]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.12.jar:5.3.12]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.12.jar:5.3.12]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:655) ~[tomcat-embed-core-9.0.54.jar:4.0.FR]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.12.jar:5.3.12]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) ~[tomcat-embed-core-9.0.54.jar:4.0.FR]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.54.jar:9.0.54]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.12.jar:5.3.12]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.12.jar:5.3.12]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.12.jar:5.3.12]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.12.jar:5.3.12]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:96) ~[spring-boot-actuator-2.5.6.jar:2.5.6]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.12.jar:5.3.12]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.12.jar:5.3.12]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.12.jar:5.3.12]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:895) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1722) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.54.jar:9.0.54]
at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]
原先的代码:
修改后的代码:
以上是关于java.lang.UnsupportedOperationException: Empty collection can‘t be reduced. 问题处理的主要内容,如果未能解决你的问题,请参考以下文章