Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: 5.0.1
    • Fix Version/s: 5.2.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      Liferay Portal version 5.0.1
      Derby DB 10.3
    • Similar Issues:
      Show 5 results 

      Description

      When I'm trying to access a folder in the document library that contains a file, then a Execpetion is thrown:
      java.lang.ClassCastException: java.lang.Long cannot be cast to [Ljava.lang.Object;
      at com.liferay.portlet.documentlibrary.service.persistence.DLFileEntryAndShortcutFinderImpl.findByFolderIds(DLFileEntryAndShortcutFinderImpl.java:156)
      at com.liferay.portlet.documentlibrary.service.impl.DLFileEntryLocalServiceImpl.getFileEntriesAndShortcuts(DLFileEntryLocalServiceImpl.java:574)
      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)
      ...

      In "DLFileEntryAndShortcutFinderImpl.java" this statement is executed:
      ( SELECT folderId AS folderId, name AS name, title AS title, 0 AS fileShortcutId FROM DLFileEntry WHERE DLFileEntry.folderId = ? )
      UNION ALL
      ( SELECT toFolderId AS folderId, toName AS name, DLFileEntry.title AS title, fileShortcutId AS fileShortcutId FROM DLFileShortcut
      INNER JOIN DLFileEntry ON (DLFileEntry.folderId = DLFileShortcut.toFolderId) AND (DLFileEntry.name = DLFileShortcut.toName)
      WHERE DLFileShortcut.folderId = ? ) ORDER BY title ASC

      Code:
      Iterator itr = QueryUtil.iterate(
      q, HibernateUtil.getDialect(), begin, end);

      while (itr.hasNext()) {
      Object[] array = (Object[])itr.next();

      Long folderId = (Long)array[0];
      String name = (String)array[1];
      //String title = (String)array[2];
      long fileShortcutId = ((Long)array[3]).longValue();

      Object obj = null;

      if (fileShortcutId > 0)

      { obj = DLFileShortcutUtil.findByPrimaryKey(fileShortcutId); }

      else

      { obj = DLFileEntryUtil.findByF_N(folderId.longValue(), name); }

      fileEntriesAndShortcuts.add(obj);
      }

      If you are using HSLDB you get an Object[] for each iter.next()
      but for Derby Db you get a Long representing the folderid.

      Does anyone have solution for this?

        Activity

        Hide
        Tobias Kaefer added a comment - - Restricted to

        I found one solution, that uses the standard mechanisms for retrieving DLFileEntry and DLFileShortcut entries:
        for (Iterator<Long> iterator = folderIds.iterator(); iterator.hasNext()

        { Long folderId = iterator.next(); List<DLFileEntry> dlFileEntryList = DLFileEntryUtil.findByFolderId(folderId); fileEntriesAndShortcuts.addAll(dlFileEntryList); List<DLFileShortcut> dlFileShortcutList = DLFileShortcutUtil.findByFolderId(folderId); fileEntriesAndShortcuts.addAll(dlFileShortcutList); }

        see attached patch for more information.

        Show
        Tobias Kaefer added a comment - - Restricted to I found one solution, that uses the standard mechanisms for retrieving DLFileEntry and DLFileShortcut entries: for (Iterator<Long> iterator = folderIds.iterator(); iterator.hasNext() { Long folderId = iterator.next(); List<DLFileEntry> dlFileEntryList = DLFileEntryUtil.findByFolderId(folderId); fileEntriesAndShortcuts.addAll(dlFileEntryList); List<DLFileShortcut> dlFileShortcutList = DLFileShortcutUtil.findByFolderId(folderId); fileEntriesAndShortcuts.addAll(dlFileShortcutList); } see attached patch for more information.
        Hide
        Michael Sørensen added a comment -

        I get the same issue when i try to insert an image from a document library.

        Stacktrace:

        09:09:38,812 ERROR [IncludeTag:426] Current URL /group/my-site/blog?p_p_id=33&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_pos=1&p_p_col_count=2&_33_struts_action=%2Fblogs%2Fedit_entry&_33_redirect=http%3A%2F%2Flocalhost%3A8080%2Fgroup%2Fmy-site%2Fblog%2F-%2Fblogs%2F10676&_33_backURL=http%3A%2F%2Flocalhost%3A8080%2Fgroup%2Fmy-site%2Fblog%2F-%2Fblogs%2F10676&_33_entryId=10676 generates exception: [Ljava.lang.Object; cannot be cast to com.liferay.portlet.documentlibrary.model.DLFileShortcut
        09:09:38,815 ERROR [IncludeTag:154] java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to com.liferay.portlet.documentlibrary.model.DLFileShortcut
        at org.apache.jsp.html.portlet.document_005flibrary.file_005fentry_005faction_jsp._jspService(file_005fentry_005faction_jsp.java:1026)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at com.liferay.portal.kernel.servlet.DirectRequestDispatcher.include(DirectRequestDispatcher.java:45)
        at com.liferay.taglib.util.IncludeTag.include(IncludeTag.java:323)
        at com.liferay.taglib.util.IncludeTag._doInclude(IncludeTag.java:418)
        at com.liferay.taglib.util.IncludeTag.doEndTag(IncludeTag.java:92)
        at org.apache.jsp.html.portlet.document_005flibrary.view_005ffile_005fentry_005ficon_jsp._jspx_meth_liferay_002dutil_005finclude_005f0(view_005ffile_005fentry_005ficon_jsp.java:1130)
        at org.apache.jsp.html.portlet.document_005flibrary.view_005ffile_005fentry_005ficon_jsp._jspService(view_005ffile_005fentry_005ficon_jsp.java:1056)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at com.liferay.portal.kernel.servlet.DirectRequestDispatcher.include(DirectRequestDispatcher.java:45)
        at com.liferay.taglib.util.IncludeTag.include(IncludeTag.java:323)
        at com.liferay.taglib.util.IncludeTag._doInclude(IncludeTag.java:418)
        at com.liferay.taglib.util.IncludeTag.doEndTag(IncludeTag.java:92)
        at org.apache.jsp.html.portlet.document_005flibrary.view_005fentries_jsp._jspx_meth_liferay_002dutil_005finclude_005f0(view_005fentries_jsp.java:2187)
        at org.apache.jsp.html.portlet.document_005flibrary.view_005fentries_jsp._jspService(view_005fentries_jsp.java:1355)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at com.liferay.portal.kernel.servlet.DirectRequestDispatcher.include(DirectRequestDispatcher.java:45)

        Show
        Michael Sørensen added a comment - I get the same issue when i try to insert an image from a document library. Stacktrace: 09:09:38,812 ERROR [IncludeTag:426] Current URL /group/my-site/blog?p_p_id=33&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_pos=1&p_p_col_count=2&_33_struts_action=%2Fblogs%2Fedit_entry&_33_redirect=http%3A%2F%2Flocalhost%3A8080%2Fgroup%2Fmy-site%2Fblog%2F-%2Fblogs%2F10676&_33_backURL=http%3A%2F%2Flocalhost%3A8080%2Fgroup%2Fmy-site%2Fblog%2F-%2Fblogs%2F10676&_33_entryId=10676 generates exception: [Ljava.lang.Object; cannot be cast to com.liferay.portlet.documentlibrary.model.DLFileShortcut 09:09:38,815 ERROR [IncludeTag:154] java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to com.liferay.portlet.documentlibrary.model.DLFileShortcut at org.apache.jsp.html.portlet.document_005flibrary.file_005fentry_005faction_jsp._jspService(file_005fentry_005faction_jsp.java:1026) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at com.liferay.portal.kernel.servlet.DirectRequestDispatcher.include(DirectRequestDispatcher.java:45) at com.liferay.taglib.util.IncludeTag.include(IncludeTag.java:323) at com.liferay.taglib.util.IncludeTag._doInclude(IncludeTag.java:418) at com.liferay.taglib.util.IncludeTag.doEndTag(IncludeTag.java:92) at org.apache.jsp.html.portlet.document_005flibrary.view_005ffile_005fentry_005ficon_jsp._jspx_meth_liferay_002dutil_005finclude_005f0(view_005ffile_005fentry_005ficon_jsp.java:1130) at org.apache.jsp.html.portlet.document_005flibrary.view_005ffile_005fentry_005ficon_jsp._jspService(view_005ffile_005fentry_005ficon_jsp.java:1056) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at com.liferay.portal.kernel.servlet.DirectRequestDispatcher.include(DirectRequestDispatcher.java:45) at com.liferay.taglib.util.IncludeTag.include(IncludeTag.java:323) at com.liferay.taglib.util.IncludeTag._doInclude(IncludeTag.java:418) at com.liferay.taglib.util.IncludeTag.doEndTag(IncludeTag.java:92) at org.apache.jsp.html.portlet.document_005flibrary.view_005fentries_jsp._jspx_meth_liferay_002dutil_005finclude_005f0(view_005fentries_jsp.java:2187) at org.apache.jsp.html.portlet.document_005flibrary.view_005fentries_jsp._jspService(view_005fentries_jsp.java:1355) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at com.liferay.portal.kernel.servlet.DirectRequestDispatcher.include(DirectRequestDispatcher.java:45)

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development

                Subcomponents

                  Structure Helper Panel