odfdom: access mutable static OdfXMLFactory.mElementTypes synchronized
... and mAttributeTypes.
@@ -30,7 +30,6 @@ package org.odftoolkit.odfdom.pkg;
import java.lang.reflect.Constructor;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
@@ -111,10 +110,12 @@ public class OdfXMLFactory {
OdfName odfName, String nodeType, Map<OdfName, Class> classCache) {
Class c = null;
String className = "";
+ synchronized (classCache) {
c = classCache.get(odfName);
if (c == null) {
String prefix = odfName.getPrefix();
- if (prefix != null && !(nodeType.equals(ATTRIBUTE_PACKAGE_NAME) && prefix.equals("xmlns"))) {
+ if (prefix != null
+ && !(nodeType.equals(ATTRIBUTE_PACKAGE_NAME) && prefix.equals("xmlns"))) {
String qName = odfName.getQName();
String localName = odfName.getLocalName();
// judge whether the element need to load class from incubator package.
@@ -143,6 +144,7 @@ public class OdfXMLFactory {
}
}
}
+ }
return c;
}
