[ http://jira.jboss.com/jira/browse/JBPORTAL-202?page=history ] Julien Viet resolved JBPORTAL-202: ----------------------------------
Resolution: Done Fix Version: 2.0 Beta 2.0 Final This is fixed in head. > Not setting the content type before setting the portlet mode on a RenderURL > (and ActionURL) leads to a NPE > ---------------------------------------------------------------------------------------------------------- > > Key: JBPORTAL-202 > URL: http://jira.jboss.com/jira/browse/JBPORTAL-202 > Project: JBoss Portal > Type: Patch > Components: Portal Core > Environment: Win2K > Reporter: Martin Holzner > Assignee: Julien Viet > Priority: Minor > Fix For: 2.0 Beta, 2.0 Final > > > problem: > portlet code like: > public void doHelp(RenderRequest req, RenderResponse res) > throws javax.portlet.PortletException > { > PortletURL viewUrl = res.createRenderURL(); > viewUrl.setPortletMode(PortletMode.VIEW); > .... > which does not set the content type before setting the portlet mode on a > RenderURL or ActionURL will see a NPE, like: > 14:09:23,525 ERROR [CoreServlet] Error > java.lang.NullPointerException > at > org.jboss.portal.server.plugins.mode.ContentTypes.isSupported(ContentTypes.java:228) > at org.jboss.portal.server.Window.isSupportedMode(Window.java:136) > at > org.jboss.portal.portlet.impl.PortletURLImpl.setPortletMode(PortletURLImpl.java:62) > at > com.novell.afw.portal.portlet.flash.FlashPortlet.doHelp(FlashPortlet.java:131) > at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:55) > at javax.portlet.GenericPortlet.render(GenericPortlet.java:114) > at > org.jboss.portal.portlet.invocation.DispatcherInterceptor.invokeRequest(DispatcherInterceptor.java:143) > at > org.jboss.portal.portlet.invocation.DispatcherInterceptor.invoke(DispatcherInterceptor.java:171) > at > org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:214) > at > org.jboss.portal.core.portlet.cms.CMSInterceptor.invoke(CMSInterceptor.java:78) > at > org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:214) > at > org.jboss.portal.portlet.invocation.PreferencesInterceptor.invoke(PreferencesInterceptor.java:93) > at > org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:214) > at > org.jboss.portal.server.invocation.component.ContextDispatcherInterceptor$InvokeNextCommand.execute(ContextDispatcherInterceptor.java:94) > 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:324) > based on this message, it's hard to figure out what the problem is. > =================================================================== > I propose the following change: > RCS file: > /cvsroot/jboss/jboss-portal/server/src/main/org/jboss/portal/server/plugins/mode/ContentTypes.java,v > retrieving revision 1.2 > diff -r1.2 ContentTypes.java > 227a228,233 > > if( mode == null){ > > throw new IllegalArgumentException("Mode not set."); > > } > > if( contentType == null){ > > throw new IllegalArgumentException("Content type not set."); > > } > =================================================================== > which leads to this error message: > 13:45:33,949 ERROR [CoreServlet] Error > java.lang.IllegalArgumentException: Content type not set. > at > org.jboss.portal.server.plugins.mode.ContentTypes.isSupported(ContentTypes.java:232) > at org.jboss.portal.server.Window.isSupportedMode(Window.java:136) > at > org.jboss.portal.portlet.impl.PortletURLImpl.setPortletMode(PortletURLImpl.java:62) > at > com.novell.afw.portal.portlet.flash.FlashPortlet.doHelp(FlashPortlet.java:131) > at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:55) > at javax.portlet.GenericPortlet.render(GenericPortlet.java:114) > at > org.jboss.portal.portlet.invocation.DispatcherInterceptor.invokeRequest(DispatcherInterceptor.java:143) > at > org.jboss.portal.portlet.invocation.DispatcherInterceptor.invoke(DispatcherInterceptor.java:171) > at > org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:214) > at > org.jboss.portal.core.portlet.cms.CMSInterceptor.invoke(CMSInterceptor.java:78) > at > org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:214) > at > org.jboss.portal.portlet.invocation.PreferencesInterceptor.invoke(PreferencesInterceptor.java:93) > at > org.jboss.portal.server.impl.invocation.InvocationImpl.invokeNext(InvocationImpl.java:214) > at > org.jboss.portal.server.invocation.component.ContextDispatcherInterceptor$InvokeNextCommand.execute(ContextDispatcherInterceptor.java:94) > 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:324) > --> still not fool proove, but at least the portlet developer gets a hint to > where the problem comes from..... -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ JBoss-Development mailing list JBoss-Development@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-development