myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject [myfaces] branch master updated: refactored
Date Tue, 25 Dec 2018 23:59:07 GMT
This is an automated email from the ASF dual-hosted git repository.

tandraschko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces.git


The following commit(s) were added to refs/heads/master by this push:
     new 6c30d9c  refactored
6c30d9c is described below

commit 6c30d9cd98fd8748dd9b4c2b76e35a0a8e7ad465
Author: Thomas Andraschko <tandraschko@apache.org>
AuthorDate: Wed Dec 26 00:59:19 2018 +0100

    refactored
---
 .../java/javax/faces/application/StateManager.java |  2 +-
 .../javax/faces/convert/BigDecimalConverter.java   | 26 +++++------
 .../javax/faces/convert/BigIntegerConverter.java   |  2 +
 .../java/javax/faces/convert/BooleanConverter.java |  2 +
 .../java/javax/faces/convert/ByteConverter.java    |  2 +
 .../javax/faces/convert/CharacterConverter.java    |  2 +
 .../javax/faces/convert/DateTimeConverter.java     | 10 ++--
 .../java/javax/faces/convert/DoubleConverter.java  | 40 ++--------------
 .../java/javax/faces/convert/FloatConverter.java   |  2 +
 .../java/javax/faces/convert/IntegerConverter.java |  2 +
 .../java/javax/faces/convert/LongConverter.java    |  2 +
 .../java/javax/faces/convert/NumberConverter.java  | 21 +++++++--
 .../java/javax/faces/convert/ShortConverter.java   |  2 +
 .../main/java/javax/faces/view/ViewMetadata.java   | 45 +++++-------------
 .../context/servlet/PartialViewContextImpl.java    | 53 ++++++++--------------
 .../javax/faces/convert/DoubleConverterTest.java   | 41 -----------------
 16 files changed, 90 insertions(+), 164 deletions(-)

diff --git a/api/src/main/java/javax/faces/application/StateManager.java b/api/src/main/java/javax/faces/application/StateManager.java
index 5198b24..1cfa088 100755
--- a/api/src/main/java/javax/faces/application/StateManager.java
+++ b/api/src/main/java/javax/faces/application/StateManager.java
@@ -250,7 +250,7 @@ public abstract class StateManager
     }
     
     /**
-     * TODO: This method should be called from somewhere when ajax response is created to
update the state saving param
+     * This method should be called from somewhere when ajax response is created to update
the state saving param
      * on client. The place where this method is called is an implementation detail, so there
is no references about
      * from where in the spec javadoc. 
      * 
diff --git a/api/src/main/java/javax/faces/convert/BigDecimalConverter.java b/api/src/main/java/javax/faces/convert/BigDecimalConverter.java
index aa5b463..ac8110f 100755
--- a/api/src/main/java/javax/faces/convert/BigDecimalConverter.java
+++ b/api/src/main/java/javax/faces/convert/BigDecimalConverter.java
@@ -43,6 +43,7 @@ public class BigDecimalConverter
     }
 
     // METHODS
+    @Override
     public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String
value)
     {
         if (facesContext == null)
@@ -56,27 +57,26 @@ public class BigDecimalConverter
 
         if (value != null)
         {
+            value = value.trim();
+            if (value.length() > 0)
             {
-                value = value.trim();
-                if (value.length() > 0)
+                try
                 {
-                    try
-                    {
-                        return new BigDecimal(value.trim());
-                    }
-                    catch (NumberFormatException e)
-                    {
-                        throw new ConverterException(_MessageUtils.getErrorMessage(facesContext,
-                                       DECIMAL_ID,
-                                       new Object[]{value,new BigDecimal(4815.16).toString(),
-                                                    _MessageUtils.getLabel(facesContext,
uiComponent)}), e);
-                    }
+                    return new BigDecimal(value.trim());
+                }
+                catch (NumberFormatException e)
+                {
+                    throw new ConverterException(_MessageUtils.getErrorMessage(facesContext,
+                                   DECIMAL_ID,
+                                   new Object[]{value,new BigDecimal(4815.16).toString(),
+                                                _MessageUtils.getLabel(facesContext, uiComponent)}),
e);
                 }
             }
         }
         return null;
     }
 
+    @Override
     public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object
value)
     {
         if (facesContext == null)
diff --git a/api/src/main/java/javax/faces/convert/BigIntegerConverter.java b/api/src/main/java/javax/faces/convert/BigIntegerConverter.java
index 7a470b8..375c419 100755
--- a/api/src/main/java/javax/faces/convert/BigIntegerConverter.java
+++ b/api/src/main/java/javax/faces/convert/BigIntegerConverter.java
@@ -43,6 +43,7 @@ public class BigIntegerConverter
     }
 
     // METHODS
+    @Override
     public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String
value)
     {
         if (facesContext == null)
@@ -74,6 +75,7 @@ public class BigIntegerConverter
         return null;
     }
 
+    @Override
     public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object
value)
     {
         if (facesContext == null)
diff --git a/api/src/main/java/javax/faces/convert/BooleanConverter.java b/api/src/main/java/javax/faces/convert/BooleanConverter.java
index c4ddd2e..66e80cd 100755
--- a/api/src/main/java/javax/faces/convert/BooleanConverter.java
+++ b/api/src/main/java/javax/faces/convert/BooleanConverter.java
@@ -41,6 +41,7 @@ public class BooleanConverter
     }
 
     // METHODS
+    @Override
     public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String
value)
     {
         if (facesContext == null)
@@ -72,6 +73,7 @@ public class BooleanConverter
         return null;
     }
 
+    @Override
     public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object
value)
     {
         if (facesContext == null)
diff --git a/api/src/main/java/javax/faces/convert/ByteConverter.java b/api/src/main/java/javax/faces/convert/ByteConverter.java
index 298ca03..f136202 100755
--- a/api/src/main/java/javax/faces/convert/ByteConverter.java
+++ b/api/src/main/java/javax/faces/convert/ByteConverter.java
@@ -41,6 +41,7 @@ public class ByteConverter
     }
 
     // METHODS
+    @Override
     public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String
value)
     {
         if (facesContext == null)
@@ -72,6 +73,7 @@ public class ByteConverter
         return null;
     }
 
+    @Override
     public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object
value)
     {
         if (facesContext == null)
diff --git a/api/src/main/java/javax/faces/convert/CharacterConverter.java b/api/src/main/java/javax/faces/convert/CharacterConverter.java
index 495f7e7..1897768 100755
--- a/api/src/main/java/javax/faces/convert/CharacterConverter.java
+++ b/api/src/main/java/javax/faces/convert/CharacterConverter.java
@@ -41,6 +41,7 @@ public class CharacterConverter
     }
 
     // METHODS
+    @Override
     public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String
value)
     {
         if (facesContext == null)
@@ -72,6 +73,7 @@ public class CharacterConverter
         return null;
     }
 
+    @Override
     public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object
value)
     {
         if (facesContext == null)
diff --git a/api/src/main/java/javax/faces/convert/DateTimeConverter.java b/api/src/main/java/javax/faces/convert/DateTimeConverter.java
index f724e3c..3de25cd 100755
--- a/api/src/main/java/javax/faces/convert/DateTimeConverter.java
+++ b/api/src/main/java/javax/faces/convert/DateTimeConverter.java
@@ -101,6 +101,7 @@ public class DateTimeConverter
     }
 
     // METHODS
+    @Override
     public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String
value)
     {
         if (facesContext == null)
@@ -214,6 +215,7 @@ public class DateTimeConverter
         return null;
     }
 
+    @Override
     public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object
value)
     {
         if (facesContext == null)
@@ -481,6 +483,7 @@ public class DateTimeConverter
     }
 
     // STATE SAVE/RESTORE
+    @Override
     public void restoreState(FacesContext facesContext, Object state)
     {
         if (state != null)
@@ -495,6 +498,7 @@ public class DateTimeConverter
         }
     }
 
+    @Override
     public Object saveState(FacesContext facesContext)
     {
         if (!initialStateMarked())
@@ -526,7 +530,6 @@ public class DateTimeConverter
 
     public void setDateStyle(String dateStyle)
     {
-        //TODO: validate timeStyle
         _dateStyle = dateStyle;
         clearInitialState();
     }
@@ -581,7 +584,6 @@ public class DateTimeConverter
 
     public void setTimeStyle(String timeStyle)
     {
-        //TODO: validate timeStyle
         _timeStyle = timeStyle;
         clearInitialState();
     }
@@ -630,23 +632,25 @@ public class DateTimeConverter
 
     public void setType(String type)
     {
-        //TODO: validate type
         _type = type;
         clearInitialState();
     }
     
     private boolean _initialStateMarked = false;
 
+    @Override
     public void clearInitialState()
     {
         _initialStateMarked = false;
     }
 
+    @Override
     public boolean initialStateMarked()
     {
         return _initialStateMarked;
     }
 
+    @Override
     public void markInitialState()
     {
         _initialStateMarked = true;
diff --git a/api/src/main/java/javax/faces/convert/DoubleConverter.java b/api/src/main/java/javax/faces/convert/DoubleConverter.java
index 992008a..0bf461b 100755
--- a/api/src/main/java/javax/faces/convert/DoubleConverter.java
+++ b/api/src/main/java/javax/faces/convert/DoubleConverter.java
@@ -30,8 +30,7 @@ import java.util.Locale;
  * see Javadoc of <a href="http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/index.html">JSF
Specification</a>
  */
 @JSFConverter
-public class DoubleConverter
-        implements Converter
+public class DoubleConverter implements Converter
 {
     // API FIELDS
     public static final String CONVERTER_ID = "javax.faces.Double";
@@ -44,6 +43,7 @@ public class DoubleConverter
     }
 
     // METHODS
+    @Override
     public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String
value)
     {
         if (facesContext == null)
@@ -63,7 +63,7 @@ public class DoubleConverter
                 try
                 {
                     value = fixLocale(facesContext, value);
-                    return this.stringToDouble(value);
+                    return Double.valueOf(value);
                 }
                 catch (NumberFormatException e)
                 {
@@ -71,7 +71,6 @@ public class DoubleConverter
                                    DOUBLE_ID,
                                    new Object[]{value,"4214",_MessageUtils.getLabel(facesContext,
uiComponent)}), e);
                 }
-
             }
         }
         return null;
@@ -130,37 +129,7 @@ public class DoubleConverter
         return value;
     }
 
-    private Double stringToDouble(String value)
-    {
-        // this is a special hack for a jvm vulnerability with
-        // converting some special double values.
-        // e.g. "2.225073858507201200000e-308"
-        // see MYFACES-3024 for further information
-        // TODO we can remove this hack, once this got fixed in the jvm!
-        if (value.length() >= 23)
-        {
-            StringBuilder normalized = new StringBuilder();
-            for (int i=0; i< value.length(); i++)
-            {
-                char c = value.charAt(i);
-                if ( c != '.')
-                {
-                    normalized.append(c);
-                }
-            }
-
-            String normalizedString = normalized.toString();
-            if (normalizedString.contains("22250738585072012") && normalizedString.contains("e-"))
-            {
-                // oops, baaad value!
-               throw new NumberFormatException("Not Allowed! This value could possibly kill
the VM!");
-            }
-        }
-
-
-        return Double.valueOf(value);
-    }
-
+    @Override
     public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object
value)
     {
         if (facesContext == null)
@@ -190,4 +159,5 @@ public class DoubleConverter
                     new Object[]{value,_MessageUtils.getLabel(facesContext, uiComponent)}),e);
         }
     }
+
 }
diff --git a/api/src/main/java/javax/faces/convert/FloatConverter.java b/api/src/main/java/javax/faces/convert/FloatConverter.java
index 7ff09cf..12d82d2 100755
--- a/api/src/main/java/javax/faces/convert/FloatConverter.java
+++ b/api/src/main/java/javax/faces/convert/FloatConverter.java
@@ -41,6 +41,7 @@ public class FloatConverter
     }
 
     // METHODS
+    @Override
     public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String
value)
     {
         if (facesContext == null)
@@ -72,6 +73,7 @@ public class FloatConverter
         return null;
     }
 
+    @Override
     public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object
value)
     {
         if (facesContext == null)
diff --git a/api/src/main/java/javax/faces/convert/IntegerConverter.java b/api/src/main/java/javax/faces/convert/IntegerConverter.java
index a10cc38..d11e7bb 100755
--- a/api/src/main/java/javax/faces/convert/IntegerConverter.java
+++ b/api/src/main/java/javax/faces/convert/IntegerConverter.java
@@ -41,6 +41,7 @@ public class IntegerConverter
     }
 
     // METHODS
+    @Override
     public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String
value)
     {
         if (facesContext == null)
@@ -72,6 +73,7 @@ public class IntegerConverter
         return null;
     }
 
+    @Override
     public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object
value)
     {
         if (facesContext == null)
diff --git a/api/src/main/java/javax/faces/convert/LongConverter.java b/api/src/main/java/javax/faces/convert/LongConverter.java
index 84ad30b..02d9d56 100755
--- a/api/src/main/java/javax/faces/convert/LongConverter.java
+++ b/api/src/main/java/javax/faces/convert/LongConverter.java
@@ -41,6 +41,7 @@ public class LongConverter
     }
 
     // METHODS
+    @Override
     public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String
value)
     {
         if (facesContext == null)
@@ -72,6 +73,7 @@ public class LongConverter
         return null;
     }
 
+    @Override
     public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object
value)
     {
         if (facesContext == null)
diff --git a/api/src/main/java/javax/faces/convert/NumberConverter.java b/api/src/main/java/javax/faces/convert/NumberConverter.java
index 1b0457e..57aaa88 100755
--- a/api/src/main/java/javax/faces/convert/NumberConverter.java
+++ b/api/src/main/java/javax/faces/convert/NumberConverter.java
@@ -27,6 +27,7 @@ import java.util.Currency;
 import java.util.Locale;
 
 import javax.el.ValueExpression;
+import javax.faces.FacesException;
 import javax.faces.component.PartialStateHolder;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
@@ -87,6 +88,7 @@ public class NumberConverter
     }
 
     // METHODS
+    @Override
     public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String
value)
     {
         if (facesContext == null)
@@ -187,6 +189,7 @@ public class NumberConverter
         return null;
     }
 
+    @Override
     public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object
value)
     {
         if (facesContext == null)
@@ -287,12 +290,10 @@ public class NumberConverter
             }
             catch (Exception e)
             {
-                throw new ConverterException("Unable to get Currency instance for currencyCode
" +
-                                             _currencyCode);
+                throw new ConverterException("Unable to get Currency instance for currencyCode
" + _currencyCode);
             }
         }
         else if (format instanceof DecimalFormat)
-
         {
             DecimalFormat dFormat = (DecimalFormat)format;
             DecimalFormatSymbols symbols = dFormat.getDecimalFormatSymbols();
@@ -302,6 +303,7 @@ public class NumberConverter
     }
 
     // STATE SAVE/RESTORE
+    @Override
     public void restoreState(FacesContext facesContext, Object state)
     {
         if (state != null)
@@ -329,6 +331,7 @@ public class NumberConverter
         }
     }
 
+    @Override
     public Object saveState(FacesContext facesContext)
     {
         if (!initialStateMarked())
@@ -531,11 +534,13 @@ public class NumberConverter
         clearInitialState();
     }
 
+    @Override
     public boolean isTransient()
     {
         return _transient;
     }
 
+    @Override
     public void setTransient(boolean aTransient)
     {
         _transient = aTransient;
@@ -554,7 +559,12 @@ public class NumberConverter
 
     public void setType(String type)
     {
-        //TODO: validate type
+        if (type != null && type.length() > 0
+                && (!"number".equals(type) && !"currency".equals(type) &&
!"percent".equals(type)))
+        {
+            throw new FacesException("Uknown type: " + type);
+        }
+        
         _type = type;
         clearInitialState();
     }
@@ -566,16 +576,19 @@ public class NumberConverter
     
     private boolean _initialStateMarked = false;
 
+    @Override
     public void clearInitialState()
     {
         _initialStateMarked = false;
     }
 
+    @Override
     public boolean initialStateMarked()
     {
         return _initialStateMarked;
     }
 
+    @Override
     public void markInitialState()
     {
         _initialStateMarked = true;
diff --git a/api/src/main/java/javax/faces/convert/ShortConverter.java b/api/src/main/java/javax/faces/convert/ShortConverter.java
index 5ff58ab..1a99d46 100755
--- a/api/src/main/java/javax/faces/convert/ShortConverter.java
+++ b/api/src/main/java/javax/faces/convert/ShortConverter.java
@@ -41,6 +41,7 @@ public class ShortConverter
     }
 
     // METHODS
+    @Override
     public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String
value)
     {
         if (facesContext == null)
@@ -72,6 +73,7 @@ public class ShortConverter
         return null;
     }
 
+    @Override
     public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object
value)
     {
         if (facesContext == null)
diff --git a/api/src/main/java/javax/faces/view/ViewMetadata.java b/api/src/main/java/javax/faces/view/ViewMetadata.java
index aaf5809..7896bc3 100644
--- a/api/src/main/java/javax/faces/view/ViewMetadata.java
+++ b/api/src/main/java/javax/faces/view/ViewMetadata.java
@@ -43,46 +43,39 @@ public abstract class ViewMetadata
     {
         LinkedList<UIViewParameter> result = null;
         UIComponent metadataFacet = root.getFacet (UIViewRoot.METADATA_FACET_NAME);
-        Iterator<UIComponent> children;
-        
+
         if (metadataFacet == null)
         {
              // No metadata, so return an empty collection.
-             
              return Collections.emptyList();
         }
         
         // Iterate over all the children, keep only the view parameters.
-        
         if (metadataFacet.getChildCount() > 0)
         {
-            children = metadataFacet.getChildren().iterator();
-            
+            Iterator<UIComponent> children = metadataFacet.getChildren().iterator();
             while (children.hasNext())
             {
                  UIComponent component = children.next();
-                 
                  if (result == null)
                  {
                      result = new LinkedList<UIViewParameter>();
                  }
-                 
                  if (component instanceof UIViewParameter)
                  {
-                      result.add ((UIViewParameter) component);
+                      result.add((UIViewParameter) component);
                  }
             }
         }
         
-        // TODO: does this need to be immutable?  Spec does not indicate either
-        // way.
+        // TODO: does this need to be immutable?  Spec does not indicate either way.
         if (result == null)
         {
             return Collections.emptyList();
         }
         else
         {
-            return Collections.unmodifiableCollection (result);
+            return Collections.unmodifiableCollection(result);
         }
     }
     
@@ -95,30 +88,24 @@ public abstract class ViewMetadata
     {
         LinkedList<UIViewAction> result = null;
         UIComponent metadataFacet = root.getFacet (UIViewRoot.METADATA_FACET_NAME);
-        Iterator<UIComponent> children;
-        
+
         if (metadataFacet == null)
         {
              // No metadata, so return an empty collection.
-             
              return Collections.emptyList();
         }
         
         // Iterate over all the children, keep only the view parameters.
-        
         if (metadataFacet.getChildCount() > 0)
         {
-            children = metadataFacet.getChildren().iterator();
-            
+            Iterator<UIComponent> children = metadataFacet.getChildren().iterator();
             while (children.hasNext())
             {
                  UIComponent component = children.next();
-                 
                  if (result == null)
                  {
                      result = new LinkedList<UIViewAction>();
                  }
-                 
                  if (component instanceof UIViewAction)
                  {
                       result.add ((UIViewAction) component);
@@ -126,8 +113,7 @@ public abstract class ViewMetadata
             }
         }
         
-        // TODO: does this need to be immutable?  Spec does not indicate either
-        // way.
+        // TODO: does this need to be immutable?  Spec does not indicate either way.
         if (result == null)
         {
             return Collections.emptyList();
@@ -157,31 +143,25 @@ public abstract class ViewMetadata
     public static Collection<UIImportConstants> getImportConstants(UIViewRoot root)
     {
         LinkedList<UIImportConstants> result = null;
-        UIComponent metadataFacet = root.getFacet (UIViewRoot.METADATA_FACET_NAME);
-        Iterator<UIComponent> children;
+        UIComponent metadataFacet = root.getFacet(UIViewRoot.METADATA_FACET_NAME);
         
         if (metadataFacet == null)
         {
              // No metadata, so return an empty collection.
-             
              return Collections.emptyList();
         }
         
         // Iterate over all the children, keep only the view parameters.
-        
         if (metadataFacet.getChildCount() > 0)
         {
-            children = metadataFacet.getChildren().iterator();
-            
+            Iterator<UIComponent> children = metadataFacet.getChildren().iterator();
             while (children.hasNext())
             {
                  UIComponent component = children.next();
-                 
                  if (result == null)
                  {
                      result = new LinkedList<UIImportConstants>();
                  }
-                 
                  if (component instanceof UIImportConstants)
                  {
                       result.add ((UIImportConstants) component);
@@ -189,15 +169,14 @@ public abstract class ViewMetadata
             }
         }
         
-        // TODO: does this need to be immutable?  Spec does not indicate either
-        // way.
+        // TODO: does this need to be immutable?  Spec does not indicate either way.
         if (result == null)
         {
             return Collections.emptyList();
         }
         else
         {
-            return Collections.unmodifiableCollection (result);
+            return Collections.unmodifiableCollection(result);
         }
     }
 
diff --git a/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java
b/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java
index 0527308..22cff46 100644
--- a/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java
@@ -107,8 +107,7 @@ public class PartialViewContextImpl extends PartialViewContext
         _facesContext = context;
     }
     
-    public PartialViewContextImpl(FacesContext context, 
-            VisitContextFactory visitContextFactory)
+    public PartialViewContextImpl(FacesContext context, VisitContextFactory visitContextFactory)
     {
         _facesContext = context;
         _visitContextFactory = visitContextFactory;
@@ -120,11 +119,10 @@ public class PartialViewContextImpl extends PartialViewContext
         assertNotReleased();
         if (_ajaxRequest == null)
         {
-            String requestType = _facesContext.getExternalContext().
-                   getRequestHeaderMap().get(FACES_REQUEST);
+            String requestType = _facesContext.getExternalContext().getRequestHeaderMap().get(FACES_REQUEST);
             _ajaxRequest = (requestType != null && PARTIAL_AJAX.equals(requestType));
-            String reqParmamterPartialAjax = _facesContext.getExternalContext().
-                    getRequestParameterMap().get(PARTIAL_AJAX_REQ);
+            String reqParmamterPartialAjax = _facesContext.getExternalContext()
+                    .getRequestParameterMap().get(PARTIAL_AJAX_REQ);
             //jsdoc reference in an ajax request the javax.faces.partial.ajax must be set
as ajax parameter
             //the other one is Faces-Request == partial/ajax which is basically the same
             _ajaxRequest = _ajaxRequest || reqParmamterPartialAjax != null;
@@ -140,8 +138,7 @@ public class PartialViewContextImpl extends PartialViewContext
         if (isAjaxRequest())
         {
             String executeMode = _facesContext.getExternalContext().
-                    getRequestParameterMap().get(
-                    PartialViewContext.PARTIAL_EXECUTE_PARAM_NAME);
+                    getRequestParameterMap().get(PartialViewContext.PARTIAL_EXECUTE_PARAM_NAME);
             if (PartialViewContext.ALL_PARTIAL_PHASE_CLIENT_IDS.equals(executeMode))
             {
                 return true;
@@ -157,8 +154,7 @@ public class PartialViewContextImpl extends PartialViewContext
 
         if (_partialRequest == null)
         {
-            String requestType = _facesContext.getExternalContext().
-                    getRequestHeaderMap().get(FACES_REQUEST);
+            String requestType = _facesContext.getExternalContext().getRequestHeaderMap().get(FACES_REQUEST);
             _partialRequest = (requestType != null && PARTIAL_PROCESS.equals(requestType));
         }
         return _partialRequest || isAjaxRequest();
@@ -174,8 +170,7 @@ public class PartialViewContextImpl extends PartialViewContext
             if (isAjaxRequest())
             {
                 String executeMode = _facesContext.getExternalContext().
-                        getRequestParameterMap().get(
-                        PartialViewContext.PARTIAL_RENDER_PARAM_NAME);
+                        getRequestParameterMap().get(PartialViewContext.PARTIAL_RENDER_PARAM_NAME);
                 if (PartialViewContext.ALL_PARTIAL_PHASE_CLIENT_IDS.equals(executeMode))
                 {
                     _renderAll = true;
@@ -231,12 +226,10 @@ public class PartialViewContextImpl extends PartialViewContext
         if (_executeClientIds == null)
         {
             String executeMode = _facesContext.getExternalContext().
-                    getRequestParameterMap().get(
-                    PartialViewContext.PARTIAL_EXECUTE_PARAM_NAME);
+                    getRequestParameterMap().get(PartialViewContext.PARTIAL_EXECUTE_PARAM_NAME);
 
-            if (executeMode != null && !executeMode.isEmpty() &&
-                    //!PartialViewContext.NO_PARTIAL_PHASE_CLIENT_IDS.equals(executeMode)
&&
-                    !PartialViewContext.ALL_PARTIAL_PHASE_CLIENT_IDS.equals(executeMode))
+            if (executeMode != null && !executeMode.isEmpty()
+                    && !PartialViewContext.ALL_PARTIAL_PHASE_CLIENT_IDS.equals(executeMode))
             {
 
                 String[] clientIds
@@ -320,9 +313,8 @@ public class PartialViewContextImpl extends PartialViewContext
                     getRequestParameterMap().get(
                     PartialViewContext.PARTIAL_RENDER_PARAM_NAME);
 
-            if (renderMode != null && !renderMode.isEmpty() &&
-                    //!PartialViewContext.NO_PARTIAL_PHASE_CLIENT_IDS.equals(renderMode)
&&
-                    !PartialViewContext.ALL_PARTIAL_PHASE_CLIENT_IDS.equals(renderMode))
+            if (renderMode != null && !renderMode.isEmpty()
+                    && !PartialViewContext.ALL_PARTIAL_PHASE_CLIENT_IDS.equals(renderMode))
             {
                 String[] clientIds
                         = StringUtils.splitShortString(_replaceTabOrEnterCharactersWithSpaces(renderMode),
' ');
@@ -341,7 +333,6 @@ public class PartialViewContextImpl extends PartialViewContext
             else
             {
                 _renderClientIds = new ArrayList<String>();
-
                 if (PartialViewContext.ALL_PARTIAL_PHASE_CLIENT_IDS.equals(renderMode))
                 {
                     _renderClientIds.add(PartialResponseWriter.RENDER_ALL_MARKER);
@@ -557,15 +548,13 @@ public class PartialViewContextImpl extends PartialViewContext
             String viewState = _facesContext.getApplication().getStateManager().getViewState(_facesContext);
             if (viewState != null)
             {
-                writer.startUpdate(HtmlResponseStateManager.generateUpdateViewStateId(
-                    _facesContext));
+                writer.startUpdate(HtmlResponseStateManager.generateUpdateViewStateId(_facesContext));
                 writer.write(viewState);
                 writer.endUpdate();
             }
             else if (viewRoot.isTransient())
             {
-                writer.startUpdate(HtmlResponseStateManager.generateUpdateViewStateId(
-                    _facesContext));
+                writer.startUpdate(HtmlResponseStateManager.generateUpdateViewStateId(_facesContext));
                 writer.write(StateTokenProcessor.STATELESS_TOKEN);
                 writer.endUpdate();
             }
@@ -574,8 +563,7 @@ public class PartialViewContextImpl extends PartialViewContext
             ClientWindow cw = _facesContext.getExternalContext().getClientWindow();
             if (cw != null)
             {
-                writer.startUpdate(HtmlResponseStateManager.generateUpdateClientWindowId(
-                    _facesContext));
+                writer.startUpdate(HtmlResponseStateManager.generateUpdateClientWindowId(_facesContext));
                 writer.write(cw.getId());
                 writer.endUpdate();
             }
@@ -625,13 +613,11 @@ public class PartialViewContextImpl extends PartialViewContext
                 for (UIComponent component : list)
                 {
                     boolean resourceRendered = false;
-                    if (ResourceUtils.DEFAULT_SCRIPT_RENDERER_TYPE.equals(component.getRendererType())
||
-                            ResourceUtils.DEFAULT_STYLESHEET_RENDERER_TYPE.equals(component.getRendererType()))
+                    if (ResourceUtils.DEFAULT_SCRIPT_RENDERER_TYPE.equals(component.getRendererType())
+                            || ResourceUtils.DEFAULT_STYLESHEET_RENDERER_TYPE.equals(component.getRendererType()))
                     {
-                        String resourceName = (String) 
-                                component.getAttributes().get(JSFAttr.NAME_ATTR);
-                        String libraryName = (String) 
-                                component.getAttributes().get(JSFAttr.LIBRARY_ATTR);
+                        String resourceName = (String) component.getAttributes().get(JSFAttr.NAME_ATTR);
+                        String libraryName = (String) component.getAttributes().get(JSFAttr.LIBRARY_ATTR);
 
                         if (resourceName == null || resourceName.isEmpty())
                         {
@@ -739,7 +725,6 @@ public class PartialViewContextImpl extends PartialViewContext
 
     private class PhaseAwareVisitCallback implements VisitCallback
     {
-
         private PhaseId _phaseId;
         private FacesContext _facesContext;
         private List<UIComponent> _alreadyUpdatedComponents;
diff --git a/impl/src/test/java/javax/faces/convert/DoubleConverterTest.java b/impl/src/test/java/javax/faces/convert/DoubleConverterTest.java
index 26ba7f6..883c115 100644
--- a/impl/src/test/java/javax/faces/convert/DoubleConverterTest.java
+++ b/impl/src/test/java/javax/faces/convert/DoubleConverterTest.java
@@ -113,45 +113,4 @@ public class DoubleConverterTest extends AbstractJsfTestCase {
         }
     }
 
-
-    /**
-     * This tests a workaround which got introduced for the jvm bug
-     * described in MYFACES-3024. This is necessary as long as the jvm
-     * contains this bug resulting in the whole thread basically stalling
-     * at 100% CPU conumption and never return from the
-     * @link http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/
-     *
-     *
-     */
-    @Test
-    public void testDoubleParsingJvmBugWorkaround()
-    {
-        String[] baaadValues = new String[] {
-                "0.00022250738585072012e-304",
-                "2.225073858507201200000e-308",
-                "2.225073858507201200000e-308",
-                "2.2250738585072012e-00308",
-                "2.2250738585072012997800001e-308"
-        };
-
-        FacesContext.getCurrentInstance().getViewRoot().setLocale(Locale.US);
-        UIInput input = new UIInput();
-        Double d;
-
-        for (String badVal : baaadValues)
-        {
-            try
-            {
-                d = (Double) mock.getAsObject(FacesContext.getCurrentInstance(), input, badVal);
-                fail();
-            }
-            catch(ConverterException cex)
-            {
-                // all is well, we expect the Converter to detect the baaad values...
-            }
-        }
-    }
-
-
-
 }


Mime
View raw message