mirror of
https://github.com/lightbend/config.git
synced 2025-01-29 05:30:08 +08:00
When serializing lists, convert to LinkedList
ArrayList and emptyList() don't seem to serialize correctly on JDK 1.6.0 betas. Unknown which other JDKs are affected. Speculating that the problem is http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6446627
This commit is contained in:
parent
2d8e42686c
commit
ab4edcfaf8
@ -3,6 +3,7 @@
|
||||
*/
|
||||
package com.typesafe.config.impl;
|
||||
|
||||
import java.io.ObjectStreamException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -228,4 +229,14 @@ final class ConfigDelayedMerge extends AbstractConfigValue implements
|
||||
sb.append("# ) end of unresolved merge\n");
|
||||
}
|
||||
}
|
||||
|
||||
// This ridiculous hack is because some JDK versions apparently can't
|
||||
// serialize an array, which is used to implement ArrayList and EmptyList.
|
||||
// maybe
|
||||
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6446627
|
||||
private Object writeReplace() throws ObjectStreamException {
|
||||
// switch to LinkedList
|
||||
return new ConfigDelayedMerge(origin(),
|
||||
new java.util.LinkedList<AbstractConfigValue>(stack), ignoresFallbacks);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
*/
|
||||
package com.typesafe.config.impl;
|
||||
|
||||
import java.io.ObjectStreamException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -192,4 +193,14 @@ class ConfigDelayedMergeObject extends AbstractConfigObject implements
|
||||
protected AbstractConfigValue peek(String key) {
|
||||
throw notResolved();
|
||||
}
|
||||
|
||||
// This ridiculous hack is because some JDK versions apparently can't
|
||||
// serialize an array, which is used to implement ArrayList and EmptyList.
|
||||
// maybe
|
||||
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6446627
|
||||
private Object writeReplace() throws ObjectStreamException {
|
||||
// switch to LinkedList
|
||||
return new ConfigDelayedMergeObject(origin(),
|
||||
new java.util.LinkedList<AbstractConfigValue>(stack), ignoresFallbacks);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
*/
|
||||
package com.typesafe.config.impl;
|
||||
|
||||
import java.io.ObjectStreamException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -284,4 +285,14 @@ final class ConfigSubstitution extends AbstractConfigValue implements
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This ridiculous hack is because some JDK versions apparently can't
|
||||
// serialize an array, which is used to implement ArrayList and EmptyList.
|
||||
// maybe
|
||||
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6446627
|
||||
private Object writeReplace() throws ObjectStreamException {
|
||||
// switch to LinkedList
|
||||
return new ConfigSubstitution(origin(), new java.util.LinkedList<Object>(pieces),
|
||||
prefixLength, ignoresFallbacks);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
*/
|
||||
package com.typesafe.config.impl;
|
||||
|
||||
import java.io.ObjectStreamException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
@ -367,4 +368,14 @@ final class SimpleConfigList extends AbstractConfigValue implements ConfigList {
|
||||
protected SimpleConfigList newCopy(boolean ignoresFallbacks, ConfigOrigin newOrigin) {
|
||||
return new SimpleConfigList(newOrigin, value);
|
||||
}
|
||||
|
||||
// This ridiculous hack is because some JDK versions apparently can't
|
||||
// serialize an array, which is used to implement ArrayList and EmptyList.
|
||||
// maybe
|
||||
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6446627
|
||||
private Object writeReplace() throws ObjectStreamException {
|
||||
// switch to LinkedList
|
||||
return new SimpleConfigList(origin(), new java.util.LinkedList<AbstractConfigValue>(value),
|
||||
resolveStatus());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user