[
https://issues.apache.org/jira/browse/XALANJ-2570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14032790#comment-14032790
]
hello.world commented on XALANJ-2570:
-------------------------------------
Changing from StringBuilder to StringBuffer helped me solve the problem. But
you probably will get the same error if using StringBuffer in Java 6.
> 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: The Latest Development Code, 2.7.1, 2.7.D2, 2.7.2
> Reporter: Holger Rehn
> Assignee: Steven J. Hathaway
> Priority: Blocker
> Attachments: XalanJ-2570.diff
>
>
> In a stylesheet I'm 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)) which causes an
> IllegalArgumentException to be thrown. 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 was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]