You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by st...@apache.org on 2011/10/25 14:33:10 UTC

svn commit: r1188631 [1/2] - in /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces: context/ context/servlet/ renderkit/ view/facelets/ webapp/

Author: struberg
Date: Tue Oct 25 12:33:10 2011
New Revision: 1188631

URL: http://svn.apache.org/viewvc?rev=1188631&view=rev
Log:
MYFACES-3368 fix checkstyle

Modified:
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/PartialResponseWriterImpl.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/renderkit/ServerSideStateCacheImpl.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/StartupServletContextListener.java

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/PartialResponseWriterImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/PartialResponseWriterImpl.java?rev=1188631&r1=1188630&r2=1188631&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/PartialResponseWriterImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/PartialResponseWriterImpl.java Tue Oct 25 12:33:10 2011
@@ -67,30 +67,37 @@ import javax.faces.context.ResponseWrite
  * @version $Revision$ $Date$
  */
 
-public class PartialResponseWriterImpl extends PartialResponseWriter {
+public class PartialResponseWriterImpl extends PartialResponseWriter
+{
 
-    class StackEntry {
+    class StackEntry
+    {
         ResponseWriter writer;
         StringWriter _doubleBuffer;
 
-        StackEntry(ResponseWriter writer, StringWriter doubleBuffer) {
+        StackEntry(ResponseWriter writer, StringWriter doubleBuffer)
+        {
             this.writer = writer;
             _doubleBuffer = doubleBuffer;
         }
 
-        public ResponseWriter getWriter() {
+        public ResponseWriter getWriter()
+        {
             return writer;
         }
 
-        public void setWriter(ResponseWriter writer) {
+        public void setWriter(ResponseWriter writer)
+        {
             this.writer = writer;
         }
 
-        public StringWriter getDoubleBuffer() {
+        public StringWriter getDoubleBuffer()
+        {
             return _doubleBuffer;
         }
 
-        public void setDoubleBuffer(StringWriter doubleBuffer) {
+        public void setDoubleBuffer(StringWriter doubleBuffer)
+        {
             _doubleBuffer = doubleBuffer;
         }
     }
@@ -99,21 +106,27 @@ public class PartialResponseWriterImpl e
     StringWriter _doubleBuffer = null;
     List<StackEntry> _nestingStack = new LinkedList<StackEntry>();
 
-    public PartialResponseWriterImpl(ResponseWriter writer) {
+    public PartialResponseWriterImpl(ResponseWriter writer)
+    {
         super(writer);
     }
 
     @Override
-    public void startCDATA() throws IOException {
-        if (!isDoubleBufferEnabled()) {
+    public void startCDATA() throws IOException
+    {
+        if (!isDoubleBufferEnabled())
+        {
             super.startCDATA();
-        } else {
+        }
+        else
+        {
             _cdataDoubleBufferWriter.write("<![CDATA[");
         }
         openDoubleBuffer();
     }
 
-    private void openDoubleBuffer() {
+    private void openDoubleBuffer()
+    {
         _doubleBuffer = new StringWriter();
         //_cdataDoubleBufferWriter = new HtmlResponseWriterImpl(_doubleBuffer, super.getContentType(), super.getCharacterEncoding());
         _cdataDoubleBufferWriter = getWrapped().cloneWithWriter(_doubleBuffer);
@@ -124,11 +137,15 @@ public class PartialResponseWriterImpl e
     }
 
     @Override
-    public void endCDATA() throws IOException {
+    public void endCDATA() throws IOException
+    {
         closeDoubleBuffer(false);
-        if (isDoubleBufferEnabled()) {
+        if (isDoubleBufferEnabled())
+        {
             _cdataDoubleBufferWriter.write("]]>");
-        } else {
+        }
+        else
+        {
             super.endCDATA();
         }
     }
@@ -146,7 +163,8 @@ public class PartialResponseWriterImpl e
      *              internal CDATA nesting counter is at the nesting depth 1
      * @throws IOException
      */
-    private void closeDoubleBuffer(boolean force) throws IOException {
+    private void closeDoubleBuffer(boolean force) throws IOException
+    {
         if (!isDoubleBufferEnabled())
         {
             return;
@@ -156,26 +174,34 @@ public class PartialResponseWriterImpl e
         * to 1 to reach the underlying closing block
         */
 
-        if (force) {
-            while (!_nestingStack.isEmpty()) {
+        if (force)
+        {
+            while (!_nestingStack.isEmpty())
+            {
                 popAndEncodeCurrentStackEntry();
 
             }
-        } else {
+        }
+        else
+        {
             popAndEncodeCurrentStackEntry();
         }
     }
 
-    private void popAndEncodeCurrentStackEntry() throws IOException {
+    private void popAndEncodeCurrentStackEntry() throws IOException
+    {
         StackEntry elem = _nestingStack.remove(0);
         StackEntry parent = (_nestingStack.isEmpty()) ? null : _nestingStack.get(0);
         String result = postProcess(elem);
-        if (parent != null) {
+        if (parent != null)
+        {
             _cdataDoubleBufferWriter = parent.getWriter();
             _doubleBuffer = parent.getDoubleBuffer();
 
             _cdataDoubleBufferWriter.write(result);
-        } else {
+        }
+        else
+        {
             _cdataDoubleBufferWriter = null;
             _doubleBuffer = null;
 
@@ -194,7 +220,8 @@ public class PartialResponseWriterImpl e
      * @return the post processed string
      * @throws IOException in case of an error
      */
-    private String postProcess(StackEntry currentElement) throws IOException {
+    private String postProcess(StackEntry currentElement) throws IOException
+    {
 
         currentElement.getWriter().flush();
         StringBuffer buffer = currentElement.getDoubleBuffer().getBuffer();
@@ -204,10 +231,10 @@ public class PartialResponseWriterImpl e
         {
             do
             {
-                buffer.replace(i, i+3, "]]><![CDATA[]]]]><![CDATA[>");
-                i=i+27; //27 is "]]><![CDATA[]]]]><![CDATA[>".length();
+                buffer.replace(i, i + 3, "]]><![CDATA[]]]]><![CDATA[>");
+                i = i + 27; //27 is "]]><![CDATA[]]]]><![CDATA[>".length();
             }
-            while ( (i = buffer.indexOf("]]>",i)) >= 0 );
+            while ((i = buffer.indexOf("]]>", i)) >= 0);
         }
         return buffer.toString();
         /*
@@ -239,7 +266,8 @@ public class PartialResponseWriterImpl e
     //--- we need to override ppr specifics to cover the case
 
     @Override
-    public void endInsert() throws IOException {
+    public void endInsert() throws IOException
+    {
         //we use a force close here to fix possible user CDATA corrections
         //under normal conditions the force close just processes the same
         //the underlying close cdata does, but nevertheless
@@ -249,7 +277,8 @@ public class PartialResponseWriterImpl e
     }
 
     @Override
-    public void endUpdate() throws IOException {
+    public void endUpdate() throws IOException
+    {
         //we use a force close here to fix possible user CDATA corrections
         //under normal conditions the force close just processes the same
         //the underlying close cdata does, but nevertheless
@@ -259,7 +288,8 @@ public class PartialResponseWriterImpl e
     }
 
     @Override
-    public void endExtension() throws IOException {
+    public void endExtension() throws IOException
+    {
         //we use a force close here to fix possible user CDATA corrections
         //under normal conditions the force close just processes the same
         //the underlying close cdata does, but nevertheless
@@ -269,7 +299,8 @@ public class PartialResponseWriterImpl e
     }
 
     @Override
-    public void endEval() throws IOException {
+    public void endEval() throws IOException
+    {
         //we use a force close here to fix possible user CDATA corrections
         //under normal conditions the force close just processes the same
         //the underlying close cdata does, but nevertheless
@@ -279,7 +310,8 @@ public class PartialResponseWriterImpl e
     }
 
     @Override
-    public void endError() throws IOException {
+    public void endError() throws IOException
+    {
         //we use a force close here to fix possible user CDATA corrections
         //under normal conditions the force close just processes the same
         //the underlying close cdata does, but nevertheless
@@ -291,85 +323,117 @@ public class PartialResponseWriterImpl e
     //--- optional delegation method ---
 
     @Override
-    public void endElement(String name) throws IOException {
-        if (isDoubleBufferEnabled()) {
+    public void endElement(String name) throws IOException
+    {
+        if (isDoubleBufferEnabled())
+        {
             _cdataDoubleBufferWriter.endElement(name);
-        } else {
+        }
+        else
+        {
             super.endElement(name);
         }
     }
 
     @Override
-    public void writeComment(Object comment) throws IOException {
-        if (isDoubleBufferEnabled()) {
+    public void writeComment(Object comment) throws IOException
+    {
+        if (isDoubleBufferEnabled())
+        {
             _cdataDoubleBufferWriter.writeComment(comment);
-        } else {
+        }
+        else
+        {
             super.writeComment(comment);
         }
     }
 
-    private boolean isDoubleBufferEnabled() {
+    private boolean isDoubleBufferEnabled()
+    {
         return !_nestingStack.isEmpty();
     }
 
     @Override
-    public void startElement(String name, UIComponent component) throws IOException {
-        if (isDoubleBufferEnabled()) {
+    public void startElement(String name, UIComponent component) throws IOException
+    {
+        if (isDoubleBufferEnabled())
+        {
             _cdataDoubleBufferWriter.startElement(name, component);
-        } else {
+        }
+        else
+        {
             super.startElement(name, component);
         }
     }
 
     @Override
-    public void writeText(Object text, String property) throws IOException {
-        if (isDoubleBufferEnabled()) {
+    public void writeText(Object text, String property) throws IOException
+    {
+        if (isDoubleBufferEnabled())
+        {
             _cdataDoubleBufferWriter.writeText(text, property);
-        } else {
+        }
+        else
+        {
             super.writeText(text, property);
         }
     }
 
     @Override
-    public void writeText(char[] text, int off, int len) throws IOException {
-        if (isDoubleBufferEnabled()) {
+    public void writeText(char[] text, int off, int len) throws IOException
+    {
+        if (isDoubleBufferEnabled())
+        {
             _cdataDoubleBufferWriter.writeText(text, off, len);
-        } else {
+        }
+        else
+        {
             super.writeText(text, off, len);
         }
     }
 
     @Override
-    public void write(char[] cbuf, int off, int len) throws IOException {
-        if (isDoubleBufferEnabled()) {
+    public void write(char[] cbuf, int off, int len) throws IOException
+    {
+        if (isDoubleBufferEnabled())
+        {
             _cdataDoubleBufferWriter.write(cbuf, off, len);
-        } else {
+        }
+        else
+        {
             super.write(cbuf, off, len);
         }
     }
 
     @Override
-    public ResponseWriter cloneWithWriter(Writer writer) {
+    public ResponseWriter cloneWithWriter(Writer writer)
+    {
         return super.cloneWithWriter(writer);
     }
 
     @Override
-    public void writeURIAttribute(String name, Object value, String property) throws IOException {
-        if (isDoubleBufferEnabled()) {
+    public void writeURIAttribute(String name, Object value, String property) throws IOException
+    {
+        if (isDoubleBufferEnabled())
+        {
             _cdataDoubleBufferWriter.writeURIAttribute(name, value, property);
-        } else {
+        }
+        else
+        {
             super.writeURIAttribute(name, value, property);
         }
     }
 
     @Override
-    public void close() throws IOException {
+    public void close() throws IOException
+    {
         //in case of a close
         //we have a user error of a final CDATA block
         //we do some error correction here
         //since a close is issued we do not care about
         //a proper closure of the cdata block here anymore
-        if (isDoubleBufferEnabled()) {
+        if (isDoubleBufferEnabled())
+        {
             //we have to properly close all nested cdata stacks
             //end end our cdata block if open
             closeDoubleBuffer(true);
@@ -380,93 +444,131 @@ public class PartialResponseWriterImpl e
     }
 
     @Override
-    public void flush() throws IOException {
-        if (isDoubleBufferEnabled()) {
+    public void flush() throws IOException
+    {
+        if (isDoubleBufferEnabled())
+        {
             _cdataDoubleBufferWriter.flush();
         }
         super.flush();
     }
 
     @Override
-    public void writeAttribute(String name, Object value, String property) throws IOException {
-        if (isDoubleBufferEnabled()) {
+    public void writeAttribute(String name, Object value, String property) throws IOException
+    {
+        if (isDoubleBufferEnabled())
+        {
             _cdataDoubleBufferWriter.writeAttribute(name, value, property);
-        } else {
+        }
+        else
+        {
             super.writeAttribute(name, value, property);
         }
     }
 
     @Override
-    public void writeText(Object object, UIComponent component, String string) throws IOException {
-        if (isDoubleBufferEnabled()) {
+    public void writeText(Object object, UIComponent component, String string) throws IOException
+    {
+        if (isDoubleBufferEnabled())
+        {
             _cdataDoubleBufferWriter.writeText(object, component, string);
-        } else {
+        }
+        else
+        {
             super.writeText(object, component, string);
         }
     }
 
     @Override
-    public Writer append(char c) throws IOException {
-        if (isDoubleBufferEnabled()) {
+    public Writer append(char c) throws IOException
+    {
+        if (isDoubleBufferEnabled())
+        {
             _cdataDoubleBufferWriter.append(c);
             return this;
-        } else {
+        }
+        else
+        {
             return super.append(c);
         }
     }
 
     @Override
-    public Writer append(CharSequence csq, int start, int end) throws IOException {
-        if (isDoubleBufferEnabled()) {
+    public Writer append(CharSequence csq, int start, int end) throws IOException
+    {
+        if (isDoubleBufferEnabled())
+        {
             _cdataDoubleBufferWriter.append(csq, start, end);
             return this;
-        } else {
+        }
+        else
+        {
             return super.append(csq, start, end);
         }
     }
 
     @Override
-    public Writer append(CharSequence csq) throws IOException {
-        if (isDoubleBufferEnabled()) {
+    public Writer append(CharSequence csq) throws IOException
+    {
+        if (isDoubleBufferEnabled())
+        {
             _cdataDoubleBufferWriter.append(csq);
             return this;
-        } else {
+        }
+        else
+        {
             return super.append(csq);
         }
     }
 
     @Override
-    public void write(char[] cbuf) throws IOException {
-        if (isDoubleBufferEnabled()) {
+    public void write(char[] cbuf) throws IOException
+    {
+        if (isDoubleBufferEnabled())
+        {
             _cdataDoubleBufferWriter.write(cbuf);
-        } else {
+        }
+        else
+        {
             super.write(cbuf);
         }
     }
 
     @Override
-    public void write(int c) throws IOException {
-        if (isDoubleBufferEnabled()) {
+    public void write(int c) throws IOException
+    {
+        if (isDoubleBufferEnabled())
+        {
             _cdataDoubleBufferWriter.write(c);
-        } else {
+        }
+        else
+        {
             super.write(c);
         }
     }
 
     @Override
-    public void write(String str, int off, int len) throws IOException {
-        if (isDoubleBufferEnabled()) {
+    public void write(String str, int off, int len) throws IOException
+    {
+        if (isDoubleBufferEnabled())
+        {
             _cdataDoubleBufferWriter.write(str, off, len);
-        } else {
+        }
+        else
+        {
             super.write(str, off, len);
         }
     }
 
     @Override
-    public void write(String str) throws IOException {
-        if (isDoubleBufferEnabled()) {
+    public void write(String str) throws IOException
+    {
+        if (isDoubleBufferEnabled())
+        {
             _cdataDoubleBufferWriter.write(str);
-        } else {
+        }
+        else
+        {
             super.write(str);
         }
     }

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java?rev=1188631&r1=1188630&r2=1188631&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java Tue Oct 25 12:33:10 2011
@@ -53,7 +53,8 @@ import org.apache.myfaces.shared.config.
 import org.apache.myfaces.shared.util.ExternalContextUtils;
 import org.apache.myfaces.shared.util.StringUtils;
 
-public class PartialViewContextImpl extends PartialViewContext {
+public class PartialViewContextImpl extends PartialViewContext
+{
 
     private static final String FACES_REQUEST = "Faces-Request";
     private static final String PARTIAL_AJAX = "partial/ajax";
@@ -87,22 +88,26 @@ public class PartialViewContextImpl exte
     private Boolean _renderAll = null;
     private PartialResponseWriter _partialResponseWriter = null;
 
-    public PartialViewContextImpl(FacesContext context) {
+    public PartialViewContextImpl(FacesContext context)
+    {
         _facesContext = context;
     }
 
     @Override
-    public boolean isAjaxRequest() {
+    public boolean isAjaxRequest()
+    {
         assertNotReleased();
         /*
          * Internal extension for
          * https://issues.apache.org/jira/browse/MYFACES-2841
          * will be changed for 2.1 to the official marker
          */
-        if (_iframeRequest == null) {
+        if (_iframeRequest == null)
+        {
             isIFrameRequest();
         }
-        if (_ajaxRequest == null) {
+        if (_ajaxRequest == null)
+        {
             String requestType = _facesContext.getExternalContext().
                     getRequestHeaderMap().get(FACES_REQUEST);
             _ajaxRequest = (requestType != null && PARTIAL_AJAX.equals(requestType));
@@ -112,14 +117,17 @@ public class PartialViewContextImpl exte
     }
 
     @Override
-    public boolean isExecuteAll() {
+    public boolean isExecuteAll()
+    {
         assertNotReleased();
 
-        if (isAjaxRequest()) {
+        if (isAjaxRequest())
+        {
             String executeMode = _facesContext.getExternalContext().
                     getRequestParameterMap().get(
                     PartialViewContext.PARTIAL_EXECUTE_PARAM_NAME);
-            if (PartialViewContext.ALL_PARTIAL_PHASE_CLIENT_IDS.equals(executeMode)) {
+            if (PartialViewContext.ALL_PARTIAL_PHASE_CLIENT_IDS.equals(executeMode))
+            {
                 return true;
             }
         }
@@ -127,31 +135,38 @@ public class PartialViewContextImpl exte
     }
 
     @Override
-    public boolean isPartialRequest() {
+    public boolean isPartialRequest()
+    {
         assertNotReleased();
 
-        if (_partialRequest == null) {
+        if (_partialRequest == null)
+        {
             String requestType = _facesContext.getExternalContext().
                     getRequestHeaderMap().get(FACES_REQUEST);
             _partialRequest = (requestType != null && PARTIAL_PROCESS.equals(requestType));
         }
-        return isAjaxRequest()  || _partialRequest;
+        return isAjaxRequest() || _partialRequest;
     }
 
     @Override
-    public boolean isRenderAll() {
+    public boolean isRenderAll()
+    {
         assertNotReleased();
 
-        if (_renderAll == null) {
-            if (isAjaxRequest()) {
+        if (_renderAll == null)
+        {
+            if (isAjaxRequest())
+            {
                 String executeMode = _facesContext.getExternalContext().
                         getRequestParameterMap().get(
                         PartialViewContext.PARTIAL_RENDER_PARAM_NAME);
-                if (PartialViewContext.ALL_PARTIAL_PHASE_CLIENT_IDS.equals(executeMode)) {
+                if (PartialViewContext.ALL_PARTIAL_PHASE_CLIENT_IDS.equals(executeMode))
+                {
                     _renderAll = true;
                 }
             }
-            if (_renderAll == null) {
+            if (_renderAll == null)
+            {
                 _renderAll = false;
             }
         }
@@ -166,15 +181,18 @@ public class PartialViewContextImpl exte
      *
      * @return true if the current request is an iframe based ajax request
      */
-    public boolean isIFrameRequest() {
-        if(_iframeRequest == null) {
+    public boolean isIFrameRequest()
+    {
+        if (_iframeRequest == null)
+        {
             _iframeRequest = _facesContext.getExternalContext().getRequestParameterMap().containsKey(PARTIAL_IFRAME);
         }
         return _iframeRequest;
     }
 
     @Override
-    public void setPartialRequest(boolean isPartialRequest) {
+    public void setPartialRequest(boolean isPartialRequest)
+    {
         assertNotReleased();
 
         _partialRequest = isPartialRequest;
@@ -182,25 +200,29 @@ public class PartialViewContextImpl exte
     }
 
     @Override
-    public void setRenderAll(boolean renderAll) {
+    public void setRenderAll(boolean renderAll)
+    {
         assertNotReleased();
 
         _renderAll = renderAll;
     }
 
     @Override
-    public Collection<String> getExecuteIds() {
+    public Collection<String> getExecuteIds()
+    {
         assertNotReleased();
 
-        if (_executeClientIds == null) {
+        if (_executeClientIds == null)
+        {
             String executeMode = _facesContext.getExternalContext().
                     getRequestParameterMap().get(
                     PartialViewContext.PARTIAL_EXECUTE_PARAM_NAME);
 
             if (executeMode != null && !"".equals(executeMode) &&
                     //!PartialViewContext.NO_PARTIAL_PHASE_CLIENT_IDS.equals(executeMode) &&
-                    !PartialViewContext.ALL_PARTIAL_PHASE_CLIENT_IDS.equals(executeMode)) {
-                
+                    !PartialViewContext.ALL_PARTIAL_PHASE_CLIENT_IDS.equals(executeMode))
+            {
+
                 String[] clientIds = StringUtils.splitShortString(_replaceTabOrEnterCharactersWithSpaces(executeMode), ' ');
 
                 //The collection must be mutable
@@ -215,35 +237,37 @@ public class PartialViewContextImpl exte
                 // The "javax.faces.source" parameter needs to be added to the list of
                 // execute ids if missing (otherwise, we'd never execute an action associated
                 // with, e.g., a button).
-                
+
                 String source = _facesContext.getExternalContext().getRequestParameterMap().get
-                    (PartialViewContextImpl.SOURCE_PARAM_NAME);
-                
+                        (PartialViewContextImpl.SOURCE_PARAM_NAME);
+
                 if (source != null)
                 {
                     source = source.trim();
-                    
-                    if (!tempList.contains (source))
+
+                    if (!tempList.contains(source))
                     {
-                        tempList.add (source);
+                        tempList.add(source);
                     }
                 }
-                
+
                 _executeClientIds = tempList;
-            } else {
+            }
+            else
+            {
                 _executeClientIds = new ArrayList<String>();
             }
         }
         return _executeClientIds;
     }
-    
+
     private String _replaceTabOrEnterCharactersWithSpaces(String mode)
     {
         StringBuilder builder = new StringBuilder(mode.length());
         for (int i = 0; i < mode.length(); i++)
         {
-            if (mode.charAt(i) == '\t' || 
-                mode.charAt(i) == '\n')
+            if (mode.charAt(i) == '\t' ||
+                    mode.charAt(i) == '\n')
             {
                 builder.append(' ');
             }
@@ -256,10 +280,12 @@ public class PartialViewContextImpl exte
     }
 
     @Override
-    public Collection<String> getRenderIds() {
+    public Collection<String> getRenderIds()
+    {
         assertNotReleased();
 
-        if (_renderClientIds == null) {
+        if (_renderClientIds == null)
+        {
             String renderMode = _facesContext.getExternalContext().
                     getRequestParameterMap().get(
                     PartialViewContext.PARTIAL_RENDER_PARAM_NAME);
@@ -280,12 +306,14 @@ public class PartialViewContextImpl exte
                     }
                 }
                 _renderClientIds = tempList;
-            } else {
+            }
+            else
+            {
                 _renderClientIds = new ArrayList<String>();
-                
-                if (PartialViewContext.ALL_PARTIAL_PHASE_CLIENT_IDS.equals (renderMode))
+
+                if (PartialViewContext.ALL_PARTIAL_PHASE_CLIENT_IDS.equals(renderMode))
                 {
-                    _renderClientIds.add (PartialResponseWriter.RENDER_ALL_MARKER);
+                    _renderClientIds.add(PartialResponseWriter.RENDER_ALL_MARKER);
                 }
             }
         }
@@ -293,9 +321,10 @@ public class PartialViewContextImpl exte
     }
 
     @Override
-    public PartialResponseWriter getPartialResponseWriter() {
+    public PartialResponseWriter getPartialResponseWriter()
+    {
         assertNotReleased();
-        
+
         if (_partialResponseWriter == null)
         {
             ResponseWriter responseWriter = _facesContext.getResponseWriter();
@@ -314,7 +343,7 @@ public class PartialViewContextImpl exte
                         // so we have to try to calculate the renderKitId and return a 
                         // RenderKit instance, to send the response.
                         String renderKitId = _facesContext.getApplication().getViewHandler().calculateRenderKitId(_facesContext);
-                        RenderKitFactory rkf = (RenderKitFactory)FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
+                        RenderKitFactory rkf = (RenderKitFactory) FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
                         renderKit = rkf.getRenderKit(_facesContext, renderKitId);
                     }
                     responseWriter = renderKit.createResponseWriter(
@@ -323,7 +352,7 @@ public class PartialViewContextImpl exte
                 }
                 catch (IOException e)
                 {
-                    throw new IllegalStateException("Cannot create Partial Response Writer",e);
+                    throw new IllegalStateException("Cannot create Partial Response Writer", e);
                 }
             }
             // It is possible that the RenderKit return a PartialResponseWriter instance when 
@@ -347,28 +376,29 @@ public class PartialViewContextImpl exte
      *
      */
     @Override
-    public void processPartial(PhaseId phaseId) {
+    public void processPartial(PhaseId phaseId)
+    {
         assertNotReleased();
 
         UIViewRoot viewRoot = _facesContext.getViewRoot();
 
-        if (phaseId == PhaseId.APPLY_REQUEST_VALUES 
-                || phaseId == PhaseId.PROCESS_VALIDATIONS 
-                || phaseId == PhaseId.UPDATE_MODEL_VALUES) 
+        if (phaseId == PhaseId.APPLY_REQUEST_VALUES
+                || phaseId == PhaseId.PROCESS_VALIDATIONS
+                || phaseId == PhaseId.UPDATE_MODEL_VALUES)
         {
             processPartialExecute(viewRoot, phaseId);
-        } 
-        else if (phaseId == PhaseId.RENDER_RESPONSE) 
+        }
+        else if (phaseId == PhaseId.RENDER_RESPONSE)
         {
             processPartialRendering(viewRoot, phaseId);
         }
     }
 
-    private void processPartialExecute(UIViewRoot viewRoot, PhaseId phaseId) 
+    private void processPartialExecute(UIViewRoot viewRoot, PhaseId phaseId)
     {
         PartialViewContext pvc = _facesContext.getPartialViewContext();
         Collection<String> executeIds = pvc.getExecuteIds();
-        if (executeIds == null || executeIds.isEmpty()) 
+        if (executeIds == null || executeIds.isEmpty())
         {
             return;
         }
@@ -379,12 +409,12 @@ public class PartialViewContextImpl exte
         viewRoot.visitTree(visitCtx, new PhaseAwareVisitCallback(_facesContext, phaseId));
     }
 
-    private void processPartialRendering(UIViewRoot viewRoot, PhaseId phaseId) 
+    private void processPartialRendering(UIViewRoot viewRoot, PhaseId phaseId)
     {
         //TODO process partial rendering
         //https://issues.apache.org/jira/browse/MYFACES-2118
         //Collection<String> renderIds = getRenderIds();
-        
+
         // We need to always update the view state marker when processing partial
         // rendering, because there is no way to check when the state has been changed
         // or not. Anyway, if we return empty response, according to the spec a javascript
@@ -397,7 +427,7 @@ public class PartialViewContextImpl exte
         // this could cause problems if PartialResponseWriter is wrapped
         PartialResponseWriter writer = _facesContext.getPartialViewContext().getPartialResponseWriter();
         PartialViewContext pvc = _facesContext.getPartialViewContext();
-        
+
         ResponseWriter oldWriter = _facesContext.getResponseWriter();
         boolean inDocument = false;
 
@@ -412,7 +442,7 @@ public class PartialViewContextImpl exte
         //http://support.microsoft.com/kb/234067
         externalContext.addResponseHeader("Expires", "-1");
 
-        try 
+        try
         {
             writer.startDocument();
             inDocument = true;
@@ -431,9 +461,9 @@ public class PartialViewContextImpl exte
                     Set<VisitHint> hints = new HashSet<VisitHint>();
                     // unrendered have to be skipped, transient definitely must be added to our list!
                     hints.add(VisitHint.SKIP_UNRENDERED);
-                    
+
                     // render=@all, so output the body.
-                    if (renderIds.contains (PartialResponseWriter.RENDER_ALL_MARKER))
+                    if (renderIds.contains(PartialResponseWriter.RENDER_ALL_MARKER))
                     {
                         processRenderAll(viewRoot, writer);
                     }
@@ -441,7 +471,7 @@ public class PartialViewContextImpl exte
                     {
                         List<UIComponent> updatedComponents = null;
                         if (!ExternalContextUtils.isPortlet(_facesContext.getExternalContext()) &&
-                             MyfacesConfig.getCurrentInstance(externalContext).isStrictJsf2RefreshTargetAjax())
+                                MyfacesConfig.getCurrentInstance(externalContext).isStrictJsf2RefreshTargetAjax())
                         {
                             RequestViewContext rvc = RequestViewContext.getCurrentInstance(_facesContext);
                             if (rvc.isRenderTarget("head"))
@@ -506,12 +536,12 @@ public class PartialViewContextImpl exte
                     }
                 }
             }
-            
+
             // invoke encodeAll() on every UIViewParameter in the view to 
             // enable every UIViewParameter to save its value in the state
             // just like UIViewRoot.encodeEnd() does on a normal request
             // (see MYFACES-2645 for details)
-            Collection<UIViewParameter> viewParams = ViewMetadata.getViewParameters(viewRoot);    
+            Collection<UIViewParameter> viewParams = ViewMetadata.getViewParameters(viewRoot);
             if (!viewParams.isEmpty())
             {
                 for (UIViewParameter param : viewParams)
@@ -519,7 +549,7 @@ public class PartialViewContextImpl exte
                     param.encodeAll(_facesContext);
                 }
             }
-            
+
             //Retrieve the state and apply it if it is not null.
             String viewState = _facesContext.getApplication().getStateManager().getViewState(_facesContext);
             if (viewState != null)
@@ -528,22 +558,32 @@ public class PartialViewContextImpl exte
                 writer.write(viewState);
                 writer.endUpdate();
             }
-        } catch (IOException ex) {
+        }
+        catch (IOException ex)
+        {
             Logger log = Logger.getLogger(PartialViewContextImpl.class.getName());
-            if (log.isLoggable(Level.SEVERE)) {
-                log.log(Level.SEVERE, "" , ex);
+            if (log.isLoggable(Level.SEVERE))
+            {
+                log.log(Level.SEVERE, "", ex);
             }
 
-        } finally {
-            try {
-                if (inDocument) {
+        }
+        finally
+        {
+            try
+            {
+                if (inDocument)
+                {
                     writer.endDocument();
                 }
                 writer.flush();
-            } catch (IOException ex) {
+            }
+            catch (IOException ex)
+            {
                 Logger log = Logger.getLogger(PartialViewContextImpl.class.getName());
-                if (log.isLoggable(Level.SEVERE)) {
-                    log.log(Level.SEVERE, "" , ex);
+                if (log.isLoggable(Level.SEVERE))
+                {
+                    log.log(Level.SEVERE, "", ex);
                 }
             }
 
@@ -551,26 +591,26 @@ public class PartialViewContextImpl exte
         }
 
     }
-    
+
     private void processRenderAll(UIViewRoot viewRoot, PartialResponseWriter writer) throws IOException
     {
         //java.util.Iterator<UIComponent> iter = viewRoot.getFacetsAndChildren();
-        writer.startUpdate (PartialResponseWriter.RENDER_ALL_MARKER);
+        writer.startUpdate(PartialResponseWriter.RENDER_ALL_MARKER);
         //while (iter.hasNext()) 
         //{ 
-            //UIComponent comp = iter.next();
-            
-            //TODO: Do not check for a specific instance, 
-            //just render all children.
-            //if (comp instanceof javax.faces.component.html.HtmlBody)
-            //{
-                //comp.encodeAll (_facesContext);
-            //}
+        //UIComponent comp = iter.next();
+
+        //TODO: Do not check for a specific instance,
+        //just render all children.
+        //if (comp instanceof javax.faces.component.html.HtmlBody)
+        //{
+        //comp.encodeAll (_facesContext);
+        //}
         //}
         for (int i = 0, childCount = viewRoot.getChildCount(); i < childCount; i++)
         {
             UIComponent comp = viewRoot.getChildren().get(i);
-            comp.encodeAll (_facesContext);
+            comp.encodeAll(_facesContext);
         }
         writer.endUpdate();
     }
@@ -578,14 +618,17 @@ public class PartialViewContextImpl exte
     /**
      * has to be thrown in many of the methods if the method is called after the instance has been released!
      */
-    private void assertNotReleased() {
-        if (_released) {
+    private void assertNotReleased()
+    {
+        if (_released)
+        {
             throw new IllegalStateException("Error the FacesContext is already released!");
         }
     }
 
     @Override
-    public void release() {
+    public void release()
+    {
         assertNotReleased();
         _executeClientIds = null;
         _renderClientIds = null;
@@ -595,7 +638,7 @@ public class PartialViewContextImpl exte
         _facesContext = null;
         _released = true;
     }
-    
+
     private UIComponent findHeadComponent(UIViewRoot root)
     {
         for (UIComponent child : root.getChildren())
@@ -617,7 +660,7 @@ public class PartialViewContextImpl exte
         }
         return null;
     }
-    
+
     private UIComponent findBodyComponent(UIViewRoot root)
     {
         for (UIComponent child : root.getChildren())
@@ -640,34 +683,47 @@ public class PartialViewContextImpl exte
         return null;
     }
 
-    private class PhaseAwareVisitCallback implements VisitCallback {
+    private class PhaseAwareVisitCallback implements VisitCallback
+    {
 
         private PhaseId _phaseId;
         private FacesContext _facesContext;
         private List<UIComponent> _alreadyUpdatedComponents;
 
-        public PhaseAwareVisitCallback(FacesContext facesContext, PhaseId phaseId) {
+        public PhaseAwareVisitCallback(FacesContext facesContext, PhaseId phaseId)
+        {
             this._phaseId = phaseId;
             this._facesContext = facesContext;
             this._alreadyUpdatedComponents = null;
         }
-        
-        public PhaseAwareVisitCallback(FacesContext facesContext, PhaseId phaseId, List<UIComponent> alreadyUpdatedComponents) {
+
+        public PhaseAwareVisitCallback(FacesContext facesContext, PhaseId phaseId, List<UIComponent> alreadyUpdatedComponents)
+        {
             this._phaseId = phaseId;
             this._facesContext = facesContext;
             this._alreadyUpdatedComponents = alreadyUpdatedComponents;
         }
 
-        public VisitResult visit(VisitContext context, UIComponent target) {
-            if (_phaseId == PhaseId.APPLY_REQUEST_VALUES) {
+        public VisitResult visit(VisitContext context, UIComponent target)
+        {
+            if (_phaseId == PhaseId.APPLY_REQUEST_VALUES)
+            {
                 target.processDecodes(_facesContext);
-            } else if (_phaseId == PhaseId.PROCESS_VALIDATIONS) {
+            }
+            else if (_phaseId == PhaseId.PROCESS_VALIDATIONS)
+            {
                 target.processValidators(_facesContext);
-            } else if (_phaseId == PhaseId.UPDATE_MODEL_VALUES) {
+            }
+            else if (_phaseId == PhaseId.UPDATE_MODEL_VALUES)
+            {
                 target.processUpdates(_facesContext);
-            } else if (_phaseId == PhaseId.RENDER_RESPONSE) {
+            }
+            else if (_phaseId == PhaseId.RENDER_RESPONSE)
+            {
                 processRenderComponent(target);
-            } else {
+            }
+            else
+            {
                 throw new IllegalStateException("PPR Response, illegale phase called");
             }
 
@@ -682,7 +738,8 @@ public class PartialViewContextImpl exte
          *
          * @param target the target component to be handled!
          */
-        private void processRenderComponent(UIComponent target) {
+        private void processRenderComponent(UIComponent target)
+        {
             boolean inUpdate = false;
             PartialResponseWriter writer = (PartialResponseWriter) _facesContext.getResponseWriter();
             if (this._alreadyUpdatedComponents != null)
@@ -698,22 +755,33 @@ public class PartialViewContextImpl exte
                     parent = parent.getParent();
                 }
             }
-            try {
+            try
+            {
                 writer.startUpdate(target.getClientId(_facesContext));
                 inUpdate = true;
                 target.encodeAll(_facesContext);
-            } catch (IOException ex) {
+            }
+            catch (IOException ex)
+            {
                 Logger log = Logger.getLogger(PartialViewContextImpl.class.getName());
-                if (log.isLoggable(Level.SEVERE)) {
+                if (log.isLoggable(Level.SEVERE))
+                {
                     log.log(Level.SEVERE, "IOException for rendering component", ex);
                 }
-            } finally {
-                if (inUpdate) {
-                    try {
+            }
+            finally
+            {
+                if (inUpdate)
+                {
+                    try
+                    {
                         writer.endUpdate();
-                    } catch (IOException ex) {
+                    }
+                    catch (IOException ex)
+                    {
                         Logger log = Logger.getLogger(PartialViewContextImpl.class.getName());
-                        if (log.isLoggable(Level.SEVERE)) {
+                        if (log.isLoggable(Level.SEVERE))
+                        {
                             log.log(Level.SEVERE, "IOException for rendering component, stopping update rendering", ex);
                         }
                     }

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/renderkit/ServerSideStateCacheImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/renderkit/ServerSideStateCacheImpl.java?rev=1188631&r1=1188630&r2=1188631&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/renderkit/ServerSideStateCacheImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/renderkit/ServerSideStateCacheImpl.java Tue Oct 25 12:33:10 2011
@@ -78,12 +78,16 @@ class ServerSideStateCacheImpl extends S
      * 
      * <p>Only applicable if state saving method is "server" (= default). For example, if this param has value = 2 and 
      * in your custom webapp there is a form that is clicked 3 times, only 2 views
-     * will be stored and the third one (the one stored the first time) will be removed from session, even if the view can
-     * store more sessions org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION. This feature becomes useful for multi-window applications.
-     * where without this feature a window can swallow all view slots so the other ones will throw ViewExpiredException.</p>
+     * will be stored and the third one (the one stored the first time) will be
+     * removed from session, even if the view can
+     * store more sessions org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION.
+     * This feature becomes useful for multi-window applications.
+     * where without this feature a window can swallow all view slots so
+     * the other ones will throw ViewExpiredException.</p>
      */
     @JSFWebConfigParam(since="2.0.6", classType="java.lang.Integer", group="state", tags="performance")
-    private static final String NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION_PARAM = "org.apache.myfaces.NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION";
+    private static final String NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION_PARAM
+            = "org.apache.myfaces.NUMBER_OF_SEQUENTIAL_VIEWS_IN_SESSION";
     
     /**
      * Default value for <code>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</code> context parameter.
@@ -104,7 +108,8 @@ class ServerSideStateCacheImpl extends S
     /**
      * Indicates that the serialized state will be compressed before it is written to the session. By default true.
      * 
-     * Only applicable if state saving method is "server" (= default) and if <code>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</code> is <code>true</code> (= default).
+     * Only applicable if state saving method is "server" (= default) and if
+     * <code>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</code> is <code>true</code> (= default).
      * If <code>true</code> (default) the serialized state will be compressed before it is written to the session.
      * If <code>false</code> the state will not be compressed.
      */
@@ -144,7 +149,8 @@ class ServerSideStateCacheImpl extends S
      * </ul>
      * 
      */
-    @JSFWebConfigParam(defaultValue="off", expectedValues="off, no, hard-soft, soft, soft-weak, weak", since="1.2.5", group="state", tags="performance")
+    @JSFWebConfigParam(defaultValue="off", expectedValues="off, no, hard-soft, soft, soft-weak, weak",
+                       since="1.2.5", group="state", tags="performance")
     private static final String CACHE_OLD_VIEWS_IN_SESSION_MODE = "org.apache.myfaces.CACHE_OLD_VIEWS_IN_SESSION_MODE";
     
     /**
@@ -171,7 +177,8 @@ class ServerSideStateCacheImpl extends S
      * The default value is false.</p>
      */
     @JSFWebConfigParam(since="2.0.6", defaultValue="false", expectedValues="true, false", group="state")
-    private static final String USE_FLASH_SCOPE_PURGE_VIEWS_IN_SESSION = "org.apache.myfaces.USE_FLASH_SCOPE_PURGE_VIEWS_IN_SESSION";
+    private static final String USE_FLASH_SCOPE_PURGE_VIEWS_IN_SESSION
+            = "org.apache.myfaces.USE_FLASH_SCOPE_PURGE_VIEWS_IN_SESSION";
 
     private static final int UNCOMPRESSED_FLAG = 0;
     private static final int COMPRESSED_FLAG = 1;
@@ -221,9 +228,11 @@ class ServerSideStateCacheImpl extends S
             if (key == null )
             {
                 if (isUseFlashScopePurgeViewsInSession(context.getExternalContext()) && 
-                    Boolean.TRUE.equals(context.getExternalContext().getRequestMap().get("oam.Flash.REDIRECT.PREVIOUSREQUEST")))
+                    Boolean.TRUE.equals(context.getExternalContext().getRequestMap()
+                                               .get("oam.Flash.REDIRECT.PREVIOUSREQUEST")))
                 {
-                    key = (SerializedViewKey) context.getExternalContext().getFlash().get(RESTORED_VIEW_KEY_REQUEST_ATTR);
+                    key = (SerializedViewKey)
+                            context.getExternalContext().getFlash().get(RESTORED_VIEW_KEY_REQUEST_ATTR);
                 }
             }
         }
@@ -283,7 +292,8 @@ class ServerSideStateCacheImpl extends S
             }
             attributeMap.put(RESTORED_SERIALIZED_VIEW_REQUEST_ATTR, serializedView);
             
-            if (getNumberOfSequentialViewsInSession(externalContext) != null && getNumberOfSequentialViewsInSession(externalContext) > 0)
+            if (getNumberOfSequentialViewsInSession(externalContext) != null &&
+                getNumberOfSequentialViewsInSession(externalContext) > 0)
             {
                 SerializedViewKey key = new SerializedViewKey(viewId, sequence);
                 attributeMap.put(RESTORED_VIEW_KEY_REQUEST_ATTR, key);
@@ -453,7 +463,8 @@ class ServerSideStateCacheImpl extends S
         {
             if (log.isLoggable(Level.FINEST))
             {
-                log.finest("Processing deserializeView - deserializing serialized state. Bytes : " + ((byte[]) state).length);
+                log.finest("Processing deserializeView - deserializing serialized state. Bytes : "
+                           + ((byte[]) state).length);
             }
 
             try
@@ -529,7 +540,8 @@ class ServerSideStateCacheImpl extends S
         }
         else
         {
-            log.severe("Exiting deserializeView - this method should not be called with a state of type : "+state.getClass());
+            log.severe("Exiting deserializeView - this method should not be called with a state of type : "
+                       + state.getClass());
             return null;
         }
     }
@@ -566,7 +578,8 @@ class ServerSideStateCacheImpl extends S
         // the garbage collector if free memory is low
         private transient Map<Object, Object> _oldSerializedViews = null;
 
-        public synchronized void add(FacesContext context, Object state, Integer nextSequence, SerializedViewKey previousRestoredKey)
+        public synchronized void add(FacesContext context, Object state, Integer nextSequence,
+                                     SerializedViewKey previousRestoredKey)
         {
             SerializedViewKey key = new SerializedViewKey(context.getViewRoot().getViewId(), nextSequence);
             _serializedViews.put(key, state);
@@ -875,7 +888,9 @@ class ServerSideStateCacheImpl extends S
 
         Integer serverStateId = getServerStateId((Object[]) viewState);
 
-        return (serverStateId == null) ? null : getSerializedViewFromServletSession(facesContext, viewId, serverStateId);
+        return (serverStateId == null)
+                ? null
+                : getSerializedViewFromServletSession(facesContext, viewId, serverStateId);
     }
 
     public Object encodeSerializedState(FacesContext facesContext, Object serializedView)