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

Wrong friendly url in document library causes a NPE

    Details

      Description

      In document-library-routes.xml we have a wrong friendly url:

      	<route>
      		<pattern>/{instanceId}/view/{folderId:\d+}/{name}</pattern>
      		<implicit-parameter name="mvcRenderCommandName">/document_library/view_file_entry</implicit-parameter>
      	</route>
      

      This URL was used in 6.0 when accessing to documents in DM portlet but since 6.1 both folderId and name where replaced with fileEntryId.

      In case of upgrading from 6.0 to a newer version, old links from external sites, pointing to old URL will cause NPE in logs.

      Steps to reproduce

      1. Create a page called "documents"
      2. Add portlet:
        • 7.0.x and master: Documents and Media portlet
        • 6.2.x: Documents and Media Display portlet
      3. Get portlet instanceId from portletpreferences table: (last characters of portletId column)
        • 7.0.x and master:
          select * from portletpreferences where portletId like 'com_liferay_document_library_web_portlet_DLPortlet_INSTANCE_%'
          
        • 6.2.x:
          select * from portletpreferences where portletId like '110_INSTANCE_%'
          
      4. Open the wrong friendly url: (replace the portlet_instanceId)
        • 7.0.x and master:
          http://localhost:8080/web/guest/documents/-/document_library/<portlet_instanceId>/view/99999/99999
          
        • 6.2.x:
          http://localhost:8080/web/guest/documents/-/document_library_display/<portlet_instanceId>/view/99999/99999
          
      5. Result:
        • Expected behaviour: No error is displayed in log and root folder of Documents and Media is displayed in page because folder 99999 doesn't exists
        • Wrong behaviour: NPE error is displayed in log and Documents and Media is temporarily unavailable is displayed in page

        Attachments

        1. 62.png
          62.png
          49 kB
        2. 70.png
          70.png
          43 kB
        3. master.png
          master.png
          31 kB
        4. reproduce.png
          reproduce.png
          23 kB

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  3 years, 12 weeks, 3 days ago

                  Packages

                  Version Package
                  6.2.X EE
                  7.0.0 DXP FP3
                  7.0.0 DXP SP1
                  7.1.X
                  Master