mmidy       00/08/17 11:26:25

  Modified:    src/org/apache/xalan/xslt TemplateList.java
  Log:
  Fix threading issue with m_priority
  
  Revision  Changes    Path
  1.9       +12 -4     xml-xalan/src/org/apache/xalan/xslt/TemplateList.java
  
  Index: TemplateList.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/TemplateList.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TemplateList.java 2000/08/04 02:16:09     1.8
  +++ TemplateList.java 2000/08/17 18:26:25     1.9
  @@ -223,6 +223,7 @@
     {
       ElemTemplate bestMatchedRule = null;
       MatchPattern2 bestMatchedPattern =null; // Syncs with bestMatchedRule
  +    double bestMatchPatPriority = XPath.MATCH_SCORE_NONE;
       if(m_isWrapperless)
       {
         return m_wrapperlessTemplate;
  @@ -274,6 +275,7 @@
   
         String prevPat = null;
         MatchPattern2 prevMatchPat = null;
  +      double prevMatchPatPriority = XPath.MATCH_SCORE_NONE;
   
         while(null != matchPat)
         {
  @@ -281,6 +283,7 @@
           // We'll be needing to match rules according to what
           // mode we're in.
           QName ruleMode = rule.m_mode;
  +        double matchPatPriority = rule.m_priority; //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.
  @@ -292,11 +295,14 @@
             String patterns = matchPat.getPattern();
   
             if((null != patterns) && !((prevPat != null) && 
prevPat.equals(patterns) &&
  -                                     (prevMatchPat.getTemplate().m_priority
  -                                      == matchPat.getTemplate().m_priority)) 
)
  +                                     prevMatchPatPriority == 
matchPatPriority))
  +                                     //(prevMatchPat.getTemplate().m_priority
  +                                     // == 
matchPat.getTemplate().m_priority)) )
             {
               prevMatchPat = matchPat;
               prevPat = patterns;
  +            prevMatchPatPriority = matchPatPriority;
  +            matchPatPriority = XPath.MATCH_SCORE_NONE;
   
               // Date date1 = new Date();
               XPath xpath = matchPat.getExpression();
  @@ -312,9 +318,9 @@
                 double priorityOfRule
                   = (XPath.MATCH_SCORE_NONE != rule.m_priority)
                     ? rule.m_priority : score;
  -              matchPat.m_priority = priorityOfRule;
  +              matchPatPriority = priorityOfRule;
                 double priorityOfBestMatched = (null != bestMatchedPattern) ?
  -                                             bestMatchedPattern.m_priority :
  +                                             bestMatchPatPriority :
                                                XPath.MATCH_SCORE_NONE;
                 // System.out.println("priorityOfRule: "+priorityOfRule+", 
priorityOfBestMatched: "+priorityOfBestMatched);
                 if(priorityOfRule > priorityOfBestMatched)
  @@ -324,6 +330,7 @@
                   highScore = score;
                   bestMatchedRule = rule;
                   bestMatchedPattern = matchPat;
  +                bestMatchPatPriority = matchPatPriority;
                 }
                 else if(priorityOfRule == priorityOfBestMatched)
                 {
  @@ -334,6 +341,7 @@
                   highScore = score;
                   bestMatchedRule = rule;
                   bestMatchedPattern = matchPat;
  +                bestMatchPatPriority = matchPatPriority;
                 }
               }
               // Date date2 = new Date();
  
  
  

Reply via email to