Incorrect assumption on the class name in compile(InputSource input, String name) at XSLTC.java
Cheng Jin
jincheng at ca.ibm.com
Sat Oct 23 14:52:25 UTC 2021
Many thanks for reminder. Will bring this up in there.
Thanks and Best Regards
Cheng Jin
jincheng at ca.ibm.com
From: "Alan Bateman" <Alan.Bateman at oracle.com>
To: "Cheng Jin" <jincheng at ca.ibm.com>, jdk-dev at openjdk.java.net
Date: 2021-10-23 02:17 AM
Subject: [EXTERNAL] Re: Incorrect assumption on the class name in
compile(InputSource input, String name) at XSLTC.java
On 22/10/2021 21:59, Cheng Jin wrote:
>
> Hi there,
>
> The code in compile(InputSource input, String name) at
>
https://github.com/openjdk/jdk/blob/master/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java
> seems incorrect as follows:
>
> public boolean compile(InputSource input, String name) {
> try {
> // Reset globals in case we're called by compile(ArrayList
v);
> reset();
>
> // The systemId may not be set, so we'll have to check the
URL
> String systemId = null;
> if (input != null) {
> systemId = input.getSystemId();
> }
>
> // Set the translet class name if not already set
> if (_className == null) {
> if (name != null) {
> setClassName(name);
> }
> else if (systemId != null && !systemId.equals("")) {
> setClassName(Util.baseName(systemId)); <-------
> incorrect here
> }
>
> // Ensure we have a non-empty class name at this point
> if (_className == null || _className.length() == 0) {
> setClassName("GregorSamsa"); // default translet
name
> }
> }
> ...
>
> Specifically, the code above assumes that systemId is something like
> "xxx:yyyy" in which case the class name (_className) is
> "die.verwandlung.yyy" ("die.verwandlung." is the default package name
since
> Java11) However,Util.baseName(systemId) returns null when systemId is
> something like "xxx:" (empty after ":"), in which case the class name
> (_className) ends up with "die.verwandlung." (an invalid class name
> inserted in the constant pool of the generated bytecode).
Can you bring this to the core-libs-dev mailing list? This is where XML
issues and issues with the XSLT compiler are usually discussed/reviewed.
-Alan.
More information about the jdk-dev
mailing list