}
StAXDialect dialect = StAXDialectDetector.getDialect(factory.getClass());
if (configuration != null) {
factory = configuration.configure(factory, dialect);
}
return new ImmutableXMLInputFactory(dialect.normalize(
dialect.makeThreadSafe(factory)));
} finally {
if (savedClassLoader != null) {
Thread.currentThread().setContextClassLoader(savedClassLoader);
}