taylor 2004/10/27 22:57:53 Modified: portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces PortletViewHandlerImpl.java FacesPortlet.java Log: When redeploying, the view roots were getting class cast exceptions since the new class deployed isn't the same as the old This patch attempts to recover from class cast exceptions, and create a new view root Revision Changes Path 1.5 +11 -3 jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/PortletViewHandlerImpl.java Index: PortletViewHandlerImpl.java =================================================================== RCS file: /home/cvs/jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/PortletViewHandlerImpl.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- PortletViewHandlerImpl.java 15 Oct 2004 21:47:44 -0000 1.4 +++ PortletViewHandlerImpl.java 28 Oct 2004 05:57:53 -0000 1.5 @@ -131,10 +131,18 @@ */ public UIViewRoot restoreView(FacesContext facesContext, String viewId) { - UIViewRoot root = handler.restoreView(facesContext, viewId); - if (root != null) + UIViewRoot root = null; + try { - facesContext.setViewRoot(root); + root = handler.restoreView(facesContext, viewId); + if (root != null) + { + facesContext.setViewRoot(root); + } + } + catch (Exception e) + { + log.error("Exception restoring view: " + e); } return root; } 1.10 +21 -3 jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/FacesPortlet.java Index: FacesPortlet.java =================================================================== RCS file: /home/cvs/jakarta-jetspeed-2/portals-bridges/myfaces/src/java/org/apache/portals/bridges/myfaces/FacesPortlet.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- FacesPortlet.java 26 Oct 2004 16:53:41 -0000 1.9 +++ FacesPortlet.java 28 Oct 2004 05:57:53 -0000 1.10 @@ -451,8 +451,13 @@ { // getLifecycle().execute(context); String vi = context.getViewRoot().getViewId(); - context.getApplication().getViewHandler().restoreView(context, vi); - + if (null == context.getApplication().getViewHandler().restoreView(context, vi)) + { + context.setViewRoot(new UIViewRoot()); + context.getViewRoot().setViewId(vi); + context.getViewRoot().setRenderKitId(RenderKitFactory.HTML_BASIC_RENDER_KIT); + request.getPortletSession().setAttribute(createViewRootKey(context, vi, viewId), context.getViewRoot()); + } getLifecycle().render(context); if (log.isTraceEnabled()) { @@ -577,9 +582,22 @@ { view = defaultView; } - UIViewRoot viewRoot = (UIViewRoot)portletRequest. + UIViewRoot viewRoot = null; + try + { + viewRoot = (UIViewRoot)portletRequest. getPortletSession(). getAttribute(createViewRootKey(facesContext, view, viewId)); + } + catch (Exception e) + { + viewRoot = new UIViewRoot(); + facesContext.setViewRoot(viewRoot); + facesContext.getViewRoot().setViewId(view); + facesContext.getViewRoot().setRenderKitId(RenderKitFactory.HTML_BASIC_RENDER_KIT); + portletRequest.getPortletSession().setAttribute(createViewRootKey(facesContext, view, viewId), viewRoot); + + } if (null != viewRoot) { facesContext.setViewRoot(viewRoot);
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]