[ https://issues.apache.org/jira/browse/XALANJ-2438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12804314#action_12804314 ]
Helge Schulz commented on XALANJ-2438: -------------------------------------- Hello Xalan committer, I have uploaded a new version of my patch, which avoids the infinite recursion in certain XPath expressions discovered by . I tested this new version with all XSL files from the sections 'accept', 'conf' and 'contrib' from the Xalan test archive (see http://svn.apache.org/repos/asf/xalan/test/trunk/tests/) and compare the output files against them of a run of an unpatched version: run-conformance-test: test-xslt-all: [echo] Testing file 'accept/collation/collation01.xsl' [echo] Testing file 'accept/collation/collation02.xsl' ... [echo] Testing file 'contrib/xsltc/schemasoft/selectHREF.xsl' [echo] Testing file 'contrib/xsltc/schemasoft/suppressEmptyElements.xsl' [echo] Compare output files of latest and fixed Xalan version [concat] [concat] 1762 of 1762 Xalan conformance test output files are identical. [concat] Total time: 32 minutes 15 seconds I also add a new test case to my test JAR file to check the infinite recursion case (see PredicateInKey-15-ChainedElementPath.xsl in the JAR file). You can run these tests with the command: java -jar PredicateInKey-XSLT-Test-1.3.jar -stepwise I tested the new patch additionally with all regression JUnit test cases of the JAXP project (see https://jaxp-sources.dev.java.net/source/browse/jaxp-sources/jaxp-ri/src/unit-test). This JUnit classes corresponds to bugs and their bug number fixed by Sun in their JDK/JRE versions. As you can see not all tests succeed with the current JDK version 1.6.0_18 and many tests are failing with the Apache Xalan versions. But there is no difference between the original and patched version. update-jaxp-tests: [echo] Update JAXP tests from JAVA-NET (jaxp-ri/src/unit-test) test-jaxp-fixed: run-jaxp-tests: [echo] Running JAXP JUnit tests with original JDK Xalan and JRE 1.6.0_18 [junit] Test bug6537913.Test FAILED (crashed) [concat] [concat] 125 of 126 JAXP JUnit tests classes succeeded. [concat] [concat] Links to bug database entries of failed tests: [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6537913> run-jaxp-tests: [echo] Running JAXP JUnit tests with fixed JDK Xalan and JRE 1.6.0_18 [junit] Test bug6537913.Test FAILED (crashed) [concat] [concat] 125 of 126 JAXP JUnit tests classes succeeded. [concat] [concat] Links to bug database entries of failed tests: [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6537913> run-jaxp-tests: [echo] Running JAXP JUnit tests with latest Apache Xalan and JRE 1.6.0_18 [junit] Test bug4892774.Bug FAILED [junit] Test bug4969042.Bug FAILED [junit] Test bug4991857.Bug FAILED [junit] Test bug6175602.Test FAILED [junit] Test bug6290947.Bug FAILED [junit] Test bug6309988.Bug FAILED [junit] Test bug6311448.UTF16Test FAILED [junit] Test bug6320118.Test FAILED [junit] Test bug6339023.Bug FAILED [junit] Test bug6384805.Test FAILED [junit] Test bug6451633.Bug FAILED [junit] Test bug6490380.Bug FAILED [junit] Test bug6490921.Bug FAILED [junit] Test bug6509668.Bug FAILED [junit] Test bug6513892.Test FAILED [junit] Test bug6521260.Test FAILED [junit] Test bug6526547.Test FAILED [junit] Test bug6537898.Test FAILED [junit] Test bug6537913.Test FAILED (crashed) [junit] Test bug6540545.Test FAILED [junit] FATAL ERROR: 'Could not compile stylesheet' [junit] Test bug6541384.Test FAILED [junit] Test bug6564400.Test FAILED [junit] Test bug6565260.Test FAILED [junit] Test bug6594813.Bug FAILED [junit] Test bug6863312.SecureProcessingTest FAILED [concat] [concat] 101 of 126 JAXP JUnit tests classes succeeded. [concat] [concat] Links to bug database entries of failed tests: [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4892774> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4969042> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4991857> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6175602> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6290947> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6309988> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6311448> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6320118> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6339023> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6384805> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6451633> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6490380> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6490921> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6509668> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6513892> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6521260> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6526547> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6537898> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6537913> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6540545> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6541384> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6564400> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6565260> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6594813> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6863312> run-jaxp-tests: [echo] Running JAXP JUnit tests with fixed Apache Xalan and JRE 1.6.0_18 [junit] Test bug4892774.Bug FAILED [junit] Test bug4969042.Bug FAILED [junit] Test bug4991857.Bug FAILED [junit] Test bug6175602.Test FAILED [junit] Test bug6290947.Bug FAILED [junit] Test bug6309988.Bug FAILED [junit] Test bug6311448.UTF16Test FAILED [junit] Test bug6320118.Test FAILED [junit] Test bug6339023.Bug FAILED [junit] Test bug6384805.Test FAILED [junit] Test bug6451633.Bug FAILED [junit] Test bug6490380.Bug FAILED [junit] Test bug6490921.Bug FAILED [junit] Test bug6509668.Bug FAILED [junit] Test bug6513892.Test FAILED [junit] Test bug6521260.Test FAILED [junit] Test bug6526547.Test FAILED [junit] Test bug6537898.Test FAILED [junit] Test bug6537913.Test FAILED (crashed) [junit] Test bug6540545.Test FAILED [junit] FATAL ERROR: 'Could not compile stylesheet' [junit] Test bug6541384.Test FAILED [junit] Test bug6564400.Test FAILED [junit] Test bug6565260.Test FAILED [junit] Test bug6594813.Bug FAILED [junit] Test bug6863312.SecureProcessingTest FAILED [concat] [concat] 101 of 126 JAXP JUnit tests classes succeeded. [concat] [concat] Links to bug database entries of failed tests: [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4892774> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4969042> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4991857> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6175602> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6290947> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6309988> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6311448> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6320118> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6339023> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6384805> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6451633> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6490380> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6490921> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6509668> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6513892> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6521260> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6526547> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6537898> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6537913> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6540545> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6541384> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6564400> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6565260> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6594813> [concat] <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6863312> BUILD SUCCESSFUL Total time: 10 minutes 42 seconds -- Helge Schulz - http://OpenSHORE.org > [PATCH] XSLTC ignores XPath predicates in xsl:key elements > ---------------------------------------------------------- > > Key: XALANJ-2438 > URL: https://issues.apache.org/jira/browse/XALANJ-2438 > Project: XalanJ2 > Issue Type: Bug > Components: XSLTC > Affects Versions: The Latest Development Code > Environment: Linux and Windows XP with Sun JRE 1.5.0_14, 1.5.0_15, > 1.6.0_04 and 1.6.0_05 > Reporter: Helge Schulz > Priority: Blocker > Fix For: The Latest Development Code > > Attachments: PredicateInKey-Sun-JRE-1_5_0_22-Fix.jar, > PredicateInKey-Sun-JRE-1_6_0_18-Fix.jar, > PredicateInKey-Xalan-SVN-r889881.patch, PredicateInKey-XSLT-Test-1.1.jar, > PredicateInKey-XSLT-Test-1.2.jar, PredicateInKey-XSLT-Test-1.3.jar, > PredicateInKey-XSLT-Test.jar, PredicateInKey.out, PredicateInKey.xml, > PredicateInKey.xsl > > > The Xalan XSLT compiler (XSLTC) ignores XPath predicates in xsl:key > elements since the class 'org.apache.xalan.xsltc.compiler.Stylesheet' > was rearranged in august 2003 to reorder the compilation of top level > XSLT elements (including keys) to respect dependencies between global > XSLT variables and keys. Method 'compileTopLevel' was changed to emit > code also for key elements and not emit code calling the method generated > by 'compileBuildKeys'. For this reason the byte code for each key element > is generated twice: First time into generated method 'buildKeys' from > 'compileBuildKeys' and second time into generated method 'topLevel' > from 'compileTopLevel'. Method 'buildKeys' is still necessary, because > it is called by the XSLT 'document' function, if additional input > documents are loaded later. > Unfortunately the translate method of some XPath elements expected to > be called only once and they remove sub elements while their first execution. > So all XPath predicates get lost in class > 'org.apache.xalan.xsltc.compiler.FilterExpr' > and 'org.apache.xalan.xsltc.compiler.Step' by a remove operation on > the '_predicates' container while the execution from 'compileBuildKeys'. > So 'compileTopLevel' generates wrong code for all key elements containing > predicates in their XPath expressions. > The attached patch changes the 'FilterExpr' and 'Step' class to use an > index variable to determine the current predicate and to not remove them. > This patch was tested with the current Subversion version of Xalan > (last change of Xalan tree in revision 584164) and with Sun JDK 1.5.0_14, > 1.5.0_15, 1.6.0_04 and 1.6.0_05. > This bug exists also in Sun JRE 1.6 (1.6.0 up to 1.6.0_05) and JRE 1.5 > (since 1.5.0_12 up to 1.5.0_15) in classes > 'com.sun.org.apache.xalan.internal.xsltc.compiler.FilterExpr' and > 'com.sun.org.apache.xalan.internal.xsltc.compiler.Step'. The attached > test JAR file contains also patches for these versions and fixes in form > of JAR files to be installed into '../jre/lib/endorsed' directories of > Sun JRE installations. The last Sun JRE version with correct handling > of xls:key elements is 1.5.0_11. > Please add the attached test files to the Xalan test suite. I have > released them under Apache license version 2.0. > Helge Schulz - OpenSHORE.org -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: xalan-dev-unsubscr...@xml.apache.org For additional commands, e-mail: xalan-dev-h...@xml.apache.org