[
http://issues.apache.org/jira/browse/XALANJ-2108?page=comments#action_12450278
]
Brian Minchau commented on XALANJ-2108:
---------------------------------------
In reviewing Santiago's original patch I find that it doesn't fully take due to
some code motion since it was
created.
All parts of the patch take, except for the second change in KeyCall.java which
wanted to insert this:
// If in a top-level element, create dependency to the referenced key
addParentDependency();
just before
return returnType;
Just one other part of the patch wouldn't take, and that was the second
sub-patch of Stylesheet.java which
wanted to change this:
// Resolve any forward referenes and translate global variables/params
_globals = resolveReferences(_globals);
final int count = _globals.size();
for (int i = 0; i < count; i++) {
final VariableBase var = (VariableBase)_globals.elementAt(i);
var.translate(classGen,toplevel);
}
// Compile code for other top-level elements
Vector whitespaceRules = new Vector();
into this:
// Create a new list containing variables/params + keys
Vector varDepElements = new Vector(_globals);
Enumeration elements = elements();
while (elements.hasMoreElements()) {
final Object element = elements.nextElement();
if (element instanceof Key) {
varDepElements.add(element);
}
}
// Determine a partial order for the variables/params and keys
varDepElements = resolveDependencies(varDepElements);
// Translate vars/params and keys in the right order
final int count = varDepElements.size();
for (int i = 0; i < count; i++) {
final TopLevelElement tle = (TopLevelElement)
varDepElements.elementAt(i);
tle.translate(classGen, toplevel);
if (tle instanceof Key) {
final Key key = (Key) tle;
_keys.put(key.getName(), key);
}
}
// Compile code for other top-level elements
Vector whitespaceRules = new Vector();
elements = elements();
So I massaged the patch a little to produce patch2.txt which I am attaching.
Santiaogo, please verify that my patch2.txt is really the same as your original
patch, just updated to
make it stick in those places.
Thanks,
Brian
> incorrect use of xsl:key cause NullPointerException
> ---------------------------------------------------
>
> Key: XALANJ-2108
> URL: http://issues.apache.org/jira/browse/XALANJ-2108
> Project: XalanJ2
> Issue Type: Bug
> Components: XSLTC
> Affects Versions: 2.6
> Environment: windows jdk 1.42.06
> Reporter: arnaud
> Assigned To: Santiago Pericas-Geertsen
> Priority: Minor
> Attachments: patch-2108-6401137.txt, patch-2108-patch2.txt
>
>
> my stylesheet
> -------------
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method = "html" encoding="iso-8859-1" />
>
> <xsl:variable name = "x" select = "'1'" />
> <xsl:variable name = "y" select = "'4'" />
> <xsl:key name = "key_test" match ="test" use = "substring(date, $x,
> $y)" />
>
> <xsl:template match="/">
> </xsl:template>
> </xsl:stylesheet>
> xml file
> <test><date>2004-01-01</date></test>
> java.lang.NullPointerException
> at
> java.lang.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:980)
> at java.lang.Double.valueOf(Double.java:202)
> at
> org.apache.xalan.xsltc.runtime.BasisLibrary.stringToReal(BasisLibrary.java:838)
> at ent_recherche_simple.buildKeys()
> at ent_recherche_simple.transform()
> at
> org.apache.xalan.xsltc.runtime.AbstractTranslet.transform(AbstractTranslet.java:580)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
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]