You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by aw...@apache.org on 2007/02/22 21:11:01 UTC

svn commit: r510638 - /incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java

Author: awhite
Date: Thu Feb 22 12:11:00 2007
New Revision: 510638

URL: http://svn.apache.org/viewvc?view=rev&rev=510638
Log:
Second attempt at serializing to full properties, including defaults, rather
than just user-defined properties.  This ensures that on deserialization we
get the proper settings despite not running product derivations.  Previous
attempt caused problems on SunONE.


Modified:
    incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java?view=diff&rev=510638&r1=510637&r2=510638
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java (original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java Thu Feb 22 12:11:00 2007
@@ -850,6 +850,7 @@
     public void readExternal(ObjectInput in)
         throws IOException, ClassNotFoundException {
         fromProperties((Map) in.readObject());
+        _props = (Map) in.readObject();
         _globals = in.readBoolean();
     }
 
@@ -858,10 +859,8 @@
      * the properties returned by {@link #toProperties}.
      */
     public void writeExternal(ObjectOutput out) throws IOException {
-        if (_props != null)
-            out.writeObject(_props);
-        else
-            out.writeObject(toProperties(false));
+        out.writeObject(toProperties(true));
+        out.writeObject(_props);
         out.writeBoolean(_globals);
     }
 
@@ -875,8 +874,9 @@
                 (new Class[]{ boolean.class });
             ConfigurationImpl clone = (ConfigurationImpl) cons.newInstance
                 (new Object[]{ Boolean.FALSE });
-            clone._globals = _globals;
             clone.fromProperties(toProperties(true));
+            clone._props = (_props == null) ? null : new HashMap(_props);
+            clone._globals = _globals;
             return clone;
         } catch (RuntimeException re) {
             throw re;