You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2010/01/28 18:49:50 UTC
svn commit: r904185 -
/pivot/trunk/wtk/src/org/apache/pivot/wtkx/WTKXSerializer.java
Author: gbrown
Date: Thu Jan 28 17:49:50 2010
New Revision: 904185
URL: http://svn.apache.org/viewvc?rev=904185&view=rev
Log:
Fix bug in WTKXSerializer introduced by the elimination of the reset() method.
Modified:
pivot/trunk/wtk/src/org/apache/pivot/wtkx/WTKXSerializer.java
Modified: pivot/trunk/wtk/src/org/apache/pivot/wtkx/WTKXSerializer.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtkx/WTKXSerializer.java?rev=904185&r1=904184&r2=904185&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtkx/WTKXSerializer.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtkx/WTKXSerializer.java Thu Jan 28 17:49:50 2010
@@ -272,6 +272,7 @@
}
private Resources resources;
+ private WTKXSerializer namespaceOwner;
private HashMap<String, Object> namedObjects;
private HashMap<String, WTKXSerializer> namedSerializers;
@@ -308,18 +309,24 @@
public static final String MIME_TYPE = "application/wtkx";
public WTKXSerializer() {
- this(null);
+ this(null, null);
}
public WTKXSerializer(Resources resources) {
- this(resources, new HashMap<String, Object>(), new HashMap<String, WTKXSerializer>());
+ this(resources, null);
}
- private WTKXSerializer(Resources resources, HashMap<String, Object> namedObjects,
- HashMap<String, WTKXSerializer> namedSerializers) {
+ private WTKXSerializer(Resources resources, WTKXSerializer namespaceOwner) {
this.resources = resources;
- this.namedObjects = namedObjects;
- this.namedSerializers = namedSerializers;
+ this.namespaceOwner = namespaceOwner;
+
+ if (namespaceOwner == null) {
+ namedObjects = new HashMap<String, Object>();
+ namedSerializers = new HashMap<String, WTKXSerializer>();
+ } else {
+ namedObjects = namespaceOwner.namedObjects;
+ namedSerializers = namespaceOwner.namedSerializers;
+ }
xmlInputFactory = XMLInputFactory.newInstance();
xmlInputFactory.setProperty("javax.xml.stream.isCoalescing", true);
@@ -399,8 +406,11 @@
}
// Reset the serializer
- namedObjects.clear();
- namedSerializers.clear();
+ if (namespaceOwner == null) {
+ namedObjects.clear();
+ namedSerializers.clear();
+ }
+
root = null;
language = DEFAULT_LANGUAGE;
@@ -688,7 +698,7 @@
// Read the object
WTKXSerializer serializer;
if (element.id == null) {
- serializer = new WTKXSerializer(resources, namedObjects, namedSerializers);
+ serializer = new WTKXSerializer(resources, this);
} else {
serializer = new WTKXSerializer(resources);
namedSerializers.put(element.id, serializer);