[ https://issues.apache.org/jira/browse/PB-84?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ate Douma updated PB-84: ------------------------ Attachment: portals-bridges-common-1.0.4.jar Thanks for testing it Tom, this was very helpful and confirms my suspicions. The fact that the internal attribute "org.apache.portals.bridges.util.portlet_window_id" just set as PORTLET_SCOPE session attribute is not returned from the APPLICATION_SCOPE enumeration of attributes clearly is not compliant with JSR-168 PLT.15.3. I have no idea how OpenPortal and JBoss Portal (see also: PB-77) are implementing their session attributes handling but IMHO this should be filed as a bug against both containers. Nonetheless, I've been thinking of an alternative solution which hopefully might work on these containers too. I've rewritten the getPortletWindowId() method as follows which works just as well on Pluto/Jetspeed-2 (which might even be a more optimal/efficient solution). If this works for OpenPortal I'm willing to replace the current solution with this new one: public static String getPortletWindowId(PortletSession session) { System.out.println("getPortletWindowId for session: "+session.getId()+" (thread: "+Thread.currentThread().getId()+")"); String portletWindowId = (String)session.getAttribute(PORTLET_WINDOW_ID); if ( portletWindowId == null ) { synchronized (session) { System.out.println(" no portletWindowId yet - going to derive it."); final String[] nameRef = new String[1]; session.setAttribute(PORTLET_WINDOW_ID, new HttpSessionBindingListener() { public void valueBound(HttpSessionBindingEvent event) { nameRef[0] = event.getName(); } public void valueUnbound(HttpSessionBindingEvent event) {} }); session.removeAttribute(PORTLET_WINDOW_ID); if (nameRef[0] != null) { portletWindowId = nameRef[0].substring("javax.portlet.p.".length(),nameRef[0].indexOf('?')); System.out.println(" --> found - PORTLET_WINDOW_ID = "+portletWindowId); session.setAttribute(PORTLET_WINDOW_ID, portletWindowId); } else { System.out.println(" --> error: failed to derive the portletWindowId"); } } } return portletWindowId; } Again, I've attached a portal-bridges-commons-1.0.4.jar (replacing the previous one) with this method compiled in. (FYI: this one is build for Java 1.4 again). I get the following (expected) output with Pluto/Jetspeed-2: getPortletWindowId for session: F8DB1E64E9C8227B0CA4A10BDB6E231A (thread: 53) no portletWindowId yet - going to derive it. --> found - PORTLET_WINDOW_ID = jp-2 Can you please again try this one out on OpenPortal and report back if this works. Also note: as you can see I'm now removing the PORTLET_WINDOW_ID attribute again regardless if a the SessionBindingListener solution works, so you should no longer encounter a CCE with this version, but won't get the requested PortletWindowId either (which then probably will break other depending code...) > CCE in PortletWindowUtils.getPortletWindowId > -------------------------------------------- > > Key: PB-84 > URL: https://issues.apache.org/jira/browse/PB-84 > Project: Portals Bridges > Issue Type: Bug > Components: common > Affects Versions: 1.0 > Environment: Mac OS, Wicket Portlets, OpenPortal Portlet Container > Reporter: Tim Boudreau > Attachments: portals-bridges-common-1.0.4.jar > > > I'm trying to get wicket portlet support working over OpenPortal. I've > hacked together implementations of ServletContextProvider and > PortletResourceURLFactory - just required exposing WicketFilter from the > Application to get the necessary data. I can deploy a portlet, but... > I'm getting this exception. > java.lang.ClassCastException: java.lang.Double > at > org.apache.portals.bridges.util.PortletWindowUtils.getPortletWindowId(PortletWindowUtils.java:45) > Looking at the code, this seems like a clear bug: The method casts to String > here: > (String)session.getAttribute(PORTLET_WINDOW_ID); > and if null fills in the value with an instance of Double. If it's going to > put a Double there, it should probably not expect a String - this exception > will occur any time this method is called twice for a PortletSession, it will > throw the CCE the second time it is called. > Since the value is not used, probably simply changing it to > Object portletWindowId = session.getAttribute(PORTLET_WINDOW_ID); > would fix it. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]