You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ar...@apache.org on 2010/09/08 00:19:04 UTC

svn commit: r993547 - /myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/PseudoFacesContext.java

Author: arobinson74
Date: Tue Sep  7 22:19:04 2010
New Revision: 993547

URL: http://svn.apache.org/viewvc?rev=993547&view=rev
Log:
TRINIDAD-1907 added sensible method returns for some of the functions of the PseudoFacesContext methods that should not be throwing exceptions

Modified:
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/PseudoFacesContext.java

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/PseudoFacesContext.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/PseudoFacesContext.java?rev=993547&r1=993546&r2=993547&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/PseudoFacesContext.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/webapp/PseudoFacesContext.java Tue Sep  7 22:19:04 2010
@@ -6,9 +6,9 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -18,12 +18,14 @@
  */
 package org.apache.myfaces.trinidadinternal.webapp;
 
+import java.util.Collections;
 import java.util.Iterator;
 
 import javax.el.ELContext;
 import javax.el.ELResolver;
 import javax.el.FunctionMapper;
 import javax.el.VariableMapper;
+
 import javax.faces.FactoryFinder;
 import javax.faces.application.Application;
 import javax.faces.application.ApplicationFactory;
@@ -37,24 +39,25 @@ import javax.faces.context.ResponseStrea
 import javax.faces.context.ResponseWriter;
 import javax.faces.render.RenderKit;
 
+
 /**
- * Pseudo FacesContext, vended by the filter for code that 
+ * Pseudo FacesContext, vended by the filter for code that
  * needs to run before (or after) the FacesServlet, but needs
  * access to servlet objects.  This object is only available
  * inside the filter.
- * 
+ *
  */
 class PseudoFacesContext extends FacesContext
 {
   public PseudoFacesContext(ExternalContext ec)
   {
-    assert ec!= null;
+    assert ec != null : "External context must not be null";
     _external = ec;
   }
 
   public void setAsCurrentInstance()
   {
-      FacesContext.setCurrentInstance(this);
+    FacesContext.setCurrentInstance(this);
   }
 
   @Override
@@ -78,13 +81,13 @@ class PseudoFacesContext extends FacesCo
   @Override
   public Iterator<FacesMessage> getMessages()
   {
-    throw new UnsupportedOperationException();
+    return Collections.<FacesMessage>emptyList().iterator();
   }
 
   @Override
   public Iterator<FacesMessage> getMessages(String id)
   {
-    throw new UnsupportedOperationException();
+    return Collections.<FacesMessage>emptyList().iterator();
   }
 
   @Override
@@ -96,43 +99,43 @@ class PseudoFacesContext extends FacesCo
   @Override
   public FacesMessage.Severity getMaximumSeverity()
   {
-    throw new UnsupportedOperationException();
+    return null;
   }
 
   @Override
   public Iterator<String> getClientIdsWithMessages()
   {
-    throw new UnsupportedOperationException();
+    return Collections.<String>emptyList().iterator();
   }
 
   @Override
   public UIViewRoot getViewRoot()
   {
-    throw new UnsupportedOperationException();
+    return null;
   }
 
   @Override
   public void setViewRoot(UIViewRoot viewRoot)
   {
-     throw new UnsupportedOperationException();
+    throw new UnsupportedOperationException();
   }
 
   @Override
   public RenderKit getRenderKit()
   {
-     throw new UnsupportedOperationException();
+    return null;
   }
 
   @Override
   public boolean getRenderResponse()
   {
-    throw new UnsupportedOperationException();
+    return false;
   }
 
   @Override
   public boolean getResponseComplete()
   {
-    throw new UnsupportedOperationException();
+    return false;
   }
 
   @Override
@@ -140,7 +143,7 @@ class PseudoFacesContext extends FacesCo
   {
     throw new UnsupportedOperationException();
   }
-  
+
   @Override
   public void setResponseStream(ResponseStream responseStream)
   {
@@ -152,7 +155,7 @@ class PseudoFacesContext extends FacesCo
   {
     throw new UnsupportedOperationException();
   }
-  
+
   @Override
   public void responseComplete()
   {
@@ -189,23 +192,17 @@ class PseudoFacesContext extends FacesCo
   }
 
   @Override
-  public PartialViewContext getPartialViewContext() 
+  public PartialViewContext getPartialViewContext()
   {
-
-    if (_partialViewContext == null) 
+    if (_partialViewContext == null)
     {
       PartialViewContextFactory f = (PartialViewContextFactory)
                       FactoryFinder.getFactory(FactoryFinder.PARTIAL_VIEW_CONTEXT_FACTORY);
       _partialViewContext = f.getPartialViewContext(this);
     }
-    return _partialViewContext;      
-  }
-
-  private PartialViewContext _partialViewContext;
-  private final ExternalContext _external;
-  private ELContext _elContext;
-  private Application _application;
 
+    return _partialViewContext;
+  }
 
   // This is used to mock up a dummy ELContext to pass into createValueExpression
   // if the FacesContext is null and we can't get FacesContext.getELContext.
@@ -237,4 +234,8 @@ class PseudoFacesContext extends FacesCo
     private final ELResolver _resolver;
   }
 
-}
+  private PartialViewContext _partialViewContext;
+  private final ExternalContext _external;
+  private ELContext _elContext;
+  private Application _application;
+}
\ No newline at end of file