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

NullPointerException generating thumbnails when ImageMagick is enabled

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Duplicate
    • Affects Version/s: 6.1.2 CE GA3
    • Fix Version/s: 7.0.0 M4
    • Component/s: DM
    • Labels:
      None
    • Environment:
      Windows 7 + Tomcat 7.0.40
    • Story Points:
      6

      Description

      When ImageMagick is enabled and configured, the document library pdf thumbnails are not generated. Enabling the log, I can see this stacktrace:

      09:08:48,908 WARN [liferay/document_library_pdf_processor-1][PDFProcessorMessageListener:40] Unable to generate images for file version 11316
      com.liferay.portal.kernel.process.ProcessException: java.lang.NullPointerException
      at com.liferay.portlet.documentlibrary.util.PDFProcessorImpl$ImageMagickProcessCallable.call(PDFProcessorImpl.java:824)
      at com.liferay.portlet.documentlibrary.util.PDFProcessorImpl$ImageMagickProcessCallable.call(PDFProcessorImpl.java:1)
      at com.liferay.portal.kernel.process.ProcessExecutor.main(ProcessExecutor.java:148)
      Caused by: java.lang.NullPointerException
      at com.liferay.portlet.documentlibrary.util.LiferayConvertCmd.run(LiferayConvertCmd.java:46)
      at com.liferay.portlet.documentlibrary.util.PDFProcessorImpl$ImageMagickProcessCallable.call(PDFProcessorImpl.java:820)
      ... 2 more

      I've debugged the Liferay code and I've found the following:

      • The problem is caused because in PDFProcessorImpl, the attributes _resourceLimitsProperties and _globalSearchPath have null values.
      • They have null values because when the operation reset() of afterPropertiesSet() from the same class is called to initialize the values, the first call to "isImageMagickEnabled()" returns false because of a NullPointer accessing the property.
      • There is a NullPointer accessing the property because the call to PortletPreferencesFactoryUtil.getPortletPreferencesFactory() return null because it has not been initialized.
      • Debugging a little bit more, I've found that the afterPropertiesSet() operation of PDFProcessorImpl is called BEFORE the setPortletPreferencesFactory(...) of PortletPreferencesFactoryUtil.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  4 years, 39 weeks, 6 days ago

                  Packages

                  Version Package
                  7.0.0 M4