Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4969110

ValidationHandler.set/getProperty() throws XMLConfigurationException

XMLWordPrintable

    • 1.3
    • generic
    • generic

        Name: eaR10174 Date: 12/16/2003


           The com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException is thrown when
        the method

             javax.xml.validation.ValidationHandler.getProperty()

        is invoked with a property name that should not be recognized, the same exception is thrown in
        case when the method

            javax.xml.validation.ValidationHandler.setProperty()

        is invoked with the property name that is null and the name that should not be recognized (see
        test.java below). According to the javadoc the methods should throw NullPointerException in
        case of the null name and org.xml.sax.SAXNotRecognizedException in case of names that can not
        be recognized.

        The bug appears in jdk1.5.0beta-b31 and affects new JCK1.5 tests (not integrated yet):

           api/javax_xml/validation/ValidatorHandler/index.html#GetSetProperty[GetSetProperty002]
           api/javax_xml/validation/ValidatorHandler/index.html#GetSetProperty[GetSetProperty003]
           api/javax_xml/validation/ValidatorHandler/index.html#GetSetProperty[GetSetProperty004]

        ------------------------------------test.java-----------------------------
        import javax.xml.validation.SchemaFactory;
        import javax.xml.validation.ValidatorHandler;
        import org.xml.sax.SAXException;
        import org.xml.sax.SAXNotRecognizedException;

        public class test {
              SchemaFactory schemaFactory =
                  SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");

              public static void main(String argv[]) {
                  test t = new test();
                  try {
                      t.run01();
                  } catch (Exception e) {
                      e.printStackTrace();
                      System.err.println("\n");
                  }

                  try {
                      t.run02(null);
                  } catch (Exception e) {
                      e.printStackTrace();
                      System.err.println("\n");
                  }

                  try {
                      t.run02("unknown1234");
                  } catch (Exception e) {
                      e.printStackTrace();
                  }
              }

              public void run01() {
                 try {
                     ValidatorHandler validatorHandler =
                         schemaFactory.newSchema().newValidatorHandler();
                     validatorHandler.getProperty("unknown1234");
                     System.out.println("SAXNotRecognizedException was not thrown.");
                 } catch (SAXNotRecognizedException e) {
                     System.out.println("OK");
                 } catch (SAXException e) {
                     System.out.println(e.toString());
                 }
              }

              public void run02(String name) {
                 try {
                     ValidatorHandler validatorHandler =
                         schemaFactory.newSchema().newValidatorHandler();
                     validatorHandler.setProperty(name, "123");
                     System.out.println("SAXNotRecognizedException was not thrown.");
                 } catch (SAXNotRecognizedException e) {
                     System.out.println("OK");
                 } catch (SAXException e) {
                     System.out.println(e.toString());
                 }
              }
        }
        --------------------------------------------------------------------------
        % java -showversion test
        java version "1.5.0-beta"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b31)
        Java HotSpot(TM) Client VM (build 1.5.0-beta-b31, mixed mode)

        com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException: unknown1234
        at
        com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.getProperty(ValidatorHandlerImpl.java:193)
        at test.run01(test.java:35)
        at test.main(test.java:12)


        com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException
        at
        com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.setProperty(ValidatorHandlerImpl.java:198)
        at test.run02(test.java:47)
        at test.main(test.java:19)


        com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException: unknown1234
        at
        com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.setProperty(ValidatorHandlerImpl.java:198)
        at test.run02(test.java:47)
        at test.main(test.java:26)
        --------------------------------------------------------------------------

        ======================================================================

              kkawagucsunw Kohsuke Kawaguchi (Inactive)
              evgsunw Evg Evg (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: