PUBLIC - Liferay Portal Community Edition
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-28094

Document Library: Moving documents between folders results in error accessing file

    Details

    • Type: Bug Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: 6.1.1 CE GA2, 6.1.20 EE GA2
    • Environment:
      Red Hat Enterprise 5.5 x86_64 (8g RAM)
      Liferay 6.1.0 CE GA1
      Tomcat 7.0.23
      MySQL 5.5.20
      Java 1.6.0_31
      Relevant portal-ext.properties set:
      dl.store.impl=com.liferay.portlet.documentlibrary.store.AdvancedFileSystemStore
    • Branch Version/s:
      6.1.x
    • Backported to Branch:
      Committed
    • Fix Priority:
      4
    • Similar Issues:
      Show 4 results 

      Description

      The basic issue is that when you move a document from one folder to another, the document is no longer viewable/downloadable via the given URL. This results in "lost" documents.

      Issue Detail
      Steps to reproduce:
      1) Navigate to Documents and Media in Control Panel
      2) Create two folders, FolderA & FolderB
      3) Upload a document (or enough files so that your DLFileEntry.name > 100) to FolderA
      4) Click on the document to see that you can view/download
      5) Move the document to FolderB
      6) Click on the document and receive an error message on screen "The requested resource was not found" (log error shown below)

      I have gone through debugging the issue and found that this occurs when the dl.store.impl is set to AdvancedFileSystemStore in the portal properties (it does not occur with FileSystemStore, I have not tested others.) The reason the file is no longer accessible is because the physical file is still being stored in the "old" folder repository, and was not moved to the "new" folder repository. This also only occurs once the DLFileEntry "name" field surpasses 3 digits. This is because the convention is to create directories under the folderId (repository) in the format of %liferay_home%/data/document_library/%companyId%/%folderId% and break up the name into 2 digit directories (i.e. 20 would be stored as /20.afsh/20_1.0.afsh, 402 would stored as /40/402.afsh/402_1.0.afsh and 24658 would be store as /24/65/24658.afsh/24658_1.0.afsh, from the directory format previously mentioned.) If the name is only 2 digits, the file move works without issue. As soon as the name is 3 digits and above, and requires at least that one extra directory level, it fails. It appears that it is unable to move the /xx/xxx.afsh/xxx_1.0.afsh directories and file, but can move the /xx.afsh/xx_1.0.afsh . This also explains why setting the dl.store.impl to FileSystemStore works, because it always stores files only one directory level deep below the folderId repository directory.

      Something to note. In the 'public void updateFile(long companyId, long repositoryId, long newRepositoryId, String fileName) throws PortalException' method of com.liferay.portlet.documentlibrary.store.FileSystemStore, line 312's call of 'fileNameDir.renameTo(newFileNameDir);' returns false. This method is actually what is called in either case, if using AdvancedFileSystemStore or the basic FileSystemStore, they just differ in the directory structure used. But I do not know if that is the root cause of the problem. It seems like the actually physical moving the of the directories and file is failing. I am testing both on RedHat Enterprise 5.5 and Mac OSX 10.7. File system permissions do not seem to be the issue, since it does work in the previously mentioned cases.

      I can provide more info if necessary, just ask!

      I should also note that this occurs on a completely uncustomized, out of the box, installation of Liferay 6.1.0 CE GA1

      Here is the error when attempting to access a file after it has been moved to another folder, due to the database reference for the DLFileEntry being updated, but the physical file not actually being successfully moved to the new location:

      2012-06-21 16:19:38 INFO [PortalImpl:4894] com.liferay.portlet.documentlibrary.NoSuchFileException: /Users/brussell/Development/builds/websitesocial/liferay-portal-6.1.0-ce-ga1-20120106155615760/bundles/liferay-portal-tomcat-6.1.0-ce-ga1/data/document_library/14537/244508/20/00/20001.afsh/20001_1.0.afsh
      com.liferay.portlet.documentlibrary.NoSuchFileException: /Users/brussell/Development/builds/websitesocial/liferay-portal-6.1.0-ce-ga1-20120106155615760/bundles/liferay-portal-tomcat-6.1.0-ce-ga1/data/document_library/14537/244508/20/00/20001.afsh/20001_1.0.afsh
      at com.liferay.portlet.documentlibrary.store.FileSystemStore.getFileAsStream(FileSystemStore.java:221)
      at com.liferay.portlet.documentlibrary.store.StoreProxyImpl.getFileAsStream(StoreProxyImpl.java:163)
      at com.liferay.portlet.documentlibrary.store.SafeFileNameStoreWrapper.getFileAsStream(SafeFileNameStoreWrapper.java:249)
      at com.liferay.portlet.documentlibrary.store.DLStoreImpl.getFileAsStream(DLStoreImpl.java:258)
      at com.liferay.portlet.documentlibrary.store.DLStoreUtil.getFileAsStream(DLStoreUtil.java:425)
      at com.liferay.portlet.documentlibrary.service.impl.DLFileEntryLocalServiceImpl.getFileAsStream(DLFileEntryLocalServiceImpl.java:593)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:112)
      at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:71)
      at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:108)
      at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:59)
      at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:108)
      at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:59)
      at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:108)
      at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:59)
      at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:108)
      at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:211)
      at $Proxy183.getFileAsStream(Unknown Source)
      at com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil.getFileAsStream(DLFileEntryLocalServiceUtil.java:422)
      at com.liferay.portlet.documentlibrary.model.impl.DLFileVersionImpl.getContentStream(DLFileVersionImpl.java:46)
      at com.liferay.portal.repository.liferayrepository.model.LiferayFileVersion.getContentStream(LiferayFileVersion.java:67)
      at com.liferay.portal.webserver.WebServerServlet.sendFile(WebServerServlet.java:917)
      at com.liferay.portal.webserver.WebServerServlet.service(WebServerServlet.java:236)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
      at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
      at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.processFilter(AutoLoginFilter.java:240)
      at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
      at org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:76)
      at sun.reflect.GeneratedMethodAccessor487.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.liferay.portal.kernel.bean.ClassLoaderBeanHandler.invoke(ClassLoaderBeanHandler.java:54)
      at $Proxy379.doFilter(Unknown Source)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
      at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
      at com.liferay.portal.sharepoint.SharepointFilter.processFilter(SharepointFilter.java:80)
      at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
      at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:121)
      at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.processFilter(VirtualHostFilter.java:215)
      at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:48)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:184)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:92)
      at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:203)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:105)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:164)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:92)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:164)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:92)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:184)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:92)
      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:70)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:680)
      Caused by: java.io.FileNotFoundException: /Users/brussell/Development/builds/websitesocial/liferay-portal-6.1.0-ce-ga1-20120106155615760/bundles/liferay-portal-tomcat-6.1.0-ce-ga1/data/document_library/14537/244508/20/00/20001.afsh/20001_1.0.afsh (No such file or directory)
      at java.io.FileInputStream.open(Native Method)
      at java.io.FileInputStream.<init>(FileInputStream.java:120)
      at com.liferay.portlet.documentlibrary.store.FileSystemStore.getFileAsStream(FileSystemStore.java:218)
      ... 80 more

        Issue Links

          Activity

          Hide
          Michael Saechang added a comment -

          Committed on:
          Portal 6.2.x GIT ID: db03e738abf875192284c25e4277b98e5b175a5c.

          Show
          Michael Saechang added a comment - Committed on: Portal 6.2.x GIT ID: db03e738abf875192284c25e4277b98e5b175a5c.
          Hide
          Tammy Fong added a comment -

          PASSED Manual Testing following the steps in the description.

          Reproduced on:
          Tomcat 7.0 + MySQL 5. Portal 6.1.10 EE.

          User will not be able to download any files that are stored as DLFileEntry.name > 100 when AdvancedFileSystemStore is used.

          Fixed on:
          Tomcat 7.0 + MySQL 5. Portal 6.1.x EE GIT ID: c1a618ec3070d070293f2ffccb51cc05a53c80fa.
          Tomcat 7.0 + MySQL 5. Portal 6.2.x GIT ID: 7943576e8ba6ee6b0b7f4f79a710b4547e5a77f3.

          User will be able to download any files that are moved regardless of the DLFileEntry.name when AdvancedFileSystemStore is used.

          Show
          Tammy Fong added a comment - PASSED Manual Testing following the steps in the description. Reproduced on: Tomcat 7.0 + MySQL 5. Portal 6.1.10 EE. User will not be able to download any files that are stored as DLFileEntry.name > 100 when AdvancedFileSystemStore is used. Fixed on: Tomcat 7.0 + MySQL 5. Portal 6.1.x EE GIT ID: c1a618ec3070d070293f2ffccb51cc05a53c80fa. Tomcat 7.0 + MySQL 5. Portal 6.2.x GIT ID: 7943576e8ba6ee6b0b7f4f79a710b4547e5a77f3. User will be able to download any files that are moved regardless of the DLFileEntry.name when AdvancedFileSystemStore is used.

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                2 years, 28 weeks, 1 day ago

                Development

                  Structure Helper Panel