mmidy 00/02/23 12:07:14
Modified: src/org/apache/xalan/xpath FuncKey.java
src/org/apache/xalan/xpath/res XPATHErrorResources.java
Log:
Check number of args to key() function
Revision Changes Path
1.5 +2 -0 xml-xalan/src/org/apache/xalan/xpath/FuncKey.java
Index: FuncKey.java
===================================================================
RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xpath/FuncKey.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- FuncKey.java 2000/01/05 23:05:25 1.4
+++ FuncKey.java 2000/02/23 20:07:13 1.5
@@ -86,6 +86,8 @@
{
path.error(context, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC);
//"context does not have an owner document!");
}
+ if (args.size()!= 2)
+ path.error(XPATHErrorResources.ER_KEY_HAS_TOO_MANY_ARGS);
String keyname = ((XObject)args.elementAt(0)).str();
XObject arg = (XObject)args.elementAt(1);
boolean argIsNodeSet = (XObject.CLASS_NODESET == arg.getType());
1.11 +6 -1
xml-xalan/src/org/apache/xalan/xpath/res/XPATHErrorResources.java
Index: XPATHErrorResources.java
===================================================================
RCS file:
/home/cvs/xml-xalan/src/org/apache/xalan/xpath/res/XPATHErrorResources.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XPATHErrorResources.java 2000/02/23 15:16:16 1.10
+++ XPATHErrorResources.java 2000/02/23 20:07:14 1.11
@@ -19,7 +19,7 @@
public static final String ERROR_SUFFIX = "ER";
public static final String WARNING_SUFFIX = "WR";
-public static final int MAX_CODE = 44; // this is needed to
keep track of the number of messages
+public static final int MAX_CODE = 45; // this is needed to
keep track of the number of messages
public static final int MAX_WARNING = 10; // this is needed to
keep track of the number of warnings
public static final int MAX_OTHERS = 20;
public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING +1;
@@ -278,6 +278,11 @@
public static final int ER_AXES_NOT_ALLOWED = 44;
static {contents[ER_AXES_NOT_ALLOWED][1]
= "Only child:: and attribute:: axes are allowed in match
patterns! Offending axes = {0}";
+}
+
+public static final int ER_KEY_HAS_TOO_MANY_ARGS = 45;
+static {contents[ER_KEY_HAS_TOO_MANY_ARGS ][1]
+ = "key() has an incorrect number of arguments.";
}