Skip to content

Commit 9ebce70

Browse files
committed
Merge branch 'origin/thread-local-xml-parser' (PR blackears#62)
2 parents 63a8d4f + bc946c4 commit 9ebce70

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

svg-core/src/main/java/com/kitfox/svg/SVGUniverse.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,15 +577,17 @@ public URI getStreamBuiltURI(String name)
577577
}
578578
}
579579

580-
static SAXParser saxParser;
581-
580+
static ThreadLocal<SAXParser> threadSAXParser = new ThreadLocal<SAXParser>();
581+
582582
private XMLReader getXMLReader() throws SAXException, ParserConfigurationException
583583
{
584+
SAXParser saxParser = threadSAXParser.get();
584585
if (saxParser == null)
585586
{
586587
SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
587588
saxParserFactory.setNamespaceAware(true);
588589
saxParser = saxParserFactory.newSAXParser();
590+
threadSAXParser.set(saxParser);
589591
}
590592
return saxParser.getXMLReader();
591593
}

0 commit comments

Comments
 (0)