sboag       00/08/06 19:52:24

  Modified:    java/src/org/apache/xpath/objects XNodeSet.java
  Log:
  Handle case (badly) when NodeIterator is not a ContextNodeList.
  
  Revision  Changes    Path
  1.3       +20 -9     xml-xalan/java/src/org/apache/xpath/objects/XNodeSet.java
  
  Index: XNodeSet.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xpath/objects/XNodeSet.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XNodeSet.java     2000/08/01 04:40:18     1.2
  +++ XNodeSet.java     2000/08/07 02:52:23     1.3
  @@ -198,21 +198,32 @@
      */
     public NodeIterator nodeset()
     {
  +    // System.out.println("In XNodeSet.nodeset()");
       NodeIterator ns = (NodeIterator)m_obj;
  -    if(((ContextNodeList)ns).isFresh()) // bit of a hack...
  +    // System.out.println("Got NodeIterator");
  +    if(ns instanceof ContextNodeList)
       {
  -      return ns;
  -    }
  -    else
  -    {
  -      try
  +     // System.out.println("Is a ContextNodeList: "+ns);
  +     if(((ContextNodeList)ns).isFresh()) // bit of a hack...
         {
  -        return ((ContextNodeList)ns).cloneWithReset();
  +        return ns;
         }
  -      catch(CloneNotSupportedException cnse)
  +      else
         {
  -        throw new RuntimeException(cnse.getMessage());
  +        try
  +        {
  +          return ((ContextNodeList)ns).cloneWithReset();
  +        }
  +        catch(CloneNotSupportedException cnse)
  +        {
  +          throw new RuntimeException(cnse.getMessage());
  +        }
         }
  +    }
  +    else
  +    {
  +      // System.out.println("Returning node iterator");
  +      return ns;
       }
     }  
   
  
  
  

Reply via email to