Project

Profile

Help

Bug #1431

closed

Null pointer exception involving common subexpression optimization?

Added by Michael Kay about 12 years ago. Updated almost 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Byte code generation
Sprint/Milestone:
-
Start date:
2012-03-06
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

I've attached a fragment of a much larger program. This fragmentary program, test.xsl,

-. compiles properly with java net.sf.saxon.Transform, under standard optimization levels

-. compiles properly with the Saxon-EE 9.4.0.1N transform.exe utility, with the -opt:9 flag

-. throws a NullPointerException when compiled with the Saxon-EE 9.4.0.1N transform.exe

utility, with the standard optimization level(-opt:10)

The command used to compile this program and the associated error message are as follows:

C:\svn_fas\trunk\FAS2\activities database\implementations\SQL Server\schema preprocessing>transform -xsl:test.xsl test.xsd -o:newtest.xsd

Failed while compiling function null

java.lang.NullPointerException

    at com.saxonica.bytecode.util.CompilerService$ObjectIdentityWrapper.hashCode(CompilerService.java:196)

    at java.lang.Object.hashCode(map.xml)

    at java.util.HashMap.get(HashMap.java:317)

    at com.saxonica.bytecode.util.CompilerService.allocateStaticVariableInfo(CompilerService.java:872)

    at com.saxonica.bytecode.ExpressionCompiler.allocateStatic(ExpressionCompiler.java:408)

    at com.saxonica.bytecode.LetExpressionCompiler.compileCommonExpr(LetExpressionCompiler.java:176)

    at com.saxonica.bytecode.LetExpressionCompiler.compileToPush(LetExpressionCompiler.java:67)

    at com.saxonica.bytecode.util.CompilerService.compileToPush(CompilerService.java:671)

    at com.saxonica.bytecode.LetExpressionCompiler.compileToPush(LetExpressionCompiler.java:75)

    at com.saxonica.bytecode.util.CompilerService.compileToPush(CompilerService.java:671)

    at com.saxonica.bytecode.util.CompilerService.compileToByteCode(CompilerService.java:591)

    at com.saxonica.expr.ee.OptimizerEE.compileToByteCode(OptimizerEE.java:1322)

    at net.sf.saxon.style.XSLTemplate.optimize(XSLTemplate.java:454)

    at net.sf.saxon.style.PrincipalStylesheetModule.compileStylesheet(PrincipalStylesheetModule.java:809)

    at net.sf.saxon.PreparedStylesheet.setStylesheetDocument(PreparedStylesheet.java:360)

    at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:207)

    at net.sf.saxon.PreparedStylesheet.compile(PreparedStylesheet.java:107)

    at net.sf.saxon.Transform.doTransform(Transform.java:559)

    at cli.Saxon.Cmd.DotNetTransform.Main(Unknown Source)

Error

java.lang.NullPointerException

Failed to compile stylesheet. 1 error detected.

This error should be reproducible with any well-formed test.xsd schema.

A key statement in this program appears to be the following:

    <xsl:value-of select="((some $p in $paths-for-type satisfies 

                               'summary' eq 

                                    $activity-specification-list/activity-specification[path-to-activity-root = $p]/activity-type)

                           and 

                           (some $p in $paths-for-type satisfies 

                               'summary' ne 

                                    $activity-specification-list/activity-specification[path-to-activity-root = $p]/activity-type))"

    />

The statement, which was originally in an xsl:when's "test" attribute, attempts to check for inconsistencies

in the $activity-specification-list table. If one removes either of the "some" clauses, the program compiles.

Please register to edit this issue

Also available in: Atom PDF