mmidy 01/03/19 14:05:15
Modified: java/src/org/apache/xalan/transformer KeyWalker.java
Log:
Throw an error message if the key name in a key function was not defined
Revision Changes Path
1.12 +7 -1
xml-xalan/java/src/org/apache/xalan/transformer/KeyWalker.java
Index: KeyWalker.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/KeyWalker.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- KeyWalker.java 2001/01/02 03:36:51 1.11
+++ KeyWalker.java 2001/03/19 22:05:13 1.12
@@ -62,6 +62,8 @@
import org.apache.xml.utils.PrefixResolver;
import org.apache.xml.utils.QName;
import org.apache.xalan.templates.KeyDeclaration;
+import org.apache.xalan.res.XSLMessages;
+import org.apache.xalan.res.XSLTErrorResources;
import org.apache.xpath.XPathContext;
import org.apache.xpath.axes.DescendantOrSelfWalker;
import org.apache.xpath.objects.XObject;
@@ -167,7 +169,7 @@
*/
public short acceptNode(Node testNode)
{
-
+ boolean foundKey = false;
KeyIterator ki = (KeyIterator) m_lpi;
Vector keys = ki.getKeyDeclarations();
@@ -189,6 +191,7 @@
if(!kd.getName().equals(name))
continue;
+ foundKey = true;
ki.getXPathContext().setNamespaceContext(ki.getPrefixResolver());
// See if our node matches the given key declaration according to
@@ -250,6 +253,9 @@
// TODO: What to do?
}
+ if (!foundKey)
+ throw new RuntimeException
+
(XSLMessages.createMessage(XSLTErrorResources.ER_NO_XSLKEY_DECLARATION, new
Object[]{name.getLocalName()}));
return this.FILTER_REJECT;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]