Page 1 of 2

NullPointerException when uploading Mail (eml) with attachments

PostPosted:Tue May 05, 2015 11:09 am
by Catscratch
Hi there,

I tried to upload an email with an attachment to an openkm folder. After the upload was finished I get exceptions on "getMailChilds" when trying to browser the folder. In the backend database everything seems to be fine. There is a folder for this mail which contains the attachment. But the frontend doesn't show it.

The exception comes from GWTVersion toString-method. There the user object is null.
Code: Select all
Line 108: sb.append(", user="); sb.append(user.getId());
Also the GWTDocument Object got a null-user. So it seems something is wrongly mapped during mapping process in MailServlet.java.
Code: Select all
Line 112: mailList.add(GWTUtil.copy(mail, getUserWorkspaceSession()));
Here is the complete exception and log from the uploading process itself. The exception is the same when trying to view the folder content containing the mail document.
Code: Select all
2015-05-05 12:56:10,674 [http-apr-0.0.0.0-8080-exec-3] ERROR com.openkm.servlet.frontend.MailServlet- 
java.lang.NullPointerException
	at com.openkm.frontend.client.bean.GWTVersion.toString(GWTVersion.java:108)
	at java.lang.String.valueOf(String.java:2981)
	at java.lang.StringBuilder.append(StringBuilder.java:131)
	at com.openkm.frontend.client.bean.GWTDocument.toString(GWTDocument.java:390)
	at java.lang.String.valueOf(String.java:2981)
	at java.lang.StringBuilder.append(StringBuilder.java:131)
	at java.util.AbstractCollection.toString(AbstractCollection.java:462)
	at java.lang.String.valueOf(String.java:2981)
	at java.lang.StringBuffer.append(StringBuffer.java:265)
	at com.openkm.frontend.client.bean.GWTMail.toString(GWTMail.java:346)
	at java.lang.String.valueOf(String.java:2981)
	at java.lang.StringBuffer.append(StringBuffer.java:265)
	at org.slf4j.helpers.MessageFormatter.deeplyAppendParameter(MessageFormatter.java:237)
	at org.slf4j.helpers.MessageFormatter.arrayFormat(MessageFormatter.java:196)
	at org.slf4j.helpers.MessageFormatter.format(MessageFormatter.java:111)
	at org.slf4j.impl.Log4jLoggerAdapter.debug(Log4jLoggerAdapter.java:223)
	at com.openkm.util.GWTUtil.copy(GWTUtil.java:1396)
	at com.openkm.servlet.frontend.MailServlet.getChilds(MailServlet.java:112)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
	at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
	at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
	at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:644)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:101)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1085)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
	at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:277)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2407)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2396)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
I also attached the EML file for further testing.
(7.01 KiB) Downloaded 278 times
Also a complete debug log, if it helps.
(9.07 KiB) Downloaded 249 times
Also tested it in the online Demo. There everything is working. So it seems to only be a problem of the latest community version from Sourceforge.

Thanks for any hints.

Re: NullPointerException when uploading Mail (eml) with attachments

PostPosted:Fri May 08, 2015 10:05 pm
by jllort
I've solved in source code. Try nighly build ( better sunday or monday )

Re: NullPointerException when uploading Mail (eml) with attachments

PostPosted:Mon May 11, 2015 2:25 pm
by Catscratch
Thanks.

But you have to modify GWTDocument as well.

Now GWTVersion does not throw an exception anymore, but GWTDocument will do so.

Can you please modify line 398 of GWTDocument.java?

Now:
Code: Select all
sb.append(", user="); sb.append(user.getId());
sb.append(", username="); sb.append(user.getUsername());
Should be:
Code: Select all
sb.append(", user=").append(user==null?"":user.getId());
sb.append(", username=").append(user==null?"":user.getUsername());

Re: NullPointerException when uploading Mail (eml) with attachments

PostPosted:Wed May 13, 2015 10:41 am
by jllort
First I would like to see the error first. Can you also send attach here the eml file for testing purpose ?

Re: NullPointerException when uploading Mail (eml) with attachments

PostPosted:Wed May 13, 2015 1:34 pm
by Catscratch
You can use the same files attached in the opening post.

Here are the exceptions for both, getId and getUsername:
Code: Select all
2015-05-11 16:23:08,366 [http-apr-0.0.0.0-8080-exec-4] ERROR com.openkm.servlet.frontend.MailServlet- 
java.lang.NullPointerException
	at com.openkm.frontend.client.bean.GWTDocument.toString(GWTDocument.java:398)
	at java.lang.String.valueOf(String.java:2981)
	at java.lang.StringBuilder.append(StringBuilder.java:131)
	at java.util.AbstractCollection.toString(AbstractCollection.java:462)
	at java.lang.String.valueOf(String.java:2981)
	at java.lang.StringBuffer.append(StringBuffer.java:265)
	at com.openkm.frontend.client.bean.GWTMail.toString(GWTMail.java:346)
	at java.lang.String.valueOf(String.java:2981)
	at java.lang.StringBuffer.append(StringBuffer.java:265)
	at org.slf4j.helpers.MessageFormatter.deeplyAppendParameter(MessageFormatter.java:237)
	at org.slf4j.helpers.MessageFormatter.arrayFormat(MessageFormatter.java:196)
	at org.slf4j.helpers.MessageFormatter.format(MessageFormatter.java:111)
	at org.slf4j.impl.Log4jLoggerAdapter.debug(Log4jLoggerAdapter.java:223)
	at com.openkm.util.GWTUtil.copy(GWTUtil.java:1396)
	at com.openkm.servlet.frontend.MailServlet.getChilds(MailServlet.java:112)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
	at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
	at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
	at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:644)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:101)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1085)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
	at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:277)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2407)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2396)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
Code: Select all
2015-05-11 16:31:25,324 [http-apr-0.0.0.0-8080-exec-6] ERROR com.openkm.servlet.frontend.MailServlet- 
java.lang.NullPointerException
	at com.openkm.frontend.client.bean.GWTDocument.toString(GWTDocument.java:399)
	at java.lang.String.valueOf(String.java:2981)
	at java.lang.StringBuilder.append(StringBuilder.java:131)
	at java.util.AbstractCollection.toString(AbstractCollection.java:462)
	at java.lang.String.valueOf(String.java:2981)
	at java.lang.StringBuffer.append(StringBuffer.java:265)
	at com.openkm.frontend.client.bean.GWTMail.toString(GWTMail.java:346)
	at java.lang.String.valueOf(String.java:2981)
	at java.lang.StringBuffer.append(StringBuffer.java:265)
	at org.slf4j.helpers.MessageFormatter.deeplyAppendParameter(MessageFormatter.java:237)
	at org.slf4j.helpers.MessageFormatter.arrayFormat(MessageFormatter.java:196)
	at org.slf4j.helpers.MessageFormatter.format(MessageFormatter.java:111)
	at org.slf4j.impl.Log4jLoggerAdapter.debug(Log4jLoggerAdapter.java:223)
	at com.openkm.util.GWTUtil.copy(GWTUtil.java:1396)
	at com.openkm.servlet.frontend.MailServlet.getChilds(MailServlet.java:112)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
	at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
	at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
	at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:644)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:101)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1085)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
	at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:277)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2407)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2396)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)

Re: NullPointerException when uploading Mail (eml) with attachments

PostPosted:Thu May 14, 2015 3:33 pm
by jllort
Can you share and eml to reproduce the problem, because is quite strange you got here a null pointer and I would like to reproduce it, to understand the reason why you got it.

Re: NullPointerException when uploading Mail (eml) with attachments

PostPosted:Thu May 14, 2015 4:44 pm
by Catscratch
And the Testmail.eml.zip from my first post isn't working for you?

Re: NullPointerException when uploading Mail (eml) with attachments

PostPosted:Sat May 16, 2015 7:23 pm
by jllort
When I'm importing the Testmail.eml I do not get any error, did you tested with nighly build ( http://integration.openkm.com/ )? I suggest import the eml file again.

Re: NullPointerException when uploading Mail (eml) with attachments

PostPosted:Mon May 18, 2015 2:32 pm
by Catscratch
I'm getting a NPE with the Testmail.eml. What's logical, because when user is null and GWTVersion would throw a NPE (without your latest patch) than GWTDocument has to throw a NPE too. Because you try to access a null object with user.getId() or user.getUsername().

Anyway. I applied the patch I provided 6 posts above and now everything is working.

So wether or not you can reconstruct the NPE I think it would be good not to access user without any check when you can't ensure that user is not null. :-)

Re: NullPointerException when uploading Mail (eml) with attachments

PostPosted:Wed May 20, 2015 5:51 pm
by jllort
I understand what you're telling me, seems login apply same workaround to GWTDocument, but I've checked the pro version and this path is only applied to GWTVersion not on GWTDocument. I can not explain exactly the reason why, but only applying the path on GWTVersion and not on GWTDocument Testmail.eml is not getting the null pointer. Sure there's some reason why on document the userId is not null but could be null on version, I will ask to one of my colleagues. I want to be sure befory apply that's really needed.

Re: NullPointerException when uploading Mail (eml) with attachments

PostPosted:Thu May 21, 2015 6:45 am
by Catscratch
Maybe it depends in some way of our LDAP structure. Maybe the LdapProvider can't find the user or I don't know. :-) I don't even excactly know where the user object should come from. But anyway, I hope you'll find some hints with your colleagues.

Re: NullPointerException when uploading Mail (eml) with attachments

PostPosted:Fri Jun 05, 2015 11:21 am
by pavila
I've tried to reproduce this bug with Testmail.eml but I can't. Can you confirm it's solved?

Re: NullPointerException when uploading Mail (eml) with attachments

PostPosted:Mon Jun 08, 2015 3:29 pm
by Catscratch
Sorry, I can't run your integration build since I'm using tomcat 8. Afaik your still building for tomcat 7.

But when I use the latest source from sourceforge and build all sources on my own, I still got the error described above.

So, what really is the problem to integrate the code fix I suggested (GWTDocument.java:398 and GWTDocument.java:399)? Even if you can't reproduce the error in tomcat 7 the code is logical and comprehensible. And in general you should never access variables without a check when you can't ensure that they are not null.

I understand your will to reproduce this error and I tried my best, but in this case a simple look in the code should be enough to see the problem that could appear.

Re: NullPointerException when uploading Mail (eml) with attachments

PostPosted:Tue Jun 09, 2015 11:51 am
by pavila
This kind of errors are no related to a Tomcat version. In the integration web you can download the OpenKM WAR, which can be deployed in Tomcat 7 or 8.

Re: NullPointerException when uploading Mail (eml) with attachments

PostPosted:Wed Jun 10, 2015 8:08 am
by Catscratch
Yes. My comment wasn't about the error. It only was a hint that I can't test the integration build since it's not compatible with tomcat 8.

See here in your own commits: Click

And here in the forum: Click

So. Long story short. My advice would be to integrate the fix provided in this topic, because it is possible you'll run into the same issue in the future. But if you don't want to integrate it, it's your right to do so. :-)