You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by sm...@apache.org on 2013/03/02 02:04:55 UTC

svn commit: r1451799 [1/3] - in /pivot/trunk: core/src/org/apache/pivot/beans/ core/src/org/apache/pivot/collections/ core/src/org/apache/pivot/io/ core/src/org/apache/pivot/json/ core/src/org/apache/pivot/serialization/ core/src/org/apache/pivot/text/...

Author: smartini
Date: Sat Mar  2 01:04:53 2013
New Revision: 1451799

URL: http://svn.apache.org/r1451799
Log:
merge some fixes from 2.0.x

Added:
    pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot894/
    pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot894/Pivot894.java
    pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot894/btn_grid.bxml
Modified:
    pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java
    pivot/trunk/core/src/org/apache/pivot/beans/BeanAdapter.java
    pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java
    pivot/trunk/core/src/org/apache/pivot/collections/Sequence.java
    pivot/trunk/core/src/org/apache/pivot/io/IOTask.java
    pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java
    pivot/trunk/core/src/org/apache/pivot/serialization/CSVSerializer.java
    pivot/trunk/core/src/org/apache/pivot/text/CharSequenceCharacterIterator.java
    pivot/trunk/core/src/org/apache/pivot/util/ListenerList.java
    pivot/trunk/core/src/org/apache/pivot/xml/XMLSerializer.java
    pivot/trunk/examples/src/org/apache/pivot/examples/buttons/radio_button_group_example.bxml
    pivot/trunk/tests/src/org/apache/pivot/tests/DataBindingTest.java
    pivot/trunk/tests/src/org/apache/pivot/tests/JavascriptConsoleTest.java
    pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot859/Pivot859.java
    pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot861/Pivot861.java
    pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot861/TestDialog.java
    pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorerDocument.java
    pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/CreateHighlightedXML.java
    pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/FakeWindowSkin.java
    pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/bxml_explorer_document.bxml
    pivot/trunk/tutorials/src/org/apache/pivot/tutorials/databinding/DataBinding.java
    pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/ComponentExplorerWindow.java
    pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/RulerSkin.java
    pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/Forms.java
    pivot/trunk/tutorials/src/org/apache/pivot/tutorials/lists/ListViews.java
    pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/RulerSkin.java
    pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ResultItemRenderer.java
    pivot/trunk/tutorials/www/data-binding.xml
    pivot/trunk/tutorials/www/forms.xml
    pivot/trunk/tutorials/www/web-queries.xml
    pivot/trunk/web/src/org/apache/pivot/web/Query.java
    pivot/trunk/web/src/org/apache/pivot/web/QueryDictionary.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraAccordionSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSheetSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFileBrowserSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFormSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraFrameSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraMenuSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPaletteSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraPromptSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSpinnerSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSplitPaneSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSuggestionPopupSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTabPaneSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewHeaderSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextInputSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java
    pivot/trunk/wtk/lib/svgSalamander-tiny.jar
    pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/DesktopApplicationContext.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/FileBrowser.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/GraphicsUtilities.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/ImageView.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/Label.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/LabelListener.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/Limits.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/ListView.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/Mouse.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/RadioButtonGroup.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/TablePane.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/TableView.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/TreeView.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ButtonData.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ButtonDataRenderer.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/content/CalendarButtonDataRenderer.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ColorItem.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/content/LinkButtonDataRenderer.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ListButtonDataRenderer.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ListItem.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ListViewItemEditor.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ListViewItemRenderer.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/content/MenuBarItemDataRenderer.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/content/MenuButtonDataRenderer.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/content/MenuItemDataRenderer.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/content/SpinnerItemRenderer.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewCellRenderer.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewHeaderData.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewHeaderDataRenderer.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewMultiCellRenderer.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TableViewTextAreaCellRenderer.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TreeBranch.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TreeNode.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TreeViewNodeEditor.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/content/TreeViewNodeRenderer.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/ScaleDecorator.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/effects/WatermarkDecorator.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/media/Image.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/media/Picture.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/BorderSkin.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/BoxPaneSkin.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CalendarButtonSkin.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/CardPaneSkin.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ColorChooserButtonSkin.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ContainerSkin.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FillPaneSkin.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/LabelSkin.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ListButtonSkin.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ScrollPaneSkin.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TablePaneSkin.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinBulletedListView.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinListItemView.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinNumberedListView.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinVerticalElementView.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/text/ImageNode.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/text/Paragraph.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/validation/ComparableValidator.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/validation/DecimalValidator.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/validation/FormattedValidator.java

Modified: pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java Sat Mar  2 01:04:53 2013
@@ -204,7 +204,8 @@ public class BXMLSerializer implements S
         }
 
         @Override
-        public Object evaluate(Object value) {
+        public Object evaluate(final Object value) {
+            Object result = value;
             Bindings bindings = scriptEngine.getBindings(ScriptContext.GLOBAL_SCOPE);
             if (bindings.containsKey(functionName)) {
                 Invocable invocable;
@@ -215,7 +216,7 @@ public class BXMLSerializer implements S
                 }
 
                 try {
-                    value = invocable.invokeFunction(functionName, value);
+                    result = invocable.invokeFunction(functionName, result);
                 } catch (NoSuchMethodException exception) {
                     throw new RuntimeException(exception);
                 } catch (ScriptException exception) {
@@ -225,7 +226,7 @@ public class BXMLSerializer implements S
                 throw new RuntimeException("Mapping function \"" + functionName + "\" is not defined.");
             }
 
-            return value;
+            return result;
         }
     }
 
@@ -393,7 +394,7 @@ public class BXMLSerializer implements S
 
     /** DO NOT USE. see https://issues.apache.org/jira/browse/PIVOT-742 */
     @Deprecated
-    public BXMLSerializer(final ClassLoader classLoader) {
+    public BXMLSerializer(@SuppressWarnings("unused") final ClassLoader classLoader) {
         throw new UnsupportedOperationException("https://issues.apache.org/jira/browse/PIVOT-742");
     }
 
@@ -447,6 +448,10 @@ public class BXMLSerializer implements S
                             processEndElement();
                             break;
                         }
+
+                        default: {
+                            break;
+                        }
                     }
                 }
             } catch (XMLStreamException exception) {
@@ -1393,6 +1398,11 @@ public class BXMLSerializer implements S
 
             case DEFINE: {
                 // No-op
+                break;
+            }
+
+            default: {
+                break;
             }
         }
 
@@ -1706,39 +1716,43 @@ public class BXMLSerializer implements S
     }
 
     private static void setStaticProperty(Object object, Class<?> propertyClass,
-        String propertyName, Object value)
+        final String propertyName, final Object value)
         throws SerializationException {
         Class<?> objectType = object.getClass();
-        propertyName = Character.toUpperCase(propertyName.charAt(0)) + propertyName.substring(1);
+        String propertyNameUpdated =
+                Character.toUpperCase(propertyName.charAt(0)) + propertyName.substring(1);
+        Object valueToAssign = value;
 
         Method setterMethod = null;
-        if (value != null) {
-            setterMethod = getStaticSetterMethod(propertyClass, propertyName,
-                objectType, value.getClass());
+        if (valueToAssign != null) {
+            setterMethod = getStaticSetterMethod(propertyClass, propertyNameUpdated,
+                objectType, valueToAssign.getClass());
         }
 
         if (setterMethod == null) {
-            Method getterMethod = getStaticGetterMethod(propertyClass, propertyName, objectType);
+            Method getterMethod = getStaticGetterMethod(propertyClass, propertyNameUpdated, objectType);
 
             if (getterMethod != null) {
                 Class<?> propertyType = getterMethod.getReturnType();
-                setterMethod = getStaticSetterMethod(propertyClass, propertyName,
+                setterMethod = getStaticSetterMethod(propertyClass, propertyNameUpdated,
                     objectType, propertyType);
 
-                if (value instanceof String) {
-                    value = BeanAdapter.coerce((String)value, propertyType);
+                if (valueToAssign instanceof String) {
+                    valueToAssign = BeanAdapter.coerce((String)valueToAssign, propertyType);
                 }
             }
         }
 
         if (setterMethod == null) {
-            throw new SerializationException(propertyClass.getName() + "." + propertyName
-                + " is not valid static property.");
+            throw new SerializationException(propertyClass.getName()
+                + "." + propertyNameUpdated
+                + " is not valid static property."
+            );
         }
 
         // Invoke the setter
         try {
-            setterMethod.invoke(null, object, value);
+            setterMethod.invoke(null, object, valueToAssign);
         } catch (Exception exception) {
             throw new SerializationException(exception);
         }

Modified: pivot/trunk/core/src/org/apache/pivot/beans/BeanAdapter.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/beans/BeanAdapter.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/beans/BeanAdapter.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/beans/BeanAdapter.java Sat Mar  2 01:04:53 2013
@@ -29,7 +29,6 @@ import java.util.Iterator;
 import java.util.Locale;
 import java.util.NoSuchElementException;
 
-import org.apache.pivot.beans.PropertyNotFoundException;
 import org.apache.pivot.collections.Map;
 import org.apache.pivot.collections.MapListener;
 import org.apache.pivot.util.ListenerList;
@@ -278,7 +277,7 @@ public class BeanAdapter implements Map<
      * If the given property does not exist or is read-only.
      */
     @Override
-    public Object put(String key, Object value) {
+    public Object put(final String key, final Object value) {
         if (key == null) {
             throw new IllegalArgumentException("key is null.");
         }
@@ -288,10 +287,11 @@ public class BeanAdapter implements Map<
         }
 
         Method setterMethod = null;
+        Object valueUpdated = value;
 
-        if (value != null) {
+        if (valueUpdated != null) {
             // Get the setter method for the value type
-            setterMethod = getSetterMethod(key, value.getClass());
+            setterMethod = getSetterMethod(key, valueUpdated.getClass());
         }
 
         if (setterMethod == null) {
@@ -300,7 +300,7 @@ public class BeanAdapter implements Map<
 
             if (propertyType != null) {
                 setterMethod = getSetterMethod(key, propertyType);
-                value = coerce(value, propertyType);
+                valueUpdated = coerce(valueUpdated, propertyType);
             }
         }
 
@@ -313,28 +313,28 @@ public class BeanAdapter implements Map<
             }
 
             Class<?> fieldType = field.getType();
-            if (value != null) {
-                Class<?> valueType = value.getClass();
+            if (valueUpdated != null) {
+                Class<?> valueType = valueUpdated.getClass();
                 if (!fieldType.isAssignableFrom(valueType)) {
-                    value = coerce(value, fieldType);
+                    valueUpdated = coerce(valueUpdated, fieldType);
                 }
             }
 
             try {
-                field.set(bean, value);
+                field.set(bean, valueUpdated);
             } catch (IllegalAccessException exception) {
                 throw new RuntimeException(String.format(ILLEGAL_ACCESS_EXCEPTION_MESSAGE_FORMAT,
                     key, bean.getClass().getName()), exception);
             }
         } else {
             try {
-                setterMethod.invoke(bean, new Object[] {value});
+                setterMethod.invoke(bean, new Object[] {valueUpdated});
             } catch (IllegalAccessException exception) {
                 throw new RuntimeException(String.format(ILLEGAL_ACCESS_EXCEPTION_MESSAGE_FORMAT,
                     key, bean.getClass().getName()), exception);
             } catch (InvocationTargetException exception) {
                 throw new RuntimeException(String.format("Error setting property \"%s\" for type %s to value \"%s\"",
-                    key, bean.getClass().getName(), "" + value), exception.getCause());
+                    key, bean.getClass().getName(), "" + valueUpdated), exception.getCause());
             }
 
         }
@@ -765,7 +765,7 @@ public class BeanAdapter implements Map<
      * @return
      * The getter method, or <tt>null</tt> if the method does not exist.
      */
-    public static Method getGetterMethod(Class<?> beanClass, String key) {
+    public static Method getGetterMethod(final Class<?> beanClass, final String key) {
         if (beanClass == null) {
             throw new IllegalArgumentException("beanClass is null.");
         }
@@ -779,18 +779,18 @@ public class BeanAdapter implements Map<
         }
 
         // Upper-case the first letter
-        key = Character.toUpperCase(key.charAt(0)) + key.substring(1);
+        String keyUpdated = Character.toUpperCase(key.charAt(0)) + key.substring(1);
         Method getterMethod = null;
 
         try {
-            getterMethod = beanClass.getMethod(GET_PREFIX + key);
+            getterMethod = beanClass.getMethod(GET_PREFIX + keyUpdated);
         } catch (NoSuchMethodException exception) {
             // No-op
         }
 
         if (getterMethod == null) {
             try {
-                getterMethod = beanClass.getMethod(IS_PREFIX + key);
+                getterMethod = beanClass.getMethod(IS_PREFIX + keyUpdated);
             } catch (NoSuchMethodException exception) {
                 // No-op
             }
@@ -811,7 +811,7 @@ public class BeanAdapter implements Map<
      * @return
      * The getter method, or <tt>null</tt> if the method does not exist.
      */
-    public static Method getSetterMethod(Class<?> beanClass, String key, Class<?> valueType) {
+    public static Method getSetterMethod(final Class<?> beanClass, final String key, final Class<?> valueType) {
         if (beanClass == null) {
             throw new IllegalArgumentException("beanClass is null.");
         }
@@ -829,8 +829,8 @@ public class BeanAdapter implements Map<
         if (valueType != null) {
             // Upper-case the first letter and prepend the "set" prefix to
             // determine the method name
-            key = Character.toUpperCase(key.charAt(0)) + key.substring(1);
-            final String methodName = SET_PREFIX + key;
+            String keyUpdated = Character.toUpperCase(key.charAt(0)) + key.substring(1);
+            final String methodName = SET_PREFIX + keyUpdated;
 
             try {
                 setterMethod = beanClass.getMethod(methodName, valueType);
@@ -841,7 +841,7 @@ public class BeanAdapter implements Map<
             if (setterMethod == null) {
                 // Look for a match on the value's super type
                 Class<?> superType = valueType.getSuperclass();
-                setterMethod = getSetterMethod(beanClass, key, superType);
+                setterMethod = getSetterMethod(beanClass, keyUpdated, superType);
             }
 
             if (setterMethod == null) {
@@ -860,7 +860,7 @@ public class BeanAdapter implements Map<
                     // No-op
                 } catch (IllegalAccessException exception) {
                     throw new RuntimeException(String.format(ILLEGAL_ACCESS_EXCEPTION_MESSAGE_FORMAT,
-                        key, beanClass.getName()), exception);
+                            keyUpdated, beanClass.getName()), exception);
                 }
             }
 
@@ -872,7 +872,7 @@ public class BeanAdapter implements Map<
                 while (setterMethod == null
                     && i < n) {
                     Class<?> interfaceType = interfaces[i++];
-                    setterMethod = getSetterMethod(beanClass, key, interfaceType);
+                    setterMethod = getSetterMethod(beanClass, keyUpdated, interfaceType);
                 }
             }
         }

Modified: pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java Sat Mar  2 01:04:53 2013
@@ -403,8 +403,8 @@ public class ArrayList<T> implements Lis
 
     public void ensureCapacity(int capacity) {
         if (capacity > items.length) {
-            capacity = Math.max(this.items.length * 3 / 2, capacity);
-            Object[] itemsLocal = new Object[capacity];
+            int capacityMax = Math.max(this.items.length * 3 / 2, capacity);
+            Object[] itemsLocal = new Object[capacityMax];
             System.arraycopy(this.items, 0, itemsLocal, 0, length);
 
             this.items = itemsLocal;

Modified: pivot/trunk/core/src/org/apache/pivot/collections/Sequence.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/Sequence.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/collections/Sequence.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/Sequence.java Sat Mar  2 01:04:53 2013
@@ -324,7 +324,7 @@ public interface Sequence<T> {
          * The item that was previously stored at the given path.
          */
         @SuppressWarnings("unchecked")
-        public static <T> T update(Sequence<T> sequence, Path path, T item) {
+        public static <T> T update(final Sequence<T> sequence, final Path path, final T item) {
             if (sequence == null) {
                 throw new IllegalArgumentException("sequence is null.");
             }
@@ -334,11 +334,12 @@ public interface Sequence<T> {
             }
 
             int i = 0, n = path.getLength() - 1;
+            Sequence<T> sequenceUpdated = sequence;
             while (i < n) {
-                sequence = (Sequence<T>)sequence.get(path.get(i++));
+                sequenceUpdated = (Sequence<T>)sequenceUpdated.get(path.get(i++));
             }
 
-            return sequence.update(path.get(i), item);
+            return sequenceUpdated.update(path.get(i), item);
         }
 
         /**
@@ -374,7 +375,7 @@ public interface Sequence<T> {
          * The path of the item to remove.
          */
         @SuppressWarnings("unchecked")
-        public static <T> Sequence<T> remove(Sequence<T> sequence, Path path, int count) {
+        public static <T> Sequence<T> remove(final Sequence<T> sequence, final Path path, int count) {
             if (sequence == null) {
                 throw new IllegalArgumentException("sequence is null.");
             }
@@ -384,11 +385,12 @@ public interface Sequence<T> {
             }
 
             int i = 0, n = path.getLength() - 1;
+            Sequence<T> sequenceUpdated = sequence;
             while (i < n) {
-                sequence = (Sequence<T>)sequence.get(path.get(i++));
+                sequenceUpdated = (Sequence<T>)sequenceUpdated.get(path.get(i++));
             }
 
-            return sequence.remove(path.get(i), count);
+            return sequenceUpdated.remove(path.get(i), count);
         }
 
         /**
@@ -404,7 +406,7 @@ public interface Sequence<T> {
          * The item at the given path, or <tt>null</tt> if the path is empty.
          */
         @SuppressWarnings("unchecked")
-        public static <T> T get(Sequence<T> sequence, Path path) {
+        public static <T> T get(final Sequence<T> sequence, final Path path) {
             if (sequence == null) {
                 throw new IllegalArgumentException("sequence is null.");
             }
@@ -418,11 +420,12 @@ public interface Sequence<T> {
                 item = null;
             } else {
                 int i = 0, n = path.getLength() - 1;
+                Sequence<T> sequenceUpdated = sequence;
                 while (i < n) {
-                    sequence = (Sequence<T>)sequence.get(path.get(i++));
+                    sequenceUpdated = (Sequence<T>)sequenceUpdated.get(path.get(i++));
                 }
 
-                item = sequence.get(path.get(i));
+                item = sequenceUpdated.get(path.get(i));
             }
 
             return item;
@@ -442,7 +445,7 @@ public interface Sequence<T> {
          * sequence; <tt>null</tt>, otherwise.
          */
         @SuppressWarnings("unchecked")
-        public static <T> Path pathOf(Sequence<T> sequence, T item) {
+        public static <T> Path pathOf(final Sequence<T> sequence, final T item) {
             if (sequence == null) {
                 throw new IllegalArgumentException("sequence is null.");
             }

Modified: pivot/trunk/core/src/org/apache/pivot/io/IOTask.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/io/IOTask.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/io/IOTask.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/io/IOTask.java Sat Mar  2 01:04:53 2013
@@ -193,6 +193,7 @@ public abstract class IOTask<V> extends 
         }
     }
 
+    // TODO: use AtomicInteger instead of volatile ...
     protected volatile long bytesSent = 0;
     protected volatile long bytesReceived = 0;
 

Modified: pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java Sat Mar  2 01:04:53 2013
@@ -217,6 +217,7 @@ public class JSONSerializer implements S
      *
      * @see #readObject(Reader)
      */
+    @SuppressWarnings("resource")
     @Override
     public Object readObject(InputStream inputStream)
         throws IOException, SerializationException {
@@ -846,6 +847,7 @@ public class JSONSerializer implements S
      *
      * @see #writeObject(Object, Writer)
      */
+    @SuppressWarnings("resource")
     @Override
     public void writeObject(Object object, OutputStream outputStream)
         throws IOException, SerializationException {

Modified: pivot/trunk/core/src/org/apache/pivot/serialization/CSVSerializer.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/serialization/CSVSerializer.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/serialization/CSVSerializer.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/serialization/CSVSerializer.java Sat Mar  2 01:04:53 2013
@@ -205,6 +205,7 @@ public class CSVSerializer implements Se
      *
      * @see #readObject(Reader)
      */
+    @SuppressWarnings("resource")
     @Override
     public List<?> readObject(InputStream inputStream)
         throws IOException, SerializationException {
@@ -441,6 +442,7 @@ public class CSVSerializer implements Se
      *
      * @see #writeObject(List, Writer)
      */
+    @SuppressWarnings("resource")
     @Override
     public void writeObject(List<?> items, OutputStream outputStream)
         throws IOException, SerializationException {

Modified: pivot/trunk/core/src/org/apache/pivot/text/CharSequenceCharacterIterator.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/text/CharSequenceCharacterIterator.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/text/CharSequenceCharacterIterator.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/text/CharSequenceCharacterIterator.java Sat Mar  2 01:04:53 2013
@@ -45,33 +45,35 @@ public final class CharSequenceCharacter
             throw new IllegalArgumentException("charSequence may not be null");
         }
 
+        int endIndexUpdated = endIndex;
+
         if (endIndex == -1) {
-            endIndex = charSequence.length();
+            endIndexUpdated = charSequence.length();
         }
 
-        if (beginIndex > endIndex) {
-            throw new IllegalArgumentException("beginIndex > endIndex, " + beginIndex + ">" + endIndex);
+        if (beginIndex > endIndexUpdated) {
+            throw new IllegalArgumentException("beginIndex > endIndex, " + beginIndex + ">" + endIndexUpdated);
         }
 
         if (beginIndex < 0) {
             throw new IndexOutOfBoundsException("beginIndex < 0, " + beginIndex);
         }
 
-        if (endIndex > charSequence.length()) {
-            throw new IndexOutOfBoundsException("endIndex > char sequence length, " + endIndex + ">" + charSequence.length());
+        if (endIndexUpdated > charSequence.length()) {
+            throw new IndexOutOfBoundsException("endIndex > char sequence length, " + endIndexUpdated + ">" + charSequence.length());
         }
 
         if (index < beginIndex) {
             throw new IndexOutOfBoundsException("(index < beginIndex, " + index + "<" + beginIndex);
         }
 
-        if (index > endIndex) {
-            throw new IndexOutOfBoundsException("(index > endIndex, " + index + ">" + endIndex);
+        if (index > endIndexUpdated) {
+            throw new IndexOutOfBoundsException("(index > endIndex, " + index + ">" + endIndexUpdated);
         }
 
         this.charSequence = charSequence;
         this.beginIndex = beginIndex;
-        this.endIndex = endIndex;
+        this.endIndex = endIndexUpdated;
 
         setIndex(index);
     }

Modified: pivot/trunk/core/src/org/apache/pivot/util/ListenerList.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/ListenerList.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/util/ListenerList.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/ListenerList.java Sat Mar  2 01:04:53 2013
@@ -16,8 +16,9 @@
  */
 package org.apache.pivot.util;
 
-import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Iterator;
+import java.util.NoSuchElementException;
 
 /**
  * Abstract base class for listener lists.
@@ -29,9 +30,43 @@ import java.util.Iterator;
  */
 public abstract class ListenerList<T> implements Iterable<T> {
 
+    // Iterator through the current array of elements
+    private class NodeIterator implements Iterator<T> {
+        private int index;
+
+        public NodeIterator() {
+            this.index = 0;
+        }
+
+        @Override
+        public boolean hasNext() {
+            return (index < last);
+        }
+
+        @Override
+        public T next() {
+            if (index >= last) {
+                throw new NoSuchElementException();
+            }
+
+            return list[index++];
+        }
+
+        @Override
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+    }
+
     private static final int DEFAULT_SIZE = 5;
 
-    private ArrayList<T> list = new ArrayList<T>(DEFAULT_SIZE);
+    // The current array of items (some of which are null)
+    // All non-null objects are at the beginning of the array
+    // and the array is reorganized on "remove"
+    @SuppressWarnings({"unchecked"})
+    private T[] list = (T[])new Object[DEFAULT_SIZE];
+    // The current length of the active list
+    private int last = 0;
 
     /**
      * Adds a listener to the list, if it has not previously been added.
@@ -44,7 +79,12 @@ public abstract class ListenerList<T> im
             return;
         }
 
-        list.add(listener);
+        // If no slot is available, increase the size of the array
+        if (last >= list.length) {
+            list = Arrays.copyOf(list, list.length + DEFAULT_SIZE);
+        }
+
+        list[last++] = listener;
     }
 
     /**
@@ -60,18 +100,25 @@ public abstract class ListenerList<T> im
             return;
         }
 
-        list.remove(index);
+        // Once we find the entry in the list, copy the rest of the
+        // existing entries down by one position
+        if (index < last - 1) {
+            System.arraycopy(list, index + 1, list, index, last - 1 - index);
+        }
+
+        list[--last] = null;
     }
 
-    /**
-     * Returns the position of the given listener in the list,
-     * or -1 if the listener is not in the list.
-     */
     private int indexOf(T listener) {
         if (listener == null) {
             throw new IllegalArgumentException("listener is null.");
         }
-        return list.indexOf(listener);
+        for (int i = 0; i < last; i++) {
+            if (list[i] == listener) {
+                return i;
+            }
+        }
+        return -1;
     }
 
     /**
@@ -95,15 +142,44 @@ public abstract class ListenerList<T> im
      * otherwise.
      */
     public boolean isEmpty() {
-        return list.isEmpty();
+        return last == 0;
     }
 
     /**
-     * Returns an iterator over the elements of the list.
+     * Get the number of elements in the list.
+     *
+     * @return
+     * the number of elements.
      */
+    public int getLength() {
+        return last;
+    }
+
     @Override
     public Iterator<T> iterator() {
-        return list.iterator();
+        return new NodeIterator();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append(getClass().getName());
+        sb.append(" [");
+
+        int i = 0;
+        for (T item : this) {
+            if (i > 0) {
+                sb.append(", ");
+            }
+
+            sb.append(item);
+            i++;
+        }
+
+        sb.append("]");
+
+        return sb.toString();
     }
 
 }

Modified: pivot/trunk/core/src/org/apache/pivot/xml/XMLSerializer.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/xml/XMLSerializer.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/xml/XMLSerializer.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/xml/XMLSerializer.java Sat Mar  2 01:04:53 2013
@@ -211,6 +211,10 @@ public class XMLSerializer implements Se
 
                         break;
                     }
+
+                    default: {
+                        break;
+                    }
                 }
             }
         } catch (XMLStreamException exception) {

Modified: pivot/trunk/examples/src/org/apache/pivot/examples/buttons/radio_button_group_example.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/examples/src/org/apache/pivot/examples/buttons/radio_button_group_example.bxml?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/examples/src/org/apache/pivot/examples/buttons/radio_button_group_example.bxml (original)
+++ pivot/trunk/examples/src/org/apache/pivot/examples/buttons/radio_button_group_example.bxml Sat Mar  2 01:04:53 2013
@@ -94,7 +94,7 @@ limitations under the License.
 
         <!--
             Workaround to push the 2nd Border across to the right hand side.
-            If visisble the TablePane.Filler ends up overlayed on top of the
+            If visible the TablePane.Filler ends up overlayed on top of the
             checkboxes from the 1st Border, and prevents mouse clicks from
             reaching them.
          -->

Modified: pivot/trunk/tests/src/org/apache/pivot/tests/DataBindingTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/DataBindingTest.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/DataBindingTest.java (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/DataBindingTest.java Sat Mar  2 01:04:53 2013
@@ -36,12 +36,13 @@ import org.apache.pivot.wtk.content.Spin
 public class DataBindingTest extends Application.Adapter {
     public static class TestListButtonDataRenderer extends ListButtonDataRenderer {
         @Override
-        public void render(Object data, Button button, boolean highlighted) {
-            if (data != null) {
-                data = JSON.get(data, "text");
+        public void render(final Object data, Button button, boolean highlighted) {
+            Object dataLoaded = data;
+            if (dataLoaded != null) {
+                dataLoaded = JSON.get(data, "text");
             }
 
-            super.render(data, button, highlighted);
+            super.render(dataLoaded, button, highlighted);
         }
 
         @Override
@@ -52,13 +53,14 @@ public class DataBindingTest extends App
 
     public static class TestListViewItemRenderer extends ListViewItemRenderer {
         @Override
-        public void render(Object item, int index, ListView listView, boolean selected,
+        public void render(final Object item, int index, final ListView listView, boolean selected,
             boolean checked, boolean highlighted, boolean disabled) {
-            if (item != null) {
-                item = JSON.get(item, "text");
+            Object itemLoaded = item;
+            if (itemLoaded != null) {
+                itemLoaded = JSON.get(item, "text");
             }
 
-            super.render(item, index, listView, selected, checked, highlighted, disabled);
+            super.render(itemLoaded, index, listView, selected, checked, highlighted, disabled);
         }
 
         @Override
@@ -69,12 +71,13 @@ public class DataBindingTest extends App
 
     public static class TestSpinnerItemRenderer extends SpinnerItemRenderer {
         @Override
-        public void render(Object item, Spinner spinner) {
-            if (item != null) {
-                item = JSON.get(item, "text");
+        public void render(final Object item, final Spinner spinner) {
+            Object itemLoaded = item;
+            if (itemLoaded != null) {
+                itemLoaded = JSON.get(item, "text");
             }
 
-            super.render(item, spinner);
+            super.render(itemLoaded, spinner);
         }
 
         @Override

Modified: pivot/trunk/tests/src/org/apache/pivot/tests/JavascriptConsoleTest.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/JavascriptConsoleTest.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/JavascriptConsoleTest.java (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/JavascriptConsoleTest.java Sat Mar  2 01:04:53 2013
@@ -107,16 +107,16 @@ public class JavascriptConsoleTest exten
      * @param className the full class name (to use as a base name), for loading resources
      */
     private void loadResources(String className) {
-        if (className == null || className.length() < 1) {
-            className = MAIN_CLASS_NAME;  // set a useful default
-        }
-
         try {
             // load some resources here, just to show its usage from JS files,
             // but only if not already loaded ...
             if (resources == null) {
                 resources = new Resources(MAIN_CLASS_NAME, locale);
-                logObject("buildResources, load resources from \"" + className + "\", with locale " + locale);
+                logObject("buildResources, load resources from "
+                    + "\""
+                    + ((className != null && className.length() > 0) ? className : MAIN_CLASS_NAME)  // set a useful default
+                    + "\", with locale " + locale
+                );
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -150,17 +150,18 @@ public class JavascriptConsoleTest exten
      * @throws SerializationException in case of error
      * @throws IOException in case of error
      */
-    private Window loadWindow(String fileName, BXMLSerializer bxmlSerializer)
+    private Window loadWindow(String fileName, final BXMLSerializer bxmlSerializer)
         throws SerializationException, IOException {
         logObject("loadWindow from \"" + fileName + "\", with the serializer " + bxmlSerializer);
 
-        if (bxmlSerializer == null) {
-            bxmlSerializer = new BXMLSerializer();
+        BXMLSerializer serializer = bxmlSerializer;
+        if (serializer == null) {
+            serializer = new BXMLSerializer();
         }
 
         // return (Window)bxmlSerializer.readObject(JavascriptConsoleTest.class, fileName); // ok
         // better, to allow usage of resources (without having to call setLocation or setResources in the serializer) ...
-        return (Window)bxmlSerializer.readObject(JavascriptConsoleTest.class, fileName, true);
+        return (Window)serializer.readObject(JavascriptConsoleTest.class, fileName, true);
     }
 
     /**
@@ -175,11 +176,12 @@ public class JavascriptConsoleTest exten
      * @param bxmlSerializer the serializer to use, or if null a new one will be created
      * @return the Window instance
      */
-    public Window loadWindowFromURL(String urlString, BXMLSerializer bxmlSerializer) {
+    public Window loadWindowFromURL(String urlString, final BXMLSerializer bxmlSerializer) {
         logObject("loadWindow from \"" + urlString + "\", with the serializer " + bxmlSerializer);
 
-        if (bxmlSerializer == null) {
-            bxmlSerializer = new BXMLSerializer();
+        BXMLSerializer serializer = bxmlSerializer;
+        if (serializer == null) {
+            serializer = new BXMLSerializer();
         }
 
         Window loadedWindow = null;
@@ -187,9 +189,9 @@ public class JavascriptConsoleTest exten
             URL url = new URL(urlString);
 
             // force the location, so it will be possible to decode resources like labels ...
-            bxmlSerializer.setLocation(url);
+            serializer.setLocation(url);
 
-            loadedWindow = (Window)bxmlSerializer.readObject(url);
+            loadedWindow = (Window)serializer.readObject(url);
         } catch (MalformedURLException e) {
             e.printStackTrace();
         } catch (IOException e) {

Modified: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot859/Pivot859.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot859/Pivot859.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot859/Pivot859.java (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot859/Pivot859.java Sat Mar  2 01:04:53 2013
@@ -51,6 +51,7 @@ public class Pivot859 extends Applicatio
     private String defaultURL = null;
 
 
+    @Override
     public void startup(final Display display, Map<String, String> properties) throws Exception {
         System.out.println("startup(...)");
 

Modified: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot861/Pivot861.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot861/Pivot861.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot861/Pivot861.java (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot861/Pivot861.java Sat Mar  2 01:04:53 2013
@@ -27,6 +27,7 @@ import org.apache.pivot.wtk.Display;
  */
 public class Pivot861 extends Application.Adapter {
 
+    @Override
     public void startup(final Display display, Map<String, String> args) throws Exception {
         System.out.println("Pivot861 startup(...)");
         System.out.println("\n"

Modified: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot861/TestDialog.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot861/TestDialog.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot861/TestDialog.java (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot861/TestDialog.java Sat Mar  2 01:04:53 2013
@@ -51,10 +51,12 @@ public class TestDialog extends Dialog i
         return dialog;
     }
 
+    @Override
     public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
         System.out.println("TestDialog initialize(...)");
 
         this.okButton.getButtonPressListeners().add(new ButtonPressListener() {
+            @Override
             public void buttonPressed(Button button) {
                 TestDialog.this.close(true);
             }

Added: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot894/Pivot894.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot894/Pivot894.java?rev=1451799&view=auto
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot894/Pivot894.java (added)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot894/Pivot894.java Sat Mar  2 01:04:53 2013
@@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pivot.tests.issues.pivot894;
+
+import java.awt.EventQueue;
+import java.io.File;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.pivot.beans.BXMLSerializer;
+import org.apache.pivot.collections.Map;
+import org.apache.pivot.util.concurrent.TaskExecutionException;
+import org.apache.pivot.wtk.Application;
+import org.apache.pivot.wtk.CardPane;
+import org.apache.pivot.wtk.Component;
+import org.apache.pivot.wtk.DesktopApplicationContext;
+import org.apache.pivot.wtk.Display;
+import org.apache.pivot.wtk.GridPane;
+import org.apache.pivot.wtk.GridPane.Row;
+import org.apache.pivot.wtk.PushButton;
+import org.apache.pivot.wtk.Window;
+import org.apache.pivot.wtk.content.ButtonData;
+import org.apache.pivot.wtk.media.Image;
+import org.apache.pivot.wtk.skin.CardPaneSkin;
+
+public class Pivot894 extends Application.Adapter {
+    // global counter, just to know how many iterations the application is doing
+    static int num = 0;
+
+    @Override
+    public void startup(Display display, Map<String, String> properties) throws Exception {
+        System.out.println("public startup(...)");
+        System.out.println("\n"
+            + "Attention: now the application will go in an infinite loop, to be able to see the memory leak.\n"
+            + "Note that probably you'll have to kill the application from outside (kill the Java process).\n"
+            + "\n"
+        );
+
+        // add some sleep to let users see the warning messages in console ...
+        Thread.sleep(2000);
+
+
+        final CardPane cardPane = new CardPane();
+        cardPane.getStyles().put("selectionChangeEffect", CardPaneSkin.SelectionChangeEffect.HORIZONTAL_SLIDE);
+
+        final Window window = new Window(cardPane);
+        window.open(display);
+
+        DesktopApplicationContext.scheduleRecurringCallback(new Runnable() {
+            @Override
+            public void run() {
+                Thread.currentThread().setName("switcher-thread");
+
+                System.out.println("Run num " + num++);  // temp
+
+
+                /*
+                //
+                // method 1:
+                //
+                // Seems to be working just fine
+                final GridPane grid = new GridPane(3);
+                grid.getRows().add(createGridRow());
+                grid.getRows().add(createGridRow());
+                grid.getRows().add(createGridRow());
+                 */
+
+
+                //
+                // method 2:
+                //
+                try {
+                    // Before the fixes for PIVOT-861 (part two) it was causing out of memory ...
+                    //
+                    // Note that this has been moved to another issue, but the problem is due to the usage
+                    // of dataRenderer tags (and then instancing ButtonDataRenderer) in the loaded bxml,
+                    // so probably even this test will be updated ...
+                    //
+                    final GridPane grid = (GridPane) new BXMLSerializer().readObject(Pivot894.class, "btn_grid.bxml");
+
+                    EventQueue.invokeLater(new Runnable() {
+                        @Override
+                        public void run() {
+                            Iterator<Component> iterator = cardPane.iterator();
+                            List<Component> deprecated = new ArrayList<Component>();
+                            while (iterator.hasNext()) {
+                                Component card = iterator.next();
+                                if (!card.isShowing()) {
+                                    deprecated.add(card);
+                                }
+                            }
+
+                            for (Component card : deprecated) {
+                                cardPane.remove(card);
+                            }
+
+                            cardPane.setSelectedIndex(cardPane.add(grid));
+
+                            System.out.println(cardPane.getSelectedIndex());
+                        }
+                    });
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+
+            }
+
+            @SuppressWarnings("unused")
+            private Row createGridRow() {
+                Row row = new Row();
+                try {
+                    // note that this method doesn't use ApplicationContext cache for images ...
+                    row.add(new PushButton(new ButtonData(Image.load(new File("clock_icon.png").toURI().toURL()), "Clock")));
+                    row.add(new PushButton(new ButtonData(Image.load(new File("clock_icon.png").toURI().toURL()), "Clock")));
+                    row.add(new PushButton(new ButtonData(Image.load(new File("clock_icon.png").toURI().toURL()), "Clock")));
+                } catch (MalformedURLException e) {
+                    e.printStackTrace();
+                } catch (TaskExecutionException e) {
+                    e.printStackTrace();
+                }
+                return row;
+            }
+        }, 100);
+    }
+
+    @Override
+    public boolean shutdown(boolean optional) throws Exception {
+        return false;
+    }
+
+    public static void main(String[] args) {
+        DesktopApplicationContext.main(Pivot894.class, args);
+    }
+
+}

Added: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot894/btn_grid.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot894/btn_grid.bxml?rev=1451799&view=auto
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot894/btn_grid.bxml (added)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot894/btn_grid.bxml Sat Mar  2 01:04:53 2013
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License,
+Version 2.0 (the "License"); you may not use this file except in
+compliance with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<GridPane
+    xmlns:bxml="http://pivot.apache.org/bxml"
+    xmlns:content="org.apache.pivot.wtk.content"
+    xmlns="org.apache.pivot.wtk"
+    columnCount="3"
+    styles="{horizontalSpacing:1, verticalSpacing:1,
+        showHorizontalGridLines:true, showVerticalGridLines:true}"
+>
+    <GridPane.Row>
+        <PushButton >
+            <dataRenderer>
+                <content:ButtonDataRenderer/>
+            </dataRenderer>
+            <content:ButtonData text="BXML" icon="@../../clock.png" />
+        </PushButton>
+        <PushButton >
+            <dataRenderer>
+                <content:ButtonDataRenderer/>
+            </dataRenderer>
+            <content:ButtonData text="BXML" icon="@../../clock.png" />
+        </PushButton>
+        <PushButton >
+            <dataRenderer>
+                <content:ButtonDataRenderer/>
+            </dataRenderer>
+            <content:ButtonData text="BXML" icon="@../../clock.png" />
+        </PushButton>
+    </GridPane.Row>
+    <GridPane.Row>
+        <PushButton >
+            <dataRenderer>
+                <content:ButtonDataRenderer/>
+            </dataRenderer>
+            <content:ButtonData text="BXML" icon="@../../clock.png" />
+        </PushButton>
+        <PushButton >
+            <dataRenderer>
+                <content:ButtonDataRenderer/>
+            </dataRenderer>
+            <content:ButtonData text="BXML" icon="@../../clock.png" />
+        </PushButton>
+        <PushButton >
+            <dataRenderer>
+                <content:ButtonDataRenderer/>
+            </dataRenderer>
+            <content:ButtonData text="BXML" icon="@../../clock.png" />
+        </PushButton>
+    </GridPane.Row>
+    <GridPane.Row>
+        <PushButton >
+            <dataRenderer>
+                <content:ButtonDataRenderer/>
+            </dataRenderer>
+            <content:ButtonData text="BXML" icon="@../../clock.png" />
+        </PushButton>
+        <PushButton >
+            <dataRenderer>
+                <content:ButtonDataRenderer/>
+            </dataRenderer>
+            <content:ButtonData text="BXML" icon="@../../clock.png" />
+        </PushButton>
+        <PushButton >
+            <dataRenderer>
+                <content:ButtonDataRenderer/>
+            </dataRenderer>
+            <content:ButtonData text="BXML" icon="@../../clock.png" />
+        </PushButton>
+    </GridPane.Row>
+</GridPane>

Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorerDocument.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorerDocument.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorerDocument.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorerDocument.java Sat Mar  2 01:04:53 2013
@@ -340,15 +340,16 @@ public class BXMLExplorerDocument extend
         }
     }
 
-    private String nameForObject(Object obj) {
-        if (obj instanceof FakeWindow) {
-            obj = ((FakeWindow) obj).window;
+    private String nameForObject(final Object obj) {
+        Object objUpdated = obj;
+        if (objUpdated instanceof FakeWindow) {
+            objUpdated = ((FakeWindow) objUpdated).window;
         }
-        String bxmlID = widgetToID.get(obj);
+        String bxmlID = widgetToID.get(objUpdated);
         if (bxmlID == null) {
-            return obj.getClass().getSimpleName();
+            return objUpdated.getClass().getSimpleName();
         }
-        return obj.getClass().getSimpleName() + " " + bxmlID;
+        return objUpdated.getClass().getSimpleName() + " " + bxmlID;
     }
 
     private static class MyTreeViewNodeRenderer extends TreeViewNodeRenderer {

Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/CreateHighlightedXML.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/CreateHighlightedXML.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/CreateHighlightedXML.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/CreateHighlightedXML.java Sat Mar  2 01:04:53 2013
@@ -67,8 +67,8 @@ public class CreateHighlightedXML {
 
     private void prettyPrint(org.w3c.dom.Element domElement, int indent) {
         newLine();
-        indent++;
-        add(createIndent(indent));
+        int indentMutable = indent + 1;
+        add(createIndent(indentMutable));
 
         add(ELEMENT_COLOR, "<" + domElement.getNodeName());
 
@@ -96,14 +96,16 @@ public class CreateHighlightedXML {
             for (int i = 0; i < childNodes.getLength(); i++) {
                 org.w3c.dom.Node node = childNodes.item(i);
                 if (node instanceof org.w3c.dom.Element) {
-                    prettyPrint((org.w3c.dom.Element) node, indent);
+                    prettyPrint((org.w3c.dom.Element) node, indentMutable);
                 }
             }
+
             newLine();
-            add(createIndent(indent));
+            add(createIndent(indentMutable));
             add(ELEMENT_COLOR, "</" + domElement.getNodeName() + ">");
         }
-        indent--;
+
+        indentMutable--;
     }
 
     private void newLine() {

Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/FakeWindowSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/FakeWindowSkin.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/FakeWindowSkin.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/FakeWindowSkin.java Sat Mar  2 01:04:53 2013
@@ -250,6 +250,7 @@ public class FakeWindowSkin extends Cont
     @Override
     public int getPreferredWidth(int height) {
         int preferredWidth = 0;
+        int heightMutable = height;
 
         FakeWindow frame = (FakeWindow) getComponent();
 
@@ -257,24 +258,22 @@ public class FakeWindowSkin extends Cont
         Dimensions titleBarSize = titleBarTablePane.getPreferredSize();
         preferredWidth = Math.max(titleBarSize.width + 2, preferredWidth);
 
-        if (height != -1) {
+        if (heightMutable != -1) {
             // Subtract title bar height and top/bottom title bar borders
             // from height constraint
-            height -= titleBarSize.height + 2;
+            heightMutable -= titleBarSize.height + 2;
         }
 
         Component content = frame.getContent();
         if (content != null) {
-            if (height != -1) {
+            if (heightMutable != -1) {
                 // Subtract padding, top/bottom content borders, and content
-                // bevel
-                // from height constraint
-                height -= (padding.top + padding.bottom) + (1) + 2;
-
-                height = Math.max(height, 0);
+                // bevel from height constraint
+                heightMutable -= (padding.top + padding.bottom) + (1) + 2;
+                heightMutable = Math.max(heightMutable, 0);
             }
 
-            preferredWidth = Math.max(preferredWidth, content.getPreferredWidth(height));
+            preferredWidth = Math.max(preferredWidth, content.getPreferredWidth(heightMutable));
         }
 
         // Add padding and left/right content borders
@@ -286,6 +285,7 @@ public class FakeWindowSkin extends Cont
     @Override
     public int getPreferredHeight(int width) {
         int preferredHeight = 0;
+        int widthMutable = width;
 
         FakeWindow frame = (FakeWindow) getComponent();
 
@@ -294,15 +294,14 @@ public class FakeWindowSkin extends Cont
 
         Component content = frame.getContent();
         if (content != null) {
-            if (width != -1) {
+            if (widthMutable != -1) {
                 // Subtract padding and left/right content borders from
                 // constraint
-                width -= (padding.left + padding.right) + 2;
-
-                width = Math.max(width, 0);
+                widthMutable -= (padding.left + padding.right) + 2;
+                widthMutable = Math.max(widthMutable, 0);
             }
 
-            preferredHeight += content.getPreferredHeight(width);
+            preferredHeight += content.getPreferredHeight(widthMutable);
         }
 
         // Add padding, top/bottom content borders, and content bevel
@@ -413,7 +412,7 @@ public class FakeWindowSkin extends Cont
     public void titleChanged(FakeWindow window, String previousTitle) {
         String title = window.getTitle();
         titleLabel.setVisible(title != null);
-        titleLabel.setText(title);
+        titleLabel.setText(title != null ? title : "");
     }
 
     @Override

Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/bxml_explorer_document.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/bxml_explorer_document.bxml?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/bxml_explorer_document.bxml (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/bxml_explorer_document.bxml Sat Mar  2 01:04:53 2013
@@ -42,7 +42,7 @@
               </ScrollPane>
             </Border>
             <Border TabPane.tabData="BXML Source">
-              <ScrollPane horizontalScrollBarPolicy="fill_to_capacity">
+              <ScrollPane horizontalScrollBarPolicy="fill_to_capacity" verticalScrollBarPolicy="fill_to_capacity">
                 <TextPane bxml:id="bxmlSourceTextPane" editable="false" styles="{wrapText:true}">
                 </TextPane>
               </ScrollPane>

Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/databinding/DataBinding.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/databinding/DataBinding.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/databinding/DataBinding.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/databinding/DataBinding.java Sat Mar  2 01:04:53 2013
@@ -80,7 +80,7 @@ public class DataBinding extends Window 
             @Override
             public void buttonPressed(Button button) {
                 form.clear();
-                sourceLabel.setText(null);
+                sourceLabel.setText("");
             }
         });
     }

Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/ComponentExplorerWindow.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/ComponentExplorerWindow.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/ComponentExplorerWindow.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/ComponentExplorerWindow.java Sat Mar  2 01:04:53 2013
@@ -125,39 +125,43 @@ public class ComponentExplorerWindow ext
                     }
 
                     switch (componentNode.getHorizontalScrollBarPolicy()) {
-                    case AUTO:
-                        horizontalScrollBarPolicyGroup.setSelection(horizontalAutoButton);
-                        break;
-                    case FILL:
-                        horizontalScrollBarPolicyGroup.setSelection(horizontalFillButton);
-                        break;
-                    case FILL_TO_CAPACITY:
-                        horizontalScrollBarPolicyGroup.setSelection(horizontalFillToCapacityButton);
-                        break;
-                    case NEVER:
-                        horizontalScrollBarPolicyGroup.setSelection(horizontalNeverButton);
-                        break;
-                    case ALWAYS:
-                        horizontalScrollBarPolicyGroup.setSelection(horizontalAlwaysButton);
-                        break;
+                        case AUTO:
+                            horizontalScrollBarPolicyGroup.setSelection(horizontalAutoButton);
+                            break;
+                        case FILL:
+                            horizontalScrollBarPolicyGroup.setSelection(horizontalFillButton);
+                            break;
+                        case FILL_TO_CAPACITY:
+                            horizontalScrollBarPolicyGroup.setSelection(horizontalFillToCapacityButton);
+                            break;
+                        case NEVER:
+                            horizontalScrollBarPolicyGroup.setSelection(horizontalNeverButton);
+                            break;
+                        case ALWAYS:
+                            horizontalScrollBarPolicyGroup.setSelection(horizontalAlwaysButton);
+                            break;
+                        default:
+                            break;
                     }
 
                     switch (componentNode.getVerticalScrollBarPolicy()) {
-                    case AUTO:
-                        verticalScrollBarPolicyGroup.setSelection(verticalAutoButton);
-                        break;
-                    case FILL:
-                        verticalScrollBarPolicyGroup.setSelection(verticalFillButton);
-                        break;
-                    case FILL_TO_CAPACITY:
-                        verticalScrollBarPolicyGroup.setSelection(verticalFillToCapacityButton);
-                        break;
-                    case NEVER:
-                        verticalScrollBarPolicyGroup.setSelection(verticalNeverButton);
-                        break;
-                    case ALWAYS:
-                        verticalScrollBarPolicyGroup.setSelection(verticalAlwaysButton);
-                        break;
+                        case AUTO:
+                            verticalScrollBarPolicyGroup.setSelection(verticalAutoButton);
+                            break;
+                        case FILL:
+                            verticalScrollBarPolicyGroup.setSelection(verticalFillButton);
+                            break;
+                        case FILL_TO_CAPACITY:
+                            verticalScrollBarPolicyGroup.setSelection(verticalFillToCapacityButton);
+                            break;
+                        case NEVER:
+                            verticalScrollBarPolicyGroup.setSelection(verticalNeverButton);
+                            break;
+                        case ALWAYS:
+                            verticalScrollBarPolicyGroup.setSelection(verticalAlwaysButton);
+                            break;
+                        default:
+                            break;
                     }
                 } else {
                     sourceTextArea.setText("");

Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/RulerSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/RulerSkin.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/RulerSkin.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/explorer/RulerSkin.java Sat Mar  2 01:04:53 2013
@@ -95,6 +95,10 @@ class RulerSkin extends ComponentSkin im
 
                 break;
             }
+
+            default: {
+                break;
+            }
         }
     }
 

Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/Forms.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/Forms.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/Forms.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/Forms.java Sat Mar  2 01:04:53 2013
@@ -62,7 +62,7 @@ public class Forms extends Window implem
                 Form.setFlag(nameBoxPane, flag);
 
                 if (flag == null) {
-                    errorLabel.setText(null);
+                    errorLabel.setText("");
                     Prompt.prompt("Pretending to submit...", Forms.this);
                 } else {
                     errorLabel.setText("Some required information is missing.");

Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/lists/ListViews.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/lists/ListViews.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/lists/ListViews.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/lists/ListViews.java Sat Mar  2 01:04:53 2013
@@ -63,6 +63,7 @@ public class ListViews extends Window im
             }
 
             private void updateSelection(ListView listViewArgument) {
+                // TODO: in future use StringBuffer instead ...
                 String selectionText = "";
 
                 Sequence<Span> selectedRanges = listViewArgument.getSelectedRanges();

Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/RulerSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/RulerSkin.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/RulerSkin.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation/RulerSkin.java Sat Mar  2 01:04:53 2013
@@ -95,6 +95,10 @@ class RulerSkin extends ComponentSkin im
 
                 break;
             }
+
+            default: {
+                break;
+            }
         }
     }
 

Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ResultItemRenderer.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ResultItemRenderer.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ResultItemRenderer.java (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/webqueries/ResultItemRenderer.java Sat Mar  2 01:04:53 2013
@@ -66,7 +66,7 @@ public class ResultItemRenderer extends 
 
             Map<String, ?> location = JSON.get(item, "['y:location']");
             if (location == null) {
-                addressLabel.setText(null);
+                addressLabel.setText("");
             } else {
                 String street = JSON.get(location, "street");
                 String city = JSON.get(location, "city");

Modified: pivot/trunk/tutorials/www/data-binding.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/data-binding.xml?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/data-binding.xml (original)
+++ pivot/trunk/tutorials/www/data-binding.xml Sat Mar  2 01:04:53 2013
@@ -187,7 +187,7 @@ limitations under the License.
                         @Override
                         public void buttonPressed(Button button) {
                             form.clear();
-                            sourceLabel.setText(null);
+                            sourceLabel.setText("");
                         }
                     });
                 }

Modified: pivot/trunk/tutorials/www/forms.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/forms.xml?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/forms.xml (original)
+++ pivot/trunk/tutorials/www/forms.xml Sat Mar  2 01:04:53 2013
@@ -222,7 +222,7 @@ limitations under the License.
                             Form.setFlag(nameBoxPane, flag);
 
                             if (flag == null) {
-                                errorLabel.setText(null);
+                                errorLabel.setText("");
                                 Prompt.prompt("Pretending to submit...", Forms.this);
                             } else {
                                 errorLabel.setText("Some required information is missing.");

Modified: pivot/trunk/tutorials/www/web-queries.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/www/web-queries.xml?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/tutorials/www/web-queries.xml (original)
+++ pivot/trunk/tutorials/www/web-queries.xml Sat Mar  2 01:04:53 2013
@@ -261,7 +261,7 @@ limitations under the License.
 
                         Map<String, ?> location = JSON.get(item, "['y:location']");
                         if (location == null) {
-                            addressLabel.setText(null);
+                            addressLabel.setText("");
                         } else {
                             String street = JSON.get(location, "street");
                             String city = JSON.get(location, "city");

Modified: pivot/trunk/web/src/org/apache/pivot/web/Query.java
URL: http://svn.apache.org/viewvc/pivot/trunk/web/src/org/apache/pivot/web/Query.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/web/src/org/apache/pivot/web/Query.java (original)
+++ pivot/trunk/web/src/org/apache/pivot/web/Query.java Sat Mar  2 01:04:53 2013
@@ -371,7 +371,8 @@ public abstract class Query<V> extends I
     }
 
     @SuppressWarnings("unchecked")
-    protected Object execute(Method method, Object value) throws QueryException {
+    protected Object execute(final Method method, final Object value) throws QueryException {
+        Object result = value;
         URL location = getLocation();
         HttpURLConnection connection = null;
 
@@ -407,8 +408,8 @@ public abstract class Query<V> extends I
             }
 
             // Set the request headers
-            if (value != null) {
-                connection.setRequestProperty("Content-Type", serializerLocal.getMIMEType(value));
+            if (result != null) {
+                connection.setRequestProperty("Content-Type", serializerLocal.getMIMEType(result));
             }
 
             for (String key : requestHeaders) {
@@ -423,18 +424,18 @@ public abstract class Query<V> extends I
 
             // Set the input/output state
             connection.setDoInput(true);
-            connection.setDoOutput(value != null);
+            connection.setDoOutput(result != null);
 
             // Connect to the server
             connection.connect();
             queryListeners.connected(this);
 
             // Write the request body
-            if (value != null) {
+            if (result != null) {
                 OutputStream outputStream = null;
                 try {
                     outputStream = connection.getOutputStream();
-                    serializerLocal.writeObject(value, new MonitoredOutputStream(outputStream));
+                    serializerLocal.writeObject(result, new MonitoredOutputStream(outputStream));
                 } finally {
                     if (outputStream != null) {
                         outputStream.close();
@@ -471,7 +472,7 @@ public abstract class Query<V> extends I
                 InputStream inputStream = null;
                 try {
                     inputStream = connection.getInputStream();
-                    value = serializerLocal.readObject(new MonitoredInputStream(inputStream));
+                    result = serializerLocal.readObject(new MonitoredInputStream(inputStream));
                 } finally {
                     if (inputStream != null) {
                         inputStream.close();
@@ -492,7 +493,7 @@ public abstract class Query<V> extends I
             throw exception;
         }
 
-        return value;
+        return result;
     }
 
     /**

Modified: pivot/trunk/web/src/org/apache/pivot/web/QueryDictionary.java
URL: http://svn.apache.org/viewvc/pivot/trunk/web/src/org/apache/pivot/web/QueryDictionary.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/web/src/org/apache/pivot/web/QueryDictionary.java (original)
+++ pivot/trunk/web/src/org/apache/pivot/web/QueryDictionary.java Sat Mar  2 01:04:53 2013
@@ -36,12 +36,13 @@ public final class QueryDictionary imple
     }
 
     @Override
-    public String get(String key) {
+    public String get(final String key) {
+        String searchKey = key;
         if (!caseSensitiveKeys) {
-            key = key.toLowerCase();
+            searchKey = searchKey.toLowerCase();
         }
 
-        ArrayList<String> list = map.get(key);
+        ArrayList<String> list = map.get(searchKey);
         if (list != null && list.getLength() > 0) {
             return list.get(0);
         }
@@ -49,12 +50,13 @@ public final class QueryDictionary imple
         return null;
     }
 
-    public String get(String key, int index) {
+    public String get(final String key, int index) {
+        String searchKey = key;
         if (!caseSensitiveKeys) {
-            key = key.toLowerCase();
+            searchKey = searchKey.toLowerCase();
         }
 
-        ArrayList<String> list = map.get(key);
+        ArrayList<String> list = map.get(searchKey);
         if (list == null || list.getLength() <= index) {
             throw new IndexOutOfBoundsException();
         }
@@ -63,15 +65,16 @@ public final class QueryDictionary imple
     }
 
     @Override
-    public String put(String key, String value) {
+    public String put(final String key, final String value) {
+        String searchKey = key;
         if (!caseSensitiveKeys) {
-            key = key.toLowerCase();
+            searchKey = searchKey.toLowerCase();
         }
 
         ArrayList<String> list = new ArrayList<String>();
         list.add(value);
 
-        ArrayList<String> previous = map.put(key, list);
+        ArrayList<String> previous = map.put(searchKey, list);
         if (previous != null && previous.getLength() > 0) {
             return previous.get(0);
         }
@@ -79,14 +82,15 @@ public final class QueryDictionary imple
         return null;
     }
 
-    public int add(String key, String value) {
+    public int add(final String key, final String value) {
+        String searchKey = key;
         if (!caseSensitiveKeys) {
-            key = key.toLowerCase();
+            searchKey = searchKey.toLowerCase();
         }
 
-        ArrayList<String> list = map.get(key);
+        ArrayList<String> list = map.get(searchKey);
         if (list == null) {
-            put(key, value);
+            put(searchKey, value);
             return 0;
         }
 
@@ -94,12 +98,13 @@ public final class QueryDictionary imple
         return list.getLength() - 1;
     }
 
-    public void insert(String key, String value, int index) {
+    public void insert(final String key, final String value, int index) {
+        String searchKey = key;
         if (!caseSensitiveKeys) {
-            key = key.toLowerCase();
+            searchKey = searchKey.toLowerCase();
         }
 
-        ArrayList<String> list = map.get(key);
+        ArrayList<String> list = map.get(searchKey);
 
         // e.g if index = 0 and length = 0, throw an exception
         if (list == null || list.getLength() <= index) {
@@ -110,12 +115,13 @@ public final class QueryDictionary imple
     }
 
     @Override
-    public String remove(String key) {
+    public String remove(final String key) {
+        String searchKey = key;
         if (!caseSensitiveKeys) {
-            key = key.toLowerCase();
+            searchKey = searchKey.toLowerCase();
         }
 
-        ArrayList<String> list = map.remove(key);
+        ArrayList<String> list = map.remove(searchKey);
         if (list != null && list.getLength() > 0) {
             return list.get(0);
         }
@@ -123,12 +129,13 @@ public final class QueryDictionary imple
         return null;
     }
 
-    public String remove(String key, int index) {
+    public String remove(final String key, int index) {
+        String searchKey = key;
         if (!caseSensitiveKeys) {
-            key = key.toLowerCase();
+            searchKey = searchKey.toLowerCase();
         }
 
-        ArrayList<String> list = map.get(key);
+        ArrayList<String> list = map.get(searchKey);
         if (list == null || list.getLength() <= index) {
             throw new IndexOutOfBoundsException();
         }
@@ -141,21 +148,23 @@ public final class QueryDictionary imple
     }
 
     @Override
-    public boolean containsKey(String key) {
+    public boolean containsKey(final String key) {
+        String searchKey = key;
         if (!caseSensitiveKeys) {
-            key = key.toLowerCase();
+            searchKey = searchKey.toLowerCase();
         }
 
-        return map.containsKey(key);
+        return map.containsKey(searchKey);
     }
 
 
-    public int getLength(String key) {
+    public int getLength(final String key) {
+        String searchKey = key;
         if (!caseSensitiveKeys) {
-            key = key.toLowerCase();
+            searchKey = searchKey.toLowerCase();
         }
 
-        ArrayList<String> list = map.get(key);
+        ArrayList<String> list = map.get(searchKey);
         if (list == null) {
             return 0;
         }

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraAccordionSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraAccordionSkin.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraAccordionSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraAccordionSkin.java Sat Mar  2 01:04:53 2013
@@ -853,6 +853,10 @@ public class TerraAccordionSkin extends 
                         selectedIndex = 8;
                         break;
                     }
+
+                    default: {
+                        break;
+                    }
                 }
 
                 if (selectedIndex >= 0
@@ -883,6 +887,10 @@ public class TerraAccordionSkin extends 
 
                         break;
                     }
+
+                    default: {
+                        break;
+                    }
                 }
 
                 if (selectedIndex >= 0

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java Sat Mar  2 01:04:53 2013
@@ -44,6 +44,7 @@ import org.apache.pivot.wtk.GraphicsUtil
 import org.apache.pivot.wtk.HorizontalAlignment;
 import org.apache.pivot.wtk.Insets;
 import org.apache.pivot.wtk.Keyboard;
+import org.apache.pivot.wtk.Keyboard.KeyCode;
 import org.apache.pivot.wtk.Label;
 import org.apache.pivot.wtk.Mouse;
 import org.apache.pivot.wtk.Orientation;
@@ -51,7 +52,6 @@ import org.apache.pivot.wtk.Spinner;
 import org.apache.pivot.wtk.SpinnerSelectionListener;
 import org.apache.pivot.wtk.TablePane;
 import org.apache.pivot.wtk.Theme;
-import org.apache.pivot.wtk.Keyboard.KeyCode;
 import org.apache.pivot.wtk.content.ButtonDataRenderer;
 import org.apache.pivot.wtk.content.NumericSpinnerData;
 import org.apache.pivot.wtk.content.SpinnerItemRenderer;
@@ -309,6 +309,10 @@ public class TerraCalendarSkin extends C
                         nextButton.requestFocus();
                         break;
                     }
+
+                    default: {
+                        break;
+                    }
                 }
 
                 consumed = true;
@@ -348,9 +352,9 @@ public class TerraCalendarSkin extends C
             CalendarDate date = new CalendarDate(2000, (Integer)item, 0);
 
             SimpleDateFormat monthFormat = new SimpleDateFormat("MMMM", calendar.getLocale());
-            item = monthFormat.format(date.toCalendar().getTime());
+            Object itemFromFormat = monthFormat.format(date.toCalendar().getTime());
 
-            super.render(item, spinner);
+            super.render(itemFromFormat, spinner);
         }
     }
 

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java?rev=1451799&r1=1451798&r2=1451799&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java Sat Mar  2 01:04:53 2013
@@ -676,7 +676,7 @@ public class TerraExpanderSkin extends E
     public void titleChanged(Expander expander, String previousTitle) {
         String title = expander.getTitle();
         titleLabel.setVisible(title != null);
-        titleLabel.setText(title);
+        titleLabel.setText(title != null ? title : "");
     }
 
     /**