Uploaded image for project: 'Xerces2-J'
  1. Xerces2-J
  2. XERCESJ-1633

Xerces crashes when validating an XML with an XSD that contains asserts

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.11.0
    • 2.12.0
    • None

    Description

      One of Oxygen users reported us a crash, If you validate "dashboard.xml" with "assert.xsd" schema.
      A NullPointerException is thrown in the XPath2 library, when the assert xpath expression is evaluated. This exception is cached in "org.eclipse.wst.xml.xpath2.processor.internal.function.FsEq" class, "do_cmp_value_op()" method at line 381.
      The problem is that there is a System.exit(1) in that method, and after the exception is printed in output, the System.exit is called.
      I looked in the sources of the XPath2 library and the problem was fixed in the last build of the XPath2 library, but Xerxes used an older version of the library (1.2.0). Maybe you can try to rebuild the XPath2 library and remove the System.exit.
      I tested on the xml-schema-1.1-dev branch.

      java.lang.RuntimeException: cannot compare using method eq
      	at org.eclipse.wst.xml.xpath2.processor.internal.function.FsEq.do_cmp_value_op(FsEq.java:381)
      	at org.eclipse.wst.xml.xpath2.processor.internal.function.FsEq.fs_eq_value(FsEq.java:116)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:592)
      	at org.eclipse.wst.xml.xpath2.processor.internal.function.FsEq.do_general_pair(FsEq.java:221)
      	at org.eclipse.wst.xml.xpath2.processor.internal.function.FsEq.do_cmp_general_op(FsEq.java:308)
      	at org.eclipse.wst.xml.xpath2.processor.internal.function.FsEq.fs_eq_general(FsEq.java:253)
      	at org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator.visit(DefaultEvaluator.java:635)
      	at org.eclipse.wst.xml.xpath2.processor.internal.ast.CmpExpr.accept(CmpExpr.java:106)
      	at org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator.do_bin_args(DefaultEvaluator.java:803)
      	at org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator.do_logic_exp(DefaultEvaluator.java:509)
      	at org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator.visit(DefaultEvaluator.java:545)
      	at org.eclipse.wst.xml.xpath2.processor.internal.ast.AndExpr.accept(AndExpr.java:39)
      	at org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator.do_expr(DefaultEvaluator.java:314)
      	at org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator.do_predicate(DefaultEvaluator.java:2072)
      	at org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator.visit(DefaultEvaluator.java:2114)
      	at org.eclipse.wst.xml.xpath2.processor.internal.ast.AxisStep.accept(AxisStep.java:46)
      	at org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator.visit(DefaultEvaluator.java:1251)
      	at org.eclipse.wst.xml.xpath2.processor.internal.ast.XPathExpr.accept(XPathExpr.java:43)
      	at org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator.do_bin_args(DefaultEvaluator.java:803)
      	at org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator.do_logic_exp(DefaultEvaluator.java:509)
      	at org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator.visit(DefaultEvaluator.java:545)
      	at org.eclipse.wst.xml.xpath2.processor.internal.ast.AndExpr.accept(AndExpr.java:39)
      	at org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator.do_expr(DefaultEvaluator.java:314)
      	at org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator.visit(DefaultEvaluator.java:1566)
      	at org.eclipse.wst.xml.xpath2.processor.internal.ast.ParExpr.accept(ParExpr.java:40)
      	at org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator.visit(DefaultEvaluator.java:2132)
      	at org.eclipse.wst.xml.xpath2.processor.internal.ast.FilterExpr.accept(FilterExpr.java:52)
      	at org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator.visit(DefaultEvaluator.java:1251)
      	at org.eclipse.wst.xml.xpath2.processor.internal.ast.XPathExpr.accept(XPathExpr.java:43)
      	at org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator.do_bin_args(DefaultEvaluator.java:802)
      	at org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator.do_logic_exp(DefaultEvaluator.java:509)
      	at org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator.visit(DefaultEvaluator.java:531)
      	at org.eclipse.wst.xml.xpath2.processor.internal.ast.OrExpr.accept(OrExpr.java:37)
      	at org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator.visit(DefaultEvaluator.java:1600)
      	at org.eclipse.wst.xml.xpath2.processor.internal.ast.FunctionCall.accept(FunctionCall.java:46)
      	at org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator.visit(DefaultEvaluator.java:2132)
      	at org.eclipse.wst.xml.xpath2.processor.internal.ast.FilterExpr.accept(FilterExpr.java:52)
      	at org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator.visit(DefaultEvaluator.java:1251)
      	at org.eclipse.wst.xml.xpath2.processor.internal.ast.XPathExpr.accept(XPathExpr.java:43)
      	at org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator.do_expr(DefaultEvaluator.java:314)
      	at org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator.visit(DefaultEvaluator.java:335)
      	at org.eclipse.wst.xml.xpath2.processor.ast.XPath.accept(XPath.java:43)
      	at org.eclipse.wst.xml.xpath2.processor.DefaultEvaluator.evaluate(DefaultEvaluator.java:289)
      	at org.apache.xerces.impl.xs.AbstractPsychoPathXPath2Impl.evaluateXPathExpr(AbstractPsychoPathXPath2Impl.java:133)
      	at org.apache.xerces.impl.xs.XMLAssertPsychopathXPath2Impl.evaluateOneAssertion(XMLAssertPsychopathXPath2Impl.java:580)
      	at org.apache.xerces.impl.xs.XMLAssertPsychopathXPath2Impl.evaluateAssertionsFromAComplexType(XMLAssertPsychopathXPath2Impl.java:530)
      	at org.apache.xerces.impl.xs.XMLAssertPsychopathXPath2Impl.processAllAssertionsOnElement(XMLAssertPsychopathXPath2Impl.java:306)
      	at org.apache.xerces.impl.xs.XMLAssertPsychopathXPath2Impl.endElement(XMLAssertPsychopathXPath2Impl.java:241)
      	at org.apache.xerces.impl.xs.XSDAssertionValidator.handleEndElement(XSDAssertionValidator.java:138)
      	at org.apache.xerces.impl.xs.XMLSchemaValidator.assertionValidatorEndElementDelegate(XMLSchemaValidator.java:2113)
      	at org.apache.xerces.impl.xs.XMLSchemaValidator.handleEndElement(XMLSchemaValidator.java:2021)
      	at org.apache.xerces.impl.xs.XMLSchemaValidator.endElement(XMLSchemaValidator.java:487)
      	at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:673)
      	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1645)
      	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:324)
      	at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:890)
      	at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:813)
      	at org.apache.xerces.jaxp.validation.StreamValidatorHelper.validate(StreamValidatorHelper.java:186)
      	at org.apache.xerces.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:133)
      	at javax.xml.validation.Validator.validate(Validator.java:82)
      	at XercesValidation.main(XercesValidation.java:277)
      Caused by: java.lang.NullPointerException
      	at org.eclipse.wst.xml.xpath2.processor.internal.types.XSAnyURI.eq(XSAnyURI.java:122)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:592)
      	at org.eclipse.wst.xml.xpath2.processor.internal.function.FsEq.do_cmp_value_op(FsEq.java:365)
      	... 63 more
      
      

      Attachments

        1. dashboard.xml
          1.0 kB
          Octavian Nadolu
        2. assert.xsd
          1 kB
          Octavian Nadolu

        Activity

          People

            mukul_gandhi Mukul Gandhi
            octavian.nadolu Octavian Nadolu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: