You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2008/05/16 11:55:12 UTC

svn commit: r656990 - /myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapter.java

Author: skitching
Date: Fri May 16 02:55:11 2008
New Revision: 656990

URL: http://svn.apache.org/viewvc?rev=656990&view=rev
Log:
Return null when no view root exists, rather than throwing
NullPointerException.

Modified:
    myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapter.java

Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapter.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapter.java?rev=656990&r1=656989&r2=656990&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapter.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/jsf/JsfFrameworkAdapter.java Fri May 16 02:55:11 2008
@@ -26,6 +26,7 @@
 import org.apache.myfaces.orchestra.frameworkAdapter._FrameworkAdapterUtils;
 import org.apache.myfaces.orchestra.lib.OrchestraException;
 
+import javax.faces.component.UIViewRoot;
 import javax.faces.context.FacesContext;
 
 import java.io.IOException;
@@ -195,9 +196,17 @@
 
     /**
      * Return the current JSF viewId.
+     * <p>
+     * Null is returned if there is not yet a UIViewRoot set up for the current request.
      */
     public String getCurrentViewId()
     {
-        return getFacesContext().getViewRoot().getViewId();
+        UIViewRoot vr = getFacesContext().getViewRoot();
+        if (vr == null)
+        {
+            return null;
+        }
+        
+        return vr.getViewId();
     }
 }