Subjects
Home
Xalan extension functions
Fomatting question serializing DOM with pretty print
xalan with pull parser
Cannot find the declaration
Apache Xalan drop support to run on JRE 1 1 x
Why does Doctype change processing of a document
Node set to XML string via Java extensions in Xalan J: possible?
Templates/Transformers + thread safety???
Problem evaluating xpath with muliple prefix with different namespace
remove an arbitrary attribute from xsl output
Xalan3 XSLT 2 0 XPath 2 0 support?
Problem using compiled translets with Xalan !!
Xalan and jstl 1 1 problem with transform tag
NullPointer in DOM2DTM getLocalName
URIResolvers base parameter with xsltc and cascaded imports
Performance problem for Xalan J on intel dual core
Standard libraries in JAXP?
Serializing a DOM tree to XML file, customize entities replacement
Library Conflict Involving BCEL Library
A question on how users are using <xsl:message >
Kevin Cormier as a new Apache Xalan J committer
Struggling to iterate over tokenized string
Xalan count() trouble
Problem with recursive xpath
Error when switching to java 1 5
document( ' ')
Problem with Xalan2 7 0 transformation
cr/lf options
entity encoded XML
can xalan transform 2 xml using one xslt?
Xalan J JIRA defect review Monday October 16, 2006 from 2:00 to 3:30 pm ED
xsl transform with cdata section elements
xslt parameters not expanded
Weird behavior of XPath evaluate()
How to avoid <xsl:message > instruction prints stylesheet file informations ?
Cannot find SimpleTransform subdirectory after installing Xalan J
recover from document not found exceptions
jdk1 5 and Xalan jar differences?
Performance Issue
Error/Bug adding floating point numbers
XPathAPI: eval exp using nodes with default namespace
modifying xalan to output invalid XML
NullPointerException
mege two separate xml nodes into one
Is this a XALAN document identification bug?
is StylesheetRoot really java io Serializable ?
transform() fails for DOMSource but succeeds for StreamSource
Thoughts on Transformer parameter passing
HELP, Xalan and jstl 1 1 problem with transformer
Problem with XPath namespace axis?
string utils:replace deleting search string if replacement string is an HTML
help with enumeration values pls
xalan 2 5 1 vs 2 7 performance question
How to insert/update in XML document
HTML Serialization and Handling of Ampersands in HREF Attributes
XHTML link tag stripping
SystemId Unknown; Line #24; Column #49; java lang NullPointerException
xpath text() help
Apostrophe problem with xalan 2 7 0
How to set variables in XML document?
Links
Home
Oracle database error code ...
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
Problem using Java extensions

Problem using Java extensions

2003-02-26       - By mkwan@(protected)
Reply:     1     2  

Hi, Karen

This is not related to bug 14236. I just looked at the source code. I will
doubt that this problem is still reproducible with Xalan 2.4.1. In 2.4.1,
the keys for the cached methods are calculated in a more sophisticated way.
It is unlikely for two methods to have the same key. If you can still
reproduce the problem with Xalan 2.4.1, please open a bug in the Bugzilla
database.

Regards,

Morris Kwan
XSLT Development
IBM Toronto Lab
Tel: (905)413-3729
Email: mkwan@(protected)



                                                                             
                                                     
                     Karen Alexander                                          
                                                     
                     <Karen.Alexander@(protected)        To:       "'xalan-dev@(protected)
.apache.org'" <xalan-dev@(protected)>,                
                     mentum.com>                   "'xalan-j-users@(protected)
.org'" <xalan-j-users@(protected)>                  
                                                  cc:                        
                                                     
                     02/26/2003 03:17 AM          Subject:  Problem using Java
extensions                                            
                                                                             
                                                     
                                                                             
                                                     
                                                                             
                                                     



I have a Java class that my customers can call from within their
stylesheets.  However, I'm experiencing a problem where, occasionally, the
Java extension calls are calling the wrong methods in my class.

Here's an excerpt from a stylesheet that is making Java extension calls to
my class (DfXmlQuery):
<xsl:variable name="xdql" select="
java:com.documentum.xml.xdql.DfXmlQuery.new()"/>
<xsl:variable name="init" select="java:init($xdql)"/>
<xsl:variable name="param" select="java:setDql($xdql,$dql)"/>
<xsl:variable name="param3" select="java:includeContent($xdql,true())"/>
<xsl:variable name="param4" select="java:setErrorTag($xdql,$errorTag)"/>
<xsl:variable name="execute" select="java:execute
($xdql,'DF_READ_QUERY',$DMS_SESSION_ID)"/>
The template is instantiating my object and calling a number of methods on
it.  However, occasionally the wrong method will be called.  For example,
instead of the calling the 'execute' method, I will sometimes see that the
'setErrorTag' method is called (with the parameters that were given to the
'execute' method).

I have placed some tracing code into the org.apache.xalan.extensions
package to trace how the extension functions are being cached.  The problem
seems to be related to having the wrong function returned from a cache.

In the trace output, it looks like we do a lookup to see if the method has
been cached.  If not, it is added to the cache.  However, at one point we
do a lookup for a method (e.g. 'execute') and the cache returns a different
method (e.g. 'setErrorTag').

Here is a snippet from my trace output where the method is not (yet) in the
cache:
>> org.apache.xalan.extensions.ExtensionsTable:extFunction
('http://xml.apache.org/xslt/java', 'setErrorTag', 'Vector@(protected)',
'Object@(protected)', 'ExpressionContext@(protected)')
 >> org.apache.xalan.extensions.ExtensionHandlerJavaPackage:callFunction
('setErrorTag', 'Vector@(protected)', 'Object@(protected)', 'ExpressionContext@(protected)')
   >> org.apache.xalan.extensions.ExtensionHandlerJavaPackage:getFromCache
('Object@(protected)', 'Object@(protected)', 'Object[]@(protected)')
   << org.apache.xalan.extensions.ExtensionHandlerJavaPackage:getFromCache
--> null
   >> org.apache.xalan.extensions.MethodResolver:getMethod ('Class@(protected)',
'setErrorTag', 'Object[]@(protected)', 'Object[][]@(protected)', 'ExpressionContext@(protected)',
'2')
     >> org.apache.xalan.extensions.MethodResolver:scoreMatch ('Class[]
@(protected)', '0', 'Object[]@(protected)', '1000')
     << org.apache.xalan.extensions.MethodResolver:scoreMatch --> "1000"
     >> org.apache.xalan.extensions.MethodResolver:convertParams ('Object
[]@(protected)', 'Object[][]@(protected)', 'Class[]@(protected)', 'ExpressionContext@(protected)')
       >> org.apache.xalan.extensions.MethodResolver:convert (
'Object@(protected)', 'Class@(protected)')
       << org.apache.xalan.extensions.MethodResolver:convert -->
"XDQLError"
   << org.apache.xalan.extensions.MethodResolver:getMethod --> "public
void com.documentum.xml.xdql.DfXmlQuery.setErrorTag(java.lang.String)"
   >> org.apache.xalan.extensions.ExtensionHandlerJavaPackage:putToCache (
'Object@(protected)', 'Object@(protected)', 'Object[]@(protected)', 'Object@(protected)')
putToCache->methodKey=617111046198565750
   << org.apache.xalan.extensions.ExtensionHandlerJavaPackage:putToCache
--> null
   >> com.documentum.xml.xdql.DfXmlQuery:setErrorTag ('XDQLError')
 << org.apache.xalan.extensions.ExtensionHandlerJavaPackage:callFunction
--> null
<< org.apache.xalan.extensions.ExtensionsTable:extFunction --> null


In this snippet, the cache lookup for the 'execute' method returns
'setErrorTag':
>> org.apache.xalan.extensions.ExtensionsTable:extFunction
('http://xml.apache.org/xslt/java', 'execute', 'Vector@(protected)',
'Object@(protected)', 'ExpressionContext@(protected)')
 >> org.apache.xalan.extensions.ExtensionHandlerJavaPackage:callFunction
('execute', 'Vector@(protected)', 'Object@(protected)', 'ExpressionContext@(protected)')
   >> org.apache.xalan.extensions.ExtensionHandlerJavaPackage:getFromCache
('Object@(protected)', 'Object@(protected)', 'Object[]@(protected)')
   << org.apache.xalan.extensions.ExtensionHandlerJavaPackage:getFromCache
--> "public void
com.documentum.xml.xdql.DfXmlQuery.setErrorTag(java.lang.String)"
   >> org.apache.xalan.extensions.MethodResolver:convertParams ('Object[]
@(protected)', 'Object[][]@(protected)', 'Class[]@(protected)', 'ExpressionContext@(protected)')

My customers are using Xalan 2.2.0, but I've had them try 2.4.1 and them
still see the problem.

I've been searching through the bug database and bug 14236 (
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14236) looks somewhat
similar to my issue.  Can you tell me if the fix is in the 2.4.1 release?

I'm guessing that the fix isn't in 2.4.1, so I'm trying to build the code
from CVS.  However, I'm having some problems because I have to make sure
that the code is compatible with Java 1.1.8.  Are the jar files available
for the nightly builds?

Thanks for your help,
- Karen