digitalfondue/lavagna

Milestones export to excell return 500

hdhog opened this issue · 15 comments

hdhog commented

log

14:01:08.017 [qtp370988149-19572] WARN  io.lavagna.web.helper.GeneralHandlerExceptionResolver - null
java.lang.NullPointerException: null
	at sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1264) ~[?:1.8.0_212]
	at sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:219) ~[?:1.8.0_212]
	at sun.awt.FontConfiguration.init(FontConfiguration.java:107) ~[?:1.8.0_212]
	at sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:774) ~[?:1.8.0_212]
	at sun.font.SunFontManager$2.run(SunFontManager.java:431) ~[?:1.8.0_212]
	at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_212]
	at sun.font.SunFontManager.<init>(SunFontManager.java:376) ~[?:1.8.0_212]
	at sun.awt.FcFontManager.<init>(FcFontManager.java:35) ~[?:1.8.0_212]
	at sun.awt.X11FontManager.<init>(X11FontManager.java:57) ~[?:1.8.0_212]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_212]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_212]
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_212]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_212]
	at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_212]
	at sun.font.FontManagerFactory$1.run(FontManagerFactory.java:83) ~[?:1.8.0_212]
	at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_212]
	at sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74) ~[?:1.8.0_212]
	at java.awt.Font.getFont2D(Font.java:491) ~[?:1.8.0_212]
	at java.awt.Font.canDisplayUpTo(Font.java:2060) ~[?:1.8.0_212]
	at java.awt.font.TextLayout.singleFont(TextLayout.java:470) ~[?:1.8.0_212]
	at java.awt.font.TextLayout.<init>(TextLayout.java:531) ~[?:1.8.0_212]
	at org.apache.poi.ss.util.SheetUtil.getDefaultCharWidth(SheetUtil.java:275) ~[poi-3.17.jar:3.17]
	at org.apache.poi.ss.util.SheetUtil.getColumnWidth(SheetUtil.java:250) ~[poi-3.17.jar:3.17]
	at org.apache.poi.ss.util.SheetUtil.getColumnWidth(SheetUtil.java:235) ~[poi-3.17.jar:3.17]
	at org.apache.poi.hssf.usermodel.HSSFSheet.autoSizeColumn(HSSFSheet.java:2165) ~[poi-3.17.jar:3.17]
	at org.apache.poi.hssf.usermodel.HSSFSheet.autoSizeColumn(HSSFSheet.java:2147) ~[poi-3.17.jar:3.17]
	at io.lavagna.service.ExcelExportService.getWorkbookFromSearchFilters(ExcelExportService.java:229) ~[classes/:?]
	at io.lavagna.service.ExcelExportService.exportMilestoneToExcel(ExcelExportService.java:250) ~[classes/:?]
	at io.lavagna.service.ExcelExportService$$FastClassBySpringCGLIB$$2306099f.invoke(<generated>) ~[classes/:?]
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.2.2.RELEASE.jar:5.2.2.RELEASE]
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:769) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:366) ~[spring-tx-5.2.2.RELEASE.jar:5.2.2.RELEASE]
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:99) ~[spring-tx-5.2.2.RELEASE.jar:5.2.2.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE]
	at io.lavagna.service.ExcelExportService$$EnhancerBySpringCGLIB$$ad80ce32.exportMilestoneToExcel(<generated>) ~[classes/:?]
	at io.lavagna.web.api.MilestoneController.exportMilestoneToExcel(MilestoneController.java:143) ~[classes!/:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) ~[spring-web-5.2.2.RELEASE.jar!/:5.2.2.RELEASE]
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.2.2.RELEASE.jar!/:5.2.2.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106) ~[spring-webmvc-5.2.2.RELEASE.jar!/:5.2.2.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:888) ~[spring-webmvc-5.2.2.RELEASE.jar!/:5.2.2.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793) ~[spring-webmvc-5.2.2.RELEASE.jar!/:5.2.2.RELEASE]
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.2.2.RELEASE.jar!/:5.2.2.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) ~[spring-webmvc-5.2.2.RELEASE.jar!/:5.2.2.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) ~[spring-webmvc-5.2.2.RELEASE.jar!/:5.2.2.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.2.2.RELEASE.jar!/:5.2.2.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.2.2.RELEASE.jar!/:5.2.2.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:645) ~[javax.servlet-api-4.0.1.jar!/:4.0.1]
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.2.2.RELEASE.jar!/:5.2.2.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:750) ~[javax.servlet-api-4.0.1.jar!/:4.0.1]
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:760) ~[jetty-servlet-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1617) ~[jetty-servlet-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.tuckey.web.filters.urlrewrite.gzip.GzipFilter.doFilter(GzipFilter.java:85) ~[urlrewritefilter-4.0.4.jar!/:4.0.4]
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604) ~[jetty-servlet-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at io.lavagna.web.security.SecurityFilter.handleWith(SecurityFilter.java:95) ~[classes!/:?]
	at io.lavagna.web.security.SecurityFilter.doFilterInternal(SecurityFilter.java:69) ~[classes!/:?]
	at io.lavagna.web.security.AbstractBaseFilter.doFilter(AbstractBaseFilter.java:46) ~[classes!/:?]
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604) ~[jetty-servlet-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at io.lavagna.web.security.AnonymousUserFilter.doFilterInternal(AnonymousUserFilter.java:59) ~[classes!/:?]
	at io.lavagna.web.security.AbstractBaseFilter.doFilter(AbstractBaseFilter.java:46) ~[classes!/:?]
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604) ~[jetty-servlet-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at io.lavagna.web.security.RememberMeFilter.doFilterInternal(RememberMeFilter.java:55) ~[classes!/:?]
	at io.lavagna.web.security.AbstractBaseFilter.doFilter(AbstractBaseFilter.java:46) ~[classes!/:?]
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604) ~[jetty-servlet-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at io.lavagna.web.security.CSFRFilter.doFilterInternal(CSFRFilter.java:62) ~[classes!/:?]
	at io.lavagna.web.security.AbstractBaseFilter.doFilter(AbstractBaseFilter.java:46) ~[classes!/:?]
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604) ~[jetty-servlet-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:545) ~[jetty-servlet-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[jetty-server-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:590) ~[jetty-security-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[jetty-server-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) ~[jetty-server-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1607) ~[jetty-server-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[jetty-server-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1297) ~[jetty-server-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[jetty-server-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:485) ~[jetty-servlet-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1577) ~[jetty-server-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[jetty-server-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1212) ~[jetty-server-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[jetty-server-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[jetty-server-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.server.Server.handle(Server.java:500) ~[jetty-server-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383) ~[jetty-server-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:547) [jetty-server-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375) [jetty-server-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:270) [jetty-server-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [jetty-io-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) [jetty-io-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117) [jetty-io-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336) [jetty-util-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313) [jetty-util-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171) [jetty-util-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129) [jetty-util-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:388) [jetty-util-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806) [jetty-util-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938) [jetty-util-9.4.24.v20191120.jar!/:9.4.24.v20191120]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]

syjer commented

hi @hdhog , looks like this issue: adoptium/temurin-build#693 .

I'll add a check so it will not fail if fontconfig is not installed

hdhog commented

i use lavagna docker image https://github.com/digitalfondue/lavagna-docker. Installing package fontconfig inside container not resolve this problem

syjer commented

@hdhog good to know, we will have a look at the default docker image too, thank you for opening this issue 👍

hdhog commented

i installed ttf-dejavu package inside image. export it's working. But generated file is corrupted

syjer commented

But generated file is corrupted

I'll try to reproduce the error, with what program are you trying to open the generated file?

hdhog commented

hm. If i export file from Microsoft Edge, file is correct. If i export from Firefox on linux file is corrupted.

from linux file size 2585
from windows file size 10752

syjer commented

well, that's quite strange :D. Thank you for the hint, I'll have a look

hdhog commented

But generated file is corrupted

I'll try to reproduce the error, with what program are you trying to open the generated file?

File exported on windows is open all (ms office 2019 on windows and libreoffice on linux)

hdhog commented

Firefox on windows => corrupted file
Google chrome on windows => good file

hdhog commented

PERSON-base(1).xlsx

Corrupted file in attachment

hdhog commented

In firefox server responce size 2.5Kb

image

request header

Host: example.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Cookie: LAVAGNA_SESSION_ID=node01635b1fnjgi1p1f6qsaln7mj3g6.node0
Upgrade-Insecure-Requests: 1
TE: Trailers

response header

HTTP/2 200 OK
cache-control: no-cache, no-store, max-age=0, must-revalidate
content-disposition: attachment; filename=PERSON-base.xls
content-encoding: gzip
date: Wed, 26 Feb 2020 14:49:25 GMT
expires: 0
pragma: no-cache
server: nginx/1.17.8
x-body-type-options: nosniff
x-csrf-token: 3b05e75e-0f06-4c01-b9f4-37d70ad14b69
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
content-type: application/x-gzip
content-length: 2585
X-Firefox-Spdy: h2
syjer commented

the corrupted file seems to be the gzipped excel (but truncated), quite strange.

I tried locally with firefox but it works on my side.

The CI build should have updated the Docker image, can you try it?

hdhog commented

New image is working!

Perfect, thank you very much again.