cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject svn commit: r1449724 - in /cocoon/cocoon3/trunk: cocoon-optional/src/main/java/org/apache/cocoon/optional/servlet/components/sax/serializers/ cocoon-sax/src/main/java/org/apache/cocoon/sax/component/
Date Mon, 25 Feb 2013 14:35:16 GMT
Author: ilgrosso
Date: Mon Feb 25 14:35:15 2013
New Revision: 1449724

URL: http://svn.apache.org/r1449724
Log:
White noise: formatting

Modified:
    cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/servlet/components/sax/serializers/EncodingHTMLSerializer.java
    cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/servlet/components/sax/serializers/EncodingXHTMLSerializer.java
    cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/servlet/components/sax/serializers/EncodingXMLSerializer.java
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/TextSerializer.java

Modified: cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/servlet/components/sax/serializers/EncodingHTMLSerializer.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/servlet/components/sax/serializers/EncodingHTMLSerializer.java?rev=1449724&r1=1449723&r2=1449724&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/servlet/components/sax/serializers/EncodingHTMLSerializer.java
(original)
+++ cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/servlet/components/sax/serializers/EncodingHTMLSerializer.java
Mon Feb 25 14:35:15 2013
@@ -20,8 +20,8 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
 import java.util.Map;
-
 import org.apache.cocoon.components.serializers.util.EncodingSerializer;
+import org.apache.cocoon.components.serializers.util.HTMLSerializer;
 import org.apache.cocoon.optional.servlet.components.sax.serializers.util.ConfigurationUtils;
 import org.apache.cocoon.pipeline.SetupException;
 import org.apache.cocoon.pipeline.caching.CacheKey;
@@ -44,50 +44,63 @@ import org.apache.cocoon.servlet.util.Ht
  * </p>
  *
  * <p>
- * Any of the XHTML document type declared or used will be converted into its HTML 4.01 counterpart,
- * and in addition to those a "compatible" doctype can be supported to exploit a couple of
shortcuts
- * into MSIE's rendering engine. The values for the <code>doctype-default</code>
can then be:
+ * Any of the XHTML document type declared or used will be converted into its HTML 4.01 counterpart,
and in addition to
+ * those a "compatible" doctype can be supported to exploit a couple of shortcuts into MSIE's
rendering engine. The
+ * values for the
+ * <code>doctype-default</code> can then be:
  * </p>
  *
  * <dl>
- * <dt>"<code>none</code>"</dt>
+ * <dt>"
+ * <code>none</code>"</dt>
  * <dd>Not to emit any dococument type declaration.</dd>
- * <dt>"<code>compatible</code>"</dt>
+ * <dt>"
+ * <code>compatible</code>"</dt>
  * <dd>The HTML 4.01 Transitional (exploiting MSIE shortcut).</dd>
- * <dt>"<code>strict</code>"</dt>
+ * <dt>"
+ * <code>strict</code>"</dt>
  * <dd>The HTML 4.01 Strict document type.</dd>
- * <dt>"<code>loose</code>"</dt>
+ * <dt>"
+ * <code>loose</code>"</dt>
  * <dd>The HTML 4.01 Transitional document type.</dd>
- * <dt>"<code>frameset</code>"</dt>
+ * <dt>"
+ * <code>frameset</code>"</dt>
  * <dd>The HTML 4.01 Frameset document type.</dd>
  * </dl>
  *
  * @version $Id$
  */
-public class EncodingHTMLSerializer extends org.apache.cocoon.components.serializers.util.HTMLSerializer
implements
-SAXPipelineComponent, Finisher, SAXConsumer, CachingPipelineComponent {
+public class EncodingHTMLSerializer
+        extends HTMLSerializer
+        implements SAXPipelineComponent, Finisher, SAXConsumer, CachingPipelineComponent
{
 
     private String encoding;
+
     private int indent = 0;
+
     private String docType;
 
+    @Override
     public CacheKey constructCacheKey() {
-        ParameterCacheKey parameterCacheKey = new ParameterCacheKey();
+        final ParameterCacheKey parameterCacheKey = new ParameterCacheKey();
         parameterCacheKey.addParameter("encoding", this.encoding);
         parameterCacheKey.addParameter("indent", this.indent);
         parameterCacheKey.addParameter("docType", this.docType);
         return parameterCacheKey;
     }
 
+    @Override
     public void finish() {
         // nothing to do
     }
 
+    @Override
     public String getContentType() {
         return this.getMimeType();
     }
 
-    public void setConfiguration(Map<String, ? extends Object> configuration) {
+    @Override
+    public void setConfiguration(final Map<String, ? extends Object> configuration)
{
         try {
             this.encoding = ConfigurationUtils.getEncoding(configuration);
             this.setEncoding(this.encoding);
@@ -107,7 +120,7 @@ SAXPipelineComponent, Finisher, SAXConsu
     }
 
     @Override
-    public void setOutputStream(OutputStream outputStream) {
+    public void setOutputStream(final OutputStream outputStream) {
         try {
             super.setOutputStream(outputStream);
         } catch (IOException e) {
@@ -115,7 +128,8 @@ SAXPipelineComponent, Finisher, SAXConsu
         }
     }
 
-    public void setup(Map<String, Object> parameters) {
+    @Override
+    public void setup(final Map<String, Object> parameters) {
         this.setup(HttpContextHelper.getRequest(parameters));
     }
 

Modified: cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/servlet/components/sax/serializers/EncodingXHTMLSerializer.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/servlet/components/sax/serializers/EncodingXHTMLSerializer.java?rev=1449724&r1=1449723&r2=1449724&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/servlet/components/sax/serializers/EncodingXHTMLSerializer.java
(original)
+++ cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/servlet/components/sax/serializers/EncodingXHTMLSerializer.java
Mon Feb 25 14:35:15 2013
@@ -20,7 +20,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
 import java.util.Map;
-
+import org.apache.cocoon.components.serializers.util.XHTMLSerializer;
 import org.apache.cocoon.optional.servlet.components.sax.serializers.util.ConfigurationUtils;
 import org.apache.cocoon.pipeline.SetupException;
 import org.apache.cocoon.pipeline.caching.CacheKey;
@@ -36,46 +36,55 @@ import org.apache.cocoon.servlet.util.Ht
  * <p>
  * A pedantinc XHTML serializer encoding all recognized entities with their proper HTML names.
  * </p>
- * 
+ *
  * <p>
  * For configuration options of this serializer, please look at the
  * {@link org.apache.cocoon.components.serializers.util.EncodingSerializer}, in addition
to those, this serializer also
  * support the specification of a default doctype. This default will be used if no document
type is received in the SAX
  * events, and can be configured in the following way:
  * </p>
- * 
+ *
  * <pre>
  * &lt;map:serialize type=&quot;exhtml&quot; doctype-default=&quot;mytype&quot;
/&gt;
  * </pre>
- * 
+ *
  * <p>
  * The value <i>mytype</i> can be one of:
  * </p>
- * 
+ *
  * <dl>
- * <dt>"<code>none</code>"</dt>
+ * <dt>"
+ * <code>none</code>"</dt>
  * <dd>Not to emit any dococument type declaration.</dd>
- * <dt>"<code>strict</code>"</dt>
+ * <dt>"
+ * <code>strict</code>"</dt>
  * <dd>The XHTML 1.0 Strict document type.</dd>
- * <dt>"<code>loose</code>"</dt>
+ * <dt>"
+ * <code>loose</code>"</dt>
  * <dd>The XHTML 1.0 Transitional document type.</dd>
- * <dt>"<code>frameset</code>"</dt>
+ * <dt>"
+ * <code>frameset</code>"</dt>
  * <dd>The XHTML 1.0 Frameset document type.</dd>
  * </dl>
- * 
- * 
+ *
+ *
  * @version $Id$
  */
-public class EncodingXHTMLSerializer extends org.apache.cocoon.components.serializers.util.XHTMLSerializer
implements
-SAXPipelineComponent, Finisher, SAXConsumer, CachingPipelineComponent {
+public class EncodingXHTMLSerializer
+        extends XHTMLSerializer
+        implements SAXPipelineComponent, Finisher, SAXConsumer, CachingPipelineComponent
{
 
     private String encoding;
+
     private int indent = 0;
+
     private String omitXmlDeclaration;
+
     private String docType;
 
+    @Override
     public CacheKey constructCacheKey() {
-        ParameterCacheKey parameterCacheKey = new ParameterCacheKey();
+        final ParameterCacheKey parameterCacheKey = new ParameterCacheKey();
         parameterCacheKey.addParameter("encoding", this.encoding);
         parameterCacheKey.addParameter("indent", this.indent);
         parameterCacheKey.addParameter("docType", this.docType);
@@ -83,15 +92,18 @@ SAXPipelineComponent, Finisher, SAXConsu
         return parameterCacheKey;
     }
 
+    @Override
     public void finish() {
         // nothing to do
     }
 
+    @Override
     public String getContentType() {
         return this.getMimeType();
     }
 
-    public void setConfiguration(Map<String, ? extends Object> configuration) {
+    @Override
+    public void setConfiguration(final Map<String, ? extends Object> configuration)
{
         try {
             this.encoding = ConfigurationUtils.getEncoding(configuration);
             this.setEncoding(this.encoding);
@@ -114,7 +126,7 @@ SAXPipelineComponent, Finisher, SAXConsu
     }
 
     @Override
-    public void setOutputStream(OutputStream outputStream) {
+    public void setOutputStream(final OutputStream outputStream) {
         try {
             super.setOutputStream(outputStream);
         } catch (IOException e) {
@@ -122,7 +134,8 @@ SAXPipelineComponent, Finisher, SAXConsu
         }
     }
 
-    public void setup(Map<String, Object> parameters) {
+    @Override
+    public void setup(final Map<String, Object> parameters) {
         this.setup(HttpContextHelper.getRequest(parameters));
     }
 

Modified: cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/servlet/components/sax/serializers/EncodingXMLSerializer.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/servlet/components/sax/serializers/EncodingXMLSerializer.java?rev=1449724&r1=1449723&r2=1449724&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/servlet/components/sax/serializers/EncodingXMLSerializer.java
(original)
+++ cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/servlet/components/sax/serializers/EncodingXMLSerializer.java
Mon Feb 25 14:35:15 2013
@@ -20,7 +20,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
 import java.util.Map;
-
+import org.apache.cocoon.components.serializers.util.XMLSerializer;
 import org.apache.cocoon.optional.servlet.components.sax.serializers.util.ConfigurationUtils;
 import org.apache.cocoon.pipeline.SetupException;
 import org.apache.cocoon.pipeline.caching.CacheKey;
@@ -39,28 +39,34 @@ import org.apache.cocoon.servlet.util.Ht
  *
  * @version $Id$
  */
-public class EncodingXMLSerializer extends org.apache.cocoon.components.serializers.util.XMLSerializer
implements
-SAXPipelineComponent, Finisher, SAXConsumer, CachingPipelineComponent {
+public class EncodingXMLSerializer
+        extends XMLSerializer
+        implements SAXPipelineComponent, Finisher, SAXConsumer, CachingPipelineComponent
{
 
     private String encoding;
+
     private int indent = 0;
 
+    @Override
     public CacheKey constructCacheKey() {
-        ParameterCacheKey parameterCacheKey = new ParameterCacheKey();
+        final ParameterCacheKey parameterCacheKey = new ParameterCacheKey();
         parameterCacheKey.addParameter("encoding", this.encoding);
         parameterCacheKey.addParameter("indent", this.indent);
         return parameterCacheKey;
     }
 
+    @Override
     public void finish() {
         // nothing to do
     }
 
+    @Override
     public String getContentType() {
         return this.getMimeType();
     }
 
-    public void setConfiguration(Map<String, ? extends Object> configuration) {
+    @Override
+    public void setConfiguration(final Map<String, ? extends Object> configuration)
{
         try {
             this.encoding = ConfigurationUtils.getEncoding(configuration);
             this.setEncoding(this.encoding);
@@ -78,7 +84,7 @@ SAXPipelineComponent, Finisher, SAXConsu
     }
 
     @Override
-    public void setOutputStream(OutputStream outputStream) {
+    public void setOutputStream(final OutputStream outputStream) {
         try {
             super.setOutputStream(outputStream);
         } catch (IOException e) {
@@ -86,7 +92,8 @@ SAXPipelineComponent, Finisher, SAXConsu
         }
     }
 
-    public void setup(Map<String, Object> parameters) {
+    @Override
+    public void setup(final Map<String, Object> parameters) {
         this.setup(HttpContextHelper.getRequest(parameters));
     }
 

Modified: cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/TextSerializer.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/TextSerializer.java?rev=1449724&r1=1449723&r2=1449724&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/TextSerializer.java
(original)
+++ cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/TextSerializer.java
Mon Feb 25 14:35:15 2013
@@ -16,24 +16,26 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.cocoon.sax.component;
 
 import org.apache.cocoon.sax.util.XMLUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.xml.sax.Attributes;
 import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
 
 /**
- * Converts XML into plain text. It omits all XML tags and writes only character
- * events to the output. Input document must have at least one element - root
- * element - which should wrap all the text inside it.
- * 
+ * Converts XML into plain text. It omits all XML tags and writes only character events to
the output. Input document
+ * must have at least one element - root element - which should wrap all the text inside
it.
+ *
  */
 public class TextSerializer extends XMLSerializer {
 
-    /*
-     * Set to true after first XML element
+    private static final Logger LOG = LoggerFactory.getLogger(TextSerializer.class);
+
+    /**
+     * Set to true after first XML element.
      */
     private boolean hasRootElement;
 
@@ -48,31 +50,33 @@ public class TextSerializer extends XMLS
         super.setOmitXmlDeclaration(true);
         this.hasRootElement = false;
     }
+
+    @Override
+    public void setDocumentLocator(final Locator locator) {
+        // nothing
+    }
+
     @Override
-    public void setDocumentLocator (Locator locator) { 
+    public void processingInstruction(final String target, final String data)
+            throws SAXException {
         // nothing
-      }
+    }
+
     @Override
-    public void processingInstruction (String target, String data)
-    throws SAXException{
+    public void startDTD(final String name, final String publicId, final String systemId)
+            throws SAXException {
         // nothing
     }
+
     @Override
-    public void startDTD(String name,
-            String publicId,
-            String systemId)
-     throws SAXException{
-     // nothing
-    }
-    
-    public void endDTD()
-            throws SAXException{
+    public void endDTD() throws SAXException {
         // nothing
     }
 
     @Override
-    public void startElement(String uri, String loc, String raw, Attributes a)
+    public void startElement(final String uri, final String loc, final String raw, final
Attributes atts)
             throws SAXException {
+
         this.hasRootElement = true;
     }
 
@@ -91,17 +95,16 @@ public class TextSerializer extends XMLS
     }
 
     /**
-     * @throws SAXException
-     *             if text is encountered before root element.
+     * @throws SAXException if text is encountered before root element.
      */
     @Override
-    public void characters(char c[], int start, int len) throws SAXException {
+    public void characters(final char buffer[], final int start, final int len) throws SAXException
{
         if (!this.hasRootElement) {
             this.hasRootElement = this.hadNoRootElement = true;
-            // getLogger().warn("Encountered text before root element. Creating <text>
wrapper element.");
+            LOG.warn("Encountered text before root element. Creating <text> wrapper
element.");
             super.startElement("", "text", "text", XMLUtils.EMPTY_ATTRIBUTES);
         }
-        super.characters(c, start, len);
+        super.characters(buffer, start, len);
     }
 
     @Override
@@ -111,8 +114,7 @@ public class TextSerializer extends XMLS
     }
 
     public static TextSerializer createPlainSerializer() {
-        TextSerializer serializer = null;
-        serializer = new TextSerializer();
+        TextSerializer serializer = new TextSerializer();
         serializer.setContentType("text/plain;charset=utf-8");
         serializer.setEncoding(ENCODING);
         serializer.setMethod(TXT);



Mime
View raw message