[ 
https://issues.apache.org/jira/browse/XERCESJ-1633?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13997322#comment-13997322
 ] 

Mukul Gandhi commented on XERCESJ-1633:
---------------------------------------

thoughts about psychopath library version, that's currently in SVN: the 
released Xerces-J XSD 1.1 beta has psychopath library jar named as 
org.eclipse.wst.xml.xpath2.processor_1.1.0.jar. it is relative to this version 
number, that psychopath library version in SVN is repeating after each fix just 
now (i.e, we're just now constantly repeating 
org.eclipse.wst.xml.xpath2.processor_1.2.0.jar after each fix, which I expect 
to be part of our next release). the version number on file 
org.eclipse.wst.xml.xpath2.processor_1.2.0.jar that's in SVN just now, has no 
relation to other psychopath jar produced at eclipse just now which are not 
related to Xerces-J development.

thoughts about this jira report: I agree, this looks like a bug in the current 
psychopath library and we may attempt a fix. looking at the example you've 
posted, it seems the user wanted to write as follows,

intended XML document:

<?xml version="1.0" encoding="UTF-8"?>
<dashboard xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:noNamespaceSchemaLocation="assert.xsd">
    <widget type="chart">
        <title text="Chart Title"></title>
        <plotOptions xmlns="http://jaspersoft.com/highcharts";>
            <plotOptions>
                <pie showInLegend="true" shadow="false" innerSize="50%">
                    <dataLabels color="#fff" distance="-20" 
format="{point.percentage:.0f} %" overflow="false"></dataLabels>
                </pie>
            </plotOptions>
            <legend width="150" align="right" x="10" layout="vertical">
                <navigation></navigation>
            </legend>
            <tooltip enabled="false"></tooltip>
            <exporting enabled="true"></exporting>
        </plotOptions>
    </widget>
    <widget type="table">
        <title>table</title>
                <table xmlns="http://www.w3.org/1999/xhtml";>
           <thead>dsds</thead>
           <tbody>dsds</tbody>
                </table>
    </widget>
</dashboard>

intended <assert>:

<xs:assert test="(@type = 'chart' and ns0:plotOptions) or (@type = 'table' and 
ns1:table)" xmlns:ns0="http://jaspersoft.com/highcharts"; 
xmlns:ns1="http://www.w3.org/1999/xhtml"/>

may be, this workaround can be suggested to user for time being.

> Xerces crashes when validating an XML with an XSD that contains asserts
> -----------------------------------------------------------------------
>
>                 Key: XERCESJ-1633
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1633
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.1 Structures
>    Affects Versions: 2.11.0
>            Reporter: Octavian Nadolu
>         Attachments: assert.xsd, dashboard.xml
>
>
> 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.
> {code}
> 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
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to