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

Cannot export a DLFileEntry in case its adaptive media record is missing in filesystem

    Details

      Description

      Cannot export a DLFileEntry in case its adaptive media record is missing in filesystem.

      Adaptive media missing files should be ignored in the same way we are ignoring missing DLFileEntries in LAR export time, see: https://github.com/liferay/liferay-portal/blob/42b9105d120818f69e4e9c675ec6fd1ee8eda9a6/modules/apps/document-library/document-library-service/src/main/java/com/liferay/document/library/internal/exportimport/data/handler/FileEntryStagedModelDataHandler.java#L292-L302

      Steps to reproduce

      1. Install a clean Liferay installation
      2. Go to "Documents and Media" and upload an image
      3. Open a system shell and go to [LIFERAY_HOME]/data/document_library/[COMPANYID]/0/adaptive
      4. Delete all files inside that folder, in order to leave all adaptive media records inconsistent
      5. Go to Liferay UI and try exporting previous uploaded image to a LAR file
        • Expected behavior: LAR file is correctly exported without the invalid adaptive media records, they will be regenerated after LAR is imported. A WARN trace will be written to log file
        • Wrong behavior: LAR file is not exported and following ERROR trace is thrown
          com.liferay.exportimport.kernel.lar.PortletDataException: com.liferay.document.library.kernel.exception.NoSuchFileException: {companyId=20095, repositoryId=0, fileName=adaptive/Preview-1000x0/20118/20118/35102/35103/, cause=java.io.FileNotFoundException: C:\Liferay\Bundles_Builds\portal-master\data\document_library\20095\0\adaptive\Preview-1000x0\20118\20118\35102\35103\1.0 (The system cannot find the path specified)}
                  at com.liferay.exportimport.kernel.lar.BaseStagedModelDataHandler.exportStagedModel(BaseStagedModelDataHandler.java:149)
                  at com.liferay.exportimport.data.handler.base.BaseStagedModelDataHandler.exportStagedModel(BaseStagedModelDataHandler.java:80)
                  at com.liferay.exportimport.kernel.lar.StagedModelDataHandlerUtil.exportStagedModel(StagedModelDataHandlerUtil.java:180)
                  at com.liferay.document.library.internal.exportimport.staged.model.repository.FileEntryStagedModelRepository.lambda$getExportActionableDynamicQuery$1(FileEntryStagedModelRepository.java:194)
                  at com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery.performAction(DefaultActionableDynamicQuery.java:394)
                  at com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery$1.call(DefaultActionableDynamicQuery.java:306)
                  at com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery$1.call(DefaultActionableDynamicQuery.java:268)
                  at com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery.doPerformActions(DefaultActionableDynamicQuery.java:326)
                  at com.liferay.portal.kernel.dao.orm.DefaultActionableDynamicQuery.performActions(DefaultActionableDynamicQuery.java:86)
                  at com.liferay.document.library.web.internal.lar.DLAdminPortletDataHandler.doExportData(DLAdminPortletDataHandler.java:208)
                  at com.liferay.exportimport.kernel.lar.BasePortletDataHandler.exportData(BasePortletDataHandler.java:141)
                  at com.liferay.exportimport.internal.controller.PortletExportControllerImpl.exportPortletData(PortletExportControllerImpl.java:727)
                  at com.liferay.exportimport.internal.controller.PortletExportControllerImpl.exportPortlet(PortletExportControllerImpl.java:483)
                  at com.liferay.exportimport.internal.controller.PortletExportControllerImpl.doExport(PortletExportControllerImpl.java:943)
                  at com.liferay.exportimport.internal.controller.PortletExportControllerImpl.export(PortletExportControllerImpl.java:152)
                  at com.liferay.portlet.exportimport.service.impl.ExportImportLocalServiceImpl.exportPortletInfoAsFile(ExportImportLocalServiceImpl.java:146)
                  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:498)
                  at com.liferay.portal.spring.aop.AopMethodInvocationImpl.proceed(AopMethodInvocationImpl.java:50)
                  at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:69)
                  at com.liferay.portal.spring.aop.AopMethodInvocationImpl.proceed(AopMethodInvocationImpl.java:57)
                  at com.liferay.portal.spring.aop.AopInvocationHandler.invoke(AopInvocationHandler.java:49)
                  at com.sun.proxy.$Proxy151.exportPortletInfoAsFile(Unknown Source)
                  at com.liferay.exportimport.kernel.service.ExportImportLocalServiceUtil.exportPortletInfoAsFile(ExportImportLocalServiceUtil.java:88)
                  at com.liferay.exportimport.internal.background.task.PortletExportBackgroundTaskExecutor.execute(PortletExportBackgroundTaskExecutor.java:73)
                  at com.liferay.portal.kernel.backgroundtask.DelegatingBackgroundTaskExecutor.execute(DelegatingBackgroundTaskExecutor.java:41)
                  at com.liferay.portal.background.task.internal.ThreadLocalAwareBackgroundTaskExecutor.execute(ThreadLocalAwareBackgroundTaskExecutor.java:72)
                  at com.liferay.portal.background.task.internal.messaging.BackgroundTaskMessageListener.doReceive(BackgroundTaskMessageListener.java:131)
                  at com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:26)
                  at com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:74)
                  at com.liferay.portal.messaging.internal.ParallelDestination$1.run(ParallelDestination.java:56)
                  at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask._runTask(ThreadPoolExecutor.java:752)
                  at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask.run(ThreadPoolExecutor.java:664)
                  at java.lang.Thread.run(Thread.java:748)
          Caused by: com.liferay.adaptive.media.exception.AMRuntimeException$IOException: com.liferay.document.library.kernel.exception.NoSuchFileException: {companyId=20095, repositoryId=0, fileName=adaptive/Preview-1000x0/20118/20118/35102/ cause=java.io.FileNotFoundException: C:\Liferay\Bundles_Builds\portal-master\data\document_library\20095\0\adaptive\Preview-1000x0\20118\20118\35102\35103\1.0 (The system cannot find the path specified)}
                  at com.liferay.adaptive.media.image.internal.storage.ImageStorage.getContentStream(ImageStorage.java:57)
                  at com.liferay.adaptive.media.image.service.impl.AMImageEntryLocalServiceImpl.getAMImageEntryContentStream(AMImageEntryLocalServiceImpl.java:255)
                  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:498)
                  at com.liferay.portal.spring.aop.AopMethodInvocationImpl.proceed(AopMethodInvocationImpl.java:50)
                  at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:69)
                  at com.liferay.portal.spring.aop.AopMethodInvocationImpl.proceed(AopMethodInvocationImpl.java:57)
                  at com.liferay.portal.spring.aop.AopInvocationHandler.invoke(AopInvocationHandler.java:49)
                  at com.sun.proxy.$Proxy985.getAMImageEntryContentStream(Unknown Source)
                  at com.liferay.adaptive.media.image.internal.finder.AMImageFinderImpl.lambda$_createMedia$2(AMImageFinderImpl.java:180)
                  at com.liferay.adaptive.media.image.internal.processor.AMImage.getInputStream(AMImage.java:45)
                  at com.liferay.adaptive.media.document.library.internal.document.library.exportimport.data.handler.AMImageDLPluggableContentDataHandler._exportMedia(AMImageDLPluggableContentDataHandler.java:144)
                  at com.liferay.adaptive.media.document.library.internal.document.library.exportimport.data.handler.AMImageDLPluggableContentDataHandler._exportMedia(AMImageDLPluggableContentDataHandler.java:123)
                  at com.liferay.adaptive.media.document.library.internal.document.library.exportimport.data.handler.AMImageDLPluggableContentDataHandler.exportContent(AMImageDLPluggableContentDataHandler.java:75)
                  at com.liferay.adaptive.media.document.library.internal.document.library.exportimport.data.handler.AMImageDLPluggableContentDataHandler.exportContent(AMImageDLPluggableContentDataHandler.java:53)
                  at com.liferay.document.library.internal.exportimport.data.handler.FileEntryStagedModelDataHandler.doExportStagedModel(FileEntryStagedModelDataHandler.java:331)
                  at com.liferay.document.library.internal.exportimport.data.handler.FileEntryStagedModelDataHandler.doExportStagedModel(FileEntryStagedModelDataHandler.java:111)
                  at com.liferay.exportimport.kernel.lar.BaseStagedModelDataHandler.exportStagedModel(BaseStagedModelDataHandler.java:102)
                  ... 35 more
          Caused by: com.liferay.document.library.kernel.exception.NoSuchFileException: {companyId=20095, repositoryId=0, fileName=adaptive/Preview-1000x0/20118/20118/35102/35103/, cause=java.io.FileNotFoundException: C:\Liferay\Bundles_Build\portal-master\data\document_library\20095\0\adaptive\Preview-1000x0\20118\20118\35102\35103\1.0 (The system cannot find the path specified)}
                  at com.liferay.portal.store.file.system.FileSystemStore.getFileAsStream(FileSystemStore.java:273)
                  at com.liferay.document.library.kernel.store.BaseStore.getFileAsStream(BaseStore.java:333)
                  at com.liferay.portal.store.file.system.ignore.duplicates.IgnoreDuplicatesStore.getFileAsStream(IgnoreDuplicatesStore.java:171)
                  at com.liferay.portal.store.file.system.safe.file.name.SafeFileNameStore.getFileAsStream(SafeFileNameStore.java:263)
                  at com.liferay.portlet.documentlibrary.store.DLStoreImpl.getFileAsStream(DLStoreImpl.java:306)
                  at com.liferay.document.library.kernel.store.DLStoreUtil.getFileAsStream(DLStoreUtil.java:381)
                  at com.liferay.adaptive.media.image.internal.storage.ImageStorage.getContentStream(ImageStorage.java:52)
                  ... 54 more
          Caused by: java.io.FileNotFoundException: C:\Liferay\Bundles_Builds\portal-master\data\document_library\20095\0\adaptive\Preview-1000x0\20118\20118\35102\35103\1.0 (The system cannot find the path specified)
                  at java.io.FileInputStream.open0(Native Method)
                  at java.io.FileInputStream.open(FileInputStream.java:195)
                  at java.io.FileInputStream.<init>(FileInputStream.java:138)
                  at com.liferay.portal.store.file.system.FileSystemStore.getFileAsStream(FileSystemStore.java:270)
                  ... 60 more

        Attachments

          Activity

            People

            • Assignee:
              beck.liu Beck Liu
              Reporter:
              jorge.diaz Jorge Diaz
              Participants of an Issue:
              Recent user:
              Clarissa Velazquez
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                48 weeks, 6 days ago

                Packages

                Version Package
                7.1.10 DXP FP15
                7.1.X
                7.2.10 DXP FP3
                7.2.X
                7.2.1 CE GA2
                Master