97 @Test
98 public void testXPath_DOM_withSM() {
99 System.out.println("Evaluate DOM Source; Security Manager is set:");
100 setSystemProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
101
102 try {
103 XPathFactory xPathFactory = XPathFactory.newInstance("http://java.sun.com/jaxp/xpath/dom",
104 "com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl", null);
105 xPathFactory.setFeature(ORACLE_FEATURE_SERVICE_MECHANISM, true);
106 if ((boolean) xPathFactory.getFeature(ORACLE_FEATURE_SERVICE_MECHANISM)) {
107 Assert.fail("should not override in secure mode");
108 }
109
110 } catch (Exception e) {
111 Assert.fail(e.getMessage());
112 } finally {
113 clearSystemProperty(DOM_FACTORY_ID);
114 }
115 }
116 }
117
|
97 @Test
98 public void testXPath_DOM_withSM() {
99 System.out.println("Evaluate DOM Source; Security Manager is set:");
100 setSystemProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
101
102 try {
103 XPathFactory xPathFactory = XPathFactory.newInstance("http://java.sun.com/jaxp/xpath/dom",
104 "com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl", null);
105 xPathFactory.setFeature(ORACLE_FEATURE_SERVICE_MECHANISM, true);
106 if ((boolean) xPathFactory.getFeature(ORACLE_FEATURE_SERVICE_MECHANISM)) {
107 Assert.fail("should not override in secure mode");
108 }
109
110 } catch (Exception e) {
111 Assert.fail(e.getMessage());
112 } finally {
113 clearSystemProperty(DOM_FACTORY_ID);
114 }
115 }
116 }
|