Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-20290

MBUtil.collectPartContent collects files with null as bytes

    Details

    • Fix Priority:
      3

      Description

      We configured a new message board category in the messageboard portlet and set it up to load messages from a mailinglist

      One of the messages loaded had apparently an empty attachment causing the following stacktrace

      java.lang.NullPointerException
              at com.liferay.portal.kernel.io.unsync.UnsyncByteArrayInputStream.<init>(UnsyncByteArrayInputStream.java:31)
              at com.liferay.documentlibrary.util.BaseHook.addFile(BaseHook.java:52)
              at com.liferay.documentlibrary.util.HookProxyImpl.addFile(HookProxyImpl.java:48)
              at com.liferay.documentlibrary.util.SafeFileNameHookWrapper.addFile(SafeFileNameHookWrapper.java:66)
              at com.liferay.documentlibrary.service.impl.DLServiceImpl.addFile(DLServiceImpl.java:75)
              at sun.reflect.GeneratedMethodAccessor1105.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
              at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:82)
              at com.liferay.portal.dao.jdbc.aop.DynamicDataSourceTransactionInterceptor.invoke(DynamicDataSourceTransactionInterceptor.java:44)
              at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
              at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
              at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
              at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
              at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
              at $Proxy151.addFile(Unknown Source)
              at com.liferay.portlet.messageboards.service.impl.MBMessageLocalServiceImpl.addMessage(MBMessageLocalServiceImpl.java:334)
              at com.liferay.portlet.messageboards.service.impl.MBMessageLocalServiceImpl.addMessage(MBMessageLocalServiceImpl.java:411)
              at sun.reflect.GeneratedMethodAccessor1003.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
              at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:82)
              at com.liferay.portal.dao.jdbc.aop.DynamicDataSourceTransactionInterceptor.invoke(DynamicDataSourceTransactionInterceptor.java:44)
              at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
              at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
              at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:58)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
              at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
              at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
              at $Proxy134.addMessage(Unknown Source)
              at com.liferay.portlet.messageboards.service.MBMessageLocalServiceUtil.addMessage(MBMessageLocalServiceUtil.java:290)
      

      The problem is that MailingListMessageListener uses MBUtil.collectPartContent to extract attachments to a collection of ObjectValuePair<String, byte[]> and in some cases byte[] will be null causing UnsyncByteArrayInputStream to fail with a NullPointerException

        Attachments

          Activity

            People

            Assignee:
            roberto.diaz Roberto Díaz
            Reporter:
            jelmer Jelmer Kuperus (Inactive)
            Participants of an Issue:
            Recent user:
            Esther Sanz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              7 years, 14 weeks, 1 day ago

                Packages

                Version Package
                7.0.0 M3