harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r549531 - in /harmony/enhanced/classlib/trunk/modules/beans/src/main/java: java/beans/PersistenceDelegate.java org/apache/harmony/beans/ObjectNode.java
Date Thu, 21 Jun 2007 16:16:50 GMT
Author: ayza
Date: Thu Jun 21 09:16:48 2007
New Revision: 549531

URL: http://svn.apache.org/viewvc?view=rev&rev=549531
Log:
Fix for java.beans.Encoder and related classes to enable correct handling of compound objects
and arrays. Among other thing it fixes problems described in HARMONY-4106 ([classlib][beans]
XMLEncoder does not encode array values)

Modified:
    harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PersistenceDelegate.java
    harmony/enhanced/classlib/trunk/modules/beans/src/main/java/org/apache/harmony/beans/ObjectNode.java

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PersistenceDelegate.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PersistenceDelegate.java?view=diff&rev=549531&r1=549530&r2=549531
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PersistenceDelegate.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PersistenceDelegate.java
Thu Jun 21 09:16:48 2007
@@ -73,6 +73,12 @@
             }
 
             out.writeExpression(instantiate(oldInstance, out));
+            newInstance = out.get(oldInstance);
+            
+            if (newInstance != null) {
+                initialize(oldInstance.getClass(), oldInstance,
+                           newInstance, out);
+            }
         }
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/beans/src/main/java/org/apache/harmony/beans/ObjectNode.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/org/apache/harmony/beans/ObjectNode.java?view=diff&rev=549531&r1=549530&r2=549531
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/beans/src/main/java/org/apache/harmony/beans/ObjectNode.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/beans/src/main/java/org/apache/harmony/beans/ObjectNode.java
Thu Jun 21 09:16:48 2007
@@ -61,30 +61,29 @@
     }
 
     public Object getObjectValue() throws Exception {
-        if (objectValue == null) {
-            objectValue = initializer.getValue();
+        if (objectValue != null) {
+            return objectValue;
         }
 
-        // XXX We probably don't need this. Investigate.
-//        if (nodes != null) {
-//            Object[] oldArgs = initializer.getArguments();
-//            Object[] newArgs = new Object[oldArgs.length];
-//
-//            for (int i = 0; i < oldArgs.length; ++i) {
-//                if (oldArgs[i] != null) {
-//                    ObjectNode node = nodes.get(oldArgs[i]);
-//
-//                    newArgs[i] = node.getObjectValue();
-//                } else {
-//                    newArgs[i] = null;
-//                }
-//            }
-//
-//            objectValue = (new Expression(initializer.getTarget(), initializer
-//                    .getMethodName(), newArgs)).getValue();
-//        } else {
-//            objectValue = initializer.getValue();
-//        }
+        if (nodes != null) {
+            Object[] oldArgs = initializer.getArguments();
+            Object[] newArgs = new Object[oldArgs.length];
+
+            for (int i = 0; i < oldArgs.length; ++i) {
+                if (oldArgs[i] != null) {
+                    ObjectNode node = nodes.get(oldArgs[i]);
+
+                    newArgs[i] = node.getObjectValue();
+                } else {
+                    newArgs[i] = null;
+                }
+            }
+
+            objectValue = (new Expression(initializer.getTarget(), initializer
+                    .getMethodName(), newArgs)).getValue();
+        } else {
+            objectValue = initializer.getValue();
+        }
 
         return objectValue;
     }



Mime
View raw message