mkwan 2003/07/10 07:41:03
Modified: java/src/org/apache/xpath/compiler Compiler.java
Log:
Fix for bugzilla 17630 (method keys for extension functions are not unique).
Revision Changes Path
1.34 +15 -4 xml-xalan/java/src/org/apache/xpath/compiler/Compiler.java
Index: Compiler.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/compiler/Compiler.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- Compiler.java 30 Jan 2003 18:46:25 -0000 1.33
+++ Compiler.java 10 Jul 2003 14:41:02 -0000 1.34
@@ -1093,6 +1093,20 @@
}
}
+ // The current id for extension functions.
+ private static long s_nextMethodId = 0;
+
+ /**
+ * Get the next available method id
+ */
+ synchronized private long getNextMethodId()
+ {
+ if (s_nextMethodId == Long.MAX_VALUE)
+ s_nextMethodId = 0;
+
+ return s_nextMethodId++;
+ }
+
/**
* Compile an extension function.
*
@@ -1123,10 +1137,7 @@
// can cache the object needed to invoke it. This way, we only pay the
// reflection overhead on the first call.
- Function extension = new FuncExtFunction(ns, funcName,
- String.valueOf(opPos)
- + String.valueOf(hashCode())
- + String.valueOf(System.currentTimeMillis()));
+ Function extension = new FuncExtFunction(ns, funcName,
String.valueOf(getNextMethodId()));
try
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]