You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2005/04/22 02:19:17 UTC

svn commit: r164151 - /cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java

Author: vgritsenko
Date: Thu Apr 21 17:19:16 2005
New Revision: 164151

URL: http://svn.apache.org/viewcvs?rev=164151&view=rev
Log:
bit of cleanup

Modified:
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java?rev=164151&r1=164150&r2=164151&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java Thu Apr 21 17:19:16 2005
@@ -1,12 +1,12 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -56,45 +56,37 @@
  *         (Apache Software Foundation)
  * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  * @author <a href="mailto:sylvain.wallez@anyware-tech.com">Sylvain Wallez</a>
- * @version CVS $Id$
+ * @version $Id$
  */
 public abstract class AbstractTextSerializer extends AbstractSerializer
         implements Configurable, CacheableProcessingComponent, Contextualizable {
 
     /**
-     * The trax <code>TransformerFactory</code> used by this serializer.
-     */
-    private SAXTransformerFactory tfactory = null;
-
-    /**
-     * The <code>Properties</code> used by this serializer.
-     */
-    protected Properties format = new Properties();
-
-    /**
-     * The default output buffer size.
+     * Cache for avoiding unnecessary checks of namespaces abilities.
+     * It associates a Boolean to the transformer class name.
      */
-    //private static final int DEFAULT_BUFFER_SIZE = 8192;
+    private static final Map needsNamespaceCache = new HashMap();
 
     /**
-     * The output buffer size to use.
+     * The trax <code>TransformerFactory</code> used by this serializer.
      */
-    //private int outputBufferSize = DEFAULT_BUFFER_SIZE;
+    private SAXTransformerFactory tfactory;
 
     /**
-     * Cache for avoiding unnecessary checks of namespaces abilities.
-     * It associates a Boolean to the transformer class name.
+     * The <code>Properties</code> used by this serializer.
      */
-    private static Map needsNamespaceCache = new HashMap();
+    protected final Properties format = new Properties();
 
     /**
      * The pipe that adds namespaces as xmlns attributes.
      */
     private NamespaceAsAttributes namespacePipe;
 
-    /** The caching key */
+    /**
+     * The caching key
+     */
     private String cachingKey = "1";
-    
+
 
     /**
      * Interpose namespace pipe if needed.
@@ -197,7 +189,7 @@
         String version = conf.getChild("version").getValue(null);
 
         final StringBuffer buffer = new StringBuffer();
-        
+
         if (cdataSectionElements != null) {
             format.put(OutputKeys.CDATA_SECTION_ELEMENTS, cdataSectionElements);
             buffer.append(";cdata-section-elements=").append(cdataSectionElements);
@@ -238,14 +230,13 @@
             format.put(OutputKeys.VERSION, version);
             buffer.append(";version=").append(version);
         }
-        
+
         if ( buffer.length() > 0 ) {
             this.cachingKey = buffer.toString();
         }
 
-        Configuration tFactoryConf = conf.getChild("transformer-factory", false);
-        if (tFactoryConf != null) {
-            String tFactoryClass = tFactoryConf.getValue();
+        String tFactoryClass = conf.getChild("transformer-factory").getValue(null);
+        if (tFactoryClass != null) {
             try {
                 this.tfactory = (SAXTransformerFactory) ClassUtils.newInstance(tFactoryClass);
                 if (getLogger().isDebugEnabled()) {
@@ -258,7 +249,6 @@
             // Standard TrAX behaviour
             this.tfactory = (SAXTransformerFactory) TransformerFactory.newInstance();
         }
-
         tfactory.setErrorListener(new TraxErrorHandler(getLogger()));
 
         // Check if we need namespace as attributes.