Bug7143711Test.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:openjdk-jdk10 作者:
@Test
public void testXPath_DOM_withSM() {
    System.out.println("Evaluate DOM Source;  Security Manager is set:");
    setSystemProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");

    try {
        XPathFactory xPathFactory = XPathFactory.newInstance("http://java.sun.com/jaxp/xpath/dom",
                "com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl", null);
        xPathFactory.setFeature(ORACLE_FEATURE_SERVICE_MECHANISM, true);
        if ((boolean) xPathFactory.getFeature(ORACLE_FEATURE_SERVICE_MECHANISM)) {
            Assert.fail("should not override in secure mode");
        }

    } catch (Exception e) {
        Assert.fail(e.getMessage());
    } finally {
        clearSystemProperty(DOM_FACTORY_ID);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号