dev@mojarra.java.net

Re: NPE in NavigationHandlerImpl

From: Roger Kitain <roger.kitain_at_oracle.com>
Date: Thu, 26 Jan 2012 12:42:56 -0500

I've created this issue in JIRA:
http://java.net/jira/browse/JAVASERVERFACES-2310

On 1/26/12 11:19 AM, Frank Würffel wrote:
> Hi,
>
> I had a NPE in NavigationHandlerImpl when I configure a Nav Case with
> redirect and the session has expired before the navigation takes place.
> This is due to a missing check fo null in the methods:
>
> clearViewMapIfNecessary and updateRenderTargets
>
> I fixed this for me by creating my own NavigationHandler but it would
> be nice to have it fixed in the mojarra code if possible.
>
> /**
> * Calls <code>clear()</code> on the ViewMap (if available) if the
> view ID of the UIViewRoot differs from <code>newId</code>
> */
> private void clearViewMapIfNecessary(UIViewRoot root, String newId) {
>
> if (root != null && !root.getViewId().equals(newId)) {
> Map<String, Object> viewMap = root.getViewMap(false);
> if (viewMap != null) {
> viewMap.clear();
> }
> }
>
> }
>
> private void updateRenderTargets(FacesContext ctx, String newId) {
>
> if (ctx.getViewRoot() == null ||
> !ctx.getViewRoot().getViewId().equals(newId)) {
> PartialViewContext pctx = ctx.getPartialViewContext();
> if (!pctx.isRenderAll()) {
> pctx.setRenderAll(true);
> }
> }
>
> }
>
>
> Tks.
>
> Frank


-- 
roger.kitain_at_oracle.com
https://twitter.com/rogerk09
http://www.java.net/blogs/rogerk