Skip to content

Commit

Permalink
Merge pull request Azure#116 from jofriedm-msft/dev
Browse files Browse the repository at this point in the history
[Java] Support Custom ClassLoader
  • Loading branch information
pemari-msft authored Aug 23, 2016
2 parents 5c6c90f + a856b01 commit 0e26539
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ public final class Utility {
/**
* A factory to create SAXParser instances.
*/
private static final SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
private static final ThreadLocal<SAXParserFactory> saxParserFactory = new ThreadLocal<SAXParserFactory>() {
@Override public SAXParserFactory initialValue() {
return SAXParserFactory.newInstance();
}
};

/**
* A factory to create XMLStreamWriter instances.
Expand Down Expand Up @@ -664,8 +668,8 @@ public static JsonParser getJsonParser(final InputStream inStream) throws JsonPa
* @throws SAXException
*/
public static SAXParser getSAXParser() throws ParserConfigurationException, SAXException {
saxParserFactory.setNamespaceAware(true);
return saxParserFactory.newSAXParser();
saxParserFactory.get().setNamespaceAware(true);
return saxParserFactory.get().newSAXParser();
}

/**
Expand Down

0 comments on commit 0e26539

Please sign in to comment.