You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2015/04/25 18:49:15 UTC

svn commit: r1676038 - /myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/SelectManyRendererBase.java

Author: weber
Date: Sat Apr 25 16:49:15 2015
New Revision: 1676038

URL: http://svn.apache.org/r1676038
Log:
TOBAGO-1453 - SelectManyRendererBase should support Collection: checkstyle

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/SelectManyRendererBase.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/SelectManyRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/SelectManyRendererBase.java?rev=1676038&r1=1676037&r2=1676038&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/SelectManyRendererBase.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/SelectManyRendererBase.java Sat Apr 25 16:49:15 2015
@@ -119,9 +119,8 @@ public class SelectManyRendererBase exte
   static final String VALUE_TYPE_KEY = "valueType";
 
   static Object getConvertedUISelectManyValue(FacesContext facesContext, UISelectMany component,
-      String[] submittedValue) throws ConverterException
-  {
-    return  getConvertedUISelectManyValue(facesContext, component,
+      String[] submittedValue) throws ConverterException {
+    return getConvertedUISelectManyValue(facesContext, component,
         submittedValue, false);
   }
 
@@ -138,14 +137,12 @@ public class SelectManyRendererBase exte
    * @throws ConverterException
    */
   static Object getConvertedUISelectManyValue(FacesContext facesContext, UISelectMany component,
-      String[] submittedValue, boolean considerValueType) throws ConverterException
-  {
+      String[] submittedValue, boolean considerValueType) throws ConverterException {
     // Attention!
-        // This code is duplicated in shared renderkit package (except for considerValueType).
+    // This code is duplicated in shared renderkit package (except for considerValueType).
     // If you change something here please do the same in the other class!
 
-    if (submittedValue == null)
-    {
+    if (submittedValue == null) {
       throw new NullPointerException("submittedValue");
     }
 
@@ -155,71 +152,58 @@ public class SelectManyRendererBase exte
     // if the component has an attached converter, use it
     Converter converter = component.getConverter();
     // at this point the valueType attribute is handled in shared.
-    if (converter == null && considerValueType)
-    {
+    if (converter == null && considerValueType) {
       // try to get a converter from the valueType attribute
       converter = getValueTypeConverter(facesContext, component);
     }
 
-    if (expression != null)
-    {
+    if (expression != null) {
       Class<?> modelType = expression
           .getType(facesContext.getELContext());
-      if (modelType == null)
-      {
+      if (modelType == null) {
         // FIXME temporal workaround for MYFACES-2552
         return submittedValue;
-      }
-      else if (modelType.isArray())
-      {
+      } else if (modelType.isArray()) {
         // the target should be an array
         Class<?> componentType = modelType.getComponentType();
         // check for optimization if the target is
         // a string array --> no conversion needed
-        if (String.class.equals(componentType))
-        {
+        if (String.class.equals(componentType)) {
           return submittedValue;
         }
-        if (converter == null)
-        {
+        if (converter == null) {
           // the compononent does not have an attached converter
           // --> try to get a registered-by-class converter
           converter = facesContext.getApplication().createConverter(
               componentType);
 
-                    if (converter == null && !Object.class.equals(componentType))
-          {
+          if (converter == null && !Object.class.equals(componentType)) {
             // could not obtain a Converter
             // --> check if we maybe do not really have to convert
 
-              // target is not an Object array
-              // and not a String array (checked some lines above)
-              // and we do not have a Converter
-              throw new ConverterException(
-                  "Could not obtain a Converter for "
-                  + componentType.getName());
-            }
+            // target is not an Object array
+            // and not a String array (checked some lines above)
+            // and we do not have a Converter
+            throw new ConverterException(
+                "Could not obtain a Converter for "
+                + componentType.getName());
           }
+        }
         // instantiate the array
         targetForConvertedValues = Array.newInstance(componentType,
             submittedValue.length);
-      }
-      else if (Collection.class.isAssignableFrom(modelType) || Object.class.equals(modelType))
-      {
-        if (converter == null)
-        {
+      } else if (Collection.class.isAssignableFrom(modelType) || Object.class.equals(modelType)) {
+        if (converter == null) {
           // try to get the by-type-converter from the type of the SelectItems
-                    _SelectItemsIterator iterator = new _SelectItemsIterator(component, facesContext);
+          SelectItemsIterator iterator = new SelectItemsIterator(component, facesContext);
           converter = getSelectItemsValueConverter(iterator, facesContext);
         }
 
         Object collectionTypeAttr = component.getAttributes().get(
             COLLECTION_TYPE_KEY);
-        if (collectionTypeAttr != null)
-        {
+        if (collectionTypeAttr != null) {
           Class<?> collectionType = getClassFromAttribute(facesContext, collectionTypeAttr);
-          if (collectionType == null)
-          {
+          if (collectionType == null) {
             throw new FacesException(
                 "The attribute "
                 + COLLECTION_TYPE_KEY
@@ -230,134 +214,99 @@ public class SelectManyRendererBase exte
                 + "to a String or a Class object.");
           }
           // now we have a collectionType --> but is it really some kind of Collection
-          if (!Collection.class.isAssignableFrom(collectionType))
-          {
+          if (!Collection.class.isAssignableFrom(collectionType)) {
             throw new FacesException("The attribute "
                                      + COLLECTION_TYPE_KEY + " of component "
                                      + component.getClientId(facesContext)
                                      + " does not point to a valid type of Collection.");
           }
           // now we have a real collectionType --> try to instantiate it
-          try
-          {
+          try {
             targetForConvertedValues = collectionType.newInstance();
-          }
-          catch (Exception e)
-          {
+          } catch (Exception e) {
             throw new FacesException("The Collection "
                                      + collectionType.getName()
                                      + "can not be instantiated.", e);
           }
-        }
-        else if (Collection.class.isAssignableFrom(modelType))
-        {
+        } else if (Collection.class.isAssignableFrom(modelType)) {
           // component.getValue() will implement Collection at this point
           Collection<?> componentValue = (Collection<?>) component
               .getValue();
           // can we clone the Collection
-          if (componentValue instanceof Cloneable)
-          {
+          if (componentValue instanceof Cloneable) {
             // clone method of Object is protected --> use reflection
-            try
-            {
+            try {
               Method cloneMethod = componentValue.getClass()
                   .getMethod("clone");
               Collection<?> clone = (Collection<?>) cloneMethod
                   .invoke(componentValue);
               clone.clear();
               targetForConvertedValues = clone;
-            }
-            catch (Exception e)
-            {
+            } catch (Exception e) {
               LOG.error("Could not clone " + componentValue.getClass().getName(), e);
             }
           }
 
           // if clone did not work
-          if (targetForConvertedValues == null)
-          {
+          if (targetForConvertedValues == null) {
             // try to create the (concrete) collection from modelType
             // or with the class object of componentValue (if any)
-            try
-            {
+            try {
               targetForConvertedValues = (componentValue != null
                                           ? componentValue.getClass()
                                           : modelType).newInstance();
-            }
-            catch (Exception e)
-            {
+            } catch (Exception e) {
               // this did not work either
               // use the standard concrete type
-              if (SortedSet.class.isAssignableFrom(modelType))
-              {
+              if (SortedSet.class.isAssignableFrom(modelType)) {
                 targetForConvertedValues = new TreeSet();
-              }
-              else if (Queue.class.isAssignableFrom(modelType))
-              {
+              } else if (Queue.class.isAssignableFrom(modelType)) {
                 targetForConvertedValues = new LinkedList();
-              }
-              else if (Set.class.isAssignableFrom(modelType))
-              {
+              } else if (Set.class.isAssignableFrom(modelType)) {
                 targetForConvertedValues = new HashSet(
                     submittedValue.length);
-              }
-              else
-              {
+              } else {
                 targetForConvertedValues = new ArrayList(
                     submittedValue.length);
               }
             }
           }
-        }
-        else /* if (Object.class.equals(modelType)) */
-        {
+        } else /* if (Object.class.equals(modelType)) */ {
           // a modelType of Object is also permitted, in order to support
           // managed bean properties of type Object
 
           // optimization: if we don't have a converter, we can return the submittedValue
-          if (converter == null)
-          {
+          if (converter == null) {
             return submittedValue;
           }
 
           targetForConvertedValues = new Object[submittedValue.length];
         }
-      }
-      else
-      {
+      } else {
         // the expression does neither point to an array nor to a collection
         throw new ConverterException(
             "ValueExpression for UISelectMany must be of type Collection or Array.");
       }
-    }
-    else
-    {
+    } else {
       targetForConvertedValues = new Object[submittedValue.length];
     }
 
     // convert the values with the selected converter (if any)
     // and store them in targetForConvertedValues
     boolean isArray = (targetForConvertedValues.getClass().isArray());
-    for (int i = 0; i < submittedValue.length; i++)
-    {
+    for (int i = 0; i < submittedValue.length; i++) {
       // get the value
       Object value;
-      if (converter != null)
-      {
+      if (converter != null) {
         value = converter.getAsObject(facesContext, component,
             submittedValue[i]);
-      }
-      else
-      {
+      } else {
         value = submittedValue[i];
       }
       // store it in targetForConvertedValues
-      if (isArray)
-      {
+      if (isArray) {
         Array.set(targetForConvertedValues, i, value);
-      }
-      else
-      {
+      } else {
         ((Collection) targetForConvertedValues).add(value);
       }
     }
@@ -377,41 +326,32 @@ public class SelectManyRendererBase exte
    *                        class cannot be found
    */
   static Class<?> getClassFromAttribute(FacesContext facesContext,
-      Object attribute) throws FacesException
-  {
+      Object attribute) throws FacesException {
     // Attention!
-        // This code is duplicated in shared renderkit package.
+    // This code is duplicated in shared renderkit package.
     // If you change something here please do the same in the other class!
 
     Class<?> type = null;
 
     // if there is a value, it must be a ...
     // ... a ValueExpression that evaluates to a String or a Class
-    if (attribute instanceof ValueExpression)
-    {
+    if (attribute instanceof ValueExpression) {
       // get the value of the ValueExpression
       attribute = ((ValueExpression) attribute)
           .getValue(facesContext.getELContext());
     }
     // ... String that is a fully qualified Java class name
-    if (attribute instanceof String)
-    {
-      try
-      {
+    if (attribute instanceof String) {
+      try {
         type = Class.forName((String) attribute);
-      }
-      catch (ClassNotFoundException cnfe)
-      {
+      } catch (ClassNotFoundException cnfe) {
         throw new FacesException(
             "Unable to find class "
             + attribute
             + " on the classpath.", cnfe);
       }
-
-    }
-    // ... a Class object
-    else if (attribute instanceof Class)
-    {
+    } else if (attribute instanceof Class) {
+      // ... a Class object
       type = (Class<?>) attribute;
     }
 
@@ -426,17 +366,14 @@ public class SelectManyRendererBase exte
    * @param component
    * @return
    */
-  static Converter getValueTypeConverter(FacesContext facesContext, UISelectMany component)
-  {
+  static Converter getValueTypeConverter(FacesContext facesContext, UISelectMany component) {
     Converter converter = null;
 
     Object valueTypeAttr = component.getAttributes().get(VALUE_TYPE_KEY);
-    if (valueTypeAttr != null)
-    {
+    if (valueTypeAttr != null) {
       // treat the valueType attribute exactly like the collectionType attribute
       Class<?> valueType = getClassFromAttribute(facesContext, valueTypeAttr);
-      if (valueType == null)
-      {
+      if (valueType == null) {
         throw new FacesException(
             "The attribute "
             + VALUE_TYPE_KEY
@@ -450,12 +387,11 @@ public class SelectManyRendererBase exte
       // --> try to get a registered-by-class converter
       converter = facesContext.getApplication().createConverter(valueType);
 
-      if (converter == null)
-      {
-        facesContext.getExternalContext().log("Found attribute valueType on component " +
-                                              getPathToComponent(component) +
-                                              ", but could not get a by-type converter for type " +
-                                              valueType.getName());
+      if (converter == null) {
+        facesContext.getExternalContext().log("Found attribute valueType on component "
+                                              + getPathToComponent(component)
+                                              + ", but could not get a by-type converter for type "
+                                              + valueType.getName());
       }
     }
 
@@ -465,42 +401,34 @@ public class SelectManyRendererBase exte
   /**
    * Iterates through the SelectItems with the given Iterator and tries to obtain
    * a by-class-converter based on the Class of SelectItem.getValue().
+   *
    * @param iterator
    * @param facesContext
    * @return The first suitable Converter for the given SelectItems or null.
    */
-  static Converter getSelectItemsValueConverter(Iterator<SelectItem> iterator, FacesContext facesContext)
-  {
+  static Converter getSelectItemsValueConverter(Iterator<SelectItem> iterator, FacesContext facesContext) {
     // Attention!
     // This code is duplicated in jsfapi component package.
     // If you change something here please do the same in the other class!
 
     Converter converter = null;
-    while (converter == null && iterator.hasNext())
-    {
+    while (converter == null && iterator.hasNext()) {
       SelectItem item = iterator.next();
-      if (item instanceof SelectItemGroup)
-      {
+      if (item instanceof SelectItemGroup) {
         Iterator<SelectItem> groupIterator = Arrays.asList(
             ((SelectItemGroup) item).getSelectItems()).iterator();
         converter = getSelectItemsValueConverter(groupIterator, facesContext);
-      }
-      else
-      {
+      } else {
         Class<?> selectItemsType = item.getValue().getClass();
 
         // optimization: no conversion for String values
-        if (String.class.equals(selectItemsType))
-        {
+        if (String.class.equals(selectItemsType)) {
           return null;
         }
 
-        try
-        {
+        try {
           converter = facesContext.getApplication().createConverter(selectItemsType);
-        }
-        catch (FacesException e)
-        {
+        } catch (FacesException e) {
           // nothing - try again
         }
       }
@@ -516,12 +444,10 @@ public class SelectManyRendererBase exte
   // ### BEGIN copy out of https://svn.apache.org/repos/asf/myfaces/core/tags/myfaces-core-module-2.2.8/
   // ###     api/src/main/java/javax/faces/component/_ComponentUtils.java
   // #################################################################################################################
-  static String getPathToComponent(UIComponent component)
-  {
+  static String getPathToComponent(UIComponent component) {
     StringBuffer buf = new StringBuffer();
 
-    if (component == null)
-    {
+    if (component == null) {
       buf.append("{Component-Path : ");
       buf.append("[null]}");
       return buf.toString();
@@ -535,24 +461,19 @@ public class SelectManyRendererBase exte
     return buf.toString();
   }
 
-  private static void getPathToComponent(UIComponent component, StringBuffer buf)
-  {
-    if (component == null)
-        {
+  private static void getPathToComponent(UIComponent component, StringBuffer buf) {
+    if (component == null) {
       return;
-        }
+    }
 
     StringBuffer intBuf = new StringBuffer();
 
     intBuf.append("[Class: ");
     intBuf.append(component.getClass().getName());
-    if (component instanceof UIViewRoot)
-    {
+    if (component instanceof UIViewRoot) {
       intBuf.append(",ViewId: ");
-      intBuf.append(((UIViewRoot)component).getViewId());
-    }
-    else
-    {
+      intBuf.append(((UIViewRoot) component).getViewId());
+    } else {
       intBuf.append(",Id: ");
       intBuf.append(component.getId());
     }
@@ -571,9 +492,9 @@ public class SelectManyRendererBase exte
   // ### BEGIN copy out of https://svn.apache.org/repos/asf/myfaces/core/tags/myfaces-core-module-2.2.8/
   // ###     api/src/main/java/javax/faces/component/_SelectItemsIterator.java
   // #################################################################################################################
-  private static class _SelectItemsIterator  implements Iterator<SelectItem>{
+  private static class SelectItemsIterator implements Iterator<SelectItem> {
 
-    private static final Iterator<UIComponent> _EMPTY_UICOMPONENT_ITERATOR = new _EmptyIterator<UIComponent>();
+    private static final Iterator<UIComponent> EMPTY_UICOMPONENT_ITERATOR = new EmptyIterator<UIComponent>();
 
     // org.apache.myfaces.shared.util.SelectItemsIterator uses JSFAttr
     private static final String VAR_ATTR = "var";
@@ -584,67 +505,55 @@ public class SelectManyRendererBase exte
     private static final String ITEM_LABEL_ESCAPED_ATTR = "itemLabelEscaped";
     private static final String NO_SELECTION_VALUE_ATTR = "noSelectionValue";
 
-    private final Iterator<UIComponent> _children;
-    private Iterator<?> _nestedItems;
-    private SelectItem _nextItem;
-    private UIComponent _currentComponent;
-    private UISelectItems _currentUISelectItems;
-    private FacesContext _facesContext;
-
-    public _SelectItemsIterator(UIComponent selectItemsParent, FacesContext facesContext)
-    {
-        _children = selectItemsParent.getChildCount() > 0
-                        ? selectItemsParent.getChildren().iterator()
-                        : _EMPTY_UICOMPONENT_ITERATOR;
-      _facesContext = facesContext;
+    private final Iterator<UIComponent> children;
+    private Iterator<?> nestedItems;
+    private SelectItem nextItem;
+    private UIComponent currentComponent;
+    private UISelectItems currentUISelectItems;
+    private FacesContext facesContext;
+
+    public SelectItemsIterator(UIComponent selectItemsParent, FacesContext facesContext) {
+      children = selectItemsParent.getChildCount() > 0
+                  ? selectItemsParent.getChildren().iterator()
+                  : EMPTY_UICOMPONENT_ITERATOR;
+      this.facesContext = facesContext;
     }
 
     @SuppressWarnings("unchecked")
-    public boolean hasNext()
-    {
-      if (_nextItem != null)
-      {
+    public boolean hasNext() {
+      if (nextItem != null) {
         return true;
       }
-      if (_nestedItems != null)
-      {
-        if (_nestedItems.hasNext())
-        {
+      if (nestedItems != null) {
+        if (nestedItems.hasNext()) {
           return true;
         }
-        _nestedItems = null;
-            _currentComponent = null;
+        nestedItems = null;
+        currentComponent = null;
       }
-      if (_children.hasNext())
-      {
-        UIComponent child = _children.next();
+      if (children.hasNext()) {
+        UIComponent child = children.next();
         // When there is other components nested that does
         // not extends from UISelectItem or UISelectItems
         // the behavior for this iterator is just skip this
         // element(s) until an element that extends from these
         // classes are found. If there is no more elements
         // that conform this condition, just return false.
-        while (!(child instanceof UISelectItem) && !(child instanceof UISelectItems))
-        {
+        while (!(child instanceof UISelectItem) && !(child instanceof UISelectItems)) {
           // Try to skip it
-          if (_children.hasNext())
-          {
+          if (children.hasNext()) {
             // Skip and do the same check
-            child = _children.next();
-          }
-          else
-          {
+            child = children.next();
+          } else {
             // End loop, so the final result is return false,
             // since there are no more components to iterate.
             return false;
           }
         }
-        if (child instanceof UISelectItem)
-        {
+        if (child instanceof UISelectItem) {
           UISelectItem uiSelectItem = (UISelectItem) child;
           Object item = uiSelectItem.getValue();
-          if (item == null)
-          {
+          if (item == null) {
             // no value attribute --> create the SelectItem out of the other attributes
             Object itemValue = uiSelectItem.getItemValue();
             String label = uiSelectItem.getItemLabel();
@@ -652,71 +561,55 @@ public class SelectManyRendererBase exte
             boolean disabled = uiSelectItem.isItemDisabled();
             boolean escape = uiSelectItem.isItemEscaped();
             boolean noSelectionOption = uiSelectItem.isNoSelectionOption();
-            if (label == null)
-            {
+            if (label == null) {
               label = itemValue.toString();
             }
             item = new SelectItem(itemValue, label, description, disabled, escape, noSelectionOption);
-          }
-          else if (!(item instanceof SelectItem))
-          {
+          } else if (!(item instanceof SelectItem)) {
             ValueExpression expression = uiSelectItem.getValueExpression("value");
             throw new IllegalArgumentException("ValueExpression '"
-                                               + (expression == null ? null : expression.getExpressionString()) + "' of UISelectItem : "
-                                               + getPathToComponent(child) + " does not reference an Object of type SelectItem");
+                 + (expression == null ? null : expression.getExpressionString()) + "' of UISelectItem : "
+                 + getPathToComponent(child) + " does not reference an Object of type SelectItem");
           }
-          _nextItem = (SelectItem) item;
-                _currentComponent = child;
+          nextItem = (SelectItem) item;
+          currentComponent = child;
           return true;
-        }
-        else if (child instanceof UISelectItems)
-        {
-          _currentUISelectItems = ((UISelectItems) child);
-          Object value = _currentUISelectItems.getValue();
-                _currentComponent = child;
-
-          if (value instanceof SelectItem)
-          {
-            _nextItem = (SelectItem) value;
+        } else if (child instanceof UISelectItems) {
+          currentUISelectItems = ((UISelectItems) child);
+          Object value = currentUISelectItems.getValue();
+          currentComponent = child;
+
+          if (value instanceof SelectItem) {
+            nextItem = (SelectItem) value;
             return true;
-          }
-          else if (value != null && value.getClass().isArray())
-          {
+          } else if (value != null && value.getClass().isArray()) {
             // value is any kind of array (primitive or non-primitive)
             // --> we have to use class Array to get the values
-                    int length = Array.getLength(value);
+            int length = Array.getLength(value);
             Collection<Object> items = new ArrayList<Object>(length);
-            for (int i = 0; i < length; i++)
-            {
+            for (int i = 0; i < length; i++) {
               items.add(Array.get(value, i));
             }
-            _nestedItems = items.iterator();
+            nestedItems = items.iterator();
             return hasNext();
-          }
-          else if (value instanceof Iterable)
-          {
+          } else if (value instanceof Iterable) {
             // value is Iterable --> Collection, DataModel,...
-            _nestedItems = ((Iterable<?>) value).iterator();
+            nestedItems = ((Iterable<?>) value).iterator();
             return hasNext();
-          }
-          else if (value instanceof Map)
-          {
+          } else if (value instanceof Map) {
             Map<Object, Object> map = ((Map<Object, Object>) value);
             Collection<SelectItem> items = new ArrayList<SelectItem>(map.size());
-            for (Map.Entry<Object, Object> entry : map.entrySet())
-            {
+            for (Map.Entry<Object, Object> entry : map.entrySet()) {
               items.add(new SelectItem(entry.getValue(), entry.getKey().toString()));
             }
 
-            _nestedItems = items.iterator();
+            nestedItems = items.iterator();
             return hasNext();
-          }
-          else
-          {
+          } else {
 
-            if ((_facesContext.isProjectStage(ProjectStage.Production) && LOG.isDebugEnabled())
+            if ((facesContext.isProjectStage(ProjectStage.Production) && LOG.isDebugEnabled())
                 || LOG.isWarnEnabled()) {
-              ValueExpression expression = _currentUISelectItems.getValueExpression("value");
+              ValueExpression expression = currentUISelectItems.getValueExpression("value");
               Object[] objects = {
                   (expression == null ? null : expression.getExpressionString()),
                   getPathToComponent(child),
@@ -725,60 +618,51 @@ public class SelectManyRendererBase exte
               String message = "ValueExpression {0} of UISelectItems with component-path {1}"
                                + " does not reference an Object of type SelectItem,"
                                + " array, Iterable or Map, but of type: {2}";
-              if (_facesContext.isProjectStage(ProjectStage.Production)) {
+              if (facesContext.isProjectStage(ProjectStage.Production)) {
                 LOG.debug(message, objects);
               } else {
                 LOG.warn(message, objects);
               }
             }
           }
-        }
-        else
-        {
-          _currentComponent = null;
+        } else {
+          currentComponent = null;
         }
       }
       return false;
     }
 
-    public SelectItem next()
-    {
-      if (!hasNext())
-      {
+    public SelectItem next() {
+      if (!hasNext()) {
         throw new NoSuchElementException();
       }
-      if (_nextItem != null)
-      {
-        SelectItem value = _nextItem;
-        _nextItem = null;
+      if (nextItem != null) {
+        SelectItem value = nextItem;
+        nextItem = null;
         return value;
       }
-      if (_nestedItems != null)
-      {
-        Object item = _nestedItems.next();
+      if (nestedItems != null) {
+        Object item = nestedItems.next();
 
-        if (!(item instanceof SelectItem))
-        {
+        if (!(item instanceof SelectItem)) {
           // check new params of SelectItems (since 2.0): itemValue, itemLabel, itemDescription,...
           // Note that according to the spec UISelectItems does not provide Getter and Setter
           // methods for this values, so we have to use the attribute map
-          Map<String, Object> attributeMap = _currentUISelectItems.getAttributes();
+          Map<String, Object> attributeMap = currentUISelectItems.getAttributes();
 
           // write the current item into the request map under the key listed in var, if available
           boolean wroteRequestMapVarValue = false;
           Object oldRequestMapVarValue = null;
-                String var = (String) attributeMap.get(VAR_ATTR);
-          if(var != null && !"".equals(var))
-          {
+          String var = (String) attributeMap.get(VAR_ATTR);
+          if (var != null && !"".equals(var)) {
             // save the current value of the key listed in var from the request map
-            oldRequestMapVarValue = _facesContext.getExternalContext().getRequestMap().put(var, item);
+            oldRequestMapVarValue = facesContext.getExternalContext().getRequestMap().put(var, item);
             wroteRequestMapVarValue = true;
           }
 
           // check the itemValue attribute
           Object itemValue = attributeMap.get(ITEM_VALUE_ATTR);
-          if (itemValue == null)
-          {
+          if (itemValue == null) {
             // the itemValue attribute was not provided
             // --> use the current item as the itemValue
             itemValue = item;
@@ -787,21 +671,17 @@ public class SelectManyRendererBase exte
           // Spec: When iterating over the select items, toString()
           // must be called on the string rendered attribute values
           Object itemLabel = attributeMap.get(ITEM_LABEL_ATTR);
-          if (itemLabel == null)
-          {
+          if (itemLabel == null) {
             itemLabel = itemValue.toString();
-          }
-          else
-          {
+          } else {
             itemLabel = itemLabel.toString();
           }
           Object itemDescription = attributeMap.get(ITEM_DESCRIPTION_ATTR);
-          if (itemDescription != null)
-          {
+          if (itemDescription != null) {
             itemDescription = itemDescription.toString();
           }
-          Boolean itemDisabled = getBooleanAttribute(_currentUISelectItems, ITEM_DISABLED_ATTR, false);
-          Boolean itemLabelEscaped = getBooleanAttribute(_currentUISelectItems, ITEM_LABEL_ESCAPED_ATTR, true);
+          Boolean itemDisabled = getBooleanAttribute(currentUISelectItems, ITEM_DISABLED_ATTR, false);
+          Boolean itemLabelEscaped = getBooleanAttribute(currentUISelectItems, ITEM_LABEL_ESCAPED_ATTR, true);
           Object noSelectionValue = attributeMap.get(NO_SELECTION_VALUE_ATTR);
           item = new SelectItem(itemValue,
               (String) itemLabel,
@@ -811,17 +691,13 @@ public class SelectManyRendererBase exte
               itemValue.equals(noSelectionValue));
 
           // remove the value with the key from var from the request map, if previously written
-          if(wroteRequestMapVarValue)
-          {
+          if (wroteRequestMapVarValue) {
             // If there was a previous value stored with the key from var in the request map, restore it
-            if (oldRequestMapVarValue != null)
-            {
-              _facesContext.getExternalContext()
+            if (oldRequestMapVarValue != null) {
+              facesContext.getExternalContext()
                   .getRequestMap().put(var, oldRequestMapVarValue);
-            }
-            else
-            {
-              _facesContext.getExternalContext()
+            } else {
+              facesContext.getExternalContext()
                   .getRequestMap().remove(var);
             }
           }
@@ -831,29 +707,21 @@ public class SelectManyRendererBase exte
       throw new NoSuchElementException();
     }
 
-    public void remove()
-    {
+    public void remove() {
       throw new UnsupportedOperationException();
     }
 
-    public UIComponent getCurrentComponent()
-    {
-        return _currentComponent;
+    public UIComponent getCurrentComponent() {
+      return currentComponent;
     }
 
-    private boolean getBooleanAttribute(UIComponent component, String attrName, boolean defaultValue)
-    {
+    private boolean getBooleanAttribute(UIComponent component, String attrName, boolean defaultValue) {
       Object value = component.getAttributes().get(attrName);
-      if (value == null)
-      {
+      if (value == null) {
         return defaultValue;
-      }
-      else if (value instanceof Boolean)
-      {
+      } else if (value instanceof Boolean) {
         return (Boolean) value;
-      }
-      else
-      {
+      } else {
         // If the value is a String, parse the boolean.
         // This makes the following code work: <tag attribute="true" />,
         // otherwise you would have to write <tag attribute="#{true}" />.
@@ -861,12 +729,10 @@ public class SelectManyRendererBase exte
       }
     }
 
-    private String getPathToComponent(UIComponent component)
-    {
+    private String getPathToComponent(UIComponent component) {
       StringBuffer buf = new StringBuffer();
 
-      if (component == null)
-      {
+      if (component == null) {
         buf.append("{Component-Path : ");
         buf.append("[null]}");
         return buf.toString();
@@ -880,10 +746,8 @@ public class SelectManyRendererBase exte
       return buf.toString();
     }
 
-    private void getPathToComponent(UIComponent component, StringBuffer buf)
-    {
-      if (component == null)
-      {
+    private void getPathToComponent(UIComponent component, StringBuffer buf) {
+      if (component == null) {
         return;
       }
 
@@ -891,13 +755,10 @@ public class SelectManyRendererBase exte
 
       intBuf.append("[Class: ");
       intBuf.append(component.getClass().getName());
-      if (component instanceof UIViewRoot)
-      {
+      if (component instanceof UIViewRoot) {
         intBuf.append(",ViewId: ");
         intBuf.append(((UIViewRoot) component).getViewId());
-      }
-      else
-      {
+      } else {
         intBuf.append(",Id: ");
         intBuf.append(component.getId());
       }
@@ -917,20 +778,17 @@ public class SelectManyRendererBase exte
   // ### BEGIN copy out of https://svn.apache.org/repos/asf/myfaces/core/tags/myfaces-core-module-2.2.8/
   // ###     api/src/main/java/javax/faces/component/_EmptyIterator.java
   // #################################################################################################################
-  private static class _EmptyIterator<T> implements Iterator<T> {
+  private static class EmptyIterator<T> implements Iterator<T> {
 
-    public boolean hasNext()
-    {
+    public boolean hasNext() {
       return false;
     }
 
-    public T next()
-    {
+    public T next() {
       throw new NoSuchElementException();
     }
 
-    public void remove()
-    {
+    public void remove() {
       throw new UnsupportedOperationException();
     }
   }