sboag       01/03/27 20:41:08

  Modified:    java/src/org/apache/xalan/processor XSLTSchema.java
               java/src/org/apache/xalan/stree SourceTreeHandler.java
               java/src/org/apache/xalan/templates ElemForEach.java
                        ElemLiteralResult.java
               java/src/org/apache/xalan/transformer QueuedSAXEvent.java
                        ResultTreeHandler.java TransformerImpl.java
               java/src/org/apache/xml/utils BoolStack.java
               java/src/org/apache/xpath XPathContext.java
  Log:
  This check-in contains a couple things that overlapped on my
  system, so I'm checking them in together.
  1) Unfinished (in progress) implementation of TransformSnapshot mechanism,
  which will hopefully allow a result ContentHandler to take a snapshot
  at a given point, and the restart execution from that point at some
  later time.  For tooling support.
  2) Check to make sure SourceTreeHandler isn't being entered twice,
  which is related to the cocoon bug from a couple of weeks ago.  This
  will just help diagnose such a problem in the future.
  3) Removed the error stack trace print from postExceptionFromThread.
  4) Report exception in SourceTreeHandler#endDocument after
  the join, if we can determine that the posted exception won't be
  caught elsewhere.
  5) removed some catches that simply rethrew the exception
  (thanks to Patrick Moore <[EMAIL PROTECTED]>).
  See my note on 3/27/2001 to Patrick for more info
  on the last two.
  
  Revision  Changes    Path
  1.18      +4 -3      
xml-xalan/java/src/org/apache/xalan/processor/XSLTSchema.java
  
  Index: XSLTSchema.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/XSLTSchema.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- XSLTSchema.java   2001/01/26 18:04:13     1.17
  +++ XSLTSchema.java   2001/03/28 04:40:59     1.18
  @@ -385,9 +385,10 @@
                                    Constants.S_XSLNAMESPACEURL, "choose",
                                    null /*alias */,
                                    new XSLTElementDef[]{ xslWhen,
  -                                                       xslOtherwise } /* 
elements */, new XSLTAttributeDef[]{ spaceAttr },
  -                                                                             
         new ProcessorTemplateElem(),
  -                                                                             
         ElemChoose.class /* class object */);
  +                                       xslOtherwise } /* elements */, 
  +                                new XSLTAttributeDef[]{ spaceAttr },
  +                                              new ProcessorTemplateElem(),
  +                                              ElemChoose.class /* class 
object */);
       XSLTElementDef xslAttribute = new XSLTElementDef(this,
                                       Constants.S_XSLNAMESPACEURL, "attribute",
                                       null /*alias */,
  
  
  
  1.35      +21 -0     
xml-xalan/java/src/org/apache/xalan/stree/SourceTreeHandler.java
  
  Index: SourceTreeHandler.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/SourceTreeHandler.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- SourceTreeHandler.java    2001/02/08 20:02:34     1.34
  +++ SourceTreeHandler.java    2001/03/28 04:41:02     1.35
  @@ -278,6 +278,13 @@
       return m_useMultiThreading;
     }
     
  +  /**
  +   * Simple count incremented in startDocument and decremented in 
  +   * endDocument, to make sure this contentHandler isn't being double 
  +   * entered.
  +   */
  +  private int m_entryCount = 0;
  +  
     /** Indicate whether running in Debug mode        */
     private static final boolean DEBUG = false;
   
  @@ -328,6 +335,13 @@
     {
       // System.out.println("startDocument: "+m_id);
       
  +    if(m_entryCount != 0)
  +      throw new org.xml.sax.SAXException(
  +    "startDocument can not be called while within startDocument/endDocument! 
"+
  +    "Threading problem?");
  +    
  +    m_entryCount++; // decremented at the end of endDocument
  +    
       synchronized (m_root)
       {
         m_inDTD = false;
  @@ -462,11 +476,18 @@
   
             // This should wait until the transformThread is considered not 
alive.
             transformThread.join();
  +          if(!m_transformer.hasTransformThreadErrorCatcher())
  +          {
  +            Exception e = m_transformer.getExceptionThrown();
  +            if(null != e)
  +              throw new org.xml.sax.SAXException(e);
  +          }
             m_transformer.setTransformThread(null);
           }
           catch (InterruptedException ie){}
         }
       }
  +    m_entryCount--; // incremented at the start of startDocument
     }
   
     /**
  
  
  
  1.20      +0 -4      
xml-xalan/java/src/org/apache/xalan/templates/ElemForEach.java
  
  Index: ElemForEach.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemForEach.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- ElemForEach.java  2001/03/26 15:47:00     1.19
  +++ ElemForEach.java  2001/03/28 04:41:03     1.20
  @@ -501,10 +501,6 @@
               }
               reMarkParams(xctxt);
             }
  -          catch(TransformerException te)
  -          {
  -            throw te;
  -          }
             finally
             {
               xctxt.popCurrentNode();
  
  
  
  1.25      +0 -4      
xml-xalan/java/src/org/apache/xalan/templates/ElemLiteralResult.java
  
  Index: ElemLiteralResult.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemLiteralResult.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- ElemLiteralResult.java    2001/03/18 09:26:57     1.24
  +++ ElemLiteralResult.java    2001/03/28 04:41:03     1.25
  @@ -636,10 +636,6 @@
           // TODO: Process m_extensionElementPrefixes && m_attributeSetsNames
           transformer.executeChildTemplates(this, sourceNode, mode, true);
         }
  -      catch(TransformerException te)
  -      {
  -        throw te;
  -      }
         finally
         {
           // If you don't do this in a finally statement, an exception could 
  
  
  
  1.8       +7 -1      
xml-xalan/java/src/org/apache/xalan/transformer/QueuedSAXEvent.java
  
  Index: QueuedSAXEvent.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/QueuedSAXEvent.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- QueuedSAXEvent.java       2001/03/06 05:50:23     1.7
  +++ QueuedSAXEvent.java       2001/03/28 04:41:04     1.8
  @@ -67,8 +67,14 @@
   /**
    * Acts as a base class for queued SAX events.
    */
  -public abstract class QueuedSAXEvent
  +public abstract class QueuedSAXEvent implements Cloneable
   {
  +  
  +  public Object clone() 
  +    throws CloneNotSupportedException
  +  {
  +    return super.clone();
  +  }
   
     /**
      * Constructor QueuedSAXEvent
  
  
  
  1.37      +1 -1      
xml-xalan/java/src/org/apache/xalan/transformer/ResultTreeHandler.java
  
  Index: ResultTreeHandler.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/ResultTreeHandler.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- ResultTreeHandler.java    2001/03/12 02:12:51     1.36
  +++ ResultTreeHandler.java    2001/03/28 04:41:04     1.37
  @@ -1441,7 +1441,7 @@
     /**
      * Use the SAX2 helper class to track result namespaces.
      */
  -  private NamespaceSupport m_nsSupport = new NamespaceSupport();
  +  NamespaceSupport m_nsSupport = new NamespaceSupport();
   
     /**
      * The transformer object.
  
  
  
  1.90      +48 -16    
xml-xalan/java/src/org/apache/xalan/transformer/TransformerImpl.java
  
  Index: TransformerImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/TransformerImpl.java,v
  retrieving revision 1.89
  retrieving revision 1.90
  diff -u -r1.89 -r1.90
  --- TransformerImpl.java      2001/03/13 22:01:58     1.89
  +++ TransformerImpl.java      2001/03/28 04:41:04     1.90
  @@ -254,7 +254,7 @@
      * ElemTemplateElement.  Needed for the 
      * org.apache.xalan.transformer.TransformState interface,  
      * so a tool can discover the calling template. */
  -  private NodeVector m_currentTemplateElements = new NodeVector(64);
  +  NodeVector m_currentTemplateElements = new NodeVector(64);
   
     /** A node vector used as a stack to track the current 
      * ElemTemplate that was matched, as well as the node that 
  @@ -262,7 +262,7 @@
      * org.apache.xalan.transformer.TransformState interface,  
      * so a tool can discover the matched template, and matched 
      * node. */
  -  private NodeVector m_currentMatchTemplates = new NodeVector();
  +  NodeVector m_currentMatchTemplates = new NodeVector();
   
     /**
      * The root of a linked set of stylesheets.
  @@ -300,18 +300,18 @@
      * Stack for the purposes of flagging infinite recursion with
      * attribute sets.
      */
  -  private Stack m_attrSetStack = null;
  +  Stack m_attrSetStack = null;
   
     /**
      * The table of counters for xsl:number support.
      * @see ElemNumber
      */
  -  private CountersTable m_countersTable = null;
  +  CountersTable m_countersTable = null;
   
     /**
      * Is > 0 when we're processing a for-each.
      */
  -  private BoolStack m_currentTemplateRuleIsNull = new BoolStack();
  +  BoolStack m_currentTemplateRuleIsNull = new BoolStack();
   
     /** The message manager, which manages error messages, warning 
      * messages, and other types of message events.   */
  @@ -458,6 +458,17 @@
     {
       m_transformThread = t;
     }
  +  
  +  private boolean m_hasTransformThreadErrorCatcher = false;
  +  
  +  /**
  +   * Return true if the transform was initiated from the transform method, 
  +   * otherwise it was probably done from a pure parse events.
  +   */
  +  public boolean hasTransformThreadErrorCatcher()
  +  {
  +    return m_hasTransformThreadErrorCatcher;
  +  }
   
     /**
      * Process the source tree to SAX parse events.
  @@ -504,6 +515,7 @@
   
       try
       {
  +      m_hasTransformThreadErrorCatcher = true;
         XMLReader reader = null;
         if(source instanceof SAXSource)
           reader = ((SAXSource)source).getXMLReader();
  @@ -676,6 +688,7 @@
       }
       finally
       {
  +      m_hasTransformThreadErrorCatcher = false;
         // This looks to be redundent to the one done in TransformNode.
         reset();
       }
  @@ -2202,10 +2215,6 @@
           t.execute(this, sourceNode, mode);
         }
       }
  -    catch(TransformerException te)
  -    {
  -      throw te;
  -    }
       finally
       {
         popElemTemplateElement();
  @@ -2906,17 +2915,20 @@
   
       synchronized (this)
       {
  -      String msg = e.getMessage();
  +      // See message from me on 3/27/2001 to Patrick Moore.
  +//      String msg = e.getMessage();
   
         // System.out.println(e.getMessage());
  +      
  +      // Is this really needed?  -sb
         notifyAll();
  -
  -      if (null == msg)
  -      {
   
  -        // m_throwNewError = false;
  -        e.printStackTrace();
  -      }
  +//      if (null == msg)
  +//      {
  +//
  +//        // m_throwNewError = false;
  +//        e.printStackTrace();
  +//      }
   
         // throw new org.apache.xml.utils.WrappedRuntimeException(e);
       }
  @@ -2966,6 +2978,26 @@
       {
         postExceptionFromThread(e);
       }
  +  }
  +  
  +  // Fragment re-execution interfaces for a tool.
  +  
  +  public TransformSnapshot getSnapshot()
  +  {
  +    return new TransformSnapshotImpl(this);
  +  }
  +  
  +  /**
  +   * This will execute the following XSLT instructions
  +   * from the snapshot point.
  +   */
  +  public void executeFromSnapshot(TransformSnapshot ts)
  +  {
  +    ((TransformSnapshotImpl)ts).apply(this);
  +  }
  +  
  +  public void stopTransformation()
  +  {
     }
     
   }  // end TransformerImpl class
  
  
  
  1.4       +8 -1      xml-xalan/java/src/org/apache/xml/utils/BoolStack.java
  
  Index: BoolStack.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/BoolStack.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BoolStack.java    2001/01/02 03:42:50     1.3
  +++ BoolStack.java    2001/03/28 04:41:06     1.4
  @@ -62,7 +62,7 @@
    * <meta name="usage" content="internal"/>
    * Simple stack for boolean values.
    */
  -public final class BoolStack
  +public final class BoolStack implements Cloneable
   {
   
     /** Array of boolean values          */
  @@ -209,4 +209,11 @@
   
       m_values = newVector;
     }
  +  
  +  public Object clone() 
  +    throws CloneNotSupportedException
  +  {
  +    return super.clone();
  +  }
  +
   }
  
  
  
  1.20      +12 -0     xml-xalan/java/src/org/apache/xpath/XPathContext.java
  
  Index: XPathContext.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/XPathContext.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- XPathContext.java 2001/03/16 22:17:28     1.19
  +++ XPathContext.java 2001/03/28 04:41:07     1.20
  @@ -455,6 +455,9 @@
      * The current context node list.
      */
     private Stack m_contextNodeLists = new Stack();
  +  
  +  public Stack getContextNodeListsStack() { return m_contextNodeLists; }
  +  public void setContextNodeListsStack(Stack s) { m_contextNodeLists = s; }
   
     /**
      * Get the current context node list.
  @@ -502,6 +505,9 @@
     /** The stack of <a 
href="http://www.w3.org/TR/xslt#dt-current-node";>current node</a> objects.
      *  Not to be confused with the current node list.  */
     private NodeVector m_currentNodes = new NodeVector();
  +  
  +  public NodeVector getCurrentNodeStack() {return m_currentNodes; }
  +  public void setCurrentNodeStack(NodeVector nv) { m_currentNodes = nv; }
   
     /**
      * Get the current context node.
  @@ -554,6 +560,9 @@
   
     /** A stack of the current sub-expression nodes.  */
     private NodeVector m_currentExpressionNodes = new NodeVector();
  +  
  +  public NodeVector getCurrentExpressionNodeStack() { return 
m_currentExpressionNodes; }
  +  public void setCurrentExpressionNodeStack(NodeVector nv) { 
m_currentExpressionNodes = nv; }
   
     /**
      * Get the current node that is the expression's context (i.e. for 
current() support).
  @@ -613,6 +622,9 @@
      * Stack of AxesIterators.
      */
     private Stack m_axesIteratorStack = new Stack();
  +  
  +  public Stack getAxesIteratorStackStacks() { return m_axesIteratorStack; }
  +  public void setAxesIteratorStackStacks(Stack s) { m_axesIteratorStack = s; 
}
   
     /**
      * <meta name="usage" content="internal"/>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to