This fixes PR36220 by avoiding withParams ever being null.
We instead let the stylesheet return the empty list, rather than
replacing it with a null return value. This also avoids having
to special-case the null value in other methods.
ChangeLog:
2008-06-23 Andrew John Hughes <[EMAIL PROTECTED]>
PR classpath/36220:
* gnu/xml/transform/CallTemplateNode.java:
(doApply(Stylesheet,QName,Node,int,int,Node,Node)):
Check for withParams being empty not null.
(references(QName)): Remove special-casing for null.
* gnu/xml/transform/Stylesheet.java:
(parseWithParams(Node)): Just return the list if empty,
don't return null instead.
--
Andrew :)
Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net
PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint = F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8
Index: gnu/xml/transform/CallTemplateNode.java
===================================================================
RCS file: /sources/classpath/classpath/gnu/xml/transform/CallTemplateNode.java,v
retrieving revision 1.6
diff -u -u -r1.6 CallTemplateNode.java
--- gnu/xml/transform/CallTemplateNode.java 17 Mar 2008 01:28:14 -0000
1.6
+++ gnu/xml/transform/CallTemplateNode.java 23 Jun 2008 17:52:22 -0000
@@ -88,7 +88,7 @@
TemplateNode t = stylesheet.getTemplate(mode, name);
if (t != null)
{
- if (withParams != null)
+ if (!withParams.isEmpty())
{
// compute the parameter values
LinkedList values = new LinkedList();
@@ -120,7 +120,7 @@
}
t.apply(stylesheet, mode, context, pos, len,
parent, nextSibling);
- if (withParams != null)
+ if (!withParams.isEmpty())
{
// pop the variable context
stylesheet.bindings.pop(Bindings.WITH_PARAM);
@@ -135,13 +135,10 @@
public boolean references(QName var)
{
- if (withParams != null)
+ for (Iterator i = withParams.iterator(); i.hasNext(); )
{
- for (Iterator i = withParams.iterator(); i.hasNext(); )
- {
- if (((WithParam) i.next()).references(var))
- return true;
- }
+ if (((WithParam) i.next()).references(var))
+ return true;
}
return super.references(var);
}
Index: gnu/xml/transform/Stylesheet.java
===================================================================
RCS file: /sources/classpath/classpath/gnu/xml/transform/Stylesheet.java,v
retrieving revision 1.13
diff -u -u -r1.13 Stylesheet.java
--- gnu/xml/transform/Stylesheet.java 22 Jun 2008 23:57:17 -0000 1.13
+++ gnu/xml/transform/Stylesheet.java 23 Jun 2008 17:52:24 -0000
@@ -1680,7 +1680,7 @@
}
node = node.getNextSibling();
}
- return ret.isEmpty() ? null : ret;
+ return ret;
}
/**