@Test
public void testFactoryFind() {
SAXParserFactory factory = SAXParserFactory.newInstance();
Assert.assertTrue(factory.getClass().getClassLoader() == null);
runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(null));
factory = SAXParserFactory.newInstance();
Assert.assertTrue(factory.getClass().getClassLoader() == null);
runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(new MyClassLoader()));
factory = SAXParserFactory.newInstance();
if (System.getSecurityManager() == null)
Assert.assertTrue(myClassLoaderUsed);
else
Assert.assertFalse(myClassLoaderUsed);
}
FactoryFindTest.java 文件源码
java
阅读 24
收藏 0
点赞 0
评论 0
项目:openjdk-jdk10
作者:
评论列表
文章目录