You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gc...@apache.org on 2011/09/07 03:55:47 UTC
svn commit: r1165956 -
/myfaces/trinidad/branches/2.0.0.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java
Author: gcrawford
Date: Wed Sep 7 01:55:47 2011
New Revision: 1165956
URL: http://svn.apache.org/viewvc?rev=1165956&view=rev
Log:
TRINIDAD-2134 NullPointerException in StateManagerImpl._calculateTokenStateSaving
Modified:
myfaces/trinidad/branches/2.0.0.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java
Modified: myfaces/trinidad/branches/2.0.0.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/2.0.0.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java?rev=1165956&r1=1165955&r2=1165956&view=diff
==============================================================================
--- myfaces/trinidad/branches/2.0.0.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java (original)
+++ myfaces/trinidad/branches/2.0.0.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java Wed Sep 7 01:55:47 2011
@@ -967,13 +967,20 @@ public class StateManagerImpl extends St
return false;
}
- // is vanilla JSF used? No Trinidad render-kit-id give? If so, we need to return FALSE,
- // since we want to save the ENTIRE state on the client...
- UIViewRoot viewRoot = FacesContext.getCurrentInstance().getViewRoot();
-
- if (viewRoot != null && RenderKitFactory.HTML_BASIC_RENDER_KIT.equals(viewRoot.getRenderKitId()))
- {
- return false;
+ // In certain situations this method is called from a filter and there's no facesContext, so
+ // make sure to check for a null context
+ FacesContext context = FacesContext.getCurrentInstance();
+
+ if (context != null)
+ {
+ // is vanilla JSF used? No Trinidad render-kit-id give? If so, we need to return FALSE,
+ // since we want to save the ENTIRE state on the client...
+ UIViewRoot viewRoot = context.getViewRoot();
+
+ if (viewRoot != null && RenderKitFactory.HTML_BASIC_RENDER_KIT.equals(viewRoot.getRenderKitId()))
+ {
+ return false;
+ }
}
// Last missing option: state-saving is "CLIENT" and the client-state-method uses