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.



git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@510638 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
A. Abram White 2007-02-22 20:11:00 +00:00
parent 7eb91d0ec9
commit 65bd1f02e3
1 changed files with 5 additions and 5 deletions

View File

@ -850,6 +850,7 @@ public class ConfigurationImpl
public void readExternal(ObjectInput in) public void readExternal(ObjectInput in)
throws IOException, ClassNotFoundException { throws IOException, ClassNotFoundException {
fromProperties((Map) in.readObject()); fromProperties((Map) in.readObject());
_props = (Map) in.readObject();
_globals = in.readBoolean(); _globals = in.readBoolean();
} }
@ -858,10 +859,8 @@ public class ConfigurationImpl
* the properties returned by {@link #toProperties}. * the properties returned by {@link #toProperties}.
*/ */
public void writeExternal(ObjectOutput out) throws IOException { public void writeExternal(ObjectOutput out) throws IOException {
if (_props != null) out.writeObject(toProperties(true));
out.writeObject(_props); out.writeObject(_props);
else
out.writeObject(toProperties(false));
out.writeBoolean(_globals); out.writeBoolean(_globals);
} }
@ -875,8 +874,9 @@ public class ConfigurationImpl
(new Class[]{ boolean.class }); (new Class[]{ boolean.class });
ConfigurationImpl clone = (ConfigurationImpl) cons.newInstance ConfigurationImpl clone = (ConfigurationImpl) cons.newInstance
(new Object[]{ Boolean.FALSE }); (new Object[]{ Boolean.FALSE });
clone._globals = _globals;
clone.fromProperties(toProperties(true)); clone.fromProperties(toProperties(true));
clone._props = (_props == null) ? null : new HashMap(_props);
clone._globals = _globals;
return clone; return clone;
} catch (RuntimeException re) { } catch (RuntimeException re) {
throw re; throw re;