Fixes - multithreading problems with OdfName
@@ -35,7 +35,6 @@ public class OdfName implements Comparable<OdfName> {
private String mLocalName;
private String mExpandedName; // i.e. {nsURI}localName
private static HashMap<String, OdfName> mOdfNames = new HashMap<String, OdfName>();
- private static StringBuilder mSB;
private OdfName(OdfNamespace ns, String localname, String expandedName) {
mNS = ns;
@@ -103,6 +102,7 @@ public class OdfName implements Comparable<OdfName> {
} else {
expandedName = localName;
}
+ synchronized (mOdfNames) {
// return a similar OdfName if one was already created before..
OdfName odfName = mOdfNames.get(expandedName);
if (odfName != null) {
@@ -114,13 +114,10 @@ public class OdfName implements Comparable<OdfName> {
return odfName;
}
}
+ }
private static String createExpandedName(String nsUri, String localName) {
- if (mSB == null) {
- mSB = new StringBuilder();
- } else {
- mSB.delete(0, mSB.length());
- }
+ StringBuilder mSB = new StringBuilder();
mSB.append('{');
mSB.append(nsUri);
mSB.append('}');
