JDK-8167179 : Make XSL generated namespace prefixes local to transformation process
  • Type: Bug
  • Component: xml
  • Sub-Component: jaxp
  • Affected Version: 6u29
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-10-05
  • Updated: 2018-02-08
  • Resolved: 2016-10-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7 JDK 8 JDK 9 Other
6u151Fixed 7u121Fixed 8u121Fixed 9 b142Fixed openjdk7uFixed
Description
Transformations that utilizes 'namespace-uri()' function generates different namespace prefixes.
As a result subsequent transformations of the same XML content with the same XSL will result in different content generated.
The example of two subsequent iterations results can be:
Iteration 1:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:TestRoot xmlns:ns0="test.xmlns">
<ns1:Element1 xmlns:ns1="test.xmlns">
</ns1:Element1>
<ns2:Element2 xmlns:ns2="test.xmlns">
</ns2:Element2>
</ns0:TestRoot>

Iteration 2:
<?xml version="1.0" encoding="UTF-8"?>
<ns3:TestRoot xmlns:ns3="test.xmlns">
<ns4:Element1 xmlns:ns4="test.xmlns">
</ns4:Element1>
<ns5:Element2 xmlns:ns5="test.xmlns">
</ns5:Element2>
</ns3:TestRoot>

Such behavior can lead to the high memory usages by cached transformer/templates instances: The unique namespace prefixes will be stored in Xerces SymbolTable associated with the cached transformer. The BasisLibrary::generatePrefix method should be fixed to generate the same prefixes numbers for each transformation operation, i.e. the prefix index counter should be made thread local and needs to be reset during the start of each transformation process.
Comments
SQE OK: No issues found with the fix during 7u121 b32 BPR testing.
19-12-2016

Review thread: http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-October/044239.html
19-10-2016