[MAGNOLIA-1552] Dialog path not always set via request parameter "mgnlPath" whch throws an NPE on save Created: 24/May/07  Updated: 23/Jan/13  Resolved: 25/May/07

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: 3.1 M2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: zam6ak Assignee: Philipp Bärfuss
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

3.1-SNAPSHOT


Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

Steps

1. Edit any user,group, or role and enter some info (like an email address)
2. Click save

ERROR org.apache.catalina.core.ContainerBase.[jboss.web].[webdev.nemours.org].[/magnolia-cms].[DialogServlet] 24.05.2007 11:57:10 – Servlet.service() for servlet DialogServlet threw exception
java.lang.NullPointerException
at info.magnolia.cms.core.DefaultHierarchyManager.getContent(DefaultHierarchyManager.java:254)
at info.magnolia.module.admininterface.DialogMVCHandler.getStorageNode(DialogMVCHandler.java:303)
at info.magnolia.module.admininterface.DialogMVCHandler.getDialog(DialogMVCHandler.java:395)
at info.magnolia.module.admininterface.DialogMVCHandler.renderHtml(DialogMVCHandler.java:355)
at info.magnolia.cms.servlets.MVCServlet.doPost(MVCServlet.java:112)
at info.magnolia.cms.servlets.MVCServlet.doGet(MVCServlet.java:48)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at info.magnolia.cms.filters.MagnoliaFilterChain.doFilter(MagnoliaFilterChain.java:42)
at info.magnolia.cms.filters.MagnoliaFilterChain.doFilter(MagnoliaFilterChain.java:50)
at info.magnolia.cms.filters.MultipartRequestFilter.doFilter(MultipartRequestFilter.java:59)
at info.magnolia.cms.filters.AbstractMagnoliaFilter.doFilter(AbstractMagnoliaFilter.java:46)
at info.magnolia.cms.filters.MagnoliaFilterChain.doFilter(MagnoliaFilterChain.java:48)
at info.magnolia.cms.filters.MgnlVirtualUriFilter.doFilter(MgnlVirtualUriFilter.java:54)
at info.magnolia.cms.filters.AbstractMagnoliaFilter.doFilter(AbstractMagnoliaFilter.java:46)
at info.magnolia.cms.filters.MagnoliaFilterChain.doFilter(MagnoliaFilterChain.java:48)
at info.magnolia.cms.cache.CacheFilter.doFilter(CacheFilter.java:97)
at info.magnolia.cms.filters.AbstractMagnoliaFilter.doFilter(AbstractMagnoliaFilter.java:46)
at info.magnolia.cms.filters.MagnoliaFilterChain.doFilter(MagnoliaFilterChain.java:48)
at info.magnolia.cms.i18n.I18NSupportFilter.doFilter(I18NSupportFilter.java:46)
at info.magnolia.cms.filters.AbstractMagnoliaFilter.doFilter(AbstractMagnoliaFilter.java:46)
at info.magnolia.cms.filters.MagnoliaFilterChain.doFilter(MagnoliaFilterChain.java:48)
at info.magnolia.cms.security.BaseSecurityFilter.doFilter(BaseSecurityFilter.java:40)
at info.magnolia.cms.filters.AbstractMagnoliaFilter.doFilter(AbstractMagnoliaFilter.java:46)
at info.magnolia.cms.filters.MagnoliaFilterChain.doFilter(MagnoliaFilterChain.java:48)
at info.magnolia.cms.security.auth.login.LoginFilter.doFilter(LoginFilter.java:61)
at info.magnolia.cms.filters.AbstractMagnoliaFilter.doFilter(AbstractMagnoliaFilter.java:46)
at info.magnolia.cms.filters.MagnoliaFilterChain.doFilter(MagnoliaFilterChain.java:48)
at info.magnolia.cms.security.BaseSecurityFilter.doFilter(BaseSecurityFilter.java:40)
at info.magnolia.cms.filters.AbstractMagnoliaFilter.doFilter(AbstractMagnoliaFilter.java:46)
at info.magnolia.cms.filters.MagnoliaFilterChain.doFilter(MagnoliaFilterChain.java:48)
at info.magnolia.cms.filters.ContentTypeFilter.doFilter(ContentTypeFilter.java:47)
at info.magnolia.cms.filters.AbstractMagnoliaFilter.doFilter(AbstractMagnoliaFilter.java:46)
at info.magnolia.cms.filters.MagnoliaFilterChain.doFilter(MagnoliaFilterChain.java:48)
at info.magnolia.cms.filters.MgnlContextFilter.doFilter(MgnlContextFilter.java:40)
at info.magnolia.cms.filters.AbstractMagnoliaFilter.doFilter(AbstractMagnoliaFilter.java:46)
at info.magnolia.cms.filters.MagnoliaFilterChain.doFilter(MagnoliaFilterChain.java:48)
at info.magnolia.cms.filters.MagnoliaMainFilter.doFilter(MagnoliaMainFilter.java:97)
at info.magnolia.cms.filters.AbstractMagnoliaFilter.doFilter(AbstractMagnoliaFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:619)



 Comments   
Comment by Magnolia International [ 24/May/07 ]

whoever gets to understand the cause of this, please a "when" clause to the subject

Comment by zam6ak [ 24/May/07 ]

> whoever gets to understand the cause of this, please a "when" clause to the subject

not sure what you ment with this statement, but if the more detailed description of the issue is necessary please lete me know.

Comment by Philipp Bracher [ 25/May/07 ]

Can't reproduce on a freshly bootstrapped magnolia.

Comment by Magnolia International [ 25/May/07 ]

Amir > nothing more the fact we (eventually) need more precise titles for the fixes to make sense in a changelog.

Comment by zam6ak [ 25/May/07 ]

Philipp

I just did a fresh build and bootstrap (revision 9555) and I still get the same error.
I am running JBoss, but I doubt that has anything to do with it....

Can you confirm?

Comment by zam6ak [ 27/Jul/07 ]

I have some more info regarding this issue.
Sometimes the exception is preceeded by:

ERROR info.magnolia.module.admininterface.DialogMVCServlet 26.07.2007 19:29:15 – no dialog registered for name: styles/global.css
ERROR org.apache.catalina.core.ContainerBase.[jboss.web].[cms.nemours.org].[/].[DialogServlet] 26.07.2007 19:29:15 – Servlet.service() for servlet DialogServlet threw exception
info.magnolia.cms.beans.config.ConfigurationException: no dialog registered for name: styles/global.css
at info.magnolia.module.admininterface.DialogMVCServlet.getHandler(DialogMVCServlet.java:77)
at info.magnolia.cms.servlets.MVCServlet.doPost(MVCServlet.java:96)

I am not sure why would there be a paragraph for styles/global.css or what is this style sheet being used for but this could be one the problems that is causing the exception

Comment by zam6ak [ 17/Aug/07 ]

OK

This issue was really starting to annoy me so I decided to take a look into the code and here is what I found out.

info.magnolia.module.admininterface.DialogMVCHandler.getStorageNode() on line 305 passed a "path" String to HierarchyMaanger in order to get content.
This "path" seems to be obtained via URL request parameter called mgnlPath which is processed via RequestFormUtil static helper class...

path is defined as

protected String path = StringUtils.EMPTY;

so it should not be null but in the constructor it is being reset by a method from RequestFormUtil

path = params.getParameter("mgnlPath");

which could reset it to null (not only path but other fields as well)

The problem seems to be that at no point there is a check if this parameter is not null....And the "mgnlPath" request parameter is not always being set it seems.

I believe info.magnolia.cms.core.DefaultHierarchyManager.getContent() should throw NPE but info.magnolia.module.admininterface.DialogMVCHandler.getStorageNode() should check if this parameter is null AND if its value is something meaningful...

So on line 305 of info.magnolia.module.admininterface.DialogMVCHandler there should be something like:

if (this.path == null) {
this.path = "WHAT SHOULD THIS BE IF IT IS NULL?";
}
Content parentContent = hm.getContent(path);

Comment by zam6ak [ 17/Aug/07 ]
  • Deleted the part of stacktrace that was repeating
  • Renamed issue summary to something more meaningful
Comment by Philipp Bracher [ 21/Aug/07 ]

mgnlPath should be set in any case. Sure we can do additional exception handling, but there is no valid default value. All we achieve is a path not found exception instead.

Comment by Philipp Bracher [ 21/Aug/07 ]

Added a check and a warn log which logs the original URL.

Comment by zam6ak [ 21/Aug/07 ]

Is it possible to also get the dialog name (or path) in the message?
As in "No path defined for a dialog [{}] called by the URL [{}]".....

Comment by Philipp Bracher [ 21/Aug/07 ]

dialog name is part of the url

Comment by zam6ak [ 22/Aug/07 ]

Ok now when I open roles dialog and just click save I get:

WARN info.magnolia.module.admininterface.DialogMVCHandler DialogMVCHandler.java(getStorageNode:306) 22.08.2007 09:20:12 No path defined for a dialog called by the url http://mypc.mycompany.org/magnoliaAuthor/.magnolia/dialogs/roleedit.html
ERROR info.magnolia.module.admininterface.PageMVCHandler SimplePageMVCHandler.java(renderHtml:47) 22.08.2007 09:20:12 Exception during rendering the page
java.lang.NullPointerException
at info.magnolia.cms.util.ContentUtil.getContent(ContentUtil.java:126)
at info.magnolia.module.admininterface.pages.RolesACLPage.addExistingAclToTable(RolesACLPage.java:252)
at info.magnolia.module.admininterface.pages.RolesACLPage.writeRepositoryTable(RolesACLPage.java:238)
at info.magnolia.module.admininterface.pages.RolesACLPage.render(RolesACLPage.java:171)
at info.magnolia.module.admininterface.SimplePageMVCHandler.renderHtml(SimplePageMVCHandler.java:44)

Generated at Mon Feb 12 03:28:00 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.