You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mm...@locus.apache.org on 2000/08/18 22:57:22 UTC

cvs commit: xml-xalan/src/org/apache/xalan/xslt KeyTable.java

mmidy       00/08/18 13:57:22

  Modified:    src/org/apache/xalan/xpath XPathSupport.java
                        XPathSupportDefault.java
               src/org/apache/xalan/xslt KeyTable.java
  Log:
  Fix problem with threading in xsl:key with KeyDeclaration.m_buildState
  
  Revision  Changes    Path
  1.12      +15 -0     xml-xalan/src/org/apache/xalan/xpath/XPathSupport.java
  
  Index: XPathSupport.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xpath/XPathSupport.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- XPathSupport.java	2000/04/07 19:13:20	1.11
  +++ XPathSupport.java	2000/08/18 20:57:21	1.12
  @@ -309,6 +309,21 @@
      * getXLocatorHandler.
      */
     XLocator createXLocatorHandler();
  +  
  +  /*
  +   * Function that returns whether a key declaration is being built
  +   */   
  +  public boolean getInConstruction(KeyDeclaration kd);
  +  
  +  /*
  +   * Function that indicates that a key declaration is being built
  +   */
  +  public void beginConstruction(KeyDeclaration kd);
  +  
  +  /*
  +   * Function that resets whether a key declaration is being built
  +   */
  +  public void endConstruction(KeyDeclaration kd);
   
   
     /**
  
  
  
  1.20      +35 -0     xml-xalan/src/org/apache/xalan/xpath/XPathSupportDefault.java
  
  Index: XPathSupportDefault.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xpath/XPathSupportDefault.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- XPathSupportDefault.java	2000/04/07 19:13:20	1.19
  +++ XPathSupportDefault.java	2000/08/18 20:57:21	1.20
  @@ -553,6 +553,41 @@
     {
       return null;
     }
  +  
  +  /*
  +   * Hashtable holding the key declarations being built
  +   */ 
  +  private Hashtable m_keyDeclarationTable;
  +  
  +  /*
  +   * Function that returns whether a key declaration is being built
  +   */   
  +  public boolean getInConstruction(KeyDeclaration kd)
  +  {
  +    // do I care about m_use??
  +    if (m_keyDeclarationTable == null || m_keyDeclarationTable.get(kd.m_name) == null)
  +      return false;
  +    else
  +      return true;
  +  }  
  +  
  +  /*
  +   * Function that indicates that a key declaration is being built
  +   */
  +  public void beginConstruction(KeyDeclaration kd)
  +  {
  +    if (null == m_keyDeclarationTable) 
  +      m_keyDeclarationTable = new Hashtable(); 
  +    m_keyDeclarationTable.put(kd.m_name, "true");  
  +  }  
  +  
  +  /*
  +   * Function that resets whether a key declaration is being built
  +   */
  +  public void endConstruction(KeyDeclaration kd)
  +  {
  +     m_keyDeclarationTable.remove(kd.m_name);
  +  }  
   
     /**
      * Function that is called when a problem event occurs.
  
  
  
  1.15      +10 -5     xml-xalan/src/org/apache/xalan/xslt/KeyTable.java
  
  Index: KeyTable.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/KeyTable.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- KeyTable.java	2000/06/22 04:43:17	1.14
  +++ KeyTable.java	2000/08/18 20:57:22	1.15
  @@ -297,19 +297,22 @@
               // We are currently processing this key declaration.
               // More than likely, the key function was called in the 
               // xsl:key declaration using the same key name.
  -            if( kd.m_buildState == KeyDeclaration.BUILDING)
  +            //if( kd.m_buildState == KeyDeclaration.BUILDING)
  +            if (execContext.getInConstruction(kd))
               {
                 return;
                 // break;
               }  
  -            kd.m_buildState = KeyDeclaration.BUILDING;
  +            //kd.m_buildState = KeyDeclaration.BUILDING;
  +            execContext.beginConstruction(kd);
               
               // See if our node matches the given key declaration according to 
               // the match attribute on xsl:key.
               double score = kd.m_match.getMatchScore(execContext, testNode);
               if(score == kd.m_match.MATCH_SCORE_NONE)
               {
  -              kd.m_buildState = KeyDeclaration.BUILT;
  +              //kd.m_buildState = KeyDeclaration.BUILT;
  +              execContext.endConstruction(kd);
                 continue;
               } 
               // Query from the node, according the the select pattern in the
  @@ -329,7 +332,8 @@
                 nl = xuse.nodeset();
                 if(0 == nl.getLength())
                 {  
  -                kd.m_buildState = KeyDeclaration.BUILT;
  +                //kd.m_buildState = KeyDeclaration.BUILT;
  +                execContext.endConstruction(kd);
                   continue;
                 }  
                 
  @@ -402,7 +406,8 @@
                 }
               } // end for(int k = 0; k < nUseValues; k++)
               
  -            kd.m_buildState = KeyDeclaration.BUILT;
  +            //kd.m_buildState = KeyDeclaration.BUILT;
  +            execContext.endConstruction(kd);
               break;
   
             } // end for(int i = 0; i < nDeclarations; i++)