< prev index next >

test/javax/xml/jaxp/unittest/validation/Bug4988387.java

Print this page




  36  * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
  37  * @run testng/othervm -DrunSecMngr=true validation.Bug4988387
  38  * @run testng/othervm validation.Bug4988387
  39  * @summary Test SchemaFactory can detect invalid XPath expressions.
  40  */
  41 @Listeners({jaxp.library.FilePolicy.class})
  42 public class Bug4988387 {
  43 
  44     @Test
  45     public void test1() throws Exception {
  46         SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
  47 
  48         try {
  49             schemaFactory.newSchema(Bug4988387.class.getResource("Bug4988387.xsd"));
  50             Assert.fail("incorrect XPath processed");
  51         } catch (SAXException e) {
  52             Assert.assertTrue(e.getMessage().startsWith("c-general-xpath"));
  53         }
  54     }
  55 }
  56 


  36  * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
  37  * @run testng/othervm -DrunSecMngr=true validation.Bug4988387
  38  * @run testng/othervm validation.Bug4988387
  39  * @summary Test SchemaFactory can detect invalid XPath expressions.
  40  */
  41 @Listeners({jaxp.library.FilePolicy.class})
  42 public class Bug4988387 {
  43 
  44     @Test
  45     public void test1() throws Exception {
  46         SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
  47 
  48         try {
  49             schemaFactory.newSchema(Bug4988387.class.getResource("Bug4988387.xsd"));
  50             Assert.fail("incorrect XPath processed");
  51         } catch (SAXException e) {
  52             Assert.assertTrue(e.getMessage().startsWith("c-general-xpath"));
  53         }
  54     }
  55 }

< prev index next >