zongaro     2003/12/11 20:24:15

  Modified:    java/src/org/apache/xalan/xsltc/trax TransformerImpl.java
  Log:
  The getDOM method might be entered more than once during a transformation, so
  the DTMManager that is created the first time in must be saved so that
  subsequent DTM's can be created with respect to it, and then discarded at the
  end of the transformation.
  
  This change restores logic that I had foolishly eliminated with my previous
  change to this file.
  
  Revision  Changes    Path
  1.78      +28 -14    
xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerImpl.java
  
  Index: TransformerImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerImpl.java,v
  retrieving revision 1.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- TransformerImpl.java      4 Dec 2003 16:44:59 -0000       1.77
  +++ TransformerImpl.java      12 Dec 2003 04:24:15 -0000      1.78
  @@ -193,6 +193,12 @@
       private TransformerFactoryImpl _tfactory = null;
   
       /**
  +     * A reference to the XSLTCDTMManager which is used to build the DOM/DTM
  +     * for this transformer.
  +     */
  +    private XSLTCDTMManager _dtmManager = null;
  +
  +    /**
        * A reference to an object that creates and caches XMLReader objects.
        */
       private XMLReaderManager _readerManager = XMLReaderManager.getInstance();
  @@ -463,10 +469,12 @@
                    boolean hasIdCall = (_translet != null) ? 
_translet.hasIdCall()
                                                            : false;
   
  -                 XSLTCDTMManager dtmManager =
  +                 if (_dtmManager == null) {
  +                     _dtmManager =
                            (XSLTCDTMManager)_tfactory.getDTMManagerClass()
                                                      .newInstance();
  -                 dom = (DOM)dtmManager.getDTM(source, false, wsfilter, true,
  +                 }
  +                 dom = (DOM)_dtmManager.getDTM(source, false, wsfilter, true,
                                                 false, false, 0, hasIdCall);
               } else if (_dom != null) {
                    dom = _dom;
  @@ -492,6 +500,14 @@
           }
       }
    
  +    /**
  +     * Returns the [EMAIL PROTECTED] 
org.apache.xalan.xsltc.trax.TransformerFactoryImpl}
  +     * object that create this <code>Transformer</code>.
  +     */
  +    protected TransformerFactoryImpl getTransformerFactory() {
  +        return _tfactory;
  +    }
  +
       private void transformIdentity(Source source, SerializationHandler 
handler)
        throws Exception 
       {
  @@ -595,7 +611,7 @@
                * situations, since there is no clear spec. how to create 
                * an empty tree when both SAXSource() and StreamSource() are 
used.
                */
  -             if ((source instanceof StreamSource && 
source.getSystemId()==null 
  +            if ((source instanceof StreamSource && 
source.getSystemId()==null 
                   && ((StreamSource)source).getInputStream()==null &&
                   ((StreamSource)source).getReader()==null)||
                   (source instanceof SAXSource &&
  @@ -614,26 +630,24 @@
                           if (systemID != null) {
                             source.setSystemId(systemID);
                           }
  -             }           
  +            }           
            if (_isIdentity) {
                transformIdentity(source, handler);
  -         }
  -         else {
  +         } else {
                _translet.transform(getDOM(source), handler);
            }
  -     }
  -     catch (TransletException e) {
  +     } catch (TransletException e) {
            if (_errorListener != null) postErrorToListener(e.getMessage());
            throw new TransformerException(e);
  -     }
  -     catch (RuntimeException e) {
  +     } catch (RuntimeException e) {
            if (_errorListener != null) postErrorToListener(e.getMessage());
            throw new TransformerException(e);
  -     }
  -     catch (Exception e) {
  +     } catch (Exception e) {
            if (_errorListener != null) postErrorToListener(e.getMessage());
            throw new TransformerException(e);
  -     }
  +     } finally {
  +            _dtmManager = null;
  +        }
       }
   
       /**
  
  
  

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

Reply via email to