mmidy 00/10/11 15:54:49
Modified: java/src/org/apache/xalan/templates TemplateList.java
Log:
Make sure code is thread safe when getting a template
Revision Changes Path
1.9 +9 -3
xml-xalan/java/src/org/apache/xalan/templates/TemplateList.java
Index: TemplateList.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/TemplateList.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- TemplateList.java 2000/10/06 22:07:42 1.8
+++ TemplateList.java 2000/10/11 22:54:48 1.9
@@ -207,6 +207,7 @@
{
ElemTemplate bestMatchedRule = null;
MatchPattern2 bestMatchedPattern =null; // Syncs with bestMatchedRule
+ double bestMatchPathPriority = XPath.MATCH_SCORE_NONE;
if(m_isWrapperless)
{
return m_wrapperlessTemplate;
@@ -261,6 +262,7 @@
String prevPat = null;
MatchPattern2 prevMatchPat = null;
+ double prevMatchPatPriority = XPath.MATCH_SCORE_NONE;
while(null != matchPat)
{
@@ -268,6 +270,7 @@
// We'll be needing to match rules according to what
// mode we're in.
QName ruleMode = rule.getMode();
+ double matchPatPriority = XPath.MATCH_SCORE_NONE;
// The logic here should be that if we are not in a mode AND
// the rule does not have a node, then go ahead.
@@ -291,7 +294,7 @@
{
bestMatchedRule = rule;
bestMatchedPattern = matchPat;
- bestMatchedPattern.m_priority
+ bestMatchPathPriority
= (XPath.MATCH_SCORE_NONE != rule.getPriority())
? rule.getPriority() :
matchPat.getExpression().getMatchScore(support, targetNode);
}
@@ -302,6 +305,8 @@
{
prevMatchPat = matchPat;
prevPat = patterns;
+ prevMatchPatPriority = matchPatPriority;
+ matchPatPriority = XPath.MATCH_SCORE_NONE;
// Date date1 = new Date();
XPath xpath = matchPat.getExpression();
@@ -317,9 +322,9 @@
double priorityOfRule
= (XPath.MATCH_SCORE_NONE != rule.getPriority())
? rule.getPriority() : score;
- matchPat.m_priority = priorityOfRule;
+ matchPatPriority = priorityOfRule;
double priorityOfBestMatched = (null != bestMatchedPattern) ?
- bestMatchedPattern.m_priority :
+ bestMatchPathPriority :
XPath.MATCH_SCORE_NONE;
// System.out.println("priorityOfRule: "+priorityOfRule+",
priorityOfBestMatched: "+priorityOfBestMatched);
if(priorityOfRule > priorityOfBestMatched)
@@ -329,6 +334,7 @@
highScore = score;
bestMatchedRule = rule;
bestMatchedPattern = matchPat;
+ bestMatchPathPriority = matchPatPriority;
}
else if(priorityOfRule == priorityOfBestMatched)
{