xalan-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Holger Rehn (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (XALANJ-2570) Argument type mismatch when using Java extension
Date Thu, 21 Mar 2013 15:09:15 GMT

     [ https://issues.apache.org/jira/browse/XALANJ-2570?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Holger Rehn updated XALANJ-2570:
--------------------------------

    Description: 
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)). 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.

  was:
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.

    
> 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)). 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: dev-unsubscribe@xalan.apache.org
For additional commands, e-mail: dev-help@xalan.apache.org


Mime
View raw message