oraxsl infinite loop using kutable.xsl and xml with default column value
oraxsl goes into an infinite loop when transforming table xml files if the table has a column with a default value; tables with no default value columns transform properly. Eventually a java.lang.StackOverflowError is thrown.
Steps to reproduce (Oracle 11gR2 - Oracle Enterprise Linux)
1. Create two tables - one with a column having a default value, one with no columns having defaults.
CREATE TABLE TABLE_WITH_DEFAULT_COLUMN
(
COLA CHAR(1 BYTE) DEFAULT 'N',
COLB CHAR(1 BYTE)
)
CREATE TABLE TABLE_WITH_NO_DEFAULT_COLUMN
(
COLA CHAR(1 BYTE),
COLB CHAR(1 BYTE)
)
2. Extract the table metadata using the dbms_metadata functionality and save the resulting clobs to files.
select dbms_metadata.get_xml('TABLE', 'TABLE_WITH_DEFAULT_COLUMN', 'REMEDY') FROM DUAL
select dbms_metadata.get_xml('TABLE', 'TABLE_WITH_NO_DEFAULT_COLUMN', 'REMEDY') FROM DUAL
3. Using the stylesheets in the $ORACLE_HOME/RDBMS/XML/XSL folder perform the transform on the table with no default columns
java -cp .\xmlparserv2.jar;.\orai18n-collation.jar oracle.xml.parser.v2.oraxsl TABLE_WITH_NO_DEFAULT_COLUMN.xml xsl\kutable.xsl
The result is a valid CREATE TABLE ddl statement.
4. 3. Using the stylesheets in the $ORACLE_HOME/RDBMS/XML/XSL folder perform the transform on the table that has a column with a default value.
java -cp .\xmlparserv2.jar;.\orai18n-collation.jar oracle.xml.parser.v2.oraxsl TABLE_WITH_DEFAULT_COLUMN.xml xsl\kutable.xsl
The result is an infinite loop and a java.lang.StackOverflowError is thrown. Increasing the stack size (-Xss100m) to 100 megabytes only delays the exception.
The external stylesheets at RDBMS/XML/XSL are identical to those stored in the database (SYS.METASTYLESHEET) except for the import statement references:
External version of import
<xsl:import href="kucommon.xsl"/>
DB version of import
<xsl:import href="/oradb/SYS/METASTYLESHEET/ROW[NAME='kucommon' and MODEL='ORACLE']/STYLESHEET/text()"/>
Yet the DBMS_METADATA.GET_DDL function returns the proper result.
I am using the xdk version_11.1.1.3.0_production version of the xmllparserv2.jar file
Any idea as to the cause of an infinite loop when the transform is done externally?