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 Karen Alexander
Reply:     1     2  

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)'
<mailto:'Vector@(protected)'> , 'Object@(protected)' <mailto:'Object@(protected)'> ,
'ExpressionContext@(protected)' <mailto:'ExpressionContext@(protected)'> )
 >> org.apache.xalan.extensions.ExtensionHandlerJavaPackage:callFunction
('setErrorTag', 'Vector@(protected)' <mailto:'Vector@(protected)'> , 'Object@(protected)'
<mailto:'Object@(protected)'> , 'ExpressionContext@(protected)'
<mailto:'ExpressionContext@(protected)'> )
   >> org.apache.xalan.extensions.ExtensionHandlerJavaPackage:getFromCache
('Object@(protected)' <mailto:'Object@(protected)'> , 'Object@(protected)'
<mailto:'Object@(protected)'> , 'Object[]@(protected)')
   << org.apache.xalan.extensions.ExtensionHandlerJavaPackage:getFromCache
--> null
   >> org.apache.xalan.extensions.MethodResolver:getMethod ('Class@(protected)'
<mailto:'Class@(protected)'> , 'setErrorTag', 'Object[]@(protected)', 'Object[][]@(protected)',
'ExpressionContext@(protected)' <mailto:'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)'
<mailto:'ExpressionContext@(protected)'> )
       >> org.apache.xalan.extensions.MethodResolver:convert
('Object@(protected)' <mailto:'Object@(protected)'> , 'Class@(protected)'
<mailto:'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)' <mailto:'Object@(protected)'> , 'Object@(protected)'
<mailto:'Object@(protected)'> , 'Object[]@(protected)', 'Object@(protected)'
<mailto:'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)'
<mailto:'Vector@(protected)'> , 'Object@(protected)' <mailto:'Object@(protected)'> ,
'ExpressionContext@(protected)' <mailto:'ExpressionContext@(protected)'> )
 >> org.apache.xalan.extensions.ExtensionHandlerJavaPackage:callFunction
('execute', 'Vector@(protected)' <mailto:'Vector@(protected)'> , 'Object@(protected)'
<mailto:'Object@(protected)'> , 'ExpressionContext@(protected)'
<mailto:'ExpressionContext@(protected)'> )
   >> org.apache.xalan.extensions.ExtensionHandlerJavaPackage:getFromCache
('Object@(protected)' <mailto:'Object@(protected)'> , 'Object@(protected)'
<mailto:'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)'
<mailto:'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
<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


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<TITLE>Message</TITLE>

<META content="MSHTML 6.00.2600.0" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=000024406-26022003><FONT face="Comic Sans MS" size=2>I have a
Java class that my customers can call from within their stylesheets.&nbsp;
However, </FONT></SPAN><SPAN class=000024406-26022003><FONT face="Comic Sans MS
"
size=2>I'm experiencing a problem where, occasionally, the Java extension calls
are calling the wrong methods in my class.</FONT></SPAN></DIV>
<DIV><SPAN class=000024406-26022003><FONT face="Comic Sans MS"
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=000024406-26022003><FONT face="Comic Sans MS" size=2>Here's an
excerpt from a stylesheet that is making Java extension calls to my class
(DfXmlQuery):</FONT></SPAN></DIV>
<DIV><SPAN class=000024406-26022003><FONT face="Comic Sans MS" size=2><FONT
face="Courier New">&lt;xsl:variable name="xdql"
select="java:com.documentum.xml.xdql.DfXmlQuery.new()"/&gt;<BR>&lt;xsl:variable
name="init" select="java:init($xdql)"/&gt;<BR>&lt;xsl:variable name="param"
select="java:setDql($xdql,$dql)"/&gt;<BR>&lt;xsl:variable name="param3"
select="java:includeContent($xdql,true())"/&gt;<BR>&lt;xsl:variable
name="param4" select="java:setErrorTag($xdql,$errorTag)"/&gt;<BR></FONT><FONT
face="Courier New">&lt;xsl:variable name="execute"
select="java:execute($xdql,'DF_READ_QUERY',$DMS_SESSION_ID)"/&gt;<BR></FONT><
/FONT></SPAN></DIV>
<DIV><SPAN class=000024406-26022003><FONT face="Comic Sans MS" size=2>The
template is instantiating my object and calling a number of methods on it.&nbsp
;
However, occasionally the wrong method will be called.&nbsp; 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).</FONT></SPAN></DIV>
<DIV><SPAN class=000024406-26022003><FONT face="Comic Sans MS"
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=000024406-26022003><FONT face="Comic Sans MS" size=2>I have
placed some tracing code into the org.apache.xalan.extensions package to trace
how the extension functions are being cached.&nbsp; The problem seems to be
related to having the wrong function returned from a cache.&nbsp;
</FONT></SPAN></DIV>
<DIV><SPAN class=000024406-26022003><FONT face="Comic Sans MS"
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=000024406-26022003><FONT face="Comic Sans MS" size=2>In the
trace output, it looks like we do a lookup to see if the method has been
cached.&nbsp; If not, it is added to the cache.&nbsp; However, at one point we
do a lookup for a method (e.g. 'execute') and the cache returns a different
method (e.g. 'setErrorTag').</FONT></SPAN></DIV>
<DIV><SPAN class=000024406-26022003><FONT face="Comic Sans MS"
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=000024406-26022003><FONT face="Comic Sans MS" size=2>Here is a
snippet from&nbsp;my trace output where the method is not (yet) in the
cache:</FONT></SPAN></DIV>
<DIV><SPAN class=000024406-26022003><FONT face="Comic Sans MS" size=2><FONT
face="Courier New" size=1>&gt;&gt;
org.apache.xalan.extensions.ExtensionsTable:extFunction
('http://xml.apache.org/xslt/java', 'setErrorTag', <A
href="mailto:'Vector@(protected)'">'Vector@(protected)'</A>, <A
href="mailto:'Object@(protected)'">'Object@(protected)'</A>, <A
href="mailto:'ExpressionContext@(protected)'">'ExpressionContext@(protected)'</A>)<BR>&nbsp;
&gt;&gt; org.apache.xalan.extensions.ExtensionHandlerJavaPackage:callFunction
('setErrorTag', <A href="mailto:'Vector@(protected)'">'Vector@(protected)'</A>, <A
href="mailto:'Object@(protected)'">'Object@(protected)'</A>, <A
href="mailto:'ExpressionContext@(protected)'">'ExpressionContext@(protected)'</A>)<BR>&nbsp;
&nbsp;&nbsp;
&gt;&gt; org.apache.xalan.extensions.ExtensionHandlerJavaPackage:getFromCache
(<A href="mailto:'Object@(protected)'">'Object@(protected)'</A>, <A
href="mailto:'Object@(protected)'">'Object@(protected)'</A>,
'Object[]@(protected)')<BR>&nbsp;&nbsp;&nbsp; &lt;&lt;
org.apache.xalan.extensions.ExtensionHandlerJavaPackage:getFromCache --&gt;
null<BR>&nbsp;&nbsp;&nbsp; &gt;&gt;
org.apache.xalan.extensions.MethodResolver:getMethod (<A
href="mailto:'Class@(protected)'">'Class@(protected)'</A>, 'setErrorTag', 'Object[]@(protected)',
'Object[][]@(protected)', <A
href="mailto:'ExpressionContext@(protected)'">'ExpressionContext@(protected)'</A>,
'2')<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &gt;&gt;
org.apache.xalan.extensions.MethodResolver:scoreMatch ('Class[]@(protected)', '0',
'Object[]@(protected)', '1000')<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;&lt;
org.apache.xalan.extensions.MethodResolver:scoreMatch --&gt;
"1000"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &gt;&gt;
org.apache.xalan.extensions.MethodResolver:convertParams ('Object[]@(protected)',
'Object[][]@(protected)', 'Class[]@(protected)', <A
href="mailto:'ExpressionContext@(protected)'">'ExpressionContext@(protected)'</A>)<BR>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&gt;&gt; org.apache.xalan.extensions.MethodResolver:convert (<A
href="mailto:'Object@(protected)'">'Object@(protected)'</A>, <A
href="mailto:'Class@(protected)'">'Class@(protected)'</A>)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;
&lt;&lt; org.apache.xalan.extensions.MethodResolver:convert --&gt;
"XDQLError"<BR>&nbsp;&nbsp;&nbsp; &lt;&lt;
org.apache.xalan.extensions.MethodResolver:getMethod --&gt; "public void
com.documentum.xml.xdql.DfXmlQuery.setErrorTag(java.lang.String)"<BR>&nbsp;
&nbsp;&nbsp;
&gt;&gt; org.apache.xalan.extensions.ExtensionHandlerJavaPackage:putToCache (<A
href="mailto:'Object@(protected)'">'Object@(protected)'</A>, <A
href="mailto:'Object@(protected)'">'Object@(protected)'</A>, 'Object[]@(protected)', <A
href="mailto:'Object@(protected)'">'Object@(protected)'</A>)<BR>putToCache-&gt
;methodKey=617111046198565750<BR>&nbsp;&nbsp;&nbsp;
&lt;&lt; org.apache.xalan.extensions.ExtensionHandlerJavaPackage:putToCache
--&gt; null<BR>&nbsp;&nbsp;&nbsp; &gt;&gt;
com.documentum.xml.xdql.DfXmlQuery:setErrorTag ('XDQLError')<BR>&nbsp; &lt;&lt;
org.apache.xalan.extensions.ExtensionHandlerJavaPackage:callFunction --&gt;
null<BR>&lt;&lt; org.apache.xalan.extensions.ExtensionsTable:extFunction --&gt;
null</FONT></FONT></SPAN></DIV>
<DIV><SPAN class=000024406-26022003><FONT face="Comic Sans MS"
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=000024406-26022003><FONT face="Comic Sans MS" size=2><FONT
face="Courier New" size=1><FONT face="Comic Sans MS" size=2></FONT>&nbsp;</DIV>
<DIV><SPAN class=000024406-26022003></SPAN><FONT face="Comic Sans MS"><FONT
size=2>I<SPAN class=000024406-26022003>n this snippet, the cache lookup for the
'execute' method returns&nbsp;'setErrorTag':</SPAN></FONT></FONT><BR>&gt;&gt;
org.apache.xalan.extensions.ExtensionsTable:extFunction
('http://xml.apache.org/xslt/java', 'execute', <A
href="mailto:'Vector@(protected)'">'Vector@(protected)'</A>, <A
href="mailto:'Object@(protected)'">'Object@(protected)'</A>, <A
href="mailto:'ExpressionContext@(protected)'">'ExpressionContext@(protected)'</A>)<BR>&nbsp;
&gt;&gt; org.apache.xalan.extensions.ExtensionHandlerJavaPackage:callFunction
('execute', <A href="mailto:'Vector@(protected)'">'Vector@(protected)'</A>, <A
href="mailto:'Object@(protected)'">'Object@(protected)'</A>, <A
href="mailto:'ExpressionContext@(protected)'">'ExpressionContext@(protected)'</A>)<BR>&nbsp;
&nbsp;&nbsp;
&gt;&gt; org.apache.xalan.extensions.ExtensionHandlerJavaPackage:getFromCache
(<A href="mailto:'Object@(protected)'">'Object@(protected)'</A>, <A
href="mailto:'Object@(protected)'">'Object@(protected)'</A>,
'Object[]@(protected)')<BR>&nbsp;&nbsp;&nbsp; &lt;&lt;
org.apache.xalan.extensions.ExtensionHandlerJavaPackage:getFromCache --&gt;
"public void
com.documentum.xml.xdql.DfXmlQuery.setErrorTag(java.lang.String)"<BR>&nbsp;
&nbsp;&nbsp;
&gt;&gt; org.apache.xalan.extensions.MethodResolver:convertParams
('Object[]@(protected)', 'Object[][]@(protected)', 'Class[]@(protected)', <A
href="mailto:'ExpressionContext@(protected)'">'ExpressionContext@(protected)'</A>)<BR></DIV><
/FONT><FONT
face="Courier New" size=1></FONT>
<DIV>&nbsp;</DIV>
<DIV><SPAN class=000024406-26022003>My customers are using Xalan 2.2.0, but I
've
had them try 2.4.1 and them still see the problem.&nbsp;</SPAN></DIV>
<DIV><SPAN class=000024406-26022003></SPAN>&nbsp;</DIV>
<DIV><SPAN class=000024406-26022003>I've been searching through the bug
database
and bug 14236 (<A
href="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14236">http://nagoya
.apache.org/bugzilla/show_bug.cgi?id=14236</A>)
looks somewhat similar to my issue.&nbsp; Can you tell me if the fix is in the
2.4.1 release?&nbsp; </SPAN></DIV>
<DIV><SPAN class=000024406-26022003></SPAN>&nbsp;</DIV>
<DIV><SPAN class=000024406-26022003></SPAN><SPAN class=000024406-26022003>I'm
guessing that the fix isn't in 2.4.1, so I'm&nbsp;trying to build the code from
CVS.&nbsp; However, I'm having some problems because I have to make sure that
the code is compatible with Java 1.1.8.&nbsp; Are the jar files available for
the nightly builds?</SPAN></DIV></FONT></SPAN>
<DIV><FONT face="Comic Sans MS" size=2></FONT>&nbsp;</DIV>
<DIV><FONT face="Comic Sans MS" size=2><SPAN class=000024406-26022003>Thanks
for
your help,</SPAN></FONT></DIV>
<DIV><FONT face="Comic Sans MS" size=2><SPAN
class=000024406-26022003></SPAN></FONT><FONT face="Comic Sans MS" size=2>&nbsp;
-
Karen</FONT> </DIV>
<DIV>&nbsp;</DIV></BODY></HTML>