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/09/13 22:59:40 UTC

cvs commit: xml-xalan/java/src/org/apache/xalan/stree DocumentImpl.java

mmidy       00/09/13 13:59:40

  Modified:    java/src/org/apache/xalan/stree DocumentImpl.java
  Log:
  May need to wait for endDocument before we can get element by id
  
  Revision  Changes    Path
  1.5       +21 -1     xml-xalan/java/src/org/apache/xalan/stree/DocumentImpl.java
  
  Index: DocumentImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/stree/DocumentImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DocumentImpl.java	2000/08/11 23:54:57	1.4
  +++ DocumentImpl.java	2000/09/13 20:59:39	1.5
  @@ -263,7 +263,27 @@
      */
     public Element getElementById(String elementId)
     {
  -    return (Element)m_idAttributes.get(elementId);    
  +    Element elem = (Element)m_idAttributes.get(elementId); 
  +    // Make sure we're done parsing.
  +    if (elem == null && !isComplete())
  +    {    
  +      synchronized (this)
  +      {
  +        try
  +        {
  +          // Don't really know why we should need the while loop,
  +          // but we seem to come out of wait() too soon! 
  +          while (!isComplete())
  +            wait();
  +        }
  +        catch (InterruptedException e)
  +        {          
  +          // That's OK, it's as good a time as any to check again
  +        }        
  +      }
  +      elem = (Element)m_idAttributes.get(elementId); 
  +    }    
  +    return elem;
     }