Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

当Api数据集中的Api地址中带参数时,如果不设置该参数的默认值,会报空指针异常,导致预览页面数据不显示 #922

Closed
dylens opened this issue Apr 15, 2022 · 9 comments

Comments

@dylens
Copy link

dylens commented Apr 15, 2022

版本号:1.4.4-beta
问题描述:

对于数据报表的API数据集,当API地址中带参数时(如:http://localhost:9000/data/api1?riqi=${riqi}),如果不设置报表参数${riqi}的默认值,应用会报空指针异常,导致预览页面数据不显示

(很多时候我们都不希望有默认的日期,如果日期过早查询出来的数据量很大,而且在预览页面查询栏点击重置按钮后,会被重置成默认日期,期望是重置为空值)

错误日志&截图:

1-不设置参数的默认值

2-点击预览

3-跳转页面数据不显示

4-替换报表参数时报了空指针

重现步骤:

1、编辑Api数据集,在Api地址中带上参数(如:http://localhost:9000/data/api1?riqi=${riqi});
2、点击“Api解析”;
3、“报表参数”中不设置该参数的默认值,点击“确定”保存;
4、点击“预览”;
5、跳转到预览页面,数据不展示;

友情提示(为了提高issue处理效率):

  • 积木报表是一款免费报表产品,功能免费源码不开放;
  • 未按格式要求发帖,会被直接删掉;
  • 请针对问题提供报表设计SQL脚本或在官网制作报表示例并提供ID;
  • 针对不好重现的问题,请录制操作视频或详细的重现步骤;
@lvdandan16
Copy link
Collaborator

收录 ws

@1298191366
Copy link

1298191366 commented Apr 18, 2022

未测出,请问是否还有其他细节,导出报表配置
image
image

@dylens
Copy link
Author

dylens commented Apr 18, 2022

我试了1.4.4-beta和1.5.0-beta两个版本的jimuReport(复现条件都没变),都会报错,报错日志如下:

2022-04-18 19:08:04.123  INFO 11388 --- [nio-8080-exec-7] o.jeecg.modules.jmreport.desreport.a.a   : freemarker base: 
2022-04-18 19:08:04.123  INFO 11388 --- [nio-8080-exec-7] o.jeecg.modules.jmreport.desreport.a.a   : freemarker customPrePath: 
2022-04-18 19:08:04.733  INFO 11388 --- [nio-8080-exec-5] o.jeecg.modules.jmreport.desreport.a.a   : --------进入show方法-----------, id = 674103341271142400
2022-04-18 19:08:04.919 ERROR 11388 --- [nio-8080-exec-5] o.jeecg.modules.jmreport.desreport.a.a   : null

java.lang.NullPointerException: null
	at java.lang.String.replace(String.java:2240) ~[na:1.8.0_321]
	at org.jeecg.modules.jmreport.desreport.service.a.e.a(JimuReportServiceImpl.java:4973) ~[jimureport-spring-boot-starter-1.5.0-beta.jar:2.0.0]
	at org.jeecg.modules.jmreport.desreport.service.a.e.getDataById(JimuReportServiceImpl.java:500) ~[jimureport-spring-boot-starter-1.5.0-beta.jar:2.0.0]
	at org.jeecg.modules.jmreport.desreport.service.a.e.show(JimuReportServiceImpl.java:3721) ~[jimureport-spring-boot-starter-1.5.0-beta.jar:2.0.0]
	at org.jeecg.modules.jmreport.desreport.service.a.e$$FastClassBySpringCGLIB$$4daca651.invoke(<generated>) ~[jimureport-spring-boot-starter-1.5.0-beta.jar:2.0.0]
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.2.10.RELEASE.jar:5.2.10.RELEASE]
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:687) ~[spring-aop-5.2.10.RELEASE.jar:5.2.10.RELEASE]
	at org.jeecg.modules.jmreport.desreport.service.a.e$$EnhancerBySpringCGLIB$$36990bcd.show(<generated>) ~[jimureport-spring-boot-starter-1.5.0-beta.jar:2.0.0]
	at org.jeecg.modules.jmreport.desreport.a.a.a(DesignReportController.java:345) ~[jimureport-spring-boot-starter-1.5.0-beta.jar:2.0.0]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_321]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_321]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_321]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_321]
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) [spring-web-5.2.10.RELEASE.jar:5.2.10.RELEASE]
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) [spring-web-5.2.10.RELEASE.jar:5.2.10.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) [spring-webmvc-5.2.10.RELEASE.jar:5.2.10.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:878) [spring-webmvc-5.2.10.RELEASE.jar:5.2.10.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:792) [spring-webmvc-5.2.10.RELEASE.jar:5.2.10.RELEASE]
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) [spring-webmvc-5.2.10.RELEASE.jar:5.2.10.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) [spring-webmvc-5.2.10.RELEASE.jar:5.2.10.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) [spring-webmvc-5.2.10.RELEASE.jar:5.2.10.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) [spring-webmvc-5.2.10.RELEASE.jar:5.2.10.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) [spring-webmvc-5.2.10.RELEASE.jar:5.2.10.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) [tomcat-embed-core-9.0.39.jar:4.0.FR]
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) [spring-webmvc-5.2.10.RELEASE.jar:5.2.10.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) [tomcat-embed-core-9.0.39.jar:4.0.FR]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [tomcat-embed-core-9.0.39.jar:9.0.39]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.39.jar:9.0.39]
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) [tomcat-embed-websocket-9.0.39.jar:9.0.39]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.39.jar:9.0.39]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.39.jar:9.0.39]
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) [spring-web-5.2.10.RELEASE.jar:5.2.10.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.2.10.RELEASE.jar:5.2.10.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.39.jar:9.0.39]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.39.jar:9.0.39]
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) [spring-web-5.2.10.RELEASE.jar:5.2.10.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.2.10.RELEASE.jar:5.2.10.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.39.jar:9.0.39]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.39.jar:9.0.39]
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) [spring-web-5.2.10.RELEASE.jar:5.2.10.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) [spring-web-5.2.10.RELEASE.jar:5.2.10.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.39.jar:9.0.39]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.39.jar:9.0.39]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-embed-core-9.0.39.jar:9.0.39]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.39.jar:9.0.39]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) [tomcat-embed-core-9.0.39.jar:9.0.39]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [tomcat-embed-core-9.0.39.jar:9.0.39]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.39.jar:9.0.39]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.39.jar:9.0.39]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat-embed-core-9.0.39.jar:9.0.39]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) [tomcat-embed-core-9.0.39.jar:9.0.39]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.39.jar:9.0.39]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-embed-core-9.0.39.jar:9.0.39]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590) [tomcat-embed-core-9.0.39.jar:9.0.39]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.39.jar:9.0.39]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_321]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_321]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.39.jar:9.0.39]
	at java.lang.Thread.run(Thread.java:750) [na:1.8.0_321]

@dylens
Copy link
Author

dylens commented Apr 18, 2022

接口http://localhost:9000/data/api1?riqi=${riqi} 返回的数据格式如下:

{"data": [{"ctotal": "125箱", "name": "三元", "value": "56", "riqi": "2021-10-21 19:00:00", "id": "1", "dtotal": "1000箱", "tp": "7000.88", "ztotal": "589箱", "规格": "每箱24瓶"}, {"ctotal": "228箱", "name": "光明", "value": "69", "riqi": "2022-03-11 11:00:00", "id": "1", "dtotal": "1900箱", "tp": "9600.66", "ztotal": "709箱", "规格": "每箱24瓶"}, {"ctotal": "129箱", "name": "特仑苏", "value": "59", "riqi": "2022-01-20 15:00:00", "id": "1", "dtotal": "1208箱", "tp": "4730.35", "ztotal": "588箱", "规格": "每箱16瓶"}]}

接口返回数据格式

@dylens
Copy link
Author

dylens commented Apr 18, 2022

后台返回报错null

@1298191366
Copy link

那你有没有定义什么东西,将""字符串替换成了null,因为我们这边传的都是空字符串,或者你能debug到他的上级吗
image

@dylens
Copy link
Author

dylens commented Apr 18, 2022

我这边没有定义任何东西,完全是用的 https://github.com/jeecgboot/JimuReport/tree/master/jimureport-example 这个项目跑的。也没法打印上级的var17变量。

上一级的var17打印不了

@1298191366
Copy link

好的,收到。

@1298191366
Copy link

已修复,待新版本发布

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants