Fóruns

Início » Liferay Portal » English » 3. Development

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Marco Ferretti
After upgrade to liferay 6 : NullPointerException getting a document
2 de Agosto de 2011 06:48
Resposta

Marco Ferretti

Ranking: Junior Member

Mensagens: 58

Data de entrada: 4 de Outubro de 2010

Mensagens recentes

Hi all,

we are in the testing phase of our upgrade process. We managed to upgrade an installation of liferay5.2.3 to Liferay 6.0.6; testing the results we found an ugly error ( see above ) .

The error appears if, in a public page, there is a link to a document that is supposed to require authentication. If the user requesting the document is logged in then there is no problem at all, if the user is not logged in ( guest ) then we recieve the following stack trace :


 1
 215:35:15,623 INFO  [PortalImpl:3829] Current URL /c/document_library/get_file?uuid=85fab282-94bc-4411-ac71-af769940511f&groupId=21920 generates exception: null
 315:35:15,647 ERROR [jsp:996] java.lang.NullPointerException
 4java.lang.NullPointerException
 5    at com.liferay.portlet.documentlibrary.action.GetFileAction.getFile(GetFileAction.java:199)
 6    at com.liferay.portlet.documentlibrary.action.GetFileAction.strutsExecute(GetFileAction.java:84)
 7    at com.liferay.portal.struts.PortletAction.execute(PortletAction.java:100)
 8    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
 9    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
10    at com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:153)
11    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
12    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
13    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
14    at com.liferay.portal.servlet.MainServlet.callParentService(MainServlet.java:508)
15    at com.liferay.portal.servlet.MainServlet.service(MainServlet.java:485)
16    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
17    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
18    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
19    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
20    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
21    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
22    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
23    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
24    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
25    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
26    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
27    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
28    at com.liferay.portal.servlet.filters.strip.StripFilter.processFilter(StripFilter.java:309)
29    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
30    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
31    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
32    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
33    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
34    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
35    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
36    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
37    at com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:110)
38    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
39    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
40    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
41    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
42    at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:182)
43    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
44    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
45    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
46    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
47    at com.liferay.portal.servlet.filters.sso.ntlm.NtlmPostFilter.processFilter(NtlmPostFilter.java:81)
48    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
49    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
50    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
51    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
52    at com.liferay.portal.sharepoint.SharepointFilter.processFilter(SharepointFilter.java:179)
53    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
54    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
55    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
56    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
57    at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.processFilter(VirtualHostFilter.java:240)
58    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
59    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
60    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
61    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
62    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
63    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
64    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
65    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
66    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:126)
67    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
68    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
69    at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
70    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
71    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
72    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:196)
73    at com.liferay.portal.servlet.filters.threadlocal.ThreadLocalFilter.processFilter(ThreadLocalFilter.java:35)
74    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:123)
75    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
76    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
77    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
78    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
79    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:465)
80    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
81    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
82    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
83    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
84    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
85    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
86    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
87    at java.lang.Thread.run(Thread.java:662)


This obviously leads to a page where the user sees an Internal Server Error message.
We tested the same path in the old version ( 5.2.3 ) and everything runs smoothly ( the non authenticated user sees a page that tells him/her that he/she is not authorized ).

Is there anything you suggest to check ?

TIA

marco
Marco Ferretti
RE: After upgrade to liferay 6 : NullPointerException getting a document
3 de Agosto de 2011 04:55
Resposta

Marco Ferretti

Ranking: Junior Member

Mensagens: 58

Data de entrada: 4 de Outubro de 2010

Mensagens recentes

Did some more tests.

I fired a bundle, created a public page, uploaded a document, secured it and linked it in the public page I just created. Trying to open the document with the guest user leads to the expected behavior ( unauthorized access ) .

This leads me to thing that something must have gone nuts during the upgrade process.

I digged a little into the code :

 1
 2        DLFileEntry fileEntry = null;
 3
 4        if (Validator.isNotNull(uuid) && (groupId > 0)) {
 5            try {
 6                fileEntry = DLFileEntryServiceUtil.getFileEntryByUuidAndGroupId(
 7                    uuid, groupId);
 8
 9                folderId = fileEntry.getFolderId();
10                name = fileEntry.getName();
11            }
12            catch (Exception e) {
13            }
14        }
15
16        if (fileShortcutId <= 0) {
17            if (Validator.isNotNull(name)) {
18                fileEntry = DLFileEntryServiceUtil.getFileEntry(
19                    groupId, folderId, name);
20
21                title = fileEntry.getTitle();
22            }
23            else if (Validator.isNotNull(title)) {
24                fileEntry = DLFileEntryServiceUtil.getFileEntryByTitle(
25                    groupId, folderId, title);
26
27                name = fileEntry.getName();
28            }
29        }
30        else {
31            DLFileShortcut fileShortcut =
32                DLFileShortcutServiceUtil.getFileShortcut(fileShortcutId);
33
34            folderId = fileShortcut.getToFolderId();
35            name = fileShortcut.getToName();
36
37            fileEntry = DLFileEntryLocalServiceUtil.getFileEntry(
38                groupId, folderId, name);
39        }
40
41        if (Validator.isNull(version)) {
42            if (Validator.isNotNull(fileEntry.getVersion())) {
43                version = fileEntry.getVersion();
44            }
45            else {
46                throw new NoSuchFileEntryException();
47            }
48        }


and as far as I can understand ( without debugging ) the problem seems to be that
1
2            fileEntry = DLFileEntryLocalServiceUtil.getFileEntry(
3                groupId, folderId, name);


return a NULL object making the test
1if (Validator.isNotNull(fileEntry.getVersion()))

throw the aforementioned exception

Is there anything I can do to double check the data or do you actually think this is a bug ?
Sampsa Sohlman
RE: After upgrade to liferay 6 : NullPointerException getting a document
12 de Outubro de 2012 05:32
Resposta

Sampsa Sohlman

LIFERAY STAFF

Ranking: Regular Member

Mensagens: 217

Data de entrada: 27 de Setembro de 2007

Mensagens recentes

Did came to same problem and made issue LPS-30480 regarding the null pointer exception. It might be still valid at trunk.