Holger Rehn created XALANJ-2570:
-----------------------------------
Summary: Argument type mismatch when using Java extension
Key: XALANJ-2570
URL: https://issues.apache.org/jira/browse/XALANJ-2570
Project: XalanJ2
Issue Type: Bug
Security Level: No security risk; visible to anyone (Ordinary problems in
Xalan projects. Anybody can view the issue.)
Components: Xalan-extensions
Affects Versions: 2.7.1, The Latest Development Code, 2.7.D2, 2.7.2
Reporter: Holger Rehn
Assignee: Steven J. Hathaway
Priority: Blocker
In a stylesheet calling method append() on a StringBuilder provided as
parameter:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:java="http://xml.apache.org/xslt/java">
<xsl:param name="SB" />
<xsl:template match="/">
<xsl:message><xsl:value-of select="java:append( $SB, 'text'
)"/></xsl:message>
</xsl:template>
</xsl:stylesheet>
Problem #1:
In the example above the MethodResolver may not choose the appropriate method.
It does work with Java 7 build 1.7.0-b147 (choosing
StringBuilder.append(String)), but not with the latest Java 7 Update 17
(choosing StringBuilder.append(CharSequence)). Method
MethodResolver.scoreMatch() returns the same score for both (and other) methods
because the value is of class XObject.CLASS_STRING.
Problem #2:
MethodResolver.convert() is not able to handle values of type CharSequence
properly and ends up converting the String value into a Double (NaN).
Please find attached a patch (against trunk, SVN revision 1383083) addressing
problem #2 and improving MethodResolver.scoreMatch() to provide a better score
if a value exactly matches the target type, compared to a value only assignable
to the target type.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]