myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Struberg <strub...@yahoo.de>
Subject Re: svn commit: r1188267 [1/2] - in /myfaces/core/trunk/api/src: main/java/javax/faces/application/ main/java/javax/faces/component/ main/java/javax/faces/component/behavior/ main/java/javax/faces/convert/ main/java/javax/faces/event/ main/java/javax
Date Mon, 24 Oct 2011 21:04:08 GMT
Please take a look at the Java-VM and the Java-Mem specification.

The Java VM has a lot of optimisation for high scalability.
One of those features is that memory which is not declared volatile will get copied to a different mem location for each thread accessing it. This allows to highly utilize the L1 and L2 caches of modern multi core CPUs. Which in turn also means that if we take as an example

public class MyCls {

  private static int i;

  public int getCounter() { return i;}
  

  public void count() { i++ };

}

might well return different values for getCounter() for different parallel threads!


I know this is not really as well known as it should be, but marking a class member 'final' does also mean that it's mem doesn't need to get synced back (because it's assumed that this got initialized once and then will never change).

LieGrue,
strub




----- Original Message -----
> From: Leonardo Uribe <lu4242@gmail.com>
> To: MyFaces Development <dev@myfaces.apache.org>; Mark Struberg <struberg@yahoo.de>
> Cc: 
> Sent: Monday, October 24, 2011 10:48 PM
> Subject: Re: svn commit: r1188267 [1/2] - in /myfaces/core/trunk/api/src: main/java/javax/faces/application/ main/java/javax/faces/component/ main/java/javax/faces/component/behavior/ main/java/javax/faces/convert/ main/java/javax/faces/event/ main/java/javax
> 
> Hi
> 
> I personally prefer use final modifier. In some cases, such vars has
> some "history" behind, so I do not agree to change them blindly,
> without check each case. Now, it could exists a hashmap that its
> variable is final, but its key/value pairs are mutable.
> 
> Really do these type of cleanups makes harder maintain 2.0.x and 2.1.x
> branches. I usually compare files and apply patches in both branches.
> I prefer delay this to a future 2.2.x branch, but if it is applied on
> current trunk its ok anyway.
> 
> regards,
> 
> Leonardo Uribe
> 
> 2011/10/24 Mark Struberg <struberg@yahoo.de>:
>>  Hi!
>> 
>>  I removed them because they got inhomogenously used. The same method 
> contained variables which are final and others which are not modified neither 
> and not marked final.
>> 
>>  Also I found a few hashmaps which were marked final, although they get 
> modified later. Please be aware that final is not only a keyword which stops you 
> from changing the pointer (in C speak) but also means that those underlying mem 
> areas will NOT be synced to other threads!
>> 
>>  Otoh there have been unmodifiableCollections in uppercase letters which are 
> not marked final ;)
>> 
>>  Btw, if anyone also likes to join and help with the cleanup then you are 
> welcome ^^
>> 
>>  I only used IDE support for fixing if without {}, but all other automated 
> reformatting turned out to create WAY too much noise (and sometimes even break 
> the format at all). I tried both IDEA and Eclipse, but none of them worked 
> satisfyingly.
>> 
>> 
>>  I'll checkin an upgrade of myfaces-core pom.xml with 
> mf-parent-11-SNAPSHOT and an additional -Pcheckstyle profile which will enable 
> the 'standard' checks.
>> 
>>  LieGrue,
>>  strub
>> 
>> 
>> 
>>  ----- Original Message -----
>>>  From: Jakob Korherr <jakob.korherr@gmail.com>
>>>  To: MyFaces Development <dev@myfaces.apache.org>; 
> gudnabrsam@gmail.com
>>>  Cc:
>>>  Sent: Monday, October 24, 2011 10:15 PM
>>>  Subject: Re: svn commit: r1188267 [1/2] - in 
> /myfaces/core/trunk/api/src: main/java/javax/faces/application/ 
> main/java/javax/faces/component/ main/java/javax/faces/component/behavior/ 
> main/java/javax/faces/convert/ main/java/javax/faces/event/ main/java/javax
>>> 
>>>  I agree with Matt. I don't think that having local variables marked 
> as
>>>  final is a bad thing.
>>> 
>>>  Regards,
>>>  Jakob
>>> 
>>>  2011/10/24 Matt Benson <gudnabrsam@gmail.com>:
>>>>   Not a huge deal; I wouldn't necessarily revert the commit, but 
> IMO
>>>>   there are good reasons to mark local variables as final:  code
>>>>   self-documents the intent that a variable's value won't 
> change;
>>>  then
>>>>   there is the somewhat controversial notion that marking a final
>>>>   variable as such may contribute to better JIT performance.  It
>>>>   certainly couldn't hurt, could it?
>>>> 
>>>>   Matt
>>>> 
>>>>   On Mon, Oct 24, 2011 at 1:09 PM,  <struberg@apache.org> 
> wrote:
>>>>>   Author: struberg
>>>>>   Date: Mon Oct 24 18:09:08 2011
>>>>>   New Revision: 1188267
>>>>> 
>>>>>   URL: http://svn.apache.org/viewvc?rev=1188267&view=rev
>>>>>   Log:
>>>>>   MYFACES-3368 fix linebreakes and unnecessary final for local 
> fields
>>>>> 
>>>>>   Modified:
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/application/NavigationCase.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponent.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponentBase.java
>>>>> 
>>>   myfaces/core/trunk/api/src/main/java/javax/faces/component/UIData.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/component/UIInput.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/component/UISelectMany.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/component/_ComponentAttributesMap.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/component/_LocaleUtils.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/component/_MethodBindingToListener.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/component/_MethodBindingToMethodExpression.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/component/_MethodExpressionToMethodBinding.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/component/_SelectItemsIterator.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/component/_ValueBindingToValueExpression.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/component/_ValueExpressionToValueBinding.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/component/behavior/_AjaxBehaviorDeltaStateHelper.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/convert/NumberConverter.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/convert/_MessageUtils.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/event/ListenerFor.java
>>>>> 
>>>   myfaces/core/trunk/api/src/main/java/javax/faces/event/PhaseEvent.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/validator/BeanValidator.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/validator/DoubleRangeValidator.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/validator/LengthValidator.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/validator/LongRangeValidator.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/validator/ValidatorException.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/AttributeHandler.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/ComponentHandler.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/CompositeFaceletHandler.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/DelegatingMetaTagHandler.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/FacetHandler.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/MetaTagHandler.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/Metadata.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/TagAttribute.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/TagAttributeException.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/TagConfig.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/TagException.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/TagHandler.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/TagHandlerDelegate.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/TextHandler.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/view/facelets/ValidatorHandler.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/main/java/javax/faces/webapp/UIComponentTagBase.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/test/java/javax/faces/application/FacesMessageTest.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/test/java/javax/faces/component/AbstractUIComponentPropertyTest.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentBaseGetClientIdTest.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/test/java/javax/faces/component/UIComponentInvokeOnComponentTest.java
>>>>> 
>>> 
>  myfaces/core/trunk/api/src/test/java/javax/faces/component/UIViewParameterTest.java
>>>>> 
>>>>>   Modified:
>>> 
> myfaces/core/trunk/api/src/main/java/javax/faces/application/NavigationCase.java
>>>>>   URL:
>>> 
> http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/application/NavigationCase.java?rev=1188267&r1=1188266&r2=1188267&view=diff
>>>>> 
>>> 
> ==============================================================================
>>>>>   ---
>>> 
> myfaces/core/trunk/api/src/main/java/javax/faces/application/NavigationCase.java
>>>  (original)
>>>>>   +++
>>> 
> myfaces/core/trunk/api/src/main/java/javax/faces/application/NavigationCase.java
>>>  Mon Oct 24 18:09:08 2011
>>>>>   @@ -249,7 +249,7 @@ public class NavigationCase
>>>>>                   
> builder.append("\">\n");
>>>>>                   for (Map.Entry<String, 
> List<String>> entry
>>>  : _parameters.entrySet())
>>>>>                   {
>>>>>   -                    final String name = entry.getKey();
>>>>>   +                    String name = entry.getKey();
>>>>>                       for (String value : entry.getValue())
>>>>>                       {
>>>>>                           builder.append("
>>>   <view-param>\n");
>>>>> 
>>>>>   Modified:
>>> 
> myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponent.java
>>>>>   URL:
>>> 
> http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponent.java?rev=1188267&r1=1188266&r2=1188267&view=diff
>>>>> 
>>> 
> ==============================================================================
>>>>>   ---
>>> 
> myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponent.java
>>>  (original)
>>>>>   +++
>>> 
> myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponent.java Mon
>>>  Oct 24 18:09:08 2011
>>>>>   @@ -62,35 +62,38 @@ import org.apache.myfaces.buildtools.mav
>>>>>    import
>>> 
> org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFWebConfigParam;
>>>>> 
>>>>>    /**
>>>>>   - *
>>>>>   + *
>>>>>    * see Javadoc of <a
>>> 
> href="http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/index.html">J
>>>>>    * SF Specification</a>
>>>>>   - *
>>>>>   + *
>>>>>    * @author Manfred Geiler (latest modification by $Author$)
>>>>>    * @version $Revision$ $Date$
>>>>>    */
>>>>>   -@JSFComponent(type = "javax.faces.Component", 
> family =
>>>  "javax.faces.Component", desc = "abstract base 
> component",
>>>  configExcluded = true)
>>>>>   -public abstract class UIComponent implements 
> PartialStateHolder,
>>>  TransientStateHolder , SystemEventListenerHolder, 
> ComponentSystemEventListener {
>>>>>   +@JSFComponent(type = "javax.faces.Component", 
> family =
>>>  "javax.faces.Component",
>>>>>   +              desc = "abstract base component",
>>>  configExcluded = true)
>>>>>   +public abstract class UIComponent
>>>>>   +        implements PartialStateHolder, TransientStateHolder,
>>>  SystemEventListenerHolder, ComponentSystemEventListener
>>>>>   +{
>>>>>       // TODO: Reorder methods, this class is a mess
>>>>>       /**
>>>>>        * Constant used in component attribute map to retrieve 
> the
>>>  BeanInfo of a composite
>>>>>        * component.
>>>>>   -     *
>>>>>   +     *
>>>>>        * @see 
> ViewDeclarationLanguage#getComponentMetadata(FacesContext,
>>>  Resource)
>>>>>        * @see
>>>  ViewDeclarationLanguage#retargetAttachedObjects(FacesContext, 
> UIComponent, List)
>>>>>        * @see
>>>  ViewDeclarationLanguage#retargetMethodExpressions(FacesContext, 
> UIComponent)
>>>>>        * @see Application#createComponent(FacesContext, 
> Resource)
>>>>>        */
>>>>>       public static final String BEANINFO_KEY =
>>>  "javax.faces.component.BEANINFO_KEY";
>>>>>   -
>>>>>   +
>>>>>       /**
>>>>>        * Constant used in BeanInfo descriptor as a key for 
> retrieve an
>>>  alternate component type
>>>>>        * for create the composite base component.
>>>>>   -     *
>>>>>   +     *
>>>>>        * @see Application#createComponent(FacesContext, 
> Resource)
>>>>>        */
>>>>>       public static final String COMPOSITE_COMPONENT_TYPE_KEY =
>>>  "javax.faces.component.COMPOSITE_COMPONENT_TYPE";
>>>>>   -
>>>>>   +
>>>>>       /**
>>>>>        * Constant used to define the facet inside this component 
> that
>>>  store the component hierarchy
>>>>>        * generated by a composite component implementation, and 
> then
>>>  rendered. In other words,
>>>>>   @@ -98,23 +101,23 @@ public abstract class UIComponent implem
>>>>>        * this face are rendered.
>>>>>        */
>>>>>       public static final String COMPOSITE_FACET_NAME =
>>>  "javax.faces.component.COMPOSITE_FACET_NAME";
>>>>>   -
>>>>>   +
>>>>>       /**
>>>>>        * Constant used to store the current component that is 
> being
>>>  processed.
>>>>>   -     *
>>>>>   +     *
>>>>>        * @see #pushComponentToEL(FacesContext, UIComponent)
>>>>>        * @see #popComponentFromEL(FacesContext)
>>>>>        */
>>>>>       public static final String CURRENT_COMPONENT =
>>>  "javax.faces.component.CURRENT_COMPONENT";
>>>>>   -
>>>>>   +
>>>>>       /**
>>>>>        * Constant used to store the current composite component 
> that is
>>>  being processed.
>>>>>   -     *
>>>>>   +     *
>>>>>        * @see #pushComponentToEL(FacesContext, UIComponent)
>>>>>        * @see #popComponentFromEL(FacesContext)
>>>>>   -     */
>>>>>   +     */
>>>>>       public static final String CURRENT_COMPOSITE_COMPONENT =
>>>  "javax.faces.component.CURRENT_COMPOSITE_COMPONENT";
>>>>>   -
>>>>>   +
>>>>>       /**
>>>>>        * This constant has two usages. The first one is in 
> component
>>>  attribute map to identify the
>>>>>        * facet name under this component is child of its parent. 
> The
>>>  second one is on BeanInfo descriptor
>>>>>   @@ -123,33 +126,35 @@ public abstract class UIComponent implem
>>>>>        * by COMPOSITE_FACET_NAME constant).
>>>>>        */
>>>>>       public static final String FACETS_KEY =
>>>  "javax.faces.component.FACETS_KEY";
>>>>>   -
>>>>>   +
>>>>>       /**
>>>>>        * Constant used in component attribute map to store the 
> {@link
>>>  javax.faces.view.Location} object
>>>>>        * where the definition of this component is.
>>>>>        */
>>>>>       public static final String VIEW_LOCATION_KEY =
>>>  "javax.faces.component.VIEW_LOCATION_KEY";
>>>>>   -
>>>>>   -    public static final String 
> ATTRS_WITH_DECLARED_DEFAULT_VALUES =
>>>  "javax.faces.component.ATTR_NAMES_WITH_DEFAULT_VALUES";
>>>>>   -
>>>>>   +
>>>>>   +    public static final String 
> ATTRS_WITH_DECLARED_DEFAULT_VALUES
>>>>>   +            =
>>>  "javax.faces.component.ATTR_NAMES_WITH_DEFAULT_VALUES";
>>>>>   +
>>>>>       /**
>>>>>        * Indicate if the facesContext attribute values under the 
> keys
>>>  javax.faces.component.CURRENT_COMPONENT and
>>>>>        * javax.faces.component.CURRENT_COMPOSITE_COMPONENT 
> should be
>>>  valid or not. By default, those keys are
>>>>>        * deprecated since 2.1
>>>>>        */
>>>>>   -    @JSFWebConfigParam(since="2.1.0",
>>>  expectedValues="true, false", defaultValue="false")
>>>>>   -    public static final String
>>>  HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME =
>>>  "javax.faces.HONOR_CURRENT_COMPONENT_ATTRIBUTES";
>>>>>   -
>>>>>   +    @JSFWebConfigParam(since = "2.1.0", 
> expectedValues =
>>>  "true, false", defaultValue = "false")
>>>>>   +    public static final String
>>>  HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME
>>>>>   +            =
>>>  "javax.faces.HONOR_CURRENT_COMPONENT_ATTRIBUTES";
>>>>>   +
>>>>>       /**
>>>>>        * The key under which the component stack is stored in 
> the
>>>  FacesContext.
>>>>>        * ATTENTION: this constant is duplicate in
>>>  CompositeComponentExpressionUtils.
>>>>>        */
>>>>>       private static final String _COMPONENT_STACK =
>>>  "componentStack:" + UIComponent.class.getName();
>>>>>   -
>>>>>   +
>>>>>       private static final String 
> _CURRENT_COMPOSITE_COMPONENT_KEY =
>>>  "compositeComponent:" + UIComponent.class.getName();
>>>>>   -
>>>>>   +
>>>>>       Map<Class<? extends SystemEvent>,
>>>  List<SystemEventListener>> _systemEventListenerClassMap;
>>>>>   -
>>>>>   +
>>>>>       /**
>>>>>        * @deprecated
>>>>>        */
>>>>>   @@ -164,26 +169,27 @@ public abstract class UIComponent implem
>>>>>       private transient Map<String, String> 
> _resourceBundleMap =
>>>  null;
>>>>>       private boolean _inView = false;
>>>>>       private _DeltaStateHelper _stateHelper = null;
>>>>>   -
>>>>>   +
>>>>>       /**
>>>>>        * In JSF 2.0 bindings map was deprecated, and replaced 
> with a map
>>>>>        * inside stateHelper. We need this one here because 
> stateHelper
>>>  needs
>>>>>        * to be implemented from here and internally it depends 
> from this
>>>  property.
>>>>>        */
>>>>>       private boolean _initialStateMarked = false;
>>>>>   -
>>>>>   -    /** Value of the {@link
>>>  UIComponent#HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME} parameter */
>>>>>   +
>>>>>   +    /** Value of the {@link
>>>  UIComponent#HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME} parameter */
>>>>>       private Boolean _honorCurrentComponentAttributes;
>>>>> 
>>>>>   -    public UIComponent() {
>>>>>   +    public UIComponent()
>>>>>   +    {
>>>>>       }
>>>>> 
>>>>>       public abstract Map<String, Object> getAttributes();
>>>>> 
>>>>>       /**
>>>>>   -     *
>>>>>   +     *
>>>>>        * {@inheritDoc}
>>>>>   -     *
>>>>>   +     *
>>>>>        * @since 2.0
>>>>>        */
>>>>>       public boolean initialStateMarked()
>>>>>   @@ -193,7 +199,7 @@ public abstract class UIComponent implem
>>>>> 
>>>>>       /**
>>>>>        * Invokes the 
> <code>invokeContextCallback</code>
>>>  method with the component, specified by 
> <code>clientId</code>.
>>>>>   -     *
>>>>>   +     *
>>>>>        * @param context
>>>>>        *            <code>FacesContext</code> for 
> the current
>>>  request
>>>>>        * @param clientId
>>>>>   @@ -204,9 +210,11 @@ public abstract class UIComponent implem
>>>>>        * @throws javax.faces.FacesException
>>>>>        */
>>>>>       public boolean invokeOnComponent(FacesContext context, 
> String
>>>  clientId, ContextCallback callback)
>>>>>   -            throws FacesException {
>>>>>   +            throws FacesException
>>>>>   +    {
>>>>>           // java.lang.NullPointerException - if any of the 
> arguments are
>>>  null
>>>>>   -        if (context == null || clientId == null || callback 
> == null) {
>>>>>   +        if (context == null || clientId == null || callback 
> == null)
>>>>>   +        {
>>>>>               throw new NullPointerException();
>>>>>           }
>>>>> 
>>>>>   @@ -215,16 +223,21 @@ public abstract class UIComponent implem
>>>>>           {
>>>>>               // searching for this component?
>>>>>               boolean found = 
> clientId.equals(this.getClientId(context));
>>>>>   -            if (found) {
>>>>>   -                try {
>>>>>   +            if (found)
>>>>>   +            {
>>>>>   +                try
>>>>>   +                {
>>>>>                       callback.invokeContextCallback(context, 
> this);
>>>>>   -                } catch (Exception e) {
>>>>>   +                }
>>>>>   +                catch (Exception e)
>>>>>   +                {
>>>>>                       throw new FacesException(e);
>>>>>                   }
>>>>>                   return found;
>>>>>               }
>>>>>               // Searching for this component's 
> children/facets
>>>>>   -            for (Iterator<UIComponent> it =
>>>  this.getFacetsAndChildren(); !found && it.hasNext();) {
>>>>>   +            for (Iterator<UIComponent> it =
>>>  this.getFacetsAndChildren(); !found && it.hasNext(); )
>>>>>   +            {
>>>>>                   found = it.next().invokeOnComponent(context, 
> clientId,
>>>  callback);
>>>>>               }
>>>>>               return found;
>>>>>   @@ -237,15 +250,16 @@ public abstract class UIComponent implem
>>>>>       }
>>>>> 
>>>>>       /**
>>>>>   -     *
>>>>>   +     *
>>>>>        * @param component
>>>>>        * @return true if the component is a composite component 
> otherwise
>>>  false is returned
>>>>>   -     *
>>>>>   +     *
>>>>>        *
>>>>>        * @throws NullPointerException if the component is null
>>>>>        * @since 2.0
>>>>>        */
>>>>>   -    public static boolean isCompositeComponent(UIComponent 
> component)
>>>  {
>>>>>   +    public static boolean isCompositeComponent(UIComponent 
> component)
>>>>>   +    {
>>>>> 
>>>>>           //since _isCompositeComponent does it the same way we 
> do it
>>>  here also although I
>>>>>           //would prefer following method
>>>>>   @@ -261,15 +275,16 @@ public abstract class UIComponent implem
>>>>>        * instance (which represents the view). If this component
>>>>>        * is a UIViewRoot instance, the components 
> "always"
>>>>>        * is on the view.
>>>>>   -     *
>>>>>   +     *
>>>>>        * By default it is false but for UIViewRoot instances is
>>>>>        * true.
>>>>>   -     *
>>>>>   +     *
>>>>>        * @return
>>>>>   -     *
>>>>>   +     *
>>>>>        * @since 2.0
>>>>>        */
>>>>>   -    public boolean isInView() {
>>>>>   +    public boolean isInView()
>>>>>   +    {
>>>>>           return _inView;
>>>>>       }
>>>>> 
>>>>>   @@ -292,10 +307,11 @@ public abstract class UIComponent implem
>>>>>        *
>>>>>        * @param context
>>>>>        * @return
>>>>>   -     *
>>>>>   +     *
>>>>>        * @since 2.0
>>>>>        */
>>>>>   -    protected boolean isVisitable(VisitContext context) {
>>>>>   +    protected boolean isVisitable(VisitContext context)
>>>>>   +    {
>>>>> 
>>>>>           Collection<VisitHint> hints = 
> context.getHints();
>>>>> 
>>>>>   @@ -322,18 +338,23 @@ public abstract class UIComponent implem
>>>>>        */
>>>>>       public abstract void setValueBinding(String name, 
> ValueBinding
>>>  binding);
>>>>> 
>>>>>   -    public void setValueExpression(String name, 
> ValueExpression
>>>  expression) {
>>>>>   -        if (name == null) {
>>>>>   +    public void setValueExpression(String name, 
> ValueExpression
>>>  expression)
>>>>>   +    {
>>>>>   +        if (name == null)
>>>>>   +        {
>>>>>               throw new NullPointerException("name");
>>>>>           }
>>>>>   -        if (name.equals("id")) {
>>>>>   +        if (name.equals("id"))
>>>>>   +        {
>>>>>               throw new IllegalArgumentException("Can't 
> set a
>>>  ValueExpression for the 'id' property.");
>>>>>           }
>>>>>   -        if (name.equals("parent")) {
>>>>>   +        if (name.equals("parent"))
>>>>>   +        {
>>>>>               throw new IllegalArgumentException("Can't 
> set a
>>>  ValueExpression for the 'parent' property.");
>>>>>           }
>>>>> 
>>>>>   -        if (expression == null) {
>>>>>   +        if (expression == null)
>>>>>   +        {
>>>>>               //if (bindings != null) {
>>>>>               //    bindings.remove(name);
>>>>>               //    if (bindings.isEmpty()) {
>>>>>   @@ -341,13 +362,19 @@ public abstract class UIComponent implem
>>>>>               //    }
>>>>>               //}
>>>>>               getStateHelper().remove(PropertyKeys.bindings, 
> name);
>>>>>   -        } else {
>>>>>   -            if (expression.isLiteralText()) {
>>>>>   -                try {
>>>>>   +        }
>>>>>   +        else
>>>>>   +        {
>>>>>   +            if (expression.isLiteralText())
>>>>>   +            {
>>>>>   +                try
>>>>>   +                {
>>>>>                       Object value =
>>>  expression.getValue(getFacesContext().getELContext());
>>>>>                       getAttributes().put(name, value);
>>>>>                       return;
>>>>>   -                } catch (ELException e) {
>>>>>   +                }
>>>>>   +                catch (ELException e)
>>>>>   +                {
>>>>>                       throw new FacesException(e);
>>>>>                   }
>>>>>               }
>>>>>   @@ -361,7 +388,8 @@ public abstract class UIComponent implem
>>>>>           }
>>>>>       }
>>>>> 
>>>>>   -    public String getClientId() {
>>>>>   +    public String getClientId()
>>>>>   +    {
>>>>>           return getClientId(getFacesContext());
>>>>>       }
>>>>> 
>>>>>   @@ -375,30 +403,36 @@ public abstract class UIComponent implem
>>>>>        *
>>>>>        * @param component the component to start from
>>>>>        * @return the parent composite component if found 
> otherwise null
>>>>>   -     *
>>>>>   +     *
>>>>>        * @since 2.0
>>>>>        */
>>>>>   -    public static UIComponent 
> getCompositeComponentParent(UIComponent
>>>  component) {
>>>>>   +    public static UIComponent 
> getCompositeComponentParent(UIComponent
>>>  component)
>>>>>   +    {
>>>>> 
>>>>>   -        if(component == null) {
>>>>>   +        if (component == null)
>>>>>   +        {
>>>>>               return null;
>>>>>           }
>>>>>           UIComponent parent = component;
>>>>> 
>>>>>   -        do {
>>>>>   +        do
>>>>>   +        {
>>>>>               parent = parent.getParent();
>>>>>   -            if(parent != null &&
>>>  UIComponent.isCompositeComponent(parent)) {
>>>>>   +            if (parent != null &&
>>>  UIComponent.isCompositeComponent(parent))
>>>>>   +            {
>>>>>                   return parent;
>>>>>               }
>>>>>   -        } while(parent != null);
>>>>>   +        } while (parent != null);
>>>>>           return null;
>>>>>       }
>>>>> 
>>>>>       /**
>>>>>        * @since 1.2
>>>>>        */
>>>>>   -    public String getContainerClientId(FacesContext ctx) {
>>>>>   -        if (ctx == null) {
>>>>>   +    public String getContainerClientId(FacesContext ctx)
>>>>>   +    {
>>>>>   +        if (ctx == null)
>>>>>   +        {
>>>>>               throw new NullPointerException("FacesContext
>>>  ctx");
>>>>>           }
>>>>> 
>>>>>   @@ -406,24 +440,26 @@ public abstract class UIComponent implem
>>>>>       }
>>>>> 
>>>>>       /**
>>>>>   -     *
>>>>>   +     *
>>>>>        * @param context
>>>>>        * @return
>>>>>   -     *
>>>>>   +     *
>>>>>        * @since 2.0
>>>>>        */
>>>>>   -    public static UIComponent 
> getCurrentComponent(FacesContext
>>>  context) {
>>>>>   -
>>>>>   +    public static UIComponent 
> getCurrentComponent(FacesContext
>>>  context)
>>>>>   +    {
>>>>>   +
>>>>>           Boolean honorCurrentComponentAttributes =
>>>  _getHonorCurrentComponentAttributes(context);
>>>>>   -
>>>>>   +
>>>>>           if (honorCurrentComponentAttributes == Boolean.TRUE)
>>>>>           {
>>>>>               return (UIComponent)
>>>  context.getAttributes().get(UIComponent.CURRENT_COMPONENT);
>>>>>           }
>>>>>           else
>>>>>           {
>>>>>   -            LinkedList<UIComponent> componentStack =
>>>  (LinkedList<UIComponent>)
>>>  context.getAttributes().get(UIComponent._COMPONENT_STACK);
>>>>>   -            if(componentStack == null)
>>>>>   +            LinkedList<UIComponent> componentStack
>>>>>   +                    = (LinkedList<UIComponent>)
>>>  context.getAttributes().get(UIComponent._COMPONENT_STACK);
>>>>>   +            if (componentStack == null)
>>>>>               {
>>>>>                   return null;
>>>>>               }
>>>>>   @@ -435,16 +471,17 @@ public abstract class UIComponent implem
>>>>>       }
>>>>> 
>>>>>       /**
>>>>>   -     *
>>>>>   +     *
>>>>>        * @param context
>>>>>        * @return
>>>>>   -     *
>>>>>   +     *
>>>>>        * @since 2.0
>>>>>        */
>>>>>   -    public static UIComponent
>>>  getCurrentCompositeComponent(FacesContext context) {
>>>>>   -
>>>>>   +    public static UIComponent
>>>  getCurrentCompositeComponent(FacesContext context)
>>>>>   +    {
>>>>>   +
>>>>>           Boolean honorCurrentComponentAttributes =
>>>  _getHonorCurrentComponentAttributes(context);
>>>>>   -
>>>>>   +
>>>>>           if (honorCurrentComponentAttributes == Boolean.TRUE)
>>>>>           {
>>>>>               return (UIComponent)
>>>  context.getAttributes().get(UIComponent.CURRENT_COMPOSITE_COMPONENT);
>>>>>   @@ -459,15 +496,22 @@ public abstract class UIComponent implem
>>>>> 
>>>>>       public abstract String getId();
>>>>> 
>>>>>   -    public List<SystemEventListener>
>>>  getListenersForEventClass(Class<? extends SystemEvent> 
> eventClass) {
>>>>>   +    public List<SystemEventListener>
>>>  getListenersForEventClass(Class<? extends SystemEvent> 
> eventClass)
>>>>>   +    {
>>>>>           List<SystemEventListener> listeners;
>>>>>   -        if (_systemEventListenerClassMap == null) {
>>>>>   +        if (_systemEventListenerClassMap == null)
>>>>>   +        {
>>>>>               listeners = Collections.emptyList();
>>>>>   -        } else {
>>>>>   +        }
>>>>>   +        else
>>>>>   +        {
>>>>>               listeners = 
> _systemEventListenerClassMap.get(eventClass);
>>>>>   -            if (listeners == null) {
>>>>>   +            if (listeners == null)
>>>>>   +            {
>>>>>                   listeners = Collections.emptyList();
>>>>>   -            } else {
>>>>>   +            }
>>>>>   +            else
>>>>>   +            {
>>>>>                   listeners = 
> Collections.unmodifiableList(listeners);
>>>>>               }
>>>>>           }
>>>>>   @@ -476,17 +520,20 @@ public abstract class UIComponent implem
>>>>>       }
>>>>> 
>>>>>       /**
>>>>>   -     *
>>>>>   +     *
>>>>>        * @return
>>>>>   -     *
>>>>>   +     *
>>>>>        * @since 2.0
>>>>>        */
>>>>>   -    public UIComponent getNamingContainer() {
>>>>>   +    public UIComponent getNamingContainer()
>>>>>   +    {
>>>>>           // Starting with "this", return the closest 
> component
>>>  in the ancestry that is a NamingContainer
>>>>>           // or null if none can be found.
>>>>>           UIComponent component = this;
>>>>>   -        do {
>>>>>   -            if (component instanceof NamingContainer) {
>>>>>   +        do
>>>>>   +        {
>>>>>   +            if (component instanceof NamingContainer)
>>>>>   +            {
>>>>>                   return component;
>>>>>               }
>>>>> 
>>>>>   @@ -512,10 +559,11 @@ public abstract class UIComponent implem
>>>>>        *     otherwise take no action</li>
>>>>>        * <ul>
>>>>>        * @param isInView
>>>>>   -     *
>>>>>   +     *
>>>>>        * @since 2.0
>>>>>        */
>>>>>   -    public void setInView(boolean isInView) {
>>>>>   +    public void setInView(boolean isInView)
>>>>>   +    {
>>>>>           _inView = isInView;
>>>>>       }
>>>>> 
>>>>>   @@ -539,48 +587,63 @@ public abstract class UIComponent implem
>>>>> 
>>>>>       public abstract boolean getRendersChildren();
>>>>> 
>>>>>   -    public Map<String, String> getResourceBundleMap() {
>>>>>   -        if (_resourceBundleMap == null) {
>>>>>   +    public Map<String, String> getResourceBundleMap()
>>>>>   +    {
>>>>>   +        if (_resourceBundleMap == null)
>>>>>   +        {
>>>>>               FacesContext context = getFacesContext();
>>>>>               Locale locale = context.getViewRoot().getLocale();
>>>>>               ClassLoader loader = 
> _ClassUtils.getContextClassLoader();
>>>>> 
>>>>>   -            try {
>>>>>   +            try
>>>>>   +            {
>>>>>                   // looks for a ResourceBundle with a base name 
> equal to
>>>  the fully qualified class
>>>>>                   // name of the current UIComponent this and 
> Locale
>>>  equal to the Locale of the current UIViewRoot.
>>>>>                   _resourceBundleMap = new
>>>  BundleMap(ResourceBundle.getBundle(getClass().getName(), locale, 
> loader));
>>>>>   -            } catch (MissingResourceException e) {
>>>>>   +            }
>>>>>   +            catch (MissingResourceException e)
>>>>>   +            {
>>>>>                   // If no such bundle is found, and the 
> component is a
>>>  composite component
>>>>>   -                if (this._isCompositeComponent()) {
>>>>>   +                if (this._isCompositeComponent())
>>>>>   +                {
>>>>>                       // No need to check componentResource (the 
> resource
>>>  used to build the composite
>>>>>                       // component instance) to null since it is 
> already
>>>  done on this._isCompositeComponent()
>>>>>                       Resource componentResource = (Resource)
>>>  getAttributes().get(Resource.COMPONENT_RESOURCE_KEY);
>>>>>                       // Let resourceName be the resourceName of 
> the
>>>  Resource for this composite component,
>>>>>                       // replacing the file extension with
>>>  ".properties"
>>>>>                       int extensionIndex =
>>>  componentResource.getResourceName().lastIndexOf('.');
>>>>>   -                    String resourceName = (extensionIndex 
> < 0 ?
>>>  componentResource.getResourceName() :
>>>  componentResource.getResourceName().substring(0, extensionIndex)) +
>>>  ".properties";
>>>>>   +                    String resourceName = (extensionIndex 
> < 0
>>>>>   +                            ? 
> componentResource.getResourceName()
>>>>>   +                            :
>>>  componentResource.getResourceName().substring(0, extensionIndex)) +
>>>  ".properties";
>>>>> 
>>>>>                       // Let libraryName be the libraryName of 
> the the
>>>  Resource for this composite component.
>>>>>                       // Call
>>>  ResourceHandler.createResource(java.lang.String,java.lang.String), 
> passing the
>>>  derived
>>>>>                       // resourceName and
>>>>>                       // libraryName.
>>>>>   -                    Resource bundleResource =
>>> 
> context.getApplication().getResourceHandler().createResource(resourceName,
>>>  componentResource.getLibraryName());
>>>>>   +                    Resource bundleResource =
>>>  context.getApplication().getResourceHandler()
>>>>>   +                            .createResource(resourceName,
>>>  componentResource.getLibraryName());
>>>>> 
>>>>>   -                    if (bundleResource != null) {
>>>>>   +                    if (bundleResource != null)
>>>>>   +                    {
>>>>>                           // If the resultant Resource exists 
> and can be
>>>  found, the InputStream for the resource
>>>>>                           // is used to create a ResourceBundle. 
> If
>>>  either of the two previous steps for obtaining the
>>>>>                           // ResourceBundle
>>>>>                           // for this component is successful, 
> the
>>>  ResourceBundle is wrapped in a Map<String, String> and
>>>>>                           // returned.
>>>>>   -                        try {
>>>>>   -                            _resourceBundleMap = new 
> BundleMap(new
>>>  PropertyResourceBundle(bundleResource.getInputStream()));
>>>>>   -                        } catch (IOException e1) {
>>>>>   +                        try
>>>>>   +                        {
>>>>>   +                            _resourceBundleMap
>>>>>   +                                    = new BundleMap(new
>>>  PropertyResourceBundle(bundleResource.getInputStream()));
>>>>>   +                        }
>>>>>   +                        catch (IOException e1)
>>>>>   +                        {
>>>>>                               // Nothing happens, then 
> resourceBundleMap
>>>  is set as empty map
>>>>>                           }
>>>>>                       }
>>>>>                   }
>>>>>                   // Otherwise Collections.EMPTY_MAP is 
> returned.
>>>>>   -                if (_resourceBundleMap == null) {
>>>>>   +                if (_resourceBundleMap == null)
>>>>>   +                {
>>>>>                       _resourceBundleMap = 
> Collections.emptyMap();
>>>>>                   }
>>>>>               }
>>>>>   @@ -594,26 +657,33 @@ public abstract class UIComponent implem
>>>>>        */
>>>>>       public abstract ValueBinding getValueBinding(String name);
>>>>> 
>>>>>   -    public ValueExpression getValueExpression(String name) {
>>>>>   -        if (name == null) {
>>>>>   +    public ValueExpression getValueExpression(String name)
>>>>>   +    {
>>>>>   +        if (name == null)
>>>>>   +        {
>>>>>               throw new NullPointerException("name can not 
> be
>>>  null");
>>>>>           }
>>>>>   -
>>>>>   -        Map<String,Object> bindings = 
> (Map<String,Object>)
>>>  getStateHelper().
>>>>>   -            get(PropertyKeys.bindings);
>>>>> 
>>>>>   -        if (bindings == null) {
>>>>>   -            if (!(this instanceof UIComponentBase)) {
>>>>>   +        Map<String, Object> bindings = (Map<String,
>>>  Object>) getStateHelper().
>>>>>   +                get(PropertyKeys.bindings);
>>>>>   +
>>>>>   +        if (bindings == null)
>>>>>   +        {
>>>>>   +            if (!(this instanceof UIComponentBase))
>>>>>   +            {
>>>>>                   // if the component does not inherit from
>>>  UIComponentBase and don't implements JSF 1.2 or later
>>>>>                   ValueBinding vb = getValueBinding(name);
>>>>>   -                if (vb != null) {
>>>>>   +                if (vb != null)
>>>>>   +                {
>>>>>                       //bindings = new HashMap<String,
>>>  ValueExpression>();
>>>>>                       ValueExpression ve = new
>>>  _ValueBindingToValueExpression(vb);
>>>>>   -                   
>  getStateHelper().put(PropertyKeys.bindings , name,
>>>   ve);
>>>>>   +                   
>  getStateHelper().put(PropertyKeys.bindings, name,
>>>  ve);
>>>>>                       return ve;
>>>>>                   }
>>>>>               }
>>>>>   -        } else {
>>>>>   +        }
>>>>>   +        else
>>>>>   +        {
>>>>>               //return bindings.get(name);
>>>>>               return (ValueExpression) bindings.get(name);
>>>>>           }
>>>>>   @@ -636,7 +706,7 @@ public abstract class UIComponent implem
>>>>> 
>>>>>       /**
>>>>>        * {@inheritDoc}
>>>>>   -     *
>>>>>   +     *
>>>>>        * @since 2.0
>>>>>        */
>>>>>       public void clearInitialState()
>>>>>   @@ -652,8 +722,10 @@ public abstract class UIComponent implem
>>>>> 
>>>>>       public abstract void encodeEnd(FacesContext context) 
> throws
>>>  IOException;
>>>>> 
>>>>>   -    public void encodeAll(FacesContext context) throws 
> IOException {
>>>>>   -        if (context == null) {
>>>>>   +    public void encodeAll(FacesContext context) throws 
> IOException
>>>>>   +    {
>>>>>   +        if (context == null)
>>>>>   +        {
>>>>>               throw new NullPointerException();
>>>>>           }
>>>>> 
>>>>>   @@ -669,23 +741,27 @@ public abstract class UIComponent implem
>>>>>           {
>>>>>               popComponentFromEL(context);
>>>>>           }
>>>>>   -
>>>>>   +
>>>>>           //if (isRendered()) {
>>>>>   -            this.encodeBegin(context);
>>>>>   +        this.encodeBegin(context);
>>>>> 
>>>>>   -            // rendering children
>>>>>   -            if (this.getRendersChildren()) {
>>>>>   -                this.encodeChildren(context);
>>>>>   -            } // let children render itself
>>>>>   -            else {
>>>>>   -                if (this.getChildCount() > 0) {
>>>>>   -                    for (int i =0; i < 
> this.getChildCount(); i++) {
>>>>>   -                        UIComponent comp = 
> this.getChildren().get(i);
>>>>>   -                        comp.encodeAll(context);
>>>>>   -                    }
>>>>>   +        // rendering children
>>>>>   +        if (this.getRendersChildren())
>>>>>   +        {
>>>>>   +            this.encodeChildren(context);
>>>>>   +        } // let children render itself
>>>>>   +        else
>>>>>   +        {
>>>>>   +            if (this.getChildCount() > 0)
>>>>>   +            {
>>>>>   +                for (int i = 0; i < this.getChildCount(); 
> i++)
>>>>>   +                {
>>>>>   +                    UIComponent comp = 
> this.getChildren().get(i);
>>>>>   +                    comp.encodeAll(context);
>>>>>                   }
>>>>>               }
>>>>>   -            this.encodeEnd(context);
>>>>>   +        }
>>>>>   +        this.encodeEnd(context);
>>>>>           //}
>>>>>       }
>>>>> 
>>>>>   @@ -701,16 +777,19 @@ public abstract class UIComponent implem
>>>>> 
>>>>>       public abstract void processDecodes(FacesContext context);
>>>>> 
>>>>>   -    public void processEvent(ComponentSystemEvent event) 
> throws
>>>  AbortProcessingException {
>>>>>   +    public void processEvent(ComponentSystemEvent event) 
> throws
>>>  AbortProcessingException
>>>>>   +    {
>>>>>           // The default implementation performs the following 
> action. If
>>>  the argument event is an instance of
>>>>>           // AfterRestoreStateEvent,
>>>>>   -        if (event instanceof PostRestoreStateEvent) {
>>>>>   +        if (event instanceof PostRestoreStateEvent)
>>>>>   +        {
>>>>> 
>>>>>               // call this.getValueExpression(java.lang.String) 
> passing
>>>  the literal string "binding"
>>>>>               ValueExpression expression =
>>>  getValueExpression("binding");
>>>>> 
>>>>>               // If the result is non-null, set the value of the
>>>  ValueExpression to be this.
>>>>>   -            if (expression != null) {
>>>>>   +            if (expression != null)
>>>>>   +            {
>>>>>                   
> expression.setValue(getFacesContext().getELContext(),
>>>  this);
>>>>>               }
>>>>> 
>>>>>   @@ -722,7 +801,8 @@ public abstract class UIComponent implem
>>>>>               // and jsp restore state triggers, a central point 
> is
>>>  preferrble so we do it here
>>>>>               //TODO ask the EG the spec clearly contradicts 
> blackbox RI
>>>  behavior here
>>>>> 
>>>>>   -
>>>  //getFacesContext().getApplication().publishEvent(getFacesContext(),
>>>  PostRestoreStateEvent.class, UIComponent.class, this);
>>>>>   +
>>>   //getFacesContext().getApplication().publishEvent(getFacesContext(),
>>>>>   +            // PostRestoreStateEvent.class, 
> UIComponent.class, this);
>>>>>           }
>>>>> 
>>>>>       }
>>>>>   @@ -733,7 +813,9 @@ public abstract class UIComponent implem
>>>>> 
>>>>>       public abstract java.lang.Object 
> processSaveState(FacesContext
>>>  context);
>>>>> 
>>>>>   -    public void subscribeToEvent(Class<? extends 
> SystemEvent>
>>>  eventClass, ComponentSystemEventListener componentListener) {
>>>>>   +    public void subscribeToEvent(Class<? extends 
> SystemEvent>
>>>  eventClass,
>>>>>   +                                 ComponentSystemEventListener
>>>  componentListener)
>>>>>   +    {
>>>>>           // The default implementation creates an inner
>>>  SystemEventListener instance that wraps argument
>>>>>           // componentListener as the listener argument.
>>>>>           if (eventClass == null)
>>>>>   @@ -744,17 +826,19 @@ public abstract class UIComponent implem
>>>>>           {
>>>>>               throw new 
> NullPointerException("componentListener
>>>  required");
>>>>>           }
>>>>>   -
>>>>>   +
>>>>>           SystemEventListener listener = new 
> EventListenerWrapper(this,
>>>  componentListener);
>>>>> 
>>>>>           // Make sure the map exists
>>>>>   -        if (_systemEventListenerClassMap == null) {
>>>>>   +        if (_systemEventListenerClassMap == null)
>>>>>   +        {
>>>>>               _systemEventListenerClassMap = new 
> HashMap<Class<?
>>>  extends SystemEvent>, List<SystemEventListener>>();
>>>>>           }
>>>>> 
>>>>>           List<SystemEventListener> listeners =
>>>  _systemEventListenerClassMap.get(eventClass);
>>>>>           // Make sure the list for class exists
>>>>>   -        if (listeners == null) {
>>>>>   +        if (listeners == null)
>>>>>   +        {
>>>>>               listeners = new 
> _DeltaList<SystemEventListener>(new
>>>  ArrayList<SystemEventListener>(2));
>>>>>               _systemEventListenerClassMap.put(eventClass, 
> listeners);
>>>>>           }
>>>>>   @@ -764,13 +848,15 @@ public abstract class UIComponent implem
>>>>>       }
>>>>> 
>>>>>       public void unsubscribeFromEvent(Class<? extends 
> SystemEvent>
>>>  eventClass,
>>>>>   -            ComponentSystemEventListener componentListener) {
>>>>>   +                                     
> ComponentSystemEventListener
>>>  componentListener)
>>>>>   +    {
>>>>>           /*
>>>>>            * When doing the comparison to determine if an 
> existing
>>>  listener is equal to the argument componentListener
>>>>>            * (and thus must be removed), the equals() method on 
> the
>>>  existing listener must be invoked, passing the
>>>>>            * argument componentListener, rather than the other 
> way
>>>  around.
>>>>>            *
>>>>>   -         * -=Simon Lessard=- What is that supposed to mean? 
> Are we
>>>  supposed to keep an internal map of created listener wrappers?
>>>>>   +         * -=Simon Lessard=- What is that supposed to mean? 
> Are we
>>>  supposed to keep
>>>>>   +         * an internal map of created listener wrappers?
>>>>>            * -= Leonardo Uribe=- Yes, it is supposed a wrapper 
> should be
>>>  used to hold listener references, to prevent
>>>>>            * serialize component instances on the state.
>>>>>            */
>>>>>   @@ -786,12 +872,13 @@ public abstract class UIComponent implem
>>>>>           if (_systemEventListenerClassMap != null)
>>>>>           {
>>>>>               List<SystemEventListener> listeners =
>>>  _systemEventListenerClassMap.get(eventClass);
>>>>>   -
>>>>>   +
>>>>>               if (listeners != null && 
> !listeners.isEmpty())
>>>>>               {
>>>>>   -                for (Iterator<SystemEventListener> it =
>>>  listeners.iterator(); it.hasNext();)
>>>>>   +                for (Iterator<SystemEventListener> it =
>>>  listeners.iterator(); it.hasNext(); )
>>>>>                   {
>>>>>   -                    ComponentSystemEventListener listener =
>>>  ((EventListenerWrapper) it.next()).getComponentSystemEventListener();
>>>>>   +                    ComponentSystemEventListener listener
>>>>>   +                            = ((EventListenerWrapper)
>>>  it.next()).getComponentSystemEventListener();
>>>>>                       if (listener != null &&
>>>  listener.equals(componentListener))
>>>>>                       {
>>>>>                           it.remove();
>>>>>   @@ -822,48 +909,59 @@ public abstract class UIComponent implem
>>>>>        * @param callback the callback to be performed
>>>>>        * @return false if the processing is not done true if we 
> can
>>>  shortcut
>>>>>        * the visiting because we are done with everything
>>>>>   -     *
>>>>>   +     *
>>>>>        * @since 2.0
>>>>>        */
>>>>>   -    public boolean visitTree(VisitContext context, 
> VisitCallback
>>>  callback) {
>>>>>   -        try {
>>>>>   +    public boolean visitTree(VisitContext context, 
> VisitCallback
>>>  callback)
>>>>>   +    {
>>>>>   +        try
>>>>>   +        {
>>>>>               pushComponentToEL(context.getFacesContext(), 
> this);
>>>>>   -
>>>>>   -            if (!isVisitable(context)) {
>>>>>   -                return false;
>>>>>   -            }
>>>>>   -
>>>>>   -            VisitResult res = 
> context.invokeVisitCallback(this,
>>>  callback);
>>>>>   -            switch (res) {
>>>>>   -            //we are done nothing has to be processed anymore
>>>>>   -            case COMPLETE:
>>>>>   -                return true;
>>>>> 
>>>>>   -            case REJECT:
>>>>>   +            if (!isVisitable(context))
>>>>>   +            {
>>>>>                   return false;
>>>>>   +            }
>>>>> 
>>>>>   -            //accept
>>>>>   -            default:
>>>>>   -                if (getFacetCount() > 0) {
>>>>>   -                    for (UIComponent facet : 
> getFacets().values()) {
>>>>>   -                        if (facet.visitTree(context, 
> callback)) {
>>>>>   -                            return true;
>>>>>   +            VisitResult res = 
> context.invokeVisitCallback(this,
>>>  callback);
>>>>>   +            switch (res)
>>>>>   +            {
>>>>>   +                //we are done nothing has to be processed 
> anymore
>>>>>   +                case COMPLETE:
>>>>>   +                    return true;
>>>>>   +
>>>>>   +                case REJECT:
>>>>>   +                    return false;
>>>>>   +
>>>>>   +                //accept
>>>>>   +                default:
>>>>>   +                    if (getFacetCount() > 0)
>>>>>   +                    {
>>>>>   +                        for (UIComponent facet : 
> getFacets().values())
>>>>>   +                        {
>>>>>   +                            if (facet.visitTree(context, 
> callback))
>>>>>   +                            {
>>>>>   +                                return true;
>>>>>   +                            }
>>>>>                           }
>>>>>                       }
>>>>>   -                }
>>>>>   -                int childCount = getChildCount();
>>>>>   -                if (childCount > 0) {
>>>>>   -                    for (int i =0; i < childCount; i++) {
>>>>>   -                        UIComponent child = 
> getChildren().get(i);
>>>>>   -                        if (child.visitTree(context, 
> callback)) {
>>>>>   -                            return true;
>>>>>   +                    int childCount = getChildCount();
>>>>>   +                    if (childCount > 0)
>>>>>   +                    {
>>>>>   +                        for (int i = 0; i < childCount; 
> i++)
>>>>>   +                        {
>>>>>   +                            UIComponent child = 
> getChildren().get(i);
>>>>>   +                            if (child.visitTree(context, 
> callback))
>>>>>   +                            {
>>>>>   +                                return true;
>>>>>   +                            }
>>>>>                           }
>>>>>                       }
>>>>>   -                }
>>>>>   -                return false;
>>>>>   +                    return false;
>>>>>               }
>>>>>           }
>>>>>   -        finally {
>>>>>   +        finally
>>>>>   +        {
>>>>>               //all components must call popComponentFromEl 
> after
>>>  visiting is finished
>>>>>               popComponentFromEL(context.getFacesContext());
>>>>>           }
>>>>>   @@ -881,14 +979,14 @@ public abstract class UIComponent implem
>>>>>        * (Note that rendererType is suspicious, in theory this 
> field is
>>>>>        * initialized on constructor, but on 1.1 and 1.2 is saved 
> and
>>>  restored,
>>>>>        * so to keep backward behavior we put it on StateHelper )
>>>>>   -     *
>>>>>   +     *
>>>>>        * Also, facesListeners can't be wrapped on 
> StateHelper because
>>>  it
>>>>>        * needs to handle PartialStateHolder instances when it is 
> saved
>>>  and
>>>>>        * restored and this interface does not implement
>>>  PartialStateHolder,
>>>>>        * so we can't propagate calls to markInitialState and
>>>  clearInitialState,
>>>>>        * in other words, the List wrapped by StateHelper does 
> not handle
>>>>>        * PartialStateHolder items.
>>>>>   -     *
>>>>>   +     *
>>>>>        * "bindings" map does not need to deal with
>>>  PartialStateHolder instances,
>>>>>        *  so we can use StateHelper feature (handle delta for 
> this map or
>>>  in
>>>>>        *  other words track add/removal from bindings map as 
> delta).
>>>>>   @@ -902,7 +1000,8 @@ public abstract class UIComponent implem
>>>>>           facesListeners
>>>>>       }
>>>>> 
>>>>>   -    protected StateHelper getStateHelper() {
>>>>>   +    protected StateHelper getStateHelper()
>>>>>   +    {
>>>>>           return getStateHelper(true);
>>>>>       }
>>>>> 
>>>>>   @@ -912,26 +1011,32 @@ public abstract class UIComponent 
> implem
>>>>>        * @param create if true a state helper is created if not 
> already
>>>  existing
>>>>>        * @return an implementation of the StateHelper interface 
> or null
>>>  if none exists and create is set to false
>>>>>        */
>>>>>   -    protected StateHelper getStateHelper(boolean create) {
>>>>>   -        if(_stateHelper != null) {
>>>>>   +    protected StateHelper getStateHelper(boolean create)
>>>>>   +    {
>>>>>   +        if (_stateHelper != null)
>>>>>   +        {
>>>>>               return _stateHelper;
>>>>>           }
>>>>>   -        if(create) {
>>>>>   +        if (create)
>>>>>   +        {
>>>>>               _stateHelper = new _DeltaStateHelper(this);
>>>>>           }
>>>>>           return _stateHelper;
>>>>>       }
>>>>>   -
>>>>>   +
>>>>>       public final TransientStateHelper 
> getTransientStateHelper()
>>>>>       {
>>>>>           return getTransientStateHelper(true);
>>>>>       }
>>>>>   -
>>>>>   -    public TransientStateHelper 
> getTransientStateHelper(boolean
>>>  create) {
>>>>>   -        if(_stateHelper != null) {
>>>>>   +
>>>>>   +    public TransientStateHelper 
> getTransientStateHelper(boolean
>>>  create)
>>>>>   +    {
>>>>>   +        if (_stateHelper != null)
>>>>>   +        {
>>>>>               return _stateHelper;
>>>>>           }
>>>>>   -        if(create) {
>>>>>   +        if (create)
>>>>>   +        {
>>>>>               _stateHelper = new _DeltaStateHelper(this);
>>>>>           }
>>>>>           return _stateHelper;
>>>>>   @@ -948,22 +1053,24 @@ public abstract class UIComponent 
> implem
>>>>>       }
>>>>> 
>>>>>       @SuppressWarnings("unchecked")
>>>>>   -    public final void popComponentFromEL(FacesContext 
> context) {
>>>>>   -        Map<Object, Object> contextAttributes =
>>>  context.getAttributes();
>>>>>   -
>>>>>   +    public final void popComponentFromEL(FacesContext 
> context)
>>>>>   +    {
>>>>>   +        Map<Object, Object> contextAttributes =
>>>  context.getAttributes();
>>>>>   +
>>>>>           if (_honorCurrentComponentAttributes == null)
>>>>>           {
>>>>>               _honorCurrentComponentAttributes =
>>>  _getHonorCurrentComponentAttributes(context);
>>>>>           }
>>>>>   -
>>>>>   +
>>>>>           if (_honorCurrentComponentAttributes == Boolean.TRUE)
>>>>>           {
>>>>>               // Pop the current UIComponent from the 
> FacesContext
>>>  attributes map so that the previous
>>>>>               // UIComponent, if any, becomes the current 
> component.
>>>>>   -            LinkedList<UIComponent> componentStack =
>>>  (LinkedList<UIComponent>)
>>>  contextAttributes.get(UIComponent._COMPONENT_STACK);
>>>>>   -
>>>>>   -            UIComponent oldCurrent =
>>>  (UIComponent)contextAttributes.get(UIComponent.CURRENT_COMPONENT);
>>>>>   -
>>>>>   +            LinkedList<UIComponent> componentStack
>>>>>   +                    = (LinkedList<UIComponent>)
>>>  contextAttributes.get(UIComponent._COMPONENT_STACK);
>>>>>   +
>>>>>   +            UIComponent oldCurrent = (UIComponent)
>>>  contextAttributes.get(UIComponent.CURRENT_COMPONENT);
>>>>>   +
>>>>>               UIComponent newCurrent = null;
>>>>>               if (componentStack != null &&
>>>  !componentStack.isEmpty())
>>>>>               {
>>>>>   @@ -973,7 +1080,7 @@ public abstract class UIComponent implem
>>>>>                       int componentIndex = 
> componentStack.indexOf(this);
>>>>>                       if (componentIndex >= 0)
>>>>>                       {
>>>>>   -                        for (int i = 0; i < 
> (componentIndex+1);
>>>  i++)
>>>>>   +                        for (int i = 0; i < 
> (componentIndex + 1);
>>>  i++)
>>>>>                           {
>>>>>                               newCurrent = 
> componentStack.removeFirst();
>>>>>                           }
>>>>>   @@ -994,8 +1101,8 @@ public abstract class UIComponent implem
>>>>>                   //Reset the current composite component
>>>>> 
>>>  contextAttributes.put(UIComponent.CURRENT_COMPOSITE_COMPONENT, null);
>>>>>               }
>>>>>   -            oldCurrent =
>>>  (UIComponent)contextAttributes.put(UIComponent.CURRENT_COMPONENT, 
> newCurrent);
>>>>>   -
>>>>>   +            oldCurrent = (UIComponent)
>>>  contextAttributes.put(UIComponent.CURRENT_COMPONENT, newCurrent);
>>>>>   +
>>>>>               if (oldCurrent != null &&
>>>  oldCurrent._isCompositeComponent())
>>>>>               {
>>>>>                   // Recalculate the current composite component
>>>>>   @@ -1008,7 +1115,7 @@ public abstract class UIComponent implem
>>>>>                       else
>>>>>                       {
>>>>>                           UIComponent previousCompositeComponent 
> = null;
>>>>>   -                        for (Iterator<UIComponent> it =
>>>  componentStack.iterator(); it.hasNext();)
>>>>>   +                        for (Iterator<UIComponent> it =
>>>  componentStack.iterator(); it.hasNext(); )
>>>>>                           {
>>>>>                               UIComponent component = it.next();
>>>>>                               if 
> (component._isCompositeComponent())
>>>>>   @@ -1026,15 +1133,16 @@ public abstract class UIComponent 
> implem
>>>>>           {
>>>>>               // Pop the current UIComponent from the 
> FacesContext
>>>  attributes map so that the previous
>>>>>               // UIComponent, if any, becomes the current 
> component.
>>>>>   -            LinkedList<UIComponent> componentStack =
>>>  (LinkedList<UIComponent>)
>>>  contextAttributes.get(UIComponent._COMPONENT_STACK);
>>>>>   -
>>>>>   +            LinkedList<UIComponent> componentStack
>>>>>   +                    = (LinkedList<UIComponent>)
>>>  contextAttributes.get(UIComponent._COMPONENT_STACK);
>>>>>   +
>>>>>               UIComponent oldCurrent = null;
>>>>>               if (componentStack != null &&
>>>  !componentStack.isEmpty())
>>>>>               {
>>>>>                   int componentIndex = 
> componentStack.indexOf(this);
>>>>>                   if (componentIndex >= 0)
>>>>>                   {
>>>>>   -                    for (int i = 0; i < 
> (componentIndex+1); i++)
>>>>>   +                    for (int i = 0; i < (componentIndex + 
> 1); i++)
>>>>>                       {
>>>>>                           oldCurrent = 
> componentStack.removeFirst();
>>>>>                       }
>>>>>   @@ -1044,12 +1152,12 @@ public abstract class UIComponent 
> implem
>>>>>                       return;
>>>>>                   }
>>>>>               }
>>>>>   -
>>>>>   +
>>>>>               if (oldCurrent != null &&
>>>  oldCurrent._isCompositeComponent())
>>>>>               {
>>>>>                   // Recalculate the current composite component
>>>>>                   UIComponent previousCompositeComponent = null;
>>>>>   -                for (Iterator<UIComponent> it =
>>>  componentStack.iterator(); it.hasNext();)
>>>>>   +                for (Iterator<UIComponent> it =
>>>  componentStack.iterator(); it.hasNext(); )
>>>>>                   {
>>>>>                       UIComponent component = it.next();
>>>>>                       if (component._isCompositeComponent())
>>>>>   @@ -1064,40 +1172,42 @@ public abstract class UIComponent 
> implem
>>>>>       }
>>>>> 
>>>>>       @SuppressWarnings("unchecked")
>>>>>   -    public final void pushComponentToEL(FacesContext context,
>>>  UIComponent component) {
>>>>>   +    public final void pushComponentToEL(FacesContext context,
>>>  UIComponent component)
>>>>>   +    {
>>>>>           if (component == null)
>>>>>           {
>>>>>               component = this;
>>>>>           }
>>>>> 
>>>>>           Map<Object, Object> contextAttributes =
>>>  context.getAttributes();
>>>>>   -
>>>>>   +
>>>>>           if (_honorCurrentComponentAttributes == null)
>>>>>           {
>>>>>               _honorCurrentComponentAttributes =
>>>  _getHonorCurrentComponentAttributes(context);
>>>>>           }
>>>>>   -
>>>>>   +
>>>>>           if (_honorCurrentComponentAttributes == Boolean.TRUE)
>>>>>           {
>>>>>               UIComponent currentComponent = (UIComponent)
>>>  contextAttributes.get(UIComponent.CURRENT_COMPONENT);
>>>>>   -
>>>>>   -            if(currentComponent != null)
>>>>>   +
>>>>>   +            if (currentComponent != null)
>>>>>               {
>>>>>   -                LinkedList<UIComponent> componentStack 
> =
>>>  (LinkedList<UIComponent>)
>>>  contextAttributes.get(UIComponent._COMPONENT_STACK);
>>>>>   -                if(componentStack == null)
>>>>>   +                LinkedList<UIComponent> componentStack
>>>>>   +                        = (LinkedList<UIComponent>)
>>>  contextAttributes.get(UIComponent._COMPONENT_STACK);
>>>>>   +                if (componentStack == null)
>>>>>                   {
>>>>>                       componentStack = new
>>>  LinkedList<UIComponent>();
>>>>>                       
> contextAttributes.put(UIComponent._COMPONENT_STACK,
>>>  componentStack);
>>>>>                   }
>>>>>   -
>>>>>   +
>>>>>                   componentStack.addFirst(currentComponent);
>>>>>               }
>>>>>   -
>>>>>   +
>>>>>               // Push the current UIComponent this to the 
> FacesContext
>>>   attribute map using the key CURRENT_COMPONENT
>>>>>               // saving the previous UIComponent associated with
>>>  CURRENT_COMPONENT for a subsequent call to
>>>>>               // 
> popComponentFromEL(javax.faces.context.FacesContext).
>>>>>               
> contextAttributes.put(UIComponent.CURRENT_COMPONENT,
>>>  component);
>>>>>   -
>>>>>   +
>>>>>               if (component._isCompositeComponent())
>>>>>               {
>>>>> 
>>>  contextAttributes.put(UIComponent.CURRENT_COMPOSITE_COMPONENT, 
> component);
>>>>>   @@ -1105,8 +1215,9 @@ public abstract class UIComponent implem
>>>>>           }
>>>>>           else
>>>>>           {
>>>>>   -            LinkedList<UIComponent> componentStack =
>>>  (LinkedList<UIComponent>)
>>>  contextAttributes.get(UIComponent._COMPONENT_STACK);
>>>>>   -            if(componentStack == null)
>>>>>   +            LinkedList<UIComponent> componentStack
>>>>>   +                    = (LinkedList<UIComponent>)
>>>  contextAttributes.get(UIComponent._COMPONENT_STACK);
>>>>>   +            if (componentStack == null)
>>>>>               {
>>>>>                   componentStack = new 
> LinkedList<UIComponent>();
>>>>>                   
> contextAttributes.put(UIComponent._COMPONENT_STACK,
>>>  componentStack);
>>>>>   @@ -1122,25 +1233,28 @@ public abstract class UIComponent 
> implem
>>>>>       /**
>>>>>        * @since 1.2
>>>>>        */
>>>>>   -    public int getFacetCount() {
>>>>>   +    public int getFacetCount()
>>>>>   +    {
>>>>>           // not sure why the RI has this method in both
>>>>>           // UIComponent and UIComponentBase
>>>>>           Map<String, UIComponent> facets = getFacets();
>>>>>           return facets == null ? 0 : facets.size();
>>>>>       }
>>>>> 
>>>>>   -    private boolean _isCompositeComponent() {
>>>>>   +    private boolean _isCompositeComponent()
>>>>>   +    {
>>>>>           //moved to the static method
>>>>>           return UIComponent.isCompositeComponent(this);
>>>>>       }
>>>>>   -
>>>>>   +
>>>>>       /**
>>>>>        * Gets value of
>>>  "javax.faces.HONOR_CURRENT_COMPONENT_ATTRIBUTES" parameter 
> cached in
>>>  facesContext.attributes
>>>>>        * or resolves that param and caches its value in
>>>  facesContext.attributes.
>>>>>   -     *
>>>>>   +     *
>>>>>        * @return canonical Boolean value for parameter
>>>  "javax.faces.HONOR_CURRENT_COMPONENT_ATTRIBUTES"
>>>>>        */
>>>>>   -    private static Boolean
>>>  _getHonorCurrentComponentAttributes(FacesContext facesContext) {
>>>>>   +    private static Boolean
>>>  _getHonorCurrentComponentAttributes(FacesContext facesContext)
>>>>>   +    {
>>>>>           // performance note: we cache value in 
> facesContext.attributes
>>>  because
>>>>>           // 1) methods pushComponentToEL, popComponentFromEl,
>>>  getCurrentComponent a getCurrentCompositeComponent
>>>>>           // can use that value
>>>>>   @@ -1149,49 +1263,65 @@ public abstract class UIComponent 
> implem
>>>>>           // implementation and performance
>>>>>           Map<Object, Object> attributes =
>>>  facesContext.getAttributes();
>>>>>           Boolean paramValue = (Boolean)
>>>  attributes.get(HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME);
>>>>>   -        if (paramValue == null) {
>>>>>   -            String param =
>>> 
> facesContext.getExternalContext().getInitParameter(HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME);
>>>>>   +        if (paramValue == null)
>>>>>   +        {
>>>>>   +            String param
>>>>>   +                    =
>>> 
> facesContext.getExternalContext().getInitParameter(HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME);
>>>>>               paramValue = Boolean.valueOf((param != null 
> &&
>>>  Boolean.valueOf(param).booleanValue()));
>>>>> 
>>>  attributes.put(HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME, 
> paramValue);
>>>>>           }
>>>>>           return paramValue;
>>>>>       }
>>>>>   -
>>>>>   -    private static class BundleMap implements Map<String,
>>>  String> {
>>>>>   +
>>>>>   +    private static class BundleMap implements Map<String,
>>>  String>
>>>>>   +    {
>>>>> 
>>>>>           private ResourceBundle _bundle;
>>>>>           private List<String> _values;
>>>>> 
>>>>>   -        public BundleMap(ResourceBundle bundle) {
>>>>>   +        public BundleMap(ResourceBundle bundle)
>>>>>   +        {
>>>>>               _bundle = bundle;
>>>>>           }
>>>>> 
>>>>>           // Optimized methods
>>>>>   -        public String get(Object key) {
>>>>>   -            try {
>>>>>   +        public String get(Object key)
>>>>>   +        {
>>>>>   +            try
>>>>>   +            {
>>>>>                   return (String) 
> _bundle.getObject(key.toString());
>>>>>   -            } catch (Exception e) {
>>>>>   +            }
>>>>>   +            catch (Exception e)
>>>>>   +            {
>>>>>                   return "???" + key + 
> "???";
>>>>>               }
>>>>>           }
>>>>> 
>>>>>   -        public boolean isEmpty() {
>>>>>   +        public boolean isEmpty()
>>>>>   +        {
>>>>>               return !_bundle.getKeys().hasMoreElements();
>>>>>           }
>>>>> 
>>>>>   -        public boolean containsKey(Object key) {
>>>>>   -            try {
>>>>>   +        public boolean containsKey(Object key)
>>>>>   +        {
>>>>>   +            try
>>>>>   +            {
>>>>>                   return _bundle.getObject(key.toString()) != 
> null;
>>>>>   -            } catch (MissingResourceException e) {
>>>>>   +            }
>>>>>   +            catch (MissingResourceException e)
>>>>>   +            {
>>>>>                   return false;
>>>>>               }
>>>>>           }
>>>>> 
>>>>>           // Unoptimized methods
>>>>>   -        public Collection<String> values() {
>>>>>   -            if (_values == null) {
>>>>>   +        public Collection<String> values()
>>>>>   +        {
>>>>>   +            if (_values == null)
>>>>>   +            {
>>>>>                   _values = new ArrayList<String>();
>>>>>   -                for (Enumeration<String> enumer =
>>>  _bundle.getKeys(); enumer.hasMoreElements();) {
>>>>>   +                for (Enumeration<String> enumer =
>>>  _bundle.getKeys(); enumer.hasMoreElements(); )
>>>>>   +                {
>>>>>                       String v = 
> _bundle.getString(enumer.nextElement());
>>>>>                       _values.add(v);
>>>>>                   }
>>>>>   @@ -1199,29 +1329,37 @@ public abstract class UIComponent 
> implem
>>>>>               return _values;
>>>>>           }
>>>>> 
>>>>>   -        public int size() {
>>>>>   +        public int size()
>>>>>   +        {
>>>>>               return values().size();
>>>>>           }
>>>>> 
>>>>>   -        public boolean containsValue(Object value) {
>>>>>   +        public boolean containsValue(Object value)
>>>>>   +        {
>>>>>               return values().contains(value);
>>>>>           }
>>>>> 
>>>>>   -        public Set<Map.Entry<String, String>> 
> entrySet() {
>>>>>   +        public Set<Map.Entry<String, String>> 
> entrySet()
>>>>>   +        {
>>>>>               Set<Entry<String, String>> set = new
>>>  HashSet<Entry<String, String>>();
>>>>>   -            for (Enumeration<String> enumer = 
> _bundle.getKeys();
>>>  enumer.hasMoreElements();) {
>>>>>   +            for (Enumeration<String> enumer = 
> _bundle.getKeys();
>>>  enumer.hasMoreElements(); )
>>>>>   +            {
>>>>>                   final String k = enumer.nextElement();
>>>>>   -                set.add(new Map.Entry<String, String>() 
> {
>>>>>   +                set.add(new Map.Entry<String, String>()
>>>>>   +                {
>>>>> 
>>>>>   -                    public String getKey() {
>>>>>   +                    public String getKey()
>>>>>   +                    {
>>>>>                           return k;
>>>>>                       }
>>>>> 
>>>>>   -                    public String getValue() {
>>>>>   +                    public String getValue()
>>>>>   +                    {
>>>>>                           return (String) _bundle.getObject(k);
>>>>>                       }
>>>>> 
>>>>>   -                    public String setValue(String value) {
>>>>>   +                    public String setValue(String value)
>>>>>   +                    {
>>>>>                           throw new 
> UnsupportedOperationException();
>>>>>                       }
>>>>>                   });
>>>>>   @@ -1230,37 +1368,44 @@ public abstract class UIComponent 
> implem
>>>>>               return set;
>>>>>           }
>>>>> 
>>>>>   -        public Set<String> keySet() {
>>>>>   +        public Set<String> keySet()
>>>>>   +        {
>>>>>               Set<String> set = new 
> HashSet<String>();
>>>>>   -            for (Enumeration<String> enumer = 
> _bundle.getKeys();
>>>  enumer.hasMoreElements();) {
>>>>>   +            for (Enumeration<String> enumer = 
> _bundle.getKeys();
>>>  enumer.hasMoreElements(); )
>>>>>   +            {
>>>>>                   set.add(enumer.nextElement());
>>>>>               }
>>>>>               return set;
>>>>>           }
>>>>> 
>>>>>           // Unsupported methods
>>>>>   -        public String remove(Object key) {
>>>>>   +        public String remove(Object key)
>>>>>   +        {
>>>>>               throw new UnsupportedOperationException();
>>>>>           }
>>>>> 
>>>>>   -        public void putAll(Map<? extends String, ? extends
>>>  String> t) {
>>>>>   +        public void putAll(Map<? extends String, ? extends
>>>  String> t)
>>>>>   +        {
>>>>>               throw new UnsupportedOperationException();
>>>>>           }
>>>>> 
>>>>>   -        public String put(String key, String value) {
>>>>>   +        public String put(String key, String value)
>>>>>   +        {
>>>>>               throw new UnsupportedOperationException();
>>>>>           }
>>>>> 
>>>>>   -        public void clear() {
>>>>>   +        public void clear()
>>>>>   +        {
>>>>>               throw new UnsupportedOperationException();
>>>>>           }
>>>>>       }
>>>>> 
>>>>>   -    static class EventListenerWrapper implements 
> SystemEventListener,
>>>  PartialStateHolder {
>>>>>   +    static class EventListenerWrapper implements 
> SystemEventListener,
>>>  PartialStateHolder
>>>>>   +    {
>>>>> 
>>>>>           private Class<?> componentClass;
>>>>>           private ComponentSystemEventListener listener;
>>>>>   -
>>>>>   +
>>>>>           private boolean _initialStateMarked;
>>>>> 
>>>>>           private int listenerCapability;
>>>>>   @@ -1270,16 +1415,16 @@ public abstract class UIComponent 
> implem
>>>>>           private static final int LISTENER_TYPE_COMPONENT = 4;
>>>>>           private static final int LISTENER_TYPE_RENDERER = 8;
>>>>>           private static final int LISTENER_TYPE_OTHER = 16;
>>>>>   -
>>>>>   +
>>>>>           public EventListenerWrapper()
>>>>>           {
>>>>>               //need a no-arg constructor for state saving 
> purposes
>>>>>               super();
>>>>>           }
>>>>>   -
>>>>>   +
>>>>>           /**
>>>>>            * Note we have two cases:
>>>>>   -         *
>>>>>   +         *
>>>>>            * 1. listener is an instance of UIComponent. In this 
> case we
>>>  cannot save and restore
>>>>>            *    it because we need to point to the real 
> component, but we
>>>  can assume the instance
>>>>>            *    is the same because UIComponent.subscribeToEvent 
> says so.
>>>  Also take into account
>>>>>   @@ -1289,11 +1434,12 @@ public abstract class UIComponent 
> implem
>>>>>            * 3. listener is an instance of 
> ComponentSystemEventListener
>>>  but not from UIComponent.
>>>>>            *    In this case, the instance could implement 
> StateHolder,
>>>  PartialStateHolder or do
>>>>>            *    implement anything, so we have to deal with that 
> case as
>>>  usual.
>>>>>   -         *
>>>>>   +         *
>>>>>            * @param component
>>>>>            * @param listener
>>>>>            */
>>>>>   -        public EventListenerWrapper(UIComponent component,
>>>  ComponentSystemEventListener listener) {
>>>>>   +        public EventListenerWrapper(UIComponent component,
>>>  ComponentSystemEventListener listener)
>>>>>   +        {
>>>>>               assert component != null;
>>>>>               assert listener != null;
>>>>> 
>>>>>   @@ -1302,7 +1448,7 @@ public abstract class UIComponent implem
>>>>> 
>>>>>               initListenerCapability();
>>>>>           }
>>>>>   -
>>>>>   +
>>>>>           private void initListenerCapability()
>>>>>           {
>>>>>               this.listenerCapability = 0;
>>>>>   @@ -1318,7 +1464,7 @@ public abstract class UIComponent implem
>>>>>               {
>>>>>                   if (this.listener instanceof 
> PartialStateHolder)
>>>>>                   {
>>>>>   -                    this.listenerCapability = 
> LISTENER_TYPE_OTHER |
>>>  LISTENER_SAVE_PARTIAL_STATE_HOLDER;
>>>>>   +                    this.listenerCapability = 
> LISTENER_TYPE_OTHER |
>>>  LISTENER_SAVE_PARTIAL_STATE_HOLDER;
>>>>>                   }
>>>>>                   else if (this.listener instanceof StateHolder)
>>>>>                   {
>>>>>   @@ -1332,7 +1478,8 @@ public abstract class UIComponent implem
>>>>>           }
>>>>> 
>>>>>           @Override
>>>>>   -        public boolean equals(Object o) {
>>>>>   +        public boolean equals(Object o)
>>>>>   +        {
>>>>>               if (o == this)
>>>>>               {
>>>>>                   return true;
>>>>>   @@ -1341,13 +1488,16 @@ public abstract class UIComponent 
> implem
>>>>>               {
>>>>>                   EventListenerWrapper other = 
> (EventListenerWrapper) o;
>>>>>                   return 
> componentClass.equals(other.componentClass)
>>>  && listener.equals(other.listener);
>>>>>   -            } else {
>>>>>   +            }
>>>>>   +            else
>>>>>   +            {
>>>>>                   return false;
>>>>>               }
>>>>>           }
>>>>> 
>>>>>           @Override
>>>>>   -        public int hashCode() {
>>>>>   +        public int hashCode()
>>>>>   +        {
>>>>>               return componentClass.hashCode() + 
> listener.hashCode();
>>>>>           }
>>>>> 
>>>>>   @@ -1358,7 +1508,7 @@ public abstract class UIComponent implem
>>>>> 
>>>>>               return 
> source.getClass().isAssignableFrom(componentClass);
>>>>>           }
>>>>>   -
>>>>>   +
>>>>>           public ComponentSystemEventListener
>>>  getComponentSystemEventListener()
>>>>>           {
>>>>>               return listener;
>>>>>   @@ -1377,9 +1527,9 @@ public abstract class UIComponent implem
>>>>>           public void clearInitialState()
>>>>>           {
>>>>>               //if (!(listener instanceof UIComponent) 
> &&
>>>  listener instanceof PartialStateHolder)
>>>>>   -            if ( (listenerCapability &
>>>  LISTENER_SAVE_PARTIAL_STATE_HOLDER) != 0)
>>>>>   +            if ((listenerCapability &
>>>  LISTENER_SAVE_PARTIAL_STATE_HOLDER) != 0)
>>>>>               {
>>>>>   -               
>  ((PartialStateHolder)listener).clearInitialState();
>>>>>   +                ((PartialStateHolder) 
> listener).clearInitialState();
>>>>>               }
>>>>>               _initialStateMarked = false;
>>>>>           }
>>>>>   @@ -1387,9 +1537,9 @@ public abstract class UIComponent implem
>>>>>           public boolean initialStateMarked()
>>>>>           {
>>>>>               //if (!(listener instanceof UIComponent) 
> &&
>>>  listener instanceof PartialStateHolder)
>>>>>   -            if ( (listenerCapability &
>>>  LISTENER_SAVE_PARTIAL_STATE_HOLDER) != 0)
>>>>>   +            if ((listenerCapability &
>>>  LISTENER_SAVE_PARTIAL_STATE_HOLDER) != 0)
>>>>>               {
>>>>>   -                return
>>>  ((PartialStateHolder)listener).initialStateMarked();
>>>>>   +                return ((PartialStateHolder)
>>>  listener).initialStateMarked();
>>>>>               }
>>>>>               //return false;
>>>>>               return _initialStateMarked;
>>>>>   @@ -1398,9 +1548,9 @@ public abstract class UIComponent implem
>>>>>           public void markInitialState()
>>>>>           {
>>>>>               //if (!(listener instanceof UIComponent) 
> &&
>>>  listener instanceof PartialStateHolder)
>>>>>   -            if ( (listenerCapability &
>>>  LISTENER_SAVE_PARTIAL_STATE_HOLDER) != 0)
>>>>>   +            if ((listenerCapability &
>>>  LISTENER_SAVE_PARTIAL_STATE_HOLDER) != 0)
>>>>>               {
>>>>>   -               
>  ((PartialStateHolder)listener).markInitialState();
>>>>>   +                ((PartialStateHolder) 
> listener).markInitialState();
>>>>>               }
>>>>>               _initialStateMarked = true;
>>>>>           }
>>>>>   @@ -1408,11 +1558,11 @@ public abstract class UIComponent 
> implem
>>>>>           public boolean isTransient()
>>>>>           {
>>>>>               //if ( listener instanceof StateHolder)
>>>>>   -            if ((listenerCapability &
>>>  LISTENER_SAVE_PARTIAL_STATE_HOLDER) != 0 ||
>>>>>   -                (listenerCapability & 
> LISTENER_SAVE_STATE_HOLDER)
>>>  != 0 )
>>>>>   +            if ((listenerCapability &
>>>  LISTENER_SAVE_PARTIAL_STATE_HOLDER) != 0 ||
>>>>>   +                    (listenerCapability &
>>>  LISTENER_SAVE_STATE_HOLDER) != 0)
>>>>>               {
>>>>>   -                return ((StateHolder)listener).isTransient();
>>>>>   -            }
>>>>>   +                return ((StateHolder) 
> listener).isTransient();
>>>>>   +            }
>>>>>               return false;
>>>>>           }
>>>>> 
>>>>>   @@ -1426,24 +1576,27 @@ public abstract class UIComponent 
> implem
>>>>>               componentClass = (Class) values[0];
>>>>>               if (values[1] instanceof _AttachedDeltaWrapper)
>>>>>               {
>>>>>   -                ((StateHolder)listener).restoreState(context,
>>>  ((_AttachedDeltaWrapper)values[1]).getWrappedStateObject());
>>>>>   +                ((StateHolder) 
> listener).restoreState(context,
>>>>>   +                        ((_AttachedDeltaWrapper)
>>>  values[1]).getWrappedStateObject());
>>>>>               }
>>>>>               else
>>>>>               {
>>>>>                   //Full restore
>>>>>                   listenerCapability = (Integer) values[2];
>>>>>   -
>>>>>   -                if ( (listenerCapability &
>>>  LISTENER_TYPE_COMPONENT) != 0 )
>>>>>   +
>>>>>   +                if ((listenerCapability & 
> LISTENER_TYPE_COMPONENT)
>>>  != 0)
>>>>>                   {
>>>>>                       listener =
>>>  UIComponent.getCurrentComponent(context);
>>>>>                   }
>>>>>   -                else if ( (listenerCapability &
>>>  LISTENER_TYPE_RENDERER) != 0)
>>>>>   +                else if ((listenerCapability &
>>>  LISTENER_TYPE_RENDERER) != 0)
>>>>>                   {
>>>>>   -                    listener = (ComponentSystemEventListener)
>>>  UIComponent.getCurrentComponent(context).getRenderer(context);
>>>>>   +                    listener = (ComponentSystemEventListener)
>>>>>   +
>>>   UIComponent.getCurrentComponent(context).getRenderer(context);
>>>>>                   }
>>>>>                   else
>>>>>                   {
>>>>>   -                    listener = (ComponentSystemEventListener)
>>>  UIComponentBase.restoreAttachedState(context, values[1]);
>>>>>   +                    listener = (ComponentSystemEventListener)
>>>>>   +
>>>   UIComponentBase.restoreAttachedState(context, values[1]);
>>>>>                   }
>>>>>                   /*
>>>>>                   listener = values[1] == null ?
>>>>>   @@ -1469,8 +1622,8 @@ public abstract class UIComponent implem
>>>>>                   Object[] state = new Object[3];
>>>>>                   state[0] = componentClass;
>>>>>                   //If this is not a component or a renderer, 
> save it
>>>  calling UIComponent.saveAttachedState
>>>>>   -                if (!( (listenerCapability &
>>>  LISTENER_TYPE_COMPONENT) != 0 ||
>>>>>   -                       (listenerCapability &
>>>  LISTENER_TYPE_RENDERER) != 0    ) )
>>>>>   +                if (!((listenerCapability &
>>>  LISTENER_TYPE_COMPONENT) != 0 ||
>>>>>   +                        (listenerCapability &
>>>  LISTENER_TYPE_RENDERER) != 0))
>>>>>                   {
>>>>>                       state[1] =
>>>  UIComponentBase.saveAttachedState(context, listener);
>>>>>                   }
>>>>>   @@ -1485,25 +1638,26 @@ public abstract class UIComponent 
> implem
>>>>>               {
>>>>>                   // If initialStateMarked() == true means two 
> things:
>>>>>                   // 1. PSS is being used
>>>>>   -                if ( (listenerCapability &
>>>  LISTENER_TYPE_COMPONENT) != 0)
>>>>>   +                if ((listenerCapability & 
> LISTENER_TYPE_COMPONENT)
>>>  != 0)
>>>>>                   {
>>>>>                       return null;
>>>>>                   }
>>>>>   -                else if ( (listenerCapability &
>>>  LISTENER_TYPE_RENDERER) != 0)
>>>>>   +                else if ((listenerCapability &
>>>  LISTENER_TYPE_RENDERER) != 0)
>>>>>                   {
>>>>>                       return null;
>>>>>                   }
>>>>>                   else
>>>>>                   {
>>>>>   -                    if ( (listenerCapability &
>>>  LISTENER_SAVE_STATE_HOLDER) != 0 ||
>>>>>   -                         (listenerCapability &
>>>  LISTENER_SAVE_PARTIAL_STATE_HOLDER) != 0)
>>>>>   +                    if ((listenerCapability &
>>>  LISTENER_SAVE_STATE_HOLDER) != 0 ||
>>>>>   +                            (listenerCapability &
>>>  LISTENER_SAVE_PARTIAL_STATE_HOLDER) != 0)
>>>>>                       {
>>>>>                           Object listenerSaved = ((StateHolder)
>>>  listener).saveState(context);
>>>>>                           if (listenerSaved == null)
>>>>>                           {
>>>>>                               return null;
>>>>>                           }
>>>>>   -                        return new Object[]{componentClass, 
> new
>>>  _AttachedDeltaWrapper(listener.getClass(), listenerSaved)};
>>>>>   +                        return new Object[]{componentClass,
>>>>>   +                                            new
>>>  _AttachedDeltaWrapper(listener.getClass(), listenerSaved)};
>>>>>                       }
>>>>>                       else
>>>>>                       {
>>>>>   @@ -1524,11 +1678,11 @@ public abstract class UIComponent 
> implem
>>>>> 
>>>>>           public void setTransient(boolean newTransientValue)
>>>>>           {
>>>>>   -            if ((listenerCapability &
>>>  LISTENER_SAVE_PARTIAL_STATE_HOLDER) != 0 ||
>>>>>   -                    (listenerCapability &
>>>  LISTENER_SAVE_STATE_HOLDER) != 0 )
>>>>>   +            if ((listenerCapability &
>>>  LISTENER_SAVE_PARTIAL_STATE_HOLDER) != 0 ||
>>>>>   +                    (listenerCapability &
>>>  LISTENER_SAVE_STATE_HOLDER) != 0)
>>>>>               {
>>>>>   -
>>>   ((StateHolder)listener).setTransient(newTransientValue);
>>>>>   -            }
>>>>>   +                ((StateHolder)
>>>  listener).setTransient(newTransientValue);
>>>>>   +            }
>>>>>           }
>>>>>       }
>>>>>    }
>>>>> 
>>>>>   Modified:
>>> 
> myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponentBase.java
>>>>>   URL:
>>> 
> http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponentBase.java?rev=1188267&r1=1188266&r2=1188267&view=diff
>>>>> 
>>> 
> ==============================================================================
>>>>>   ---
>>> 
> myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponentBase.java
>>>  (original)
>>>>>   +++
>>> 
> myfaces/core/trunk/api/src/main/java/javax/faces/component/UIComponentBase.java
>>>  Mon Oct 24 18:09:08 2011
>>>>>   @@ -590,7 +590,7 @@ public abstract class UIComponentBase ex
>>>>>               return null;
>>>>>           }
>>>>> 
>>>>>   -        final char separatorChar =
>>>  UINamingContainer.getSeparatorChar(getFacesContext());
>>>>>   +        char separatorChar =
>>>  UINamingContainer.getSeparatorChar(getFacesContext());
>>>>>           UIComponent findBase;
>>>>>           if (expr.charAt(0) == separatorChar)
>>>>>           {
>>>>> 
>>>>>   Modified:
>>>  myfaces/core/trunk/api/src/main/java/javax/faces/component/UIData.java
>>>>>   URL:
>>> 
> http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIData.java?rev=1188267&r1=1188266&r2=1188267&view=diff
>>>>> 
>>> 
> ==============================================================================
>>>>>   ---
>>>  myfaces/core/trunk/api/src/main/java/javax/faces/component/UIData.java
>>>  (original)
>>>>>   +++
>>>  myfaces/core/trunk/api/src/main/java/javax/faces/component/UIData.java 
> Mon Oct
>>>  24 18:09:08 2011
>>>>>   @@ -316,7 +316,7 @@ public class UIData extends UIComponentB
>>>>>               throw new NullPointerException();
>>>>>           }
>>>>> 
>>>>>   -        final String baseClientId = getClientId(context);
>>>>>   +        String baseClientId = getClientId(context);
>>>>> 
>>>>>           // searching for this component?
>>>>>           boolean returnValue = baseClientId.equals(clientId);
>>>>>   @@ -1565,7 +1565,7 @@ public class UIData extends UIComponentB
>>>>>           {
>>>>>               FacesEvent originalEvent = ((FacesEventWrapper)
>>>  event).getWrappedFacesEvent();
>>>>>               int eventRowIndex = ((FacesEventWrapper)
>>>  event).getRowIndex();
>>>>>   -            final int currentRowIndex = getRowIndex();
>>>>>   +            int currentRowIndex = getRowIndex();
>>>>>               UIComponent source = originalEvent.getComponent();
>>>>>               UIComponent compositeParent =
>>>  UIComponent.getCompositeComponentParent(source);
>>>>> 
>>>>> 
>>>>>   Modified:
>>>  myfaces/core/trunk/api/src/main/java/javax/faces/component/UIInput.java
>>>>>   URL:
>>> 
> http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIInput.java?rev=1188267&r1=1188266&r2=1188267&view=diff
>>>>> 
>>> 
> ==============================================================================
>>>>>   ---
>>>  myfaces/core/trunk/api/src/main/java/javax/faces/component/UIInput.java
>>>  (original)
>>>>>   +++
>>>  myfaces/core/trunk/api/src/main/java/javax/faces/component/UIInput.java 
> Mon Oct
>>>  24 18:09:08 2011
>>>>>   @@ -1065,7 +1065,7 @@ public class UIInput extends UIOutput im
>>>>>       @SuppressWarnings("unchecked")
>>>>>       private Map<String, List<Object[]>> 
> _getDebugInfoMap()
>>>>>       {
>>>>>   -        final Map<String, Object> requestMap = 
> getFacesContext()
>>>>>   +        Map<String, Object> requestMap = 
> getFacesContext()
>>>>>                   .getExternalContext().getRequestMap();
>>>>>           Map<String, List<Object[]>> debugInfo =
>>>  (Map<String, List<Object[]>>)
>>>>>                   requestMap.get(DEBUG_INFO_KEY + 
> getClientId());
>>>>> 
>>>>>   Modified:
>>> 
> myfaces/core/trunk/api/src/main/java/javax/faces/component/UISelectMany.java
>>>>>   URL:
>>> 
> http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UISelectMany.java?rev=1188267&r1=1188266&r2=1188267&view=diff
>>>>> 
>>> 
> ==============================================================================
>>>>>   ---
>>> 
> myfaces/core/trunk/api/src/main/java/javax/faces/component/UISelectMany.java
>>>  (original)
>>>>>   +++
>>> 
> myfaces/core/trunk/api/src/main/java/javax/faces/component/UISelectMany.java Mon
>>>  Oct 24 18:09:08 2011
>>>>>   @@ -419,7 +419,7 @@ public class UISelectMany extends UIInpu
>>>>>           }
>>>>>           else
>>>>>           {
>>>>>   -            Class<? extends Object> valueClass =
>>>  convertedValue.getClass();
>>>>>   +            Class<?> valueClass = 
> convertedValue.getClass();
>>>>>               if (valueClass.isArray())
>>>>>               {
>>>>>                   return new 
> _PrimitiveArrayIterator(convertedValue);
>>>>> 
>>>>>   Modified:
>>> 
> myfaces/core/trunk/api/src/main/java/javax/faces/component/_ComponentAttributesMap.java
>>>>>   URL:
>>> 
> http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/_ComponentAttributesMap.java?rev=1188267&r1=1188266&r2=1188267&view=diff
>>>>> 
>>> 
> ==============================================================================
>>>>>   ---
>>> 
> myfaces/core/trunk/api/src/main/java/javax/faces/component/_ComponentAttributesMap.java
>>>  (original)
>>>>>   +++
>>> 
> myfaces/core/trunk/api/src/main/java/javax/faces/component/_ComponentAttributesMap.java
>>>  Mon Oct 24 18:09:08 2011
>>>>>   @@ -210,9 +210,9 @@ class _ComponentAttributesMap implements
>>>>>       /**
>>>>>        * Call put(key, value) for each entry in the provided 
> map.
>>>>>        */
>>>>>   -    public void putAll(Map<? extends String, ? extends 
> Object>
>>>  t)
>>>>>   +    public void putAll(Map<? extends String, ?> t)
>>>>>       {
>>>>>   -        for (Map.Entry<? extends String, ? extends 
> Object> entry
>>>  : t.entrySet())
>>>>>   +        for (Map.Entry<? extends String, ?> entry :
>>>  t.entrySet())
>>>>>           {
>>>>>               put(entry.getKey(), entry.getValue());
>>>>>           }
>>>>> 
>>>>>   Modified:
>>> 
> myfaces/core/trunk/api/src/main/java/javax/faces/component/_LocaleUtils.java
>>>>>   URL:
>>> 
> http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/_LocaleUtils.java?rev=1188267&r1=1188266&r2=1188267&view=diff
>>>>> 
>>> 
> ==============================================================================
>>>>>   ---
>>> 
> myfaces/core/trunk/api/src/main/java/javax/faces/component/_LocaleUtils.java
>>>  (original)
>>>>>   +++
>>> 
> myfaces/core/trunk/api/src/main/java/javax/faces/component/_LocaleUtils.java Mon
>>>  Oct 24 18:09:08 2011
>>>>>   @@ -34,21 +34,22 @@ import java.util.concurrent.ConcurrentMa
>>>>>    * <p>This class tries to handle {@code null} input 
> gracefully.
>>>>>    * An exception will not be thrown for a {@code null} input.
>>>>>    * Each method documents its behaviour in more 
> detail.</p>
>>>>>   - *
>>>>>   + *
>>>>>    * NOTE: This a copy of commons lang LocaleUtils, to use it 
> inside
>>>  MyFaces
>>>>>    *
>>>>>    * @since 2.2
>>>>>    * @version $Id$
>>>>>    */
>>>>>   -class _LocaleUtils {
>>>>>   +class _LocaleUtils
>>>>>   +{
>>>>> 
>>>>>       /** Concurrent map of language locales by country. */
>>>>>   -    private static final ConcurrentMap<String,
>>>  List<Locale>> cLanguagesByCountry =
>>>>>   -        new ConcurrentHashMap<String, 
> List<Locale>>();
>>>>>   +    private static final ConcurrentMap<String,
>>>  List<Locale>> cLanguagesByCountry =
>>>>>   +            new ConcurrentHashMap<String, 
> List<Locale>>();
>>>>> 
>>>>>       /** Concurrent map of country locales by language. */
>>>>>   -    private static final ConcurrentMap<String,
>>>  List<Locale>> cCountriesByLanguage =
>>>>>   -        new ConcurrentHashMap<String, 
> List<Locale>>();
>>>>>   +    private static final ConcurrentMap<String,
>>>  List<Locale>> cCountriesByLanguage =
>>>>>   +            new ConcurrentHashMap<String, 
> List<Locale>>();
>>>>> 
>>>>>       /**
>>>>>        * <p>{@code _LocaleUtils} instances should NOT be
>>>  constructed in standard programming.
>>>>>   @@ -57,11 +58,13 @@ class _LocaleUtils {
>>>>>        * <p>This constructor is public to permit tools 
> that require
>>>  a JavaBean instance
>>>>>        * to operate.</p>
>>>>>        */
>>>>>   -    public _LocaleUtils() {
>>>>>   -      super();
>>>>>   +    public _LocaleUtils()
>>>>>   +    {
>>>>>   +        super();
>>>>>       }
>>>>> 
>>>>> 
>>> 
> //-----------------------------------------------------------------------
>>>>>   +
>>>>>       /**
>>>>>        * <p>Converts a String to a Locale.</p>
>>>>>        *
>>>>>   @@ -89,37 +92,51 @@ class _LocaleUtils {
>>>>>        * @return a Locale, null if null input
>>>>>        * @throws IllegalArgumentException if the string is an 
> invalid
>>>  format
>>>>>        */
>>>>>   -    public static Locale toLocale(String str) {
>>>>>   -        if (str == null) {
>>>>>   +    public static Locale toLocale(String str)
>>>>>   +    {
>>>>>   +        if (str == null)
>>>>>   +        {
>>>>>               return null;
>>>>>           }
>>>>>           int len = str.length();
>>>>>   -        if (len != 2 && len != 5 && len < 
> 7) {
>>>>>   +        if (len != 2 && len != 5 && len < 
> 7)
>>>>>   +        {
>>>>>               throw new IllegalArgumentException("Invalid 
> locale
>>>  format: " + str);
>>>>>           }
>>>>>           char ch0 = str.charAt(0);
>>>>>           char ch1 = str.charAt(1);
>>>>>   -        if (ch0 < 'a' || ch0 > 'z' || 
> ch1 <
>>>  'a' || ch1 > 'z') {
>>>>>   +        if (ch0 < 'a' || ch0 > 'z' || 
> ch1 <
>>>  'a' || ch1 > 'z')
>>>>>   +        {
>>>>>               throw new IllegalArgumentException("Invalid 
> locale
>>>  format: " + str);
>>>>>           }
>>>>>   -        if (len == 2) {
>>>>>   +        if (len == 2)
>>>>>   +        {
>>>>>               return new Locale(str, "");
>>>>>   -        } else {
>>>>>   -            if (str.charAt(2) != '_') {
>>>>>   +        }
>>>>>   +        else
>>>>>   +        {
>>>>>   +            if (str.charAt(2) != '_')
>>>>>   +            {
>>>>>                   throw new 
> IllegalArgumentException("Invalid locale
>>>  format: " + str);
>>>>>               }
>>>>>               char ch3 = str.charAt(3);
>>>>>   -            if (ch3 == '_') {
>>>>>   +            if (ch3 == '_')
>>>>>   +            {
>>>>>                   return new Locale(str.substring(0, 2), 
> "",
>>>  str.substring(4));
>>>>>               }
>>>>>               char ch4 = str.charAt(4);
>>>>>   -            if (ch3 < 'A' || ch3 > 'Z' 
> || ch4
>>>  < 'A' || ch4 > 'Z') {
>>>>>   +            if (ch3 < 'A' || ch3 > 'Z' 
> || ch4
>>>  < 'A' || ch4 > 'Z')
>>>>>   +            {
>>>>>                   throw new 
> IllegalArgumentException("Invalid locale
>>>  format: " + str);
>>>>>               }
>>>>>   -            if (len == 5) {
>>>>>   +            if (len == 5)
>>>>>   +            {
>>>>>                   return new Locale(str.substring(0, 2), 
> str.substring(3,
>>>  5));
>>>>>   -            } else {
>>>>>   -                if (str.charAt(5) != '_') {
>>>>>   +            }
>>>>>   +            else
>>>>>   +            {
>>>>>   +                if (str.charAt(5) != '_')
>>>>>   +                {
>>>>>                       throw new 
> IllegalArgumentException("Invalid
>>>  locale format: " + str);
>>>>>                   }
>>>>>                   return new Locale(str.substring(0, 2), 
> str.substring(3,
>>>  5), str.substring(6));
>>>>>   @@ -128,6 +145,7 @@ class _LocaleUtils {
>>>>>       }
>>>>> 
>>>>> 
>>> 
> //-----------------------------------------------------------------------
>>>>>   +
>>>>>       /**
>>>>>        * <p>Obtains the list of locales to search through 
> when
>>>  performing
>>>>>        * a locale search.</p>
>>>>>   @@ -140,11 +158,13 @@ class _LocaleUtils {
>>>>>        * @param locale  the locale to start from
>>>>>        * @return the unmodifiable list of Locale objects, 0 
> being locale,
>>>  not null
>>>>>        */
>>>>>   -    public static List<Locale> localeLookupList(Locale 
> locale) {
>>>>>   +    public static List<Locale> localeLookupList(Locale 
> locale)
>>>>>   +    {
>>>>>           return localeLookupList(locale, locale);
>>>>>       }
>>>>> 
>>>>> 
>>> 
> //-----------------------------------------------------------------------
>>>>>   +
>>>>>       /**
>>>>>        * <p>Obtains the list of locales to search through 
> when
>>>  performing
>>>>>        * a locale search.</p>
>>>>>   @@ -162,17 +182,22 @@ class _LocaleUtils {
>>>>>        * @param defaultLocale  the default locale to use if no 
> other is
>>>  found
>>>>>        * @return the unmodifiable list of Locale objects, 0 
> being locale,
>>>  not null
>>>>>        */
>>>>>   -    public static List<Locale> localeLookupList(Locale 
> locale,
>>>  Locale defaultLocale) {
>>>>>   +    public static List<Locale> localeLookupList(Locale 
> locale,
>>>  Locale defaultLocale)
>>>>>   +    {
>>>>>           List<Locale> list = new 
> ArrayList<Locale>(4);
>>>>>   -        if (locale != null) {
>>>>>   +        if (locale != null)
>>>>>   +        {
>>>>>               list.add(locale);
>>>>>   -            if (locale.getVariant().length() > 0) {
>>>>>   +            if (locale.getVariant().length() > 0)
>>>>>   +            {
>>>>>                   list.add(new Locale(locale.getLanguage(),
>>>  locale.getCountry()));
>>>>>               }
>>>>>   -            if (locale.getCountry().length() > 0) {
>>>>>   +            if (locale.getCountry().length() > 0)
>>>>>   +            {
>>>>>                   list.add(new Locale(locale.getLanguage(),
>>>  ""));
>>>>>               }
>>>>>   -            if (list.contains(defaultLocale) == false) {
>>>>>   +            if (!list.contains(defaultLocale))
>>>>>   +            {
>>>>>                   list.add(defaultLocale);
>>>>>               }
>>>>>           }
>>>>>   @@ -180,45 +205,52 @@ class _LocaleUtils {
>>>>>       }
>>>>> 
>>>>> 
>>> 
> //-----------------------------------------------------------------------
>>>>>   +
>>>>>       /**
>>>>>        * <p>Obtains an unmodifiable list of installed
>>>  locales.</p>
>>>>>   -     *
>>>>>   +     *
>>>>>        * <p>This method is a wrapper around {@link
>>>  Locale#getAvailableLocales()}.
>>>>>        * It is more efficient, as the JDK method must create a 
> new array
>>>  each
>>>>>        * time it is called.</p>
>>>>>        *
>>>>>        * @return the unmodifiable list of available locales
>>>>>        */
>>>>>   -    public static List<Locale> availableLocaleList() {
>>>>>   +    public static List<Locale> availableLocaleList()
>>>>>   +    {
>>>>>           return SyncAvoid.AVAILABLE_LOCALE_LIST;
>>>>>       }
>>>>> 
>>>>> 
>>> 
> //-----------------------------------------------------------------------
>>>>>   +
>>>>>       /**
>>>>>        * <p>Obtains an unmodifiable set of installed
>>>  locales.</p>
>>>>>   -     *
>>>>>   +     *
>>>>>        * <p>This method is a wrapper around {@link
>>>  Locale#getAvailableLocales()}.
>>>>>        * It is more efficient, as the JDK method must create a 
> new array
>>>  each
>>>>>        * time it is called.</p>
>>>>>        *
>>>>>        * @return the unmodifiable set of available locales
>>>>>        */
>>>>>   -    public static Set<Locale> availableLocaleSet() {
>>>>>   +    public static Set<Locale> availableLocaleSet()
>>>>>   +    {
>>>>>           return SyncAvoid.AVAILABLE_LOCALE_SET;
>>>>>       }
>>>>> 
>>>>> 
>>> 
> //-----------------------------------------------------------------------
>>>>>   +
>>>>>       /**
>>>>>        * <p>Checks if the locale specified is in the list 
> of
>>>  available locales.</p>
>>>>>        *
>>>>>        * @param locale the Locale object to check if it is 
> available
>>>>>        * @return true if the locale is a known locale
>>>>>        */
>>>>>   -    public static boolean isAvailableLocale(Locale locale) {
>>>>>   +    public static boolean isAvailableLocale(Locale locale)
>>>>>   +    {
>>>>>           return availableLocaleList().contains(locale);
>>>>>       }
>>>>> 
>>>>> 
>>> 
> //-----------------------------------------------------------------------
>>>>>   +
>>>>>       /**
>>>>>        * <p>Obtains the list of languages supported for a 
> given
>>>  country.</p>
>>>>>        *
>>>>>   @@ -228,18 +260,23 @@ class _LocaleUtils {
>>>>>        * @param countryCode  the 2 letter country code, null 
> returns
>>>  empty
>>>>>        * @return an unmodifiable List of Locale objects, not 
> null
>>>>>        */
>>>>>   -    public static List<Locale> 
> languagesByCountry(String
>>>  countryCode) {
>>>>>   -        if (countryCode == null) {
>>>>>   +    public static List<Locale> 
> languagesByCountry(String
>>>  countryCode)
>>>>>   +    {
>>>>>   +        if (countryCode == null)
>>>>>   +        {
>>>>>               return Collections.emptyList();
>>>>>           }
>>>>>           List<Locale> langs =
>>>  cLanguagesByCountry.get(countryCode);
>>>>>   -        if (langs == null) {
>>>>>   +        if (langs == null)
>>>>>   +        {
>>>>>               langs = new ArrayList<Locale>();
>>>>>               List<Locale> locales = 
> availableLocaleList();
>>>>>   -            for (int i = 0; i < locales.size(); i++) {
>>>>>   +            for (int i = 0; i < locales.size(); i++)
>>>>>   +            {
>>>>>                   Locale locale = locales.get(i);
>>>>>                   if (countryCode.equals(locale.getCountry()) 
> &&
>>>>>   -                        locale.getVariant().length() == 0) {
>>>>>   +                        locale.getVariant().length() == 0)
>>>>>   +                {
>>>>>                       langs.add(locale);
>>>>>                   }
>>>>>               }
>>>>>   @@ -251,28 +288,34 @@ class _LocaleUtils {
>>>>>       }
>>>>> 
>>>>> 
>>> 
> //-----------------------------------------------------------------------
>>>>>   +
>>>>>       /**
>>>>>        * <p>Obtains the list of countries supported for a 
> given
>>>  language.</p>
>>>>>   -     *
>>>>>   +     *
>>>>>        * <p>This method takes a language code and searches 
> to find
>>>  the
>>>>>        * countries available for that language. Variant locales 
> are
>>>  removed.</p>
>>>>>        *
>>>>>        * @param languageCode  the 2 letter language code, null 
> returns
>>>  empty
>>>>>        * @return an unmodifiable List of Locale objects, not 
> null
>>>>>        */
>>>>>   -    public static List<Locale> 
> countriesByLanguage(String
>>>  languageCode) {
>>>>>   -        if (languageCode == null) {
>>>>>   +    public static List<Locale> 
> countriesByLanguage(String
>>>  languageCode)
>>>>>   +    {
>>>>>   +        if (languageCode == null)
>>>>>   +        {
>>>>>               return Collections.emptyList();
>>>>>           }
>>>>>           List<Locale> countries =
>>>  cCountriesByLanguage.get(languageCode);
>>>>>   -        if (countries == null) {
>>>>>   +        if (countries == null)
>>>>>   +        {
>>>>>               countries = new ArrayList<Locale>();
>>>>>               List<Locale> locales = 
> availableLocaleList();
>>>>>   -            for (int i = 0; i < locales.size(); i++) {
>>>>>   +            for (int i = 0; i < locales.size(); i++)
>>>>>   +            {
>>>>>                   Locale locale = locales.get(i);
>>>>>                   if (languageCode.equals(locale.getLanguage())
>>>  &&
>>>>>                           locale.getCountry().length() != 0 
> &&
>>>>>   -                        locale.getVariant().length() == 0) {
>>>>>   +                        locale.getVariant().length() == 0)
>>>>>   +                {
>>>>>                       countries.add(locale);
>>>>>                   }
>>>>>               }
>>>>>   @@ -285,13 +328,15 @@ class _LocaleUtils {
>>>>> 
>>>>> 
>>> 
> //-----------------------------------------------------------------------
>>>>>       // class to avoid synchronization
>>>>>   -    static class SyncAvoid {
>>>>>   +    static class SyncAvoid
>>>>>   +    {
>>>>>           /** Unmodifiable list of available locales. */
>>>>>           private static List<Locale> 
> AVAILABLE_LOCALE_LIST;
>>>>>           /** Unmodifiable set of available locales. */
>>>>>           private static Set<Locale> AVAILABLE_LOCALE_SET;
>>>>>   -
>>>>>   -        static {
>>>>>   +
>>>>>   +        static
>>>>>   +        {
>>>>>               List<Locale> list = new
>>>  ArrayList<Locale>(Arrays.asList(Locale.getAvailableLocales())); 
>  // extra
>>>  safe
>>>>>               AVAILABLE_LOCALE_LIST = 
> Collections.unmodifiableList(list);
>>>>>               AVAILABLE_LOCALE_SET = 
> Collections.unmodifiableSet(new
>>>  HashSet<Locale>(availableLocaleList()));
>>>>> 
>>>>>   Modified:
>>> 
> myfaces/core/trunk/api/src/main/java/javax/faces/component/_MethodBindingToListener.java
>>>>>   URL:
>>> 
> http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/_MethodBindingToListener.java?rev=1188267&r1=1188266&r2=1188267&view=diff
>>>>> 
>>> 
> ==============================================================================
>>>>>   ---
>>> 
> myfaces/core/trunk/api/src/main/java/javax/faces/component/_MethodBindingToListener.java
>>>  (original)
>>>>>   +++
>>> 
> myfaces/core/trunk/api/src/main/java/javax/faces/component/_MethodBindingToListener.java
>>>  Mon Oct 24 18:09:08 2011
>>>>>   @@ -20,7 +20,6 @@
>>>>>    package javax.faces.component;
>>>>> 
>>>>>    import javax.faces.FacesException;
>>>>>   -import javax.faces.component.StateHolder;
>>>>>    import javax.faces.context.FacesContext;
>>>>>    import javax.faces.el.EvaluationException;
>>>>>    import javax.faces.el.MethodBinding;
>>>>>   @@ -32,17 +31,20 @@ import javax.faces.event.FacesEvent;
>>>>>    *
>>>>>    * @author Stan Silvert
>>>>>    */
>>>>>   -abstract class _MethodBindingToListener implements 
> StateHolder {
>>>>>   -
>>>>>   +abstract class _MethodBindingToListener implements 
> StateHolder
>>>>>   +{
>>>>>   +
>>>>>       protected MethodBinding methodBinding;
>>>>>   -
>>>>>   -    public _MethodBindingToListener() {
>>>>>   +
>>>>>   +    public _MethodBindingToListener()
>>>>>   +    {
>>>>>       }
>>>>>   -
>>>>>   +
>>>>>       /**
>>>>>        * Creates a new instance of MethodBindingToListener
>>>>>        */
>>>>>   -    public _MethodBindingToListener(MethodBinding 
> methodBinding) {
>>>>>   +    public _MethodBindingToListener(MethodBinding 
> methodBinding)
>>>>>   +    {
>>>>>           if (methodBinding == null)
>>>>>           {
>>>>>               throw new NullPointerException("methodBinding 
> can not
>>>  be null");
>>>>>   @@ -51,58 +53,71 @@ abstract class _MethodBindingToListener
>>>>>           {
>>>>>               throw new 
> IllegalArgumentException("methodBinding must
>>>  implement the StateHolder interface");
>>>>>           }
>>>>>   -
>>>>>   +
>>>>>           this.methodBinding = methodBinding;
>>>>>       }
>>>>> 
>>>>>   -    private FacesContext getFacesContext() {
>>>>>   +    private FacesContext getFacesContext()
>>>>>   +    {
>>>>>           return FacesContext.getCurrentInstance();
>>>>>       }
>>>>> 
>>>>>   -    protected void invokeMethodBinding(FacesEvent event) 
> throws
>>>  AbortProcessingException {
>>>>>   -        try {
>>>>>   -            methodBinding.invoke(getFacesContext(), new 
> Object[]
>>>  {event});
>>>>>   +    protected void invokeMethodBinding(FacesEvent event) 
> throws
>>>  AbortProcessingException
>>>>>   +    {
>>>>>   +        try
>>>>>   +        {
>>>>>   +            methodBinding.invoke(getFacesContext(), new
>>>  Object[]{event});
>>>>>           }
>>>>>   -        catch (EvaluationException e) {
>>>>>   +        catch (EvaluationException e)
>>>>>   +        {
>>>>>               Throwable cause = e.getCause();
>>>>>   -            if (cause != null && cause instanceof
>>>  AbortProcessingException) {
>>>>>   -                throw (AbortProcessingException)cause;
>>>>>   +            if (cause != null && cause instanceof
>>>  AbortProcessingException)
>>>>>   +            {
>>>>>   +                throw (AbortProcessingException) cause;
>>>>>               }
>>>>>   -
>>>>>   +
>>>>>               throw e;
>>>>>           }
>>>>>       }
>>>>>   -
>>>>>   -    public MethodBinding getMethodBinding() {
>>>>>   +
>>>>>   +    public MethodBinding getMethodBinding()
>>>>>   +    {
>>>>>           return methodBinding;
>>>>>       }
>>>>>   -
>>>>>   -    public void restoreState(FacesContext context, Object 
> state) {
>>>>>   -        Object[] stateArray = (Object[])state;
>>>>>   -        try {
>>>>>   -            methodBinding =
>>>  (MethodBinding)_ClassUtils.getContextClassLoader()
>>>>>   -
>>>  .loadClass((String)stateArray[0])
>>>>>   -                                                 
> .newInstance();
>>>>>   -        } catch (Exception e) {
>>>>>   +
>>>>>   +    public void restoreState(FacesContext context, Object 
> state)
>>>>>   +    {
>>>>>   +        Object[] stateArray = (Object[]) state;
>>>>>   +        try
>>>>>   +        {
>>>>>   +            methodBinding = (MethodBinding)
>>>  _ClassUtils.getContextClassLoader()
>>>>>   +                    .loadClass((String) stateArray[0])
>>>>>   +                    .newInstance();
>>>>>   +        }
>>>>>   +        catch (Exception e)
>>>>>   +        {
>>>>>               throw new FacesException(e);
>>>>>           }
>>>>>   -
>>>>>   -        ((StateHolder)methodBinding).restoreState(context,
>>>  stateArray[1]);
>>>>>   +
>>>>>   +        ((StateHolder) methodBinding).restoreState(context,
>>>  stateArray[1]);
>>>>>       }
>>>>> 
>>>>>   -    public Object saveState(FacesContext context) {
>>>>>   +    public Object saveState(FacesContext context)
>>>>>   +    {
>>>>>           Object[] stateArray = new Object[2];
>>>>>           stateArray[0] = methodBinding.getClass().getName();
>>>>>   -        stateArray[1] =
>>>  ((StateHolder)methodBinding).saveState(context);
>>>>>   +        stateArray[1] = ((StateHolder)
>>>  methodBinding).saveState(context);
>>>>>           return stateArray;
>>>>>       }
>>>>> 
>>>>>   -    public void setTransient(boolean newTransientValue) {
>>>>>   -       
>  ((StateHolder)methodBinding).setTransient(newTransientValue);
>>>>>   +    public void setTransient(boolean newTransientValue)
>>>>>   +    {
>>>>>   +        ((StateHolder) 
> methodBinding).setTransient(newTransientValue);
>>>>>       }
>>>>> 
>>>>>   -    public boolean isTransient() {
>>>>>   -        return ((StateHolder)methodBinding).isTransient();
>>>>>   +    public boolean isTransient()
>>>>>   +    {
>>>>>   +        return ((StateHolder) methodBinding).isTransient();
>>>>>       }
>>>>>   -
>>>>>   +
>>>>>    }
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>> 
>>> 
>>> 
>>>  --
>>>  Jakob Korherr
>>> 
>>>  blog: http://www.jakobk.com
>>>  twitter: http://twitter.com/jakobkorherr
>>>  work: http://www.irian.at
>>> 
>> 
>

Mime
View raw message