harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r556513 [1/2] - in /harmony/enhanced/classlib/branches/java6: make/ modules/awt/make/ modules/awt/src/main/java/common/java/awt/ modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/ modules/awt/src/test/api/java/common/java/awt/...
Date Mon, 16 Jul 2007 06:12:27 GMT
Author: pyang
Date: Sun Jul 15 23:12:24 2007
New Revision: 556513

URL: http://svn.apache.org/viewvc?view=rev&rev=556513
Log:
Merge updates from classlib trunk@556012 since r555239

Added:
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/ColorPainter.java
      - copied unchanged from r556012, harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/synth/ColorPainter.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/DefaultStyleFactory.java
      - copied unchanged from r556012, harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/synth/DefaultStyleFactory.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/ImagePainter.java
      - copied unchanged from r556012, harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/synth/ImagePainter.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/PaintersManager.java
      - copied unchanged from r556012, harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/synth/PaintersManager.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/XMLSynthParser.java
      - copied unchanged from r556012, harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/synth/XMLSynthParser.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/XMLSynthStyle.java
      - copied unchanged from r556012, harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/synth/XMLSynthStyle.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/text/html/parser/ParserDelegatorTest.java
      - copied unchanged from r556012, harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/javax/swing/text/html/parser/ParserDelegatorTest.java
Modified:
    harmony/enhanced/classlib/branches/java6/make/depends.properties
    harmony/enhanced/classlib/branches/java6/modules/awt/make/exclude.windows.x86_64.drl
    harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/BorderLayout.java
    harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontFinder.java
    harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextMetricsCalculator.java
    harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextRunBreaker.java
    harmony/enhanced/classlib/branches/java6/modules/awt/src/test/api/java/common/java/awt/BorderLayoutRTest.java
    harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java
    harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/Encoder.java
    harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PersistenceDelegate.java
    harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/XMLEncoder.java
    harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/beancontext/BeanContextServicesSupport.java
    harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/DefaultPersistenceDelegatesFactory.java
    harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/ObjectNode.java
    harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_BooleanPersistenceDelegate.java
    harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_BytePersistenceDelegate.java
    harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_CharacterPersistenceDelegate.java
    harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_ClassPersistenceDelegate.java
    harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_DoublePersistenceDelegate.java
    harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_FloatPersistenceDelegate.java
    harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_IntegerPersistenceDelegate.java
    harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_LongPersistenceDelegate.java
    harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_ShortPersistenceDelegate.java
    harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_reflect_FieldPersistenceDelegate.java
    harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_reflect_ProxyPersistenceDelegate.java
    harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EncoderTest.java
    harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PersistenceDelegateTest.java
    harmony/enhanced/classlib/branches/java6/modules/lang-management/make/exclude.common
    harmony/enhanced/classlib/branches/java6/modules/lang-management/make/exclude.linux.x86.ibm
    harmony/enhanced/classlib/branches/java6/modules/lang-management/make/exclude.windows.x86.ibm
    harmony/enhanced/classlib/branches/java6/modules/luni-kernel/src/main/java/java/lang/System.java
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/AbstractList.java
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Collections.java
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Properties.java
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/AbstractListTest.java
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/CollectionsTest.java
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/PropertiesTest.java
    harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/CharsetProviderImpl.java
    harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_windows_949.java
    harmony/enhanced/classlib/branches/java6/modules/swing/make/exclude.common
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/ColorType.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/Region.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/SynthConstants.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/SynthContext.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/SynthGraphicsUtils.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/SynthLookAndFeel.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/SynthStyle.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/text/html/parser/ParserDelegator.java
    harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/org/apache/harmony/x/swing/internal/nls/messages.properties
    harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/plaf/synth/SynthStyleTest.java

Modified: harmony/enhanced/classlib/branches/java6/make/depends.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/make/depends.properties?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/make/depends.properties (original)
+++ harmony/enhanced/classlib/branches/java6/make/depends.properties Sun Jul 15 23:12:24 2007
@@ -38,10 +38,10 @@
 junit.url=${maven2.base}/junit/junit/3.8.2/junit-3.8.2.jar
 junit.md5=28e7eb9eeefe31a657c68755bfccc541
 
-bcprov.dir=${depends.jars}/bcprov-jdk15-136
+bcprov.dir=${depends.jars}/bcprov-jdk15-137
 bcprov.jar=${bcprov.dir}/bcprov.jar
-bcprov.url=http://www.bouncycastle.org/download/bcprov-jdk15-136.jar
-bcprov.md5=30c42e406de583a09cbf7124f7dae5ed
+bcprov.url=http://www.bouncycastle.org/download/bcprov-jdk15-137.jar
+bcprov.md5=7cdb436aaa4b222db7fc02495dfcde51
 
 msvcr.dir.x86=${depends.dir}/libs/windows.x86
 msvcr.dll.x86=${msvcr.dir.x86}/msvcr71.dll

Modified: harmony/enhanced/classlib/branches/java6/modules/awt/make/exclude.windows.x86_64.drl
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/make/exclude.windows.x86_64.drl?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/make/exclude.windows.x86_64.drl (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/make/exclude.windows.x86_64.drl Sun Jul 15 23:12:24 2007
@@ -15,3 +15,6 @@
 
 #HARMONY-4181
 java/awt/geom/AreaTest.java
+
+#HARMONY-4307
+org/apache/harmony/awt/ListenerListTest.java

Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/BorderLayout.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/BorderLayout.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/BorderLayout.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/java/awt/BorderLayout.java Sun Jul 15 23:12:24 2007
@@ -32,6 +32,7 @@
 
 import org.apache.harmony.awt.FieldsAccessor;
 import org.apache.harmony.awt.internal.nls.Messages;
+import org.apache.harmony.awt.wtk.NativeWindow;
 
 
 public class BorderLayout implements LayoutManager2, Serializable {
@@ -481,16 +482,21 @@
         int middleY = clientRect.y;
 
         if (visibleComponents[N] != null) {
+            visibleComponents[N].setSize(clientRect.width, 
+                    prefCompSizes[N].height);
             visibleComponents[N].setBounds(clientRect.x, clientRect.y,
-                    clientRect.width, prefCompSizes[N].height);
+                    clientRect.width, prefCompSizes[N].height, 
+                    NativeWindow.BOUNDS_NOSIZE, true);
             middleY += prefCompSizes[N].height + vGap;
         }
         int middleHeight = clientRect.height - prefCompSizes[N].height
                 - prefCompSizes[S].height - vGapOverhead;
         middleHeight = Math.max(middleHeight, 0);
         if (visibleComponents[W] != null) {
+            visibleComponents[W].setSize(prefCompSizes[W].width, middleHeight);
             visibleComponents[W].setBounds(clientRect.x, middleY,
-                    prefCompSizes[W].width, middleHeight);
+                    prefCompSizes[W].width, middleHeight, 
+                    NativeWindow.BOUNDS_NOSIZE, true);
             centerX += prefCompSizes[W].width + hGap;
         }
         int middleWidth = clientRect.width - prefCompSizes[W].width -
@@ -500,14 +506,19 @@
             visibleComponents[C].setBounds(centerX, middleY, middleWidth, middleHeight);
         }
         if (visibleComponents[S] != null) {
+            visibleComponents[S].setSize(clientRect.width, 
+                    prefCompSizes[S].height);
             visibleComponents[S].setBounds(clientRect.x,
                     clientRect.y + clientRect.height - prefCompSizes[S].height,
-                    clientRect.width, prefCompSizes[S].height);
+                    clientRect.width, prefCompSizes[S].height, 
+                    NativeWindow.BOUNDS_NOSIZE, true);
         }
         if (visibleComponents[E] != null) {
+            visibleComponents[E].setSize(prefCompSizes[E].width, middleHeight);
             visibleComponents[E].setBounds(
                     clientRect.x + clientRect.width - prefCompSizes[E].width,
-                    middleY, prefCompSizes[E].width, middleHeight);
+                    middleY, prefCompSizes[E].width, middleHeight, 
+                    NativeWindow.BOUNDS_NOSIZE, true);
         }
     }
 

Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontFinder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontFinder.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontFinder.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/FontFinder.java Sun Jul 15 23:12:24 2007
@@ -103,7 +103,7 @@
      * @param fonts - mapping of the font run starts to the fonts
      */
     static void findFonts(char text[], int runStart, int runLimit, List<Integer> runStarts,
-            Map<Integer, Font> fonts) {
+            Map<Integer, Object> fonts) {
         Font prevFont = null;
         Font currFont;
         for (int i = runStart; i < runLimit; i++) {

Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextMetricsCalculator.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextMetricsCalculator.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextMetricsCalculator.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextMetricsCalculator.java Sun Jul 15 23:12:24 2007
@@ -86,7 +86,7 @@
      */
     public void checkBaselines() {
         // Take baseline offsets of the first font and normalize them
-        HashMap<Integer, Font> fonts = breaker.fonts;
+        HashMap<Integer, Object> fonts = breaker.fonts;
 
         Object val = fonts.get(new Integer(0));
 

Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextRunBreaker.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextRunBreaker.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextRunBreaker.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/TextRunBreaker.java Sun Jul 15 23:12:24 2007
@@ -53,7 +53,7 @@
 
     byte[] levels;
 
-    HashMap<Integer, Font> fonts;
+    HashMap<Integer, Object> fonts;
     HashMap<Integer, Decoration> decorations;
 
     // Related to default font substitution
@@ -193,7 +193,7 @@
      */
     void createStyleRuns() {
         // TODO - implement fast and simple case
-        fonts = new HashMap<Integer, Font>();
+        fonts = new HashMap<Integer, Object>();
         decorations = new HashMap<Integer, Decoration>();
         ////
 
@@ -221,7 +221,8 @@
             // Find appropriate font or place GraphicAttribute there
 
             // 1. Try to pick up CHAR_REPLACEMENT (compatibility)
-            Font value = (Font)attributes.get(TextAttribute.CHAR_REPLACEMENT);
+            Object value = (GraphicAttribute)
+                    attributes.get(TextAttribute.CHAR_REPLACEMENT);
 
             if (value == null) {
                 // 2. Try to Get FONT

Modified: harmony/enhanced/classlib/branches/java6/modules/awt/src/test/api/java/common/java/awt/BorderLayoutRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/awt/src/test/api/java/common/java/awt/BorderLayoutRTest.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/awt/src/test/api/java/common/java/awt/BorderLayoutRTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/awt/src/test/api/java/common/java/awt/BorderLayoutRTest.java Sun Jul 15 23:12:24 2007
@@ -110,5 +110,49 @@
         assertEquals(defSize, layout.preferredLayoutSize(emptyContainer));
     }   
     
-    
+    /**
+     * Regression for HARMONY-4085
+     */
+    public final void testHarmony4085() {
+        final Frame f = new Frame();
+        final boolean[] isInvoked = new boolean[4];
+
+        f.add(new Component() {
+            @Override
+            public void setSize(int width, int height) {
+                isInvoked[0] = true;
+                super.setSize(width, height);
+            }
+        }, BorderLayout.EAST);
+        f.add(new Component() {
+            @Override
+            public void setSize(int width, int height) {
+                isInvoked[1] = true;
+                super.setSize(width, height);
+            }
+        }, BorderLayout.WEST);
+        f.add(new Component() {
+            @Override
+            public void setSize(int width, int height) {
+                isInvoked[2] = true;
+                super.setSize(width, height);
+            }
+        }, BorderLayout.NORTH);
+        f.add(new Component() {
+            @Override
+            public void setSize(int width, int height) {
+                isInvoked[3] = true;
+                super.setSize(width, height);
+            }
+        }, BorderLayout.SOUTH);
+
+        f.setSize(100, 100);
+        f.setVisible(true);
+        f.dispose();
+
+        assertTrue(isInvoked[0]);
+        assertTrue(isInvoked[1]);
+        assertTrue(isInvoked[2]);
+        assertTrue(isInvoked[3]);
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/DefaultPersistenceDelegate.java Sun Jul 15 23:12:24 2007
@@ -17,7 +17,6 @@
 
 package java.beans;
 
-import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
 import org.apache.harmony.beans.internal.nls.Messages;
@@ -57,8 +56,7 @@
 
         // added for compatibility with RI
         if (out == null) {
-            throw new NullPointerException(
-                    Messages.getString("beans.4C")); //$NON-NLS-1$
+            throw new NullPointerException(Messages.getString("beans.4C")); //$NON-NLS-1$
         }
 
         // added for compatibility with RI
@@ -67,46 +65,83 @@
                     new NullPointerException(Messages.getString("beans.4A"))); //$NON-NLS-1$
             return;
         }
-      
-        try {
-            PropertyDescriptor[] pds = Introspector.getBeanInfo(type)
-                    .getPropertyDescriptors();
 
-            for (PropertyDescriptor pd : pds) {
-                if (!isTransient(pd)) {
-                    Method getter = pd.getReadMethod();
-
-                    if (getter != null) {
-                        Method setter = pd.getWriteMethod();
-
-                        if (setter != null) {
-                            Object oldValue = getter.invoke(oldInstance,
-                                    (Object[]) null);
-                            Object newValue = getter.invoke(newInstance,
-                                    (Object[]) null);
-
-                            if (oldValue != null && !oldValue.equals(newValue)
-                                    || oldValue == null && newValue != null) {
-                                String setterName = setter.getName();
-                                Statement s = new Statement(oldInstance,
-                                        setterName, new Object[] { oldValue });
+        // added for compatibility with RI
+        if (oldInstance == null) {
+            throw new NullPointerException(Messages.getString("beans.4C")); //$NON-NLS-1$
+        }
 
-                                out.writeStatement(s);
+        BeanInfo info = null;
+        try {
+            info = Introspector.getBeanInfo(type);
+        } catch (IntrospectionException e) {
+            out.getExceptionListener().exceptionThrown(e);
+            return;
+        }
+        PropertyDescriptor[] pds = info.getPropertyDescriptors();
+
+        for (PropertyDescriptor pd : pds) {
+            if (!isTransient(pd)) {
+                Method getter = pd.getReadMethod();
+
+                if (getter != null) {
+                    Method setter = pd.getWriteMethod();
+
+                    if (setter != null) {
+                        Expression getterExp = new Expression(oldInstance, pd
+                                .getReadMethod().getName(), null);
+                        try {
+                            // Calculate the old value of the property
+                            Object oldValue = getterExp.getValue();
+
+                            // Write the getter expression to the encoder
+                            out.writeExpression(getterExp);
+
+                            // Get the target value that exists in the new
+                            // environment
+                            Object targetVal = out.get(oldValue);
+
+                            Object newValue = new Expression(newInstance, pd
+                                    .getReadMethod().getName(), null)
+                                    .getValue();
+
+                            /*
+                             * Make the target value and current property value
+                             * equivalent in the new environment
+                             */
+                            if (null == targetVal) {
+                                if (null != newValue) {
+                                    // Set to null
+                                    Statement setterStm = new Statement(
+                                            oldInstance, pd.getWriteMethod()
+                                                    .getName(),
+                                            new Object[] { null });
+                                    out.writeStatement(setterStm);
+                                }
+                            } else {
+                                PersistenceDelegate delegate = out
+                                        .getPersistenceDelegate(targetVal
+                                                .getClass());
+                                if (!delegate.mutatesTo(targetVal, newValue)) {
+                                    Statement setterStm = new Statement(
+                                            oldInstance, pd.getWriteMethod()
+                                                    .getName(),
+                                            new Object[] { oldValue });
+                                    out.writeStatement(setterStm);
+                                }
                             }
-                        } else {
-                            // commented since the process should be
-                            // continued even if no setter is found
-                            // throw new Exception("no setter for " +
-                            // pd.getName() + " property.");
-                            continue;
+                        } catch (Exception ex) {
+                            out.getExceptionListener().exceptionThrown(ex);
                         }
+                    } else {
+                        // commented since the process should be
+                        // continued even if no setter is found
+                        // throw new Exception("no setter for " +
+                        // pd.getName() + " property.");
+                        continue;
                     }
                 }
             }
-        } catch (RuntimeException e) {
-            throw e;
-        } catch (Exception e) {
-            out.getExceptionListener().exceptionThrown(e);
         }
     }
 
@@ -169,7 +204,7 @@
         if (oldInstance != null && constructorPropertyNames != null
                 && constructorPropertyNames.length > 0) {
 
-            //Get explicitly declared equals method.
+            // Get explicitly declared equals method.
             Method equalsMethod = null;
             try {
                 equalsMethod = oldInstance.getClass().getDeclaredMethod(
@@ -180,15 +215,15 @@
             }
 
             if (equalsMethod != null) {
-                    Object result;
-                    try {
-                        result = equalsMethod.invoke(oldInstance,
-                                new Object[] { newInstance });
-                    } catch (Exception e) {
-                        //should not happen here.
-                        throw new Error(e);
-                    }
-                    return ((Boolean) result).booleanValue();
+                Object result;
+                try {
+                    result = equalsMethod.invoke(oldInstance,
+                            new Object[] { newInstance });
+                } catch (Exception e) {
+                    // should not happen here.
+                    throw new Error(e);
+                }
+                return ((Boolean) result).booleanValue();
             }
         }
         return super.mutatesTo(oldInstance, newInstance);

Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/Encoder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/Encoder.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/Encoder.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/Encoder.java Sun Jul 15 23:12:24 2007
@@ -18,33 +18,47 @@
 package java.beans;
 
 import java.util.HashMap;
+import java.util.IdentityHashMap;
 import java.util.Vector;
 
 import org.apache.harmony.beans.DefaultPersistenceDelegatesFactory;
 import org.apache.harmony.beans.NullPersistenceDelegate;
 import org.apache.harmony.beans.ObjectNode;
-import org.apache.harmony.beans.internal.nls.Messages;
 
 public class Encoder {
 
-    private ExceptionListener exceptionListener = null;
+    private ExceptionListener exceptionListener = defaultExListener;
 
-    private final HashMap<Class<?>, PersistenceDelegate> persistenceDelegates = new HashMap<Class<?>, PersistenceDelegate>();
+    private static final ExceptionListener defaultExListener = new DefaultExceptionListener();
+
+    private static class DefaultExceptionListener implements ExceptionListener {
+
+        public void exceptionThrown(Exception exception) {
+            System.err.println("Exception during encoding:" + exception); //$NON-NLS-1$
+            System.err.println("Continue...");
+        }
+
+    }
+
+    private static final HashMap<Class<?>, PersistenceDelegate> persistenceDelegates = new HashMap<Class<?>, PersistenceDelegate>();
 
     Vector<Object> roots = new Vector<Object>();
 
-    HashMap<Object, ObjectNode> nodes = new HashMap<Object, ObjectNode>();
+    IdentityHashMap<Object, ObjectNode> nodes = new IdentityHashMap<Object, ObjectNode>();
+
+    private IdentityHashMap oldNewMap = new IdentityHashMap();
 
     public Encoder() {
         super();
     }
 
     public Object get(Object oldInstance) {
-        if (oldInstance == null) {
-            return null;
+        if (oldInstance == null || oldInstance instanceof String
+                || oldInstance == String.class) {
+            return oldInstance;
         }
 
-        return getValue(nodes.get(oldInstance));
+        return oldNewMap.get(oldInstance);
     }
 
     public Object remove(Object oldInstance) {
@@ -53,7 +67,8 @@
             return null;
         }
 
-        return getValue(nodes.remove(oldInstance));
+        getValue(nodes.remove(oldInstance));
+        return oldNewMap.remove(oldInstance);
     }
 
     public PersistenceDelegate getPersistenceDelegate(Class<?> type) {
@@ -77,6 +92,9 @@
 
     protected void writeObject(Object object) {
         roots.add(object);
+        if (object == null) {
+            return;
+        }
         doWriteObject(object);
     }
 
@@ -90,100 +108,98 @@
         }
 
         pd.writeObject(object, this);
+        if (isString(object.getClass())) {
+            nodes.put(object, new ObjectNode(pd.instantiate(object, this)));
+        }
     }
 
-    public void writeStatement(Statement oldStm) {
-        ObjectNode node = nodes.get(oldStm.getTarget());
+    private Object forceNew(Object old) {
+        if (old == null) {
+            return null;
+        }
+        Object nu = get(old);
+        if (nu != null) {
+            return nu;
+        }
+        writeObject(old);
+        return get(old);
+    }
 
-        if (node != null) {
-            try {
-                Statement statement;
-                Object[] oldArgs = oldStm.getArguments();
+    private Object[] forceNewArray(Object oldArray[]) {
+        if (oldArray == null) {
+            return null;
+        }
+        Object newArray[] = new Object[oldArray.length];
+        for (int i = 0; i < oldArray.length; i++) {
+            newArray[i] = forceNew(oldArray[i]);
+        }
+        return newArray;
+    }
 
-                // FIXME add target processing here
-                write(oldArgs);
-                statement = new Statement(node.getObjectValue(), oldStm
-                        .getMethodName(), oldArgs);
-                statement.execute();
-                node.addStatement(statement);
-            } catch (Exception e) {
-                getExceptionListener().exceptionThrown(e);
-            }
-        } else {
-            // FIXME incompatible with RI, default constructor should be
-            // called instead
-            System.out.println(Messages.getString(
-                    "beans.10", oldStm.getTarget())); //$NON-NLS-1$
+    public void writeStatement(Statement oldStm) {
+        if (oldStm == null) {
+            throw new NullPointerException();
         }
+        try {
+            // FIXME add target processing here
+            Object newTarget = forceNew(oldStm.getTarget());
+            Object newArgs[] = forceNewArray(oldStm.getArguments());
+            Statement statement = new Statement(newTarget, oldStm
+                    .getMethodName(), newArgs);
+            statement.execute();
+        } catch (Exception e) {
+            getExceptionListener().exceptionThrown(e);
+        }
+    }
+
+    private void put(Object old, Object nu) {
+        oldNewMap.put(old, nu);
     }
 
     public void writeExpression(Expression oldExp) {
+        if (oldExp == null) {
+            throw new NullPointerException();
+        }
         try {
             Object oldValue = oldExp.getValue();
-            Object oldTarget = oldExp.getTarget();
-
-            ObjectNode valueNode = null;
-            Class<?> valueType = null;
-
-            // write target
-            if (!Statement.isPDConstructor(oldExp)
-                    && !Statement.isStaticMethodCall(oldExp)) {
-                ObjectNode parent;
-
-                // XXX investigate
-                // write(oldTarget);
-                parent = nodes.get(oldTarget);
-                if (parent != null) {
-                    parent.addExpression(oldExp);
-                }
+            if (oldValue == null || get(oldValue) != null) {
+                return;
             }
 
-            // write value
+            // copy to newExp
+            Object newTarget = forceNew(oldExp.getTarget());
+            Object newArgs[] = forceNewArray(oldExp.getArguments());
+            Expression newExp = new Expression(newTarget, oldExp
+                    .getMethodName(), newArgs);
 
-            if (oldValue != null) {
-                valueType = oldValue.getClass();
-                valueNode = nodes.get(oldValue);
+            // execute newExp
+            Object newValue = null;
+            try {
+                newValue = newExp.getValue();
+            } catch (IndexOutOfBoundsException ex) {
+                // Current Container does not have any component, newVal set
+                // to null
             }
 
-            if (valueNode == null) {
+            // relate oldValue to newValue
+            put(oldValue, newValue);
 
-                if (isNull(valueType) || isPrimitive(valueType)
-                        || isString(valueType)) {
-                    valueNode = new ObjectNode(oldExp);
-                } else {
-                    write(oldExp.getArguments());
-                    valueNode = new ObjectNode(oldExp, nodes);
-                }
-
-                nodes.put(oldValue, valueNode);
-            } else if (oldExp.getMethodName().equals("new")) { //$NON-NLS-1$
-                valueNode.addReference();
-            } else {
-                // XXX the information about referencedExpressions is not
-                // being used by anyone
-                // node.addReferencedExpression(oldExp);
-            }
+            // force same state
+            writeObject(oldValue);
         } catch (Exception e) {
             // TODO - remove written args
-            e.printStackTrace();
             getExceptionListener().exceptionThrown(e);
         }
     }
 
     public void setExceptionListener(ExceptionListener exceptionListener) {
+        if (exceptionListener == null) {
+            exceptionListener = defaultExListener;
+        }
         this.exceptionListener = exceptionListener;
     }
 
     public ExceptionListener getExceptionListener() {
-        if (exceptionListener == null) {
-            exceptionListener = new ExceptionListener() {
-
-                public void exceptionThrown(Exception e) {
-                    System.out.println(e.getClass() + ": " + e.getMessage()); //$NON-NLS-1$
-                }
-            };
-        }
-
         return exceptionListener;
     }
 
@@ -204,7 +220,7 @@
         return node.getObjectValue();
     }
 
-    private Object[] write(Object[] oldInstances) throws Exception {
+    Object[] write(Object[] oldInstances) throws Exception {
         if (oldInstances != null) {
             Object[] newInstances = new Object[oldInstances.length];
 

Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PersistenceDelegate.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/PersistenceDelegate.java Sun Jul 15 23:12:24 2007
@@ -68,9 +68,7 @@
         if (mutatesTo(oldInstance, newInstance)) {
             initialize(oldInstance.getClass(), oldInstance, newInstance, out);
         } else {
-            if (newInstance != null) {
-                out.remove(newInstance);
-            }
+        	out.remove(oldInstance);
 
             out.writeExpression(instantiate(oldInstance, out));
             newInstance = out.get(oldInstance);

Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/XMLEncoder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/XMLEncoder.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/XMLEncoder.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/XMLEncoder.java Sun Jul 15 23:12:24 2007
@@ -53,6 +53,71 @@
     public Object getOwner() {
         return owner;
     }
+    
+    @Override
+    public void writeExpression(Expression oldExp) {
+
+		Object oldValue = null;
+		try {
+			oldValue = oldExp.getValue();
+		} catch (Exception e) {
+			getExceptionListener()
+					.exceptionThrown(
+							new Exception("failed to execute expression: "
+									+ oldExp, e));
+			return;
+		}
+		
+		if (get(oldValue) != null) {
+			return;
+		}
+		
+		Object oldTarget = oldExp.getTarget();
+
+		ObjectNode valueNode = null;
+		Class<?> valueType = null;
+
+		// write target
+		if (!Statement.isPDConstructor(oldExp)
+				&& !Statement.isStaticMethodCall(oldExp)) {
+			ObjectNode parent;
+
+			// XXX investigate
+			// write(oldTarget);
+			parent = nodes.get(oldTarget);
+			if (parent != null) {
+				parent.addExpression(oldExp);
+			}
+		}
+
+		// write value
+		valueType = oldValue.getClass();
+		valueNode = nodes.get(oldValue);
+
+		if (valueNode == null) {
+
+			if (isNull(valueType) || isPrimitive(valueType)
+					|| isString(valueType)) {
+				valueNode = new ObjectNode(oldExp);
+			} else {
+				try {
+					write((Object[])oldExp.getArguments());
+				} catch (Exception e) {
+					getExceptionListener().exceptionThrown(e);
+				}
+				valueNode = new ObjectNode(oldExp, nodes);
+			}
+
+			nodes.put(oldValue, valueNode);
+		} else if (oldExp.getMethodName().equals("new")) { //$NON-NLS-1$
+			valueNode.addReference();
+		} else {
+			// XXX the information about referencedExpressions is not
+			// being used by anyone
+			// node.addReferencedExpression(oldExp);
+		}
+		super.writeExpression(oldExp);
+	}
 
     @Override
     public void writeStatement(Statement oldStm) {
@@ -97,9 +162,9 @@
             if (object != null) {
                 ObjectNode node = nodes.get(object);
 
-                printObjectTag(0, object, node);
+                printObjectTag(1, object, node);
             } else {
-                printNullTag(0);
+                printNullTag(1);
             }
         }
 
@@ -174,7 +239,8 @@
                         tag.addAttr("length", ((Integer) arguments[1]) //$NON-NLS-1$
                                 .toString());
                     } else {
-                        tag.addAttr("class", node.getObjectType().getName()); //$NON-NLS-1$
+                        tag.addAttr("class", ((Class)node.getInitializer().getTarget()).getName()); //$NON-NLS-1$
+                        tag.addAttr("method", node.getInitializer().getMethodName());
                     }
                 } catch (Exception e) {
                     getExceptionListener().exceptionThrown(e);
@@ -389,7 +455,7 @@
             String result = ""; //$NON-NLS-1$
 
             for (int i = 0; i < tabCount; ++i) {
-                result += '\t';
+                result += ' ';
             }
             result = result + s + "\n"; //$NON-NLS-1$
             out.write(result.getBytes("UTF-8")); //$NON-NLS-1$

Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/beancontext/BeanContextServicesSupport.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/beancontext/BeanContextServicesSupport.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/beancontext/BeanContextServicesSupport.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/java/beans/beancontext/BeanContextServicesSupport.java Sun Jul 15 23:12:24 2007
@@ -129,7 +129,7 @@
         /**
          * Delegate to the wrapped <code>BeanContextServices</code>.
          */
-        public Object getService(BeanContextServices bcs, Object requestor,
+        Object getService(BeanContextServices bcs, Object requestor,
                 Class serviceClass, Object serviceSelector,
                 BeanContextServiceRevokedListener listener)
                 throws TooManyListenersException {

Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/DefaultPersistenceDelegatesFactory.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/DefaultPersistenceDelegatesFactory.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/DefaultPersistenceDelegatesFactory.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/DefaultPersistenceDelegatesFactory.java Sun Jul 15 23:12:24 2007
@@ -25,7 +25,8 @@
 
 public final class DefaultPersistenceDelegatesFactory {
 
-    private static Map<String, PersistenceDelegate> persistenceDelegates = new HashMap<String, PersistenceDelegate>();
+    private static final DefaultPersistenceDelegate DEFAULT_PERSISTENCE_DELEGATE = new DefaultPersistenceDelegate();
+	private static Map<String, PersistenceDelegate> persistenceDelegates = new HashMap<String, PersistenceDelegate>();
 
     private static PersistenceDelegate createPersistenceDelegate(Class<?> type) {
         if (type == null) {
@@ -53,7 +54,7 @@
             }
 
             if (pd == null) {
-                pd = new DefaultPersistenceDelegate();
+                pd = DEFAULT_PERSISTENCE_DELEGATE;
             }
         }
         return pd;

Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/ObjectNode.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/ObjectNode.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/ObjectNode.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/ObjectNode.java Sun Jul 15 23:12:24 2007
@@ -19,7 +19,7 @@
 
 import java.beans.Expression;
 import java.beans.Statement;
-import java.util.HashMap;
+import java.util.IdentityHashMap;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.Map;
@@ -51,7 +51,7 @@
         this.nodes = null;
     }
 
-    public ObjectNode(Expression initializer, HashMap<Object, ObjectNode> nodes) {
+    public ObjectNode(Expression initializer, IdentityHashMap<Object, ObjectNode> nodes) {
         this.initializer = initializer;
         this.nodes = nodes;
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_BooleanPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_BooleanPersistenceDelegate.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_BooleanPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_BooleanPersistenceDelegate.java Sun Jul 15 23:12:24 2007
@@ -27,7 +27,7 @@
     protected Expression instantiate(Object oldInstance, Encoder out) {
         boolean value = ((Boolean) oldInstance).booleanValue();
         return new Expression(oldInstance, Boolean.class, "new", //$NON-NLS-1$
-                new Object[] { Boolean.valueOf(value) });
+                new Object[] { Boolean.valueOf(value).toString() });
     }
 
     @Override

Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_BytePersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_BytePersistenceDelegate.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_BytePersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_BytePersistenceDelegate.java Sun Jul 15 23:12:24 2007
@@ -26,7 +26,7 @@
     protected Expression instantiate(Object oldInstance, Encoder out) {
         Byte value = (Byte) oldInstance;
         return new Expression(oldInstance, Byte.class, "new", //$NON-NLS-1$
-                new Object[] { value });
+                new Object[] { value.toString() });
     }
 
     @Override

Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_CharacterPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_CharacterPersistenceDelegate.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_CharacterPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_CharacterPersistenceDelegate.java Sun Jul 15 23:12:24 2007
@@ -25,9 +25,8 @@
 
     @Override
     protected Expression instantiate(Object oldInstance, Encoder out) {
-        Character value = (Character) oldInstance;
-        return new Expression(oldInstance, Character.class, "new", //$NON-NLS-1$
-                new Object[] { value });
+        return new Expression(oldInstance, oldInstance.toString(),
+                "charAt", new Object[] { new Integer(0) });
     }
 
     @Override

Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_ClassPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_ClassPersistenceDelegate.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_ClassPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_ClassPersistenceDelegate.java Sun Jul 15 23:12:24 2007
@@ -29,6 +29,13 @@
         Field fld = null;
         final String TYPE = "TYPE"; //$NON-NLS-1$
         Expression result;
+        /*
+         * Special treatment to String.class to prevent endless loop of
+         * instantiation.
+         */
+        if (value == String.class) {
+            return new Expression(value, "", "getClass", null);  //$NON-NLS-1$//$NON-NLS-2$
+        }
         try {
             if (value.equals(Integer.TYPE)) {
                 fld = Integer.class.getField(TYPE);
@@ -56,7 +63,7 @@
             // we have primitive type
             result = new Expression(oldInstance, fld, "get", new Object[] { null }); //$NON-NLS-1$
         } else {
-            result = new Expression(oldInstance, Class.class, "forName", //$NON-NLS-1$ 
+            result = new Expression(oldInstance, String.class, "forName", //$NON-NLS-1$ 
                     new Object[] { value.getName() });
         }
         return result;

Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_DoublePersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_DoublePersistenceDelegate.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_DoublePersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_DoublePersistenceDelegate.java Sun Jul 15 23:12:24 2007
@@ -25,7 +25,7 @@
     @Override
     protected Expression instantiate(Object oldInstance, Encoder out) {
         Double value = (Double) oldInstance;
-        return new Expression(oldInstance, Double.class, "new", new Object[] { value }); //$NON-NLS-1$
+        return new Expression(oldInstance, Double.class, "new", new Object[] { value.toString() }); //$NON-NLS-1$
     }
 
     @Override

Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_FloatPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_FloatPersistenceDelegate.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_FloatPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_FloatPersistenceDelegate.java Sun Jul 15 23:12:24 2007
@@ -25,7 +25,7 @@
     @Override
     protected Expression instantiate(Object oldInstance, Encoder out) {
         Float value = (Float) oldInstance;
-        return new Expression(oldInstance, Float.class, "new", new Object[] { value }); //$NON-NLS-1$
+        return new Expression(oldInstance, Float.class, "new", new Object[] { value.toString() }); //$NON-NLS-1$
     }
 
     @Override

Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_IntegerPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_IntegerPersistenceDelegate.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_IntegerPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_IntegerPersistenceDelegate.java Sun Jul 15 23:12:24 2007
@@ -25,10 +25,21 @@
     @Override
     protected Expression instantiate(Object oldInstance, Encoder out) {
         Integer value = (Integer) oldInstance;
-        return new Expression(oldInstance, Integer.class, "new", new Object[] { value }); //$NON-NLS-1$
+        return new Expression(oldInstance, Integer.class,
+				"new", new Object[] { value.toString() }); //$NON-NLS-1$
     }
 
     @Override
     protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
+    }
+    
+    /*
+     * Two Integer objects are regarded mutatable if they are equal.
+     */
+    protected boolean mutatesTo(Object o1, Object o2) {
+        if (null == o2) {
+            return false;
+        }
+        return o1.equals(o2);
     }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_LongPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_LongPersistenceDelegate.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_LongPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_LongPersistenceDelegate.java Sun Jul 15 23:12:24 2007
@@ -25,7 +25,7 @@
     @Override
     protected Expression instantiate(Object oldInstance, Encoder out) {
         Long value = (Long) oldInstance;
-        return new Expression(oldInstance, Long.class, "new", new Object[] { value }); //$NON-NLS-1$
+        return new Expression(oldInstance, Long.class, "new", new Object[] { value.toString() }); //$NON-NLS-1$
     }
 
     @Override

Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_ShortPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_ShortPersistenceDelegate.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_ShortPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_ShortPersistenceDelegate.java Sun Jul 15 23:12:24 2007
@@ -25,7 +25,7 @@
     @Override
     protected Expression instantiate(Object oldInstance, Encoder out) {
         Short value = (Short) oldInstance;
-        return new Expression(oldInstance, Short.class, "new", new Object[] { value }); //$NON-NLS-1$
+        return new Expression(oldInstance, Short.class, "new", new Object[] { value.toString() }); //$NON-NLS-1$
     }
 
     @Override

Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_reflect_FieldPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_reflect_FieldPersistenceDelegate.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_reflect_FieldPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_reflect_FieldPersistenceDelegate.java Sun Jul 15 23:12:24 2007
@@ -32,7 +32,7 @@
         assert oldInstance instanceof Field : oldInstance;
         Field oldField = (Field) oldInstance;
         Class<?> declClass = oldField.getDeclaringClass();
-        return new Expression(oldField, declClass, "getDeclaredField", //$NON-NLS-1$
+        return new Expression(oldField, declClass, "getField", //$NON-NLS-1$
                 new Object[] { oldField.getName() });
     }
 

Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_reflect_ProxyPersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_reflect_ProxyPersistenceDelegate.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_reflect_ProxyPersistenceDelegate.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/main/java/org/apache/harmony/beans/java_lang_reflect_ProxyPersistenceDelegate.java Sun Jul 15 23:12:24 2007
@@ -17,13 +17,13 @@
 
 package org.apache.harmony.beans;
 
+import java.beans.DefaultPersistenceDelegate;
 import java.beans.Encoder;
 import java.beans.Expression;
-import java.beans.PersistenceDelegate;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Proxy;
 
-public class java_lang_reflect_ProxyPersistenceDelegate extends PersistenceDelegate {
+public class java_lang_reflect_ProxyPersistenceDelegate extends DefaultPersistenceDelegate {
     @Override
     protected Expression instantiate(Object oldInstance, Encoder out) {
         assert oldInstance instanceof Proxy : oldInstance;
@@ -39,11 +39,13 @@
         assert oldInstance instanceof Proxy : oldInstance;
         assert newInstance instanceof Proxy : newInstance;
         assert newInstance == oldInstance;
+        super.initialize(type, oldInstance, newInstance, out);
     }
 
     @Override
     protected boolean mutatesTo(Object oldInstance, Object newInstance) {
         assert oldInstance instanceof Proxy : oldInstance;
-        return oldInstance == newInstance;
+        assert oldInstance == newInstance;
+        return super.mutatesTo(oldInstance, newInstance);
     }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EncoderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EncoderTest.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EncoderTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EncoderTest.java Sun Jul 15 23:12:24 2007
@@ -381,7 +381,7 @@
         Encoder enc = new Encoder();
         PersistenceDelegate pd = enc
                 .getPersistenceDelegate(MockFooLiYang.class);
-        assertTrue(pd instanceof VerbosePD);
+        assertTrue(pd instanceof DefaultPersistenceDelegate);
     }
 
     public void testGetPersistenceDelegate_Default() {

Modified: harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PersistenceDelegateTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PersistenceDelegateTest.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PersistenceDelegateTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PersistenceDelegateTest.java Sun Jul 15 23:12:24 2007
@@ -30,7 +30,14 @@
 import org.apache.harmony.beans.tests.support.mock.MockFoo;
 import org.apache.harmony.beans.tests.support.mock.MockFooStop;
 
-
+import java.beans.XMLEncoder;
+import java.beans.XMLDecoder;
+import java.io.ByteArrayOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.DataInputStream;
+import java.io.BufferedOutputStream;
+import java.io.IOException;
+import java.lang.reflect.Field;
 /**
  * Test java.beans.PersistenceDelegate
  */
@@ -206,7 +213,45 @@
         assertFalse(pd.mutatesTo(null, "test"));
     }
 
-    
+    public void test_writeObject_Null_LXMLEncoder() throws Exception{
+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+        XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(byteArrayOutputStream));
+        encoder.writeObject(null);
+        encoder.close();
+
+        DataInputStream stream = new DataInputStream(new ByteArrayInputStream(byteArrayOutputStream.toByteArray()));
+        XMLDecoder decoder = new XMLDecoder(stream);
+        assertNull(decoder.readObject());
+        stream = new DataInputStream(PersistenceDelegateTest.class.getResourceAsStream("/xml/null.xml"));
+        decoder = new XMLDecoder(stream);
+        assertNull(decoder.readObject());
+    }
+
+    class Bar {
+        public int value;
+        public void barTalk() {
+            System.out.println("Bar is coming!");
+        }
+    }
+    public void test_writeObject_java_lang_reflect_Field()
+			throws SecurityException, NoSuchFieldException, IOException {
+		ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+		XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(
+				byteArrayOutputStream));
+		Field value = Bar.class.getField("value");
+		encoder.writeObject(value);
+		encoder.close();
+
+		DataInputStream stream = new DataInputStream(new ByteArrayInputStream(
+				byteArrayOutputStream.toByteArray()));
+		
+		XMLDecoder decoder = new XMLDecoder(stream); Field field = (Field)
+		decoder.readObject();
+
+        assertEquals(value, field);
+		assertEquals(value.getName(), field.getName());
+	}
+
     // <--
 
     private void assertWasAdded(Class<?> targetClass, String methodName,

Modified: harmony/enhanced/classlib/branches/java6/modules/lang-management/make/exclude.common
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/lang-management/make/exclude.common?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/lang-management/make/exclude.common (original)
+++ harmony/enhanced/classlib/branches/java6/modules/lang-management/make/exclude.common Sun Jul 15 23:12:24 2007
@@ -1,26 +1 @@
-org/apache/harmony/lang/management/ClassLoadingMXBeanImplTest.java
-org/apache/harmony/lang/management/CompilationMXBeanImplTest.java
-org/apache/harmony/lang/management/DynamicMXBeanImplTest.java
-org/apache/harmony/lang/management/GarbageCollectorMXBeanImplTest.java
-org/apache/harmony/lang/management/LoggingMXBeanImplTest.java
-org/apache/harmony/lang/management/MemoryManagerImplTest.java
-org/apache/harmony/lang/management/MemoryMXBeanImplTest.java
-org/apache/harmony/lang/management/MemoryPoolMXBeanImplTest.java
-org/apache/harmony/lang/management/MultiInstanceDynamicMXBeanImplTest.java
-org/apache/harmony/lang/management/RuntimeMXBeanImplTest.java
-org/apache/harmony/lang/management/SingleInstanceDynamicMXBeanImplTest.java
-org/apache/harmony/lang/management/ThreadInfoTest.java
-org/apache/harmony/lang/management/ThreadMXBeanImplTest.java
-
-org/apache/harmony/lang/management/tests/java/lang/management/ClassLoadingMXBeanTest.java
-org/apache/harmony/lang/management/tests/java/lang/management/CompilationMXBeanTest.java
-org/apache/harmony/lang/management/tests/java/lang/management/GarbageCollectorMXBeanTest.java
-org/apache/harmony/lang/management/tests/java/lang/management/LoggingMXBeanTest.java
-org/apache/harmony/lang/management/tests/java/lang/management/ManagementFactoryTest.java
-org/apache/harmony/lang/management/tests/java/lang/management/MemoryManagerMXBeanTest.java
-org/apache/harmony/lang/management/tests/java/lang/management/MemoryMXBeanTest.java
-org/apache/harmony/lang/management/tests/java/lang/management/MemoryPoolMXBeanTest.java
-org/apache/harmony/lang/management/tests/java/lang/management/RuntimeMXBeanTest.java
 org/apache/harmony/lang/management/tests/java/lang/management/ThreadMXBeanTest.java
-
-tests/java/util/logging/LoggingMXBeanTest.java

Modified: harmony/enhanced/classlib/branches/java6/modules/lang-management/make/exclude.linux.x86.ibm
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/lang-management/make/exclude.linux.x86.ibm?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/lang-management/make/exclude.linux.x86.ibm (original)
+++ harmony/enhanced/classlib/branches/java6/modules/lang-management/make/exclude.linux.x86.ibm Sun Jul 15 23:12:24 2007
@@ -0,0 +1,26 @@
+org/apache/harmony/lang/management/ClassLoadingMXBeanImplTest.java
+org/apache/harmony/lang/management/CompilationMXBeanImplTest.java
+org/apache/harmony/lang/management/DynamicMXBeanImplTest.java
+org/apache/harmony/lang/management/GarbageCollectorMXBeanImplTest.java
+org/apache/harmony/lang/management/LoggingMXBeanImplTest.java
+org/apache/harmony/lang/management/MemoryManagerImplTest.java
+org/apache/harmony/lang/management/MemoryMXBeanImplTest.java
+org/apache/harmony/lang/management/MemoryPoolMXBeanImplTest.java
+org/apache/harmony/lang/management/MultiInstanceDynamicMXBeanImplTest.java
+org/apache/harmony/lang/management/RuntimeMXBeanImplTest.java
+org/apache/harmony/lang/management/SingleInstanceDynamicMXBeanImplTest.java
+org/apache/harmony/lang/management/ThreadInfoTest.java
+org/apache/harmony/lang/management/ThreadMXBeanImplTest.java
+
+org/apache/harmony/lang/management/tests/java/lang/management/ClassLoadingMXBeanTest.java
+org/apache/harmony/lang/management/tests/java/lang/management/CompilationMXBeanTest.java
+org/apache/harmony/lang/management/tests/java/lang/management/GarbageCollectorMXBeanTest.java
+org/apache/harmony/lang/management/tests/java/lang/management/LoggingMXBeanTest.java
+org/apache/harmony/lang/management/tests/java/lang/management/ManagementFactoryTest.java
+org/apache/harmony/lang/management/tests/java/lang/management/MemoryManagerMXBeanTest.java
+org/apache/harmony/lang/management/tests/java/lang/management/MemoryMXBeanTest.java
+org/apache/harmony/lang/management/tests/java/lang/management/MemoryPoolMXBeanTest.java
+org/apache/harmony/lang/management/tests/java/lang/management/RuntimeMXBeanTest.java
+org/apache/harmony/lang/management/tests/java/lang/management/ThreadMXBeanTest.java
+
+tests/java/util/logging/LoggingMXBeanTest.java

Modified: harmony/enhanced/classlib/branches/java6/modules/lang-management/make/exclude.windows.x86.ibm
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/lang-management/make/exclude.windows.x86.ibm?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/lang-management/make/exclude.windows.x86.ibm (original)
+++ harmony/enhanced/classlib/branches/java6/modules/lang-management/make/exclude.windows.x86.ibm Sun Jul 15 23:12:24 2007
@@ -0,0 +1,27 @@
+org/apache/harmony/lang/management/ClassLoadingMXBeanImplTest.java
+org/apache/harmony/lang/management/CompilationMXBeanImplTest.java
+org/apache/harmony/lang/management/DynamicMXBeanImplTest.java
+org/apache/harmony/lang/management/GarbageCollectorMXBeanImplTest.java
+org/apache/harmony/lang/management/LoggingMXBeanImplTest.java
+org/apache/harmony/lang/management/MemoryManagerImplTest.java
+org/apache/harmony/lang/management/MemoryMXBeanImplTest.java
+org/apache/harmony/lang/management/MemoryPoolMXBeanImplTest.java
+org/apache/harmony/lang/management/MultiInstanceDynamicMXBeanImplTest.java
+org/apache/harmony/lang/management/RuntimeMXBeanImplTest.java
+org/apache/harmony/lang/management/SingleInstanceDynamicMXBeanImplTest.java
+org/apache/harmony/lang/management/ThreadInfoTest.java
+org/apache/harmony/lang/management/ThreadMXBeanImplTest.java
+
+org/apache/harmony/lang/management/tests/java/lang/management/ClassLoadingMXBeanTest.java
+org/apache/harmony/lang/management/tests/java/lang/management/CompilationMXBeanTest.java
+org/apache/harmony/lang/management/tests/java/lang/management/GarbageCollectorMXBeanTest.java
+org/apache/harmony/lang/management/tests/java/lang/management/LoggingMXBeanTest.java
+org/apache/harmony/lang/management/tests/java/lang/management/ManagementFactoryTest.java
+org/apache/harmony/lang/management/tests/java/lang/management/MemoryManagerMXBeanTest.java
+org/apache/harmony/lang/management/tests/java/lang/management/MemoryMXBeanTest.java
+org/apache/harmony/lang/management/tests/java/lang/management/MemoryPoolMXBeanTest.java
+org/apache/harmony/lang/management/tests/java/lang/management/RuntimeMXBeanTest.java
+org/apache/harmony/lang/management/tests/java/lang/management/ThreadMXBeanTest.java
+
+tests/java/util/logging/LoggingMXBeanTest.java
+

Modified: harmony/enhanced/classlib/branches/java6/modules/luni-kernel/src/main/java/java/lang/System.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni-kernel/src/main/java/java/lang/System.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni-kernel/src/main/java/java/lang/System.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni-kernel/src/main/java/java/lang/System.java Sun Jul 15 23:12:24 2007
@@ -490,8 +490,8 @@
 
         systemProperties.put("file.encoding", fileEncoding);
 
-        systemProperties.put("java.version", "1.4.2 subset");
-        systemProperties.put("java.specification.version", "1.4");
+        systemProperties.put("java.version", "1.5 subset");
+        systemProperties.put("java.specification.version", "1.5");
 
         systemProperties.put("java.specification.vendor", "Sun Microsystems Inc.");
         systemProperties.put("java.specification.name", "Java Platform API Specification");

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/AbstractList.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/AbstractList.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/AbstractList.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/AbstractList.java Sun Jul 15 23:12:24 2007
@@ -62,13 +62,14 @@
         public void remove() {
             if (expectedModCount == modCount) {
                 try {
-                    AbstractList.this.remove(lastPosition);
-                } catch (IndexOutOfBoundsException e) {
-                    throw new IllegalStateException();
-                }
-                if (modCount != expectedModCount) {
-                    expectedModCount++;
-                }
+					AbstractList.this.remove(lastPosition);
+				} catch (IndexOutOfBoundsException e) {
+					throw new IllegalStateException();
+				} finally {
+					if (modCount != expectedModCount) {
+						expectedModCount++;
+					}
+				}
                 if (pos == lastPosition) {
                     pos--;
                 }

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Collections.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Collections.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Collections.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Collections.java Sun Jul 15 23:12:24 2007
@@ -1473,12 +1473,12 @@
             return -1;
         }
 
-        Comparable<T> key = (Comparable<T>) object;
+               
         if (!(list instanceof RandomAccess)) {
-            ListIterator<T> it = (ListIterator<T>) list.listIterator();
+            ListIterator<? extends Comparable<? super T>> it = list.listIterator();
             while (it.hasNext()) {
                 int result;
-                if ((result = key.compareTo(it.next())) <= 0) {
+                if ((result = -it.next().compareTo(object)) <= 0) {    
                     if (result == 0) {
                         return it.previousIndex();
                     }
@@ -1491,7 +1491,7 @@
         int low = 0, mid = list.size(), high = mid - 1, result = -1;
         while (low <= high) {
             mid = (low + high) >> 1;
-            if ((result = key.compareTo((T) list.get(mid))) > 0) {
+            if ((result = -list.get(mid).compareTo(object)) > 0) {
                 low = mid + 1;
             } else if (result == 0) {
                 return mid;
@@ -1531,7 +1531,7 @@
             ListIterator<? extends T> it = list.listIterator();
             while (it.hasNext()) {
                 int result;
-                if ((result = comparator.compare(object, it.next())) <= 0) {
+                if ((result = -comparator.compare(it.next(), object)) <= 0) {
                     if (result == 0) {
                         return it.previousIndex();
                     }
@@ -1544,7 +1544,7 @@
         int low = 0, mid = list.size(), high = mid - 1, result = -1;
         while (low <= high) {
             mid = (low + high) >> 1;
-            if ((result = comparator.compare(object, list.get(mid))) > 0) {
+            if ((result = -comparator.compare(list.get(mid),object)) > 0) {
                 low = mid + 1;
             } else if (result == 0) {
                 return mid;

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Properties.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Properties.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Properties.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Properties.java Sun Jul 15 23:12:24 2007
@@ -407,6 +407,9 @@
 			}
 			buf[offset++] = nextChar;
 		}
+        if(keyLength==-1 && offset>0){
+            keyLength = offset;
+        }
 		if (keyLength >= 0) {
 			String temp = new String(buf, 0, offset);
 			put(temp.substring(0, keyLength), temp.substring(keyLength));

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/AbstractListTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/AbstractListTest.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/AbstractListTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/AbstractListTest.java Sun Jul 15 23:12:24 2007
@@ -20,10 +20,12 @@
 import java.util.AbstractList;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.ConcurrentModificationException;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.ListIterator;
+import java.util.NoSuchElementException;
 import java.util.RandomAccess;
 
 public class AbstractListTest extends junit.framework.TestCase {
@@ -195,6 +197,75 @@
             // expected
         }
     }
+
+    class MockArrayList<E> extends AbstractList<E> {
+    	/**
+    	 * 
+    	 */
+    	private static final long serialVersionUID = 1L;
+    	
+    	ArrayList<E> list = new ArrayList<E>();
+    	
+    	public E remove(int idx) {
+    		modCount++;
+    		return list.remove(idx);
+    	}
+
+    	@Override
+    	public E get(int index) {
+    		return list.get(index);
+    	}
+
+    	@Override
+    	public int size() {
+    		return list.size();
+    	}
+    	
+    	public void add(int idx, E o) {
+    		modCount++;
+    		list.add(idx, o);
+    	}
+    }
+    
+    /*
+     * Regression test for HY-4398
+     */
+    public void test_iterator_next() {
+		MockArrayList<String> t = new MockArrayList<String>();
+		t.list.add("a");
+		t.list.add("b");
+		
+		Iterator it = t.iterator();
+		
+		while (it.hasNext()) {
+			it.next();
+		}
+		try {
+            it.next();
+            fail("Should throw NoSuchElementException");
+        } catch (NoSuchElementException cme) {
+            // expected
+        }
+
+        t.add("c");
+        try {
+            it.remove();
+            fail("Should throw NoSuchElementException");
+        } catch (ConcurrentModificationException cme) {
+            // expected
+		}
+		
+		it = t.iterator();
+		try {
+			it.remove();
+			fail("Should throw IllegalStateException");
+		} catch (IllegalStateException ise) {
+			// expected
+		}
+
+		Object value = it.next();
+		assertEquals("a", value);
+	}
 
     /**
      * @tests java.util.AbstractList#subList(int, int)

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/CollectionsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/CollectionsTest.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/CollectionsTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/CollectionsTest.java Sun Jul 15 23:12:24 2007
@@ -1919,6 +1919,70 @@
    			assertEquals(errMsg, e.getCause().getMessage());
    		}
     }
+    
+    public void test_binarySearch_asymmetry_with_comparator() throws Exception{
+        List list = new ArrayList();
+        String s1 = new String("a");
+        String s2 = new String("aa");
+        String s3 = new String("aaa");        
+        list.add(s1);
+        list.add(s2);
+        list.add(s3);
+        Collections.sort(list);
+        Object o = Collections.binarySearch(list, 1, new StringComparator());
+        assertSame(0,o);
+    }
+    
+    public void test_binarySearch_asymmetry() throws Exception{
+        List list = new LinkedList();
+        String s1 = new String("a");
+        String s2 = new String("aa");
+        String s3 = new String("aaa");        
+        list.add(new MyComparable(s1));
+        list.add(new MyComparable(s2));
+        list.add(new MyComparable(s3));
+        Collections.sort(list);
+        Object o = Collections.binarySearch(list, 1);
+        assertSame(0,o);
+    }
+    
+    
+    private class MyComparable implements Comparable {
+
+        public String s;
+
+        public MyComparable(String s) {
+            this.s = s;
+
+        }
+
+        public int compareTo(Object another) {
+            int length = 0;
+            if (another instanceof MyComparable) {
+                length = (((MyComparable) another).s).length();
+            } else {
+                length = (Integer) another;
+            }
+            return s.length() - length;
+        }
+
+    }
+    
+    private class StringComparator implements Comparator {
+
+        public int compare(Object object1, Object object2) {
+            String s = (String) object1;
+            int length;
+            if(object2 instanceof String){
+                length = ((String)object2).length();
+            }
+            else
+            {
+                length = (Integer) object2;
+            }            
+            return s.length() - length;
+        }
+    }
 
 
     /**

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/PropertiesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/PropertiesTest.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/PropertiesTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/PropertiesTest.java Sun Jul 15 23:12:24 2007
@@ -690,6 +690,17 @@
                     .getProperty(nextKey).equals(myProps.getProperty(nextKey)));
         }
     }
+ 
+    /**
+     * if loading from single line like "hello" without "\n\r" neither "=", it should be same 
+     * as loading from "hello="
+     */
+    public void testLoadSingleLine() throws Exception{
+        Properties props = new Properties();
+        InputStream sr = new ByteArrayInputStream("hello".getBytes());
+        props.load(sr);
+        assertEquals(1, props.size());
+    }
 
     /**
      * Sets up the fixture, for example, open a network connection. This method

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/CharsetProviderImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/CharsetProviderImpl.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/CharsetProviderImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/CharsetProviderImpl.java Sun Jul 15 23:12:24 2007
@@ -624,8 +624,7 @@
                                                             "x-MS950-HKSCS",
                                                             "MS950_HKSCS" } },
 
-            { "additional.x_windows_949",         null, new String[] { "KSC_5601",
-                                                            "x-windows-949",
+            { "additional.x_windows_949",         null, new String[] { "x-windows-949",
                                                             "MS949" } },
 
             { "additional.GB18030",                null, new String[] { "GB18030",

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_windows_949.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_windows_949.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_windows_949.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_windows_949.java Sun Jul 15 23:12:24 2007
@@ -32,7 +32,7 @@
         }
 
         public boolean contains(Charset cs) {
-            return cs.name().equalsIgnoreCase("IBM367") || cs.name().equalsIgnoreCase("US-ASCII") ;
+            return cs.name().equalsIgnoreCase("x-windows-949") || cs.name().equalsIgnoreCase("IBM367") || cs.name().equalsIgnoreCase("US-ASCII") ;
         }
 
         public CharsetDecoder newDecoder() {

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/make/exclude.common
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/make/exclude.common?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/make/exclude.common (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/make/exclude.common Sun Jul 15 23:12:24 2007
@@ -138,3 +138,9 @@
 javax/swing/text/html/parser/DTD401Test.java
 javax/swing/text/html/parser/DTDTest.java
 javax/swing/text/html/parser/TagElementTest.java
+
+# see HARMONY-4462
+javax/swing/text/html/FormView_FormSelectElementTest.java
+
+#H-4008
+javax/swing/text/html/FormView_FormInputElementTest.java

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/ColorType.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/ColorType.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/ColorType.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/ColorType.java Sun Jul 15 23:12:24 2007
@@ -80,6 +80,10 @@
      */
     static ColorType calculateColorType(String key) {
 
+        if (key == null) {
+            return null;
+        }
+
         key = key.toUpperCase().intern();
 
         if (key == "BACKGROUND") { //$NON-NLS-1$
@@ -93,7 +97,6 @@
         } else if (key == "FOCUS") { //$NON-NLS-1$
             return FOCUS;
         }
-
         throw new IllegalStateException(Messages.getString("swing.err.1C") //$NON-NLS-1$
                 + key);
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/Region.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/Region.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/Region.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/Region.java Sun Jul 15 23:12:24 2007
@@ -210,9 +210,10 @@
      */
     static Region getRegionFromUIID(String ui) {
 
+        // Possible improvement:
         // This method creates additional object(substring) but possibly faster
         // way is the creating two HashMaps that contains the same values but
-        // the different keys: ui and name
+        // the different keys: UI and name
         return regionsMap.get(ui.substring(0, (ui.length() - 2)));
     }
 

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/SynthConstants.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/SynthConstants.java?view=diff&rev=556513&r1=556512&r2=556513
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/SynthConstants.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/synth/SynthConstants.java Sun Jul 15 23:12:24 2007
@@ -24,7 +24,7 @@
  */
 public interface SynthConstants {
 
-    /** The component (usual a button) is marked as default (additional) */
+    /** The component (a JButton) is marked as default (additional) */
     static int DEFAULT = 1024;
 
     /** The component is disabled (primary) */



Mime
View raw message