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 2004/09/22 14:27:27 UTC

svn commit: rev 47047 - in cocoon/trunk/src: blocks/databases/java/org/apache/cocoon/transformation blocks/linkrewriter/java/org/apache/cocoon/transformation blocks/mail/java/org/apache/cocoon/mail/transformation blocks/portal/java/org/apache/cocoon/portal/coplets/basket blocks/portal/java/org/apache/cocoon/portal/transformation blocks/repository/java/org/apache/cocoon/transformation blocks/session-fw/java/org/apache/cocoon/webapps/session/transformation java/org/apache/cocoon/transformation

Author: vgritsenko
Date: Wed Sep 22 05:27:27 2004
New Revision: 47047

Modified:
   cocoon/trunk/src/blocks/databases/java/org/apache/cocoon/transformation/SQLTransformer.java
   cocoon/trunk/src/blocks/linkrewriter/java/org/apache/cocoon/transformation/VariableRewriterTransformer.java
   cocoon/trunk/src/blocks/mail/java/org/apache/cocoon/mail/transformation/SendMailTransformer.java
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketTransformer.java
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/transformation/CopletTransformer.java
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/transformation/NewEventLinkTransformer.java
   cocoon/trunk/src/blocks/repository/java/org/apache/cocoon/transformation/SourcePropsWritingTransformer.java
   cocoon/trunk/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/transformation/SessionPreTransformer.java
   cocoon/trunk/src/java/org/apache/cocoon/transformation/AbstractSAXTransformer.java
   cocoon/trunk/src/java/org/apache/cocoon/transformation/CIncludeTransformer.java
   cocoon/trunk/src/java/org/apache/cocoon/transformation/JPathTransformer.java
   cocoon/trunk/src/java/org/apache/cocoon/transformation/SimpleFormTransformer.java
   cocoon/trunk/src/java/org/apache/cocoon/transformation/SourceWritingTransformer.java
Log:
AbstractSAXTransformer cleanup:
Make sure namespaceURI is not null, add javadoc.
Make sure defaultNamespaceURI is not null, add javadoc.
Implementations of AbstractSAXTransformer should set defaultNamespaceURI, not namespaceURI.


Modified: cocoon/trunk/src/blocks/databases/java/org/apache/cocoon/transformation/SQLTransformer.java
==============================================================================
--- cocoon/trunk/src/blocks/databases/java/org/apache/cocoon/transformation/SQLTransformer.java	(original)
+++ cocoon/trunk/src/blocks/databases/java/org/apache/cocoon/transformation/SQLTransformer.java	Wed Sep 22 05:27:27 2004
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 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.
@@ -69,7 +69,7 @@
  *         (PWR Organisation & Entwicklung)
  * @author <a href="mailto:sven.beauprez@the-ecorp.com">Sven Beauprez</a>
  * @author <a href="mailto:a.saglimbeni@pro-netics.com">Alfio Saglimbeni</a>
- * @version CVS $Id: SQLTransformer.java,v 1.20 2004/07/07 08:50:47 cziegeler Exp $
+ * @version CVS $Id$
  */
 public class SQLTransformer
   extends AbstractSAXTransformer
@@ -171,10 +171,10 @@
 
     /** Encoding we use for CLOB field */
 	protected String clobEncoding;
-	
+
     /** The default encoding for xml */
     protected String xmlDefaultEncoding;
-    
+
     /**
      * Constructor
      */
@@ -182,7 +182,7 @@
         this.format = new Properties();
         this.format.put(OutputKeys.METHOD, "text");
         this.format.put(OutputKeys.OMIT_XML_DECLARATION, "yes");
-        this.namespaceURI = NAMESPACE;
+        super.defaultNamespaceURI = NAMESPACE;
     }
 
     /** The connection used by all top level queries */
@@ -866,7 +866,7 @@
         protected HashMap outParametersNames = null;
 
         /** Handling of case of column names in results */
-        protected String columnCase; 
+        protected String columnCase;
 
         protected Query( SQLTransformer transformer, int query_index ) {
             this.transformer = transformer;
@@ -1127,7 +1127,7 @@
         protected String getColumnValue( int i ) throws SQLException {
 			int numberOfChar = 1024;
             String retval;
-			
+
 			if (rs.getMetaData().getColumnType(i) == java.sql.Types.DOUBLE) {
                 retval = SQLTransformer.getStringValue( rs.getBigDecimal( i ) );
 			} else if (rs.getMetaData().getColumnType(i) == java.sql.Types.CLOB) {
@@ -1145,7 +1145,7 @@
 				}
 				retval = buffer.toString();
 			} else {
-                retval = SQLTransformer.getStringValue( rs.getObject( i ) );                
+                retval = SQLTransformer.getStringValue( rs.getObject( i ) );
             }
             return retval;
         }
@@ -1211,12 +1211,12 @@
                 if ( value.length() > 0 && value.charAt(0) == '<') {
                     try {
                         String  stripped = value;
-                
-                        // Strip off the XML Declaration if there is one!                
+
+                        // Strip off the XML Declaration if there is one!
                         if( stripped.startsWith( "<?xml " ) ) {
                             stripped = stripped.substring( stripped.indexOf( "?>" ) + 2 );
                         }
-                
+
                         if (transformer.parser == null) {
                             transformer.parser = (SAXParser)manager.lookup(SAXParser.ROLE);
                         }

Modified: cocoon/trunk/src/blocks/linkrewriter/java/org/apache/cocoon/transformation/VariableRewriterTransformer.java
==============================================================================
--- cocoon/trunk/src/blocks/linkrewriter/java/org/apache/cocoon/transformation/VariableRewriterTransformer.java	(original)
+++ cocoon/trunk/src/blocks/linkrewriter/java/org/apache/cocoon/transformation/VariableRewriterTransformer.java	Wed Sep 22 05:27:27 2004
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 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.
@@ -35,7 +35,7 @@
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.AttributesImpl;
 
-/** 
+/**
  * Rewrites URIs in links to a value determined by an InputModule.
  * The URI scheme identifies the InputModule to use, and the rest of the URI is
  * used as the attribute name.
@@ -134,13 +134,13 @@
  * Note that currently, only links in the default ("") namespace are converted.
  *
  * @author <a href="mailto:jefft@apache.org">Jeff Turner</a>
- * @version CVS $Id: VariableRewriterTransformer.java,v 1.8 2004/05/26 11:23:47 unico Exp $
+ * @version CVS $Id$
  */
 public class VariableRewriterTransformer
     extends AbstractSAXTransformer implements Initializable, Disposable
 {
 
-    private static String NAMESPACE="";
+    private static String NAMESPACE = "";
 
     /** A list of attributes considered 'links' */
     private Set linkAttrs;
@@ -150,17 +150,24 @@
     private Set outSchemes;
 
     /** Configuration passed to the component once through configure(). */
-    private Configuration origConf; 
+    private Configuration origConf;
 
     /** Derivation of origConf with variables obtained from setup() parameters.
      * Recreated once per invocation. */
-    private Configuration conf; 
+    private Configuration conf;
 
     private InputModuleHelper modHelper;
 
     private String badLinkStr;
 
     /**
+     * Constructor. Set the namespace.
+     */
+    public VariableRewriterTransformer() {
+        super.defaultNamespaceURI = NAMESPACE;
+    }
+
+    /**
      * Configure this component from the map:transformer block.  Called before
      * initialization and setup.
      */
@@ -169,12 +176,11 @@
         super.configure(conf);
         this.origConf = conf;
     }
- 
+
     /**
      * Initiate resources prior to this component becoming active.
      */
     public void initialize() throws Exception {
-        this.namespaceURI = NAMESPACE;
         this.modHelper = new InputModuleHelper();
         modHelper.setup(this.manager);
     }
@@ -231,7 +237,7 @@
             String name,
             String raw,
             Attributes attr)
-        throws ProcessingException, IOException, SAXException 
+        throws ProcessingException, IOException, SAXException
     {
         Attributes newAttrs = null;
         boolean matched = false;
@@ -339,7 +345,7 @@
         // Note: configure() and initialize() are not called after every
         //recycle, so don't null origConf
     }
-    
+
     /* (non-Javadoc)
      * @see org.apache.avalon.framework.activity.Disposable#dispose()
      */

Modified: cocoon/trunk/src/blocks/mail/java/org/apache/cocoon/mail/transformation/SendMailTransformer.java
==============================================================================
--- cocoon/trunk/src/blocks/mail/java/org/apache/cocoon/mail/transformation/SendMailTransformer.java	(original)
+++ cocoon/trunk/src/blocks/mail/java/org/apache/cocoon/mail/transformation/SendMailTransformer.java	Wed Sep 22 05:27:27 2004
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 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.
@@ -59,10 +59,10 @@
  *
  * <p>
  *  The SendMailTransformer requires classes of the mail api from sun which comes
- *  with the mail.jar and activation.jar. 
- *  In order to use the SendMailtransformer, you have to download the mail.jar 
- *  from http://java.sun.com/products/javamail/ also like the activation.jar 
- *  from http://java.sun.com/products/javabeans/glasgow/jaf.html 
+ *  with the mail.jar and activation.jar.
+ *  In order to use the SendMailtransformer, you have to download the mail.jar
+ *  from http://java.sun.com/products/javamail/ also like the activation.jar
+ *  from http://java.sun.com/products/javabeans/glasgow/jaf.html
  *  and install it in the Cocoon lib directory.
  * </p>
  * <p>
@@ -174,7 +174,7 @@
  *
  */
 public class SendMailTransformer extends AbstractSAXTransformer {
-    
+
     /*
      * constants, related to elements in configuration-file
      */
@@ -192,7 +192,7 @@
     public static final String ELEMENT_SUCCESS            = "success";
     public static final String ELEMENT_FAILURE            = "failure";
     public static final String ELEMENT_RESULT             = "result";
-    
+
     public static final String DEFAULT_BODY_MIMETYPE      = "text/html";
 
     /*
@@ -238,12 +238,12 @@
 
     protected String defaultSmtpHost;
     protected String defaultFromAddress;
-    
+
     /**
      * create a new Transformer
      */
     public SendMailTransformer() {
-        this.defaultNamespaceURI = NAMESPACE;
+        super.defaultNamespaceURI = NAMESPACE;
     }
 
     /* (non-Javadoc)
@@ -255,7 +255,7 @@
         this.defaultSmtpHost = configuration.getChild("smtphost").getValue("");
         this.defaultFromAddress = configuration.getChild("from").getValue("");
     }
-    
+
     /**
      * invoked every time when the transformer is triggered by the pipeline
      */
@@ -263,7 +263,7 @@
                       Parameters par)
     throws ProcessingException, SAXException, IOException {
         super.setup(resolver, objectModel, src, par);
-        
+
         this.mailHost    = par.getParameter(PARAM_SMTPHOST, this.defaultSmtpHost);
         this.fromAddress = par.getParameter(PARAM_FROM, this.defaultFromAddress);
         this.port        = this.request.getServerPort();
@@ -279,7 +279,7 @@
         this.attachments = new ArrayList();
         this.defaultToAddresses = new ArrayList();
         appendToAddress(this.defaultToAddresses, par.getParameter(PARAM_TO, ""));
-        
+
   	    this.subject = par.getParameter(PARAM_SUBJECT, null);
    	    this.body = par.getParameter(PARAM_BODY, null);
     }
@@ -309,18 +309,18 @@
             this.mode = MODE_SUBJECT;
         } else if (name.equals(ELEMENT_MAILBODY)) {
             String strBody = attr.getValue("src");
-            
+
             if (strBody != null) {
                 this.bodyURI = strBody;
             }
-            
+
             String mType = attr.getValue("mime-type");
             if (mType != null) {
                 this.bodyMimeType = new String(mType);
             } else {
                 this.bodyMimeType = DEFAULT_BODY_MIMETYPE;
             }
-            
+
             this.startTextRecording();
             this.mode = MODE_BODY;
         } else if (name.equals(ELEMENT_ATTACHMENT)) {
@@ -525,10 +525,10 @@
         sm.setFrom(new InternetAddress(this.fromAddress));
         sm.setSubject(this.subject);
 
-        // process mail-body 					
+        // process mail-body
         BodyPart messageBodyPart = new MimeBodyPart();
 
-        // decide, if to take content from source or plain text 
+        // decide, if to take content from source or plain text
         // from variable to build mailbody
         if (this.bodyURI != null) {
             Source      inSrc   = resolver.resolveURI(this.bodyURI);
@@ -545,7 +545,7 @@
         Multipart multipart = new MimeMultipart();
         multipart.addBodyPart(messageBodyPart);
 
-        // process attachments				
+        // process attachments
         Iterator iterAtt = this.attachments.iterator();
 
         while (iterAtt.hasNext()) {
@@ -634,7 +634,7 @@
             super.sendStartElementEventNS("message");
             super.sendTextEvent(ex.getMessage());
             super.sendEndElementEventNS("message");
-            
+
             /* only with jdk 1.4
             super.sendStartElementEvent("email:stacktrace");
 
@@ -643,8 +643,8 @@
                 super.sendTextEvent(s + "\n");
             }
 
-            super.sendEndElementEvent("email:stacktrace");*/ 
-            
+            super.sendEndElementEvent("email:stacktrace");*/
+
             super.sendEndElementEventNS("exception");
 	    this.ignoreHooksCount--;
         } catch (SAXException e) {
@@ -662,7 +662,7 @@
         return iaArr;
     }
 
-	public void recycle() { 
+	public void recycle() {
         this.toAddresses = null;
         this.defaultToAddresses = null;
 	    this.attachments = null;
@@ -678,7 +678,7 @@
 	    this.smtpMessage = null;
 	    super.recycle();
 	}
-	
+
     static class AttachmentDescriptor {
         String       strAttrName;
         String       strAttrMimeType;

Modified: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketTransformer.java
==============================================================================
--- cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketTransformer.java	(original)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/coplets/basket/BasketTransformer.java	Wed Sep 22 05:27:27 2004
@@ -1,12 +1,12 @@
 /*
  * Copyright 2004,2004 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.
@@ -33,36 +33,36 @@
 /**
  * This transformer supports the basket feature. It can generate links to
  * add content and to upload files into the basket.
- * 
- * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a> 
- * 
- * @version CVS $Id: BasketTransformer.java,v 1.2 2004/03/05 13:02:11 bdelacretaz Exp $
+ *
+ * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
+ *
+ * @version CVS $Id$
  */
 public class BasketTransformer
 extends AbstractSAXTransformer {
 
     /** The namespace URI to listen for. */
     public static final String NAMESPACE_URI = "http://apache.org/cocoon/portal/basket/1.0";
-    
+
     /** Element to add a link */
     protected static final String ADD_ITEM_ELEMENT = "add-item";
-    
+
     /** Element to upload an item */
     protected static final String UPLOAD_ITEM_ELEMENT = "upload-item";
-    
+
     /** Element for the upload form */
     protected static final String UPLOAD_FORM_ELEMENT = "upload-form";
 
     /** Upload element list */
     protected List uploadElements = new ArrayList();
-    
+
     /**
      * Constructor
      */
     public BasketTransformer() {
-        this.namespaceURI = NAMESPACE_URI;
+        super.defaultNamespaceURI = NAMESPACE_URI;
     }
-    
+
     /* (non-Javadoc)
      * @see org.apache.avalon.excalibur.pool.Recyclable#recycle()
      */
@@ -85,7 +85,7 @@
             this.uploadElements = new ArrayList();
         }
     }
-    
+
     /* (non-Javadoc)
      * @see org.apache.cocoon.transformation.AbstractSAXTransformer#startTransformingElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
      */

Modified: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/transformation/CopletTransformer.java
==============================================================================
--- cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/transformation/CopletTransformer.java	(original)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/transformation/CopletTransformer.java	Wed Sep 22 05:27:27 2004
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2002,2004 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.
@@ -35,34 +35,34 @@
 
 /**
  * This transformer offers various functions for developing pipeline based coplets.
- * 
+ *
  * Includes coplet instance data by using JXPath expressions.
  * The transformer searches for tags &lt;coplet:coplet xmlns:coplet="http://apache.org/cocoon/portal/coplet/1.0"&gt;.
  * They must have an attribute "select" that contains a valid JXPath expression applying to the coplet instance data.<br><br>
  *
  * Example:<br><br>
- * 
+ *
  * <pre>&lt;maxpageable xmlns:coplet="http://apache.org/cocoon/portal/coplet/1.0"&gt;
  * 	&lt;coplet:coplet select="copletData.maxpageable"/&gt;
  * &lt;/maxpageable&gt;<br></pre>
- * 
- * The transformer will insert the boolean value specifying whether the coplet is 
- * maxpageable or not.<br> 
+ *
+ * The transformer will insert the boolean value specifying whether the coplet is
+ * maxpageable or not.<br>
  * Please see also the documentation of superclass AbstractCopletTransformer for how
  * the coplet instance data are acquired.
  *
  * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj&ouml;rn L&uuml;tkemeier</a>
- * @version CVS $Id: CopletTransformer.java,v 1.19 2004/04/01 10:25:41 cziegeler Exp $
+ * @version CVS $Id$
  */
-public class CopletTransformer 
+public class CopletTransformer
 extends AbstractCopletTransformer {
 
     /**
      * The namespace URI to listen for.
      */
     public static final String NAMESPACE_URI = "http://apache.org/cocoon/portal/coplet/1.0";
-    
+
     /**
      * The XML element name to listen for.
      */
@@ -73,7 +73,7 @@
      */
     public static final String SELECT_ATTR = "select";
 
-        
+
     /**
      * The XML element name to listen for.
      */
@@ -81,26 +81,26 @@
 
     /** Create a link containing several events */
     public static final String LINKS_ELEM = "links";
-    
+
     /** The content for the links element */
     public static final String CONTENT_ELEM = "content";
 
     /** Are we inside a links element? */
     protected boolean insideLinks;
-    
+
     /** The collected list of events */
     protected List collectedEvents = new ArrayList();
-    
+
     /** The content of the links */
     protected XMLizable content;
-    
+
     /**
      * Creates new CopletTransformer.
      */
     public CopletTransformer() {
-        this.defaultNamespaceURI = NAMESPACE_URI;
+        super.defaultNamespaceURI = NAMESPACE_URI;
     }
-    
+
     /* (non-Javadoc)
      * @see org.apache.cocoon.transformation.AbstractSAXTransformer#setupTransforming()
      */
@@ -115,23 +115,23 @@
     /**
      * Overridden from superclass.
      */
-    public void startTransformingElement(String uri, String name, String raw, Attributes attr) 
+    public void startTransformingElement(String uri, String name, String raw, Attributes attr)
     throws ProcessingException, IOException, SAXException {
         if (name.equals(COPLET_ELEM)) {
             String expression = attr.getValue(SELECT_ATTR);
             if (expression == null) {
                 throw new ProcessingException("Attribute "+SELECT_ATTR+" must be spcified.");
             }
-                
+
             CopletInstanceData cid = this.getCopletInstanceData();
-            
+
             JXPathContext jxpathContext = JXPathContext.newContext( cid );
             Object object = jxpathContext.getValue(expression);
-                
+
             if (object == null) {
                 throw new ProcessingException("Could not find value for expression "+expression);
             }
-                
+
         } else if (name.equals(LINK_ELEM)) {
 
             final LinkService linkService = this.getPortalService().getComponentManager().getLinkService();
@@ -143,7 +143,7 @@
             if ( attr.getValue("href") != null ) {
                 final CopletInstanceData cid = this.getCopletInstanceData();
                 ChangeCopletInstanceAspectDataEvent event = new ChangeCopletInstanceAspectDataEvent(cid, null, null);
-                
+
                 String value = linkService.getLinkURI(event);
                 if (value.indexOf('?') == -1) {
                     value = value + '?' + attr.getValue("href");
@@ -155,10 +155,10 @@
             } else {
                 final String path = attr.getValue("path");
                 final String value = attr.getValue("value");
-                
+
                 newAttrs.removeAttribute("path");
                 newAttrs.removeAttribute("value");
-                
+
                 JXPathEvent event = null;
                 if ( attr.getValue("layout") != null ) {
                     newAttrs.removeAttribute("layout");
@@ -201,7 +201,7 @@
     /**
      * Overridden from superclass.
      */
-    public void endTransformingElement(String uri, String name, String raw) 
+    public void endTransformingElement(String uri, String name, String raw)
     throws ProcessingException, IOException, SAXException {
         if ( name.equals(LINK_ELEM) ) {
             if ( !this.insideLinks ) {
@@ -214,7 +214,7 @@
             this.insideLinks = false;
             final String format = (String)this.stack.pop();
             final LinkService linkService = this.getPortalService().getComponentManager().getLinkService();
-            
+
             final String href = linkService.getLinkURI(this.collectedEvents);
             final AttributesImpl newAttrs = new AttributesImpl();
             this.output(href, format, newAttrs );
@@ -232,24 +232,24 @@
             this.content = this.endSAXRecording();
         } else if (!name.equals(COPLET_ELEM)) {
             super.endTransformingElement(uri, name, raw);
-        }  
+        }
     }
-    
+
     /**
      * Output the link
      */
-    protected void output(String uri, String format, AttributesImpl newAttrs) 
+    protected void output(String uri, String format, AttributesImpl newAttrs)
     throws SAXException {
         if ( format == null ) {
             // default
             format = "html-link";
         }
-        
+
         if ( "html-link".equals(format) ) {
             newAttrs.addCDATAAttribute("href", uri);
             this.sendStartElementEvent("a", newAttrs);
             this.stack.push("a");
-        
+
         } else if ( "html-form".equals(format) ) {
             boolean addParametersAsHiddenFields = false;
             String parameters = null;
@@ -278,7 +278,7 @@
                     this.startElement("", "input", "input", hiddenAttrs);
                     this.endElement("", "input", "input");
                 }
-                
+
             }
         } else if ( "text".equals(format) ) {
             this.sendTextEvent(uri);

Modified: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/transformation/NewEventLinkTransformer.java
==============================================================================
--- cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/transformation/NewEventLinkTransformer.java	(original)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/transformation/NewEventLinkTransformer.java	Wed Sep 22 05:27:27 2004
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2002,2004 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.
@@ -31,30 +31,30 @@
  * elements replaces the URI form the attribute which is specified within
  * an attribute called "attribute" and renames the element as specified
  * within an attribute called "element".
- * 
+ *
  * Example:<br><br>
- * 
+ *
  * <pre>
  * &lt;root xmlns:ev="http://apache.org/cocoon/portal/eventlink/1.0"&gt;
  *   &lt;ev:eventlink href="http://eventlinkexample" element="a" attribute="href"&gt;linktext&lt;/ev:eventlink&gt;
  * &lt;/root&gt;<br></pre>
  *
  * will be replaced with something like:<br><br>
- * 
+ *
  * <pre>
  * &lt;root&gt;
  *   &lt;a href="portal?cocoon-portal-event=8"&gt;linktext&lt;/a&gt;
  * &lt;/root&gt;<br></pre>
- * 
- * The transformer will create two CopletLinkEvents and insert corresponding links 
- * to them to the XML instead of "http://eventlinkexample". If such a link is pressed 
+ *
+ * The transformer will create two CopletLinkEvents and insert corresponding links
+ * to them to the XML instead of "http://eventlinkexample". If such a link is pressed
  * the corresponding CopletLinkEvent is sent to the Subscribers to be handled.<br>
  * Please see also the documentation of superclass AbstractCopletTransformer for how
  * the coplet instance data are acquired.
- *   
+ *
  * @author <a href="mailto:gernot.koller@rizit.at">Gernot Koller</a>
- * 
- * @version CVS $Id: NewEventLinkTransformer.java,v 1.7 2004/03/16 09:16:59 cziegeler Exp $
+ *
+ * @version CVS $Id$
  */
 public class NewEventLinkTransformer extends AbstractCopletTransformer {
     /**
@@ -79,7 +79,7 @@
     public static final String ELEMENT_ATTR = "element";
 
     /**
-     * Used to store elements' name between startTransformingElement and endTransformingElement. 
+     * Used to store elements' name between startTransformingElement and endTransformingElement.
      */
     private Stack elementStack = new Stack();
 
@@ -95,7 +95,7 @@
      * @see java.lang.Object#Object()
      */
     public NewEventLinkTransformer() {
-        this.namespaceURI = NAMESPACE_URI;
+        super.defaultNamespaceURI = NAMESPACE_URI;
     }
 
     /**

Modified: cocoon/trunk/src/blocks/repository/java/org/apache/cocoon/transformation/SourcePropsWritingTransformer.java
==============================================================================
--- cocoon/trunk/src/blocks/repository/java/org/apache/cocoon/transformation/SourcePropsWritingTransformer.java	(original)
+++ cocoon/trunk/src/blocks/repository/java/org/apache/cocoon/transformation/SourcePropsWritingTransformer.java	Wed Sep 22 05:27:27 2004
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 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.
@@ -33,7 +33,7 @@
 
 /**
  * This transformer allows you to set and remove properties on an InspectableSource.
- * 
+ *
 * <p>Input XML document example:</p>
  * <pre>
  * &lt;page&gt;
@@ -50,9 +50,9 @@
  *   ...
  * &lt;/page&gt;
  * </pre>
- * 
+ *
  * @author <a href="mailto:gcasper@s-und-n.de">Guido Casper</a>
- * @version CVS $Id: SourcePropsWritingTransformer.java,v 1.5 2004/03/05 13:02:22 bdelacretaz Exp $
+ * @version CVS $Id$
  */
 public class SourcePropsWritingTransformer
     extends AbstractSAXTransformer {
@@ -73,13 +73,13 @@
     private static final int STATE_REMOVE    = 4;
 
     private int state;
-    
+
     /**
      * Constructor
      * Set the namespace
      */
     public SourcePropsWritingTransformer() {
-        this.namespaceURI = SPWT_URI;
+        super.defaultNamespaceURI = SPWT_URI;
     }
 
     public void recycle() {
@@ -223,7 +223,7 @@
             this.state = STATE_PATCH;
             this.stack.push(this.endRecording());
             this.stack.push(REMOVE_ELEMENT);
-            
+
         // default
         } else {
             super.endTransformingElement(uri, name, raw);
@@ -234,7 +234,7 @@
         }
     }
 
-    private void setProperty(String src, Element element) 
+    private void setProperty(String src, Element element)
     throws ProcessingException, IOException, SAXException {
         if (src != null && element != null) {
             try {
@@ -254,10 +254,10 @@
             this.getLogger().error("Error setting properties on "+src);
         }
     }
-    
-    private void removeProperty(String src, Element element) 
-    throws ProcessingException, IOException, SAXException { 
-        
+
+    private void removeProperty(String src, Element element)
+    throws ProcessingException, IOException, SAXException {
+
         if (src != null && element != null) {
             try {
                 Source source = this.resolver.resolveURI(src);

Modified: cocoon/trunk/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/transformation/SessionPreTransformer.java
==============================================================================
--- cocoon/trunk/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/transformation/SessionPreTransformer.java	(original)
+++ cocoon/trunk/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/transformation/SessionPreTransformer.java	Wed Sep 22 05:27:27 2004
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 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.
@@ -32,7 +32,7 @@
  * pipeline.
  *
  * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
- * @version CVS $Id: SessionPreTransformer.java,v 1.4 2004/03/19 14:16:54 cziegeler Exp $
+ * @version CVS $Id$
 */
 public class SessionPreTransformer
 extends AbstractSessionTransformer {
@@ -60,8 +60,12 @@
     /** Are we inside a getxml? */
     protected int processingGetXML;
 
+
+    /**
+     * Constructor. Set the namespace.
+     */
     public SessionPreTransformer() {
-        this.namespaceURI = SessionConstants.SESSION_NAMESPACE_URI;
+        super.defaultNamespaceURI = SessionConstants.SESSION_NAMESPACE_URI;
     }
 
     /**
@@ -90,11 +94,9 @@
      */
     public void endElement(String uri, String name, String raw) throws SAXException {
         super.endElement(uri, name, raw);
-        if (uri != null
-            && namespaceURI != null
-            && uri.equals(namespaceURI) == true
+        if (namespaceURI.equals(uri)
             && this.processingGetXML > 0
-            && name.equals(GETXML_ELEMENT) == true) {
+            && name.equals(GETXML_ELEMENT)) {
             this.processingGetXML--;
             this.ignoreEventsCount--;
             this.ignoreHooksCount--;
@@ -111,11 +113,9 @@
                              String raw,
                              Attributes attr)
     throws SAXException {
-        if (uri != null
-            && namespaceURI != null
-            && uri.equals(namespaceURI) == true
+        if (namespaceURI.equals(uri)
             && this.processingGetXML > 0
-            && name.equals(GETXML_ELEMENT) == true) {
+            && name.equals(GETXML_ELEMENT)) {
             this.processingGetXML++;
             this.ignoreEventsCount++;
             this.ignoreHooksCount++;

Modified: cocoon/trunk/src/java/org/apache/cocoon/transformation/AbstractSAXTransformer.java
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/transformation/AbstractSAXTransformer.java	(original)
+++ cocoon/trunk/src/java/org/apache/cocoon/transformation/AbstractSAXTransformer.java	Wed Sep 22 05:27:27 2004
@@ -57,65 +57,73 @@
 import org.xml.sax.helpers.AttributesImpl;
 
 /**
- *  This class is the basis for all transformers. It provides various useful
- *  methods and hooks for implementing own custom transformers.<p>
- *  <p>
- *  The basic behaviour of each transformer consists of the following four parts:
- *  <ul>
- *  <li>Listen for specific events with a given namespace</li>
- *  <li>Collect information via these events</li>
- *  <li>Process the information</li>
- *  <li>Create new events from the processed information</li>
- *  </ul><p>
- *  For all these four purposes the AbstractSAXTransformer offers some
- *  powerful methods and hooks:
- *  <p>
- *  Namespace handling<p>
- *  By setting the instance variable namespaceURI to the namespace the
- *  events are filtered and only events with this namespace are send to
- *  the two hooks startTransformingElement() and endTransformingElement().<p>
- *  It is possible to override the default
- *  namespace for the transformer by specifying the parameter "namespaceURI"
- *  in the pipeline. This avoids possible namespace collisions.<p>
+ * This class is the basis for all transformers. It provides various useful
+ * methods and hooks for implementing own custom transformers.
  *
- *  Recording of information<p>
- *  There are several methods for recording information, e.g. startRecording(),
- *  startTextRecording() etc. These methods collect information from the xml
- *  stream for further processing.<p>
+ * <p>The basic behaviour of each transformer consists of the following four
+ * parts:</p>
+ * <ul>
+ * <li>Listen for specific events with a given namespace</li>
+ * <li>Collect information via these events</li>
+ * <li>Process the information</li>
+ * <li>Create new events from the processed information</li>
+ * </ul>
  *
- *  Creating new events<p>
- *  New events can be easily created with the <code>sendEvents()</code>
- *  method, the <code>sendStartElementEvent()</code> methods, the <code>sendEndElementEvent()</code>
- *  method or the <code>sendTextEvent()</code> method.<p>
+ * <p>For all these four purposes the AbstractSAXTransformer offers some
+ * powerful methods and hooks:</p>
  *
- *  Initialization<p>
- *  Before the document is processed the setupTransforming() hook is invoked.
+ * <h3>Namespace handling</h3>
+ * By setting the instance variable namespaceURI to the namespace the
+ * events are filtered and only events with this namespace are send to
+ * the two hooks: <code>startTransformingElement</code> and
+ * <code>endTransformingElement</code>. It is possible to override the default
+ * namespace for the transformer by specifying the parameter "namespaceURI"
+ * in the pipeline. This avoids possible namespace collisions.
  *
+ * <h3>Recording of information</h3>
+ * There are several methods for recording information, e.g. startRecording(),
+ * startTextRecording() etc. These methods collect information from the xml
+ * stream for further processing.
+ *
+ * <h3>Creating new events</h3>
+ * New events can be easily created with the <code>sendEvents()</code>
+ * method, the <code>sendStartElementEvent()</code> methods, the
+ * <code>sendEndElementEvent()</code> method or the
+ * <code>sendTextEvent()</code> method.
+ *
+ * <h3>Initialization</h3>
+ * Before the document is processed the <code>setupTransforming</code> hook
+ * is invoked.
  *
  * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
- * @version CVS $Id: AbstractSAXTransformer.java,v 1.13 2004/06/18 14:28:56 vgritsenko Exp $
+ * @version CVS $Id$
 */
 public abstract class AbstractSAXTransformer
-extends AbstractTransformer
-implements Serviceable, Configurable, Recyclable {
+        extends AbstractTransformer
+        implements Serviceable, Configurable, Recyclable {
 
-    /** Controlls SAX event handling.
-     *  If set to true all whitespace events are ignored.
+    /**
+     * Controlls SAX event handling.
+     * If set to true all whitespace events are ignored.
      */
     protected boolean ignoreWhitespaces;
-    /** Controlls SAX event handling
-     *  If set to true all characters events containing only whitespaces
-     *  are ignored.
+
+    /**
+     * Controlls SAX event handling.
+     * If set to true all characters events containing only whitespaces
+     * are ignored.
      */
     protected boolean ignoreEmptyCharacters;
 
-    /** Controlls SAX event handling
+    /**
+     * Controlls SAX event handling.
      * If this is incremented all events are not forwarded to the next
      * pipeline component, but the hooks are still called.
      */
     protected int ignoreEventsCount;
 
-    /** Controlls SAX event handling
+    /**
+     * Controlls SAX event handling.
      * If this is greater than zero, the hooks are not called. Attention,
      * make sure, that you decrement this counter properly as your hooks are
      * not called anymore!
@@ -123,25 +131,31 @@
     protected int ignoreHooksCount;
 
     /**
-     *  The used namespace for the SAX filtering.
-     *  This is either the defaultNamespaceURI or the value
-     *  set by the "namespaceURI" parameter for the pipeline.
+     * The namespace used by the transformer for the SAX events filtering.
+     * This either equals to the {@link #defaultNamespaceURI} or to the value
+     * set by the <code>namespaceURI</code> sitemap parameter for the pipeline.
+     * Must never be null.
      */
-    protected String  namespaceURI;
+    protected String namespaceURI;
 
     /**
      * This is the default namespace used by the transformer.
-     * It should be set in the constructor.
+     * Implementations should set its value in the constructor.
+     * Must never be null.
      */
-    protected String  defaultNamespaceURI;
+    protected String defaultNamespaceURI;
 
-    /** A stack for collecting information.
-     *  The stack is important for collection information especially when
-     *  the tags can be nested.
+    /**
+     * A stack for collecting information.
+     * The stack is important for collection information especially when
+     * the tags can be nested.
+     */
+    protected Stack stack = new Stack();
+
+    /**
+     * The stack of current used recorders
      */
-    protected Stack   stack = new Stack();
-    /** The stack of current used recorders */
-    protected Stack   recorderStack = new Stack();
+    protected Stack recorderStack = new Stack();
 
     /** The current Request object */
     protected Request            request;
@@ -163,22 +177,24 @@
     /** Are we already initialized for the current request? */
     private boolean isInitialized;
 
-    /** Empty attributes (for performance). This can be used
-     *  do create own attributes, but make sure to clean them
-     *  afterwords.
+    /**
+     * Empty attributes (for performance). This can be used
+     * do create own attributes, but make sure to clean them
+     * afterwords.
      */
     protected AttributesImpl emptyAttributes = new AttributesImpl();
 
     /** The namespaces and their prefixes */
     private List namespaces = new ArrayList(5);
+
     /** The current prefix for our namespace */
     private String ourPrefix;
 
+
     /* (non-Javadoc)
      * @see Configurable#configure(Configuration)
      */
-    public void configure(Configuration configuration)
-    throws ConfigurationException {
+    public void configure(Configuration configuration) throws ConfigurationException {
     }
 
     /* (non-Javadoc)
@@ -187,19 +203,19 @@
     public void setup(SourceResolver resolver,
                       Map            objectModel,
                       String         src,
-                      Parameters     par)
-    throws ProcessingException,
-           SAXException,
-           IOException {
+                      Parameters     params)
+    throws ProcessingException, SAXException, IOException {
+
         if (getLogger().isDebugEnabled()) {
             getLogger().debug("Setup resolver=" + resolver +
                               ", objectModel=" + objectModel +
                               ", src=" + src +
-                              ", parameters=" + par);
+                              ", parameters=" + params);
         }
 
+        // defaultNamespaceURI should never be null
         if (this.defaultNamespaceURI == null) {
-            this.defaultNamespaceURI = this.namespaceURI;
+            this.defaultNamespaceURI = "";
         }
         this.objectModel = objectModel;
 
@@ -207,13 +223,13 @@
         this.response = ObjectModelHelper.getResponse(objectModel);
         this.context = ObjectModelHelper.getContext(objectModel);
         this.resolver = resolver;
-        this.parameters = par;
+        this.parameters = params;
         this.source = src;
         this.isInitialized = false;
 
         // get the current namespace
-        this.namespaceURI = this.parameters.getParameter("namespaceURI",
-                                                         this.defaultNamespaceURI);
+        this.namespaceURI = params.getParameter("namespaceURI",
+                                                this.defaultNamespaceURI);
 
         this.ignoreHooksCount = 0;
         this.ignoreEventsCount = 0;
@@ -226,6 +242,7 @@
      */
     public void recycle() {
         super.recycle();
+        this.namespaceURI = null;
         this.objectModel = null;
         this.request = null;
         this.response = null;
@@ -290,18 +307,14 @@
                              String raw,
                              Attributes attr)
     throws SAXException {
-        if (uri != null
-            && namespaceURI != null
-            && uri.equals(namespaceURI) == true
-            && this.ignoreHooksCount == 0) {
-
+        if (namespaceURI.equals(uri) && ignoreHooksCount == 0) {
             // this is our namespace:
             try {
-                this.startTransformingElement(uri, name, raw, attr);
-            } catch (ProcessingException pException) {
-                throw new SAXException("ProcessingException: " + pException, pException);
-            } catch (IOException ioe) {
-                throw new SAXException("Exception occured during processing: " + ioe, ioe);
+                startTransformingElement(uri, name, raw, attr);
+            } catch (ProcessingException e) {
+                throw new SAXException("ProcessingException: " + e, e);
+            } catch (IOException e) {
+                throw new SAXException("IOException occured during processing: " + e, e);
             }
         } else {
             if (ignoreEventsCount == 0) {
@@ -310,25 +323,21 @@
         }
     }
 
-
     /**
      * Process the SAX event.
      * The namespace of the event is checked. If it is the defined namespace
      * for this transformer the endTransformingElement() hook is called.
      */
-    public void endElement(String uri, String name, String raw) throws SAXException {
-        if (uri != null
-            && namespaceURI != null
-            && uri.equals(namespaceURI) == true
-            && this.ignoreHooksCount == 0) {
-
+    public void endElement(String uri, String name, String raw)
+    throws SAXException {
+        if (namespaceURI.equals(uri) && this.ignoreHooksCount == 0) {
             // this is our namespace:
             try {
-                this.endTransformingElement(uri, name, raw);
+                endTransformingElement(uri, name, raw);
             } catch (ProcessingException e) {
                 throw new SAXException("ProcessingException: " + e, e);
-            } catch (IOException ioe) {
-                throw new SAXException("Exception occured during processing: " + ioe, ioe);
+            } catch (IOException e) {
+                throw new SAXException("IOException occured during processing: " + e, e);
             }
         } else {
             if (ignoreEventsCount == 0) {
@@ -343,7 +352,7 @@
     public void characters(char[] p0, int p1, int p2)
     throws SAXException {
         if (this.ignoreEventsCount == 0) {
-            if (this.ignoreEmptyCharacters == true) {
+            if (this.ignoreEmptyCharacters) {
                 String value = new String(p0, p1, p2);
                 if (value.trim().length() > 0) {
                     super.characters(p0, p1, p2);
@@ -364,11 +373,13 @@
         }
     }
 
+
     /*
      * Recording of events.
      * With this method all events are not forwarded to the next component in the pipeline.
      * They are recorded to create a document fragment.
      */
+
     private LexicalHandler   originalLexicalHandler;
     private ContentHandler   originalContentHandler;
 
@@ -377,13 +388,13 @@
      * Do not invoke this method directly.
      */
     protected void addRecorder(XMLConsumer recorder) {
-        if (this.recorderStack.empty() == true) {
+        if (this.recorderStack.empty()) {
             // redirect if first (top) recorder
             this.originalLexicalHandler = this.lexicalHandler;
             this.originalContentHandler = this.contentHandler;
         }
-        this.setContentHandler(recorder);
-        this.setLexicalHandler(recorder);
+        setContentHandler(recorder);
+        setLexicalHandler(recorder);
         this.recorderStack.push(recorder);
     }
 
@@ -395,15 +406,16 @@
         Object recorder = this.recorderStack.pop();
         if (this.recorderStack.empty() == true) {
             // undo redirect if no recorder any more
-            this.setContentHandler(originalContentHandler);
-            this.setLexicalHandler(originalLexicalHandler);
+            setContentHandler(originalContentHandler);
+            setLexicalHandler(originalLexicalHandler);
             this.originalLexicalHandler = null;
             this.originalContentHandler = null;
         } else {
-            XMLConsumer next = (XMLConsumer)recorderStack.peek();
-            this.setContentHandler(next);
-            this.setLexicalHandler(next);
+            XMLConsumer next = (XMLConsumer) recorderStack.peek();
+            setContentHandler(next);
+            setLexicalHandler(next);
         }
+
         return recorder;
     }
 
@@ -415,7 +427,7 @@
      */
     public void startSAXRecording()
     throws SAXException {
-        this.addRecorder(new SaxBuffer());
+        addRecorder(new SaxBuffer());
     }
 
     /**
@@ -426,7 +438,7 @@
      */
     public XMLizable endSAXRecording()
     throws SAXException {
-        return (XMLizable)this.removeRecorder();
+        return (XMLizable) this.removeRecorder();
     }
 
     /**
@@ -439,8 +451,7 @@
         if (getLogger().isDebugEnabled()) {
             getLogger().debug("Start text recording");
         }
-        XMLConsumer recorder = new TextRecorder();
-        addRecorder(recorder);
+        addRecorder(new TextRecorder());
 
         sendStartPrefixMapping();
     }
@@ -453,7 +464,7 @@
     throws SAXException {
         sendEndPrefixMapping();
 
-        TextRecorder recorder = (TextRecorder)this.removeRecorder();
+        TextRecorder recorder = (TextRecorder) removeRecorder();
         String text = recorder.getText();
         if (getLogger().isDebugEnabled()) {
             getLogger().debug("End text recording. Text=" + text);
@@ -485,7 +496,7 @@
     public String endSerializedXMLRecording()
     throws SAXException, ProcessingException {
         DocumentFragment fragment = endRecording();
-        String text = XMLUtils.serializeNode(fragment, (Properties)this.stack.pop());
+        String text = XMLUtils.serializeNode(fragment, (Properties) this.stack.pop());
         if (getLogger().isDebugEnabled()) {
             getLogger().debug("End serialized XML recording. XML=" + text);
         }
@@ -504,8 +515,7 @@
         if (getLogger().isDebugEnabled()) {
             getLogger().debug("Start parameters recording");
         }
-        XMLConsumer recorder = new ParametersRecorder();
-        addRecorder(recorder);
+        addRecorder(new ParametersRecorder());
 
         sendStartPrefixMapping();
     }
@@ -521,7 +531,7 @@
     throws SAXException {
         sendEndPrefixMapping();
 
-        ParametersRecorder recorder = (ParametersRecorder)this.removeRecorder();
+        ParametersRecorder recorder = (ParametersRecorder) this.removeRecorder();
         SourceParameters parameters = recorder.getParameters(source);
         if (getLogger().isDebugEnabled()) {
             getLogger().debug("End parameters recording. Parameters=" + parameters);
@@ -540,7 +550,7 @@
     throws SAXException {
         sendEndPrefixMapping();
 
-        ParametersRecorder recorder = (ParametersRecorder)this.removeRecorder();
+        ParametersRecorder recorder = (ParametersRecorder) removeRecorder();
         SourceParameters parameters = recorder.getParameters(source);
         if (getLogger().isDebugEnabled()) {
             getLogger().debug("End parameters recording. Parameters=" + parameters);
@@ -584,6 +594,7 @@
         final DocumentFragment recordedDocFrag = doc.createDocumentFragment();
         final Node root = doc.getDocumentElement();
         root.normalize();
+
         boolean appendedNode = false;
         while (root.hasChildNodes() == true) {
             Node child = root.getFirstChild();
@@ -672,7 +683,7 @@
      */
     public void sendTextEvent(String text)
     throws SAXException {
-        this.characters(text.toCharArray(), 0, text.length());
+        characters(text.toCharArray(), 0, text.length());
     }
 
     /**
@@ -684,7 +695,7 @@
      */
     public void sendStartElementEvent(String localname)
     throws SAXException {
-        this.startElement("", localname, localname, emptyAttributes);
+        startElement("", localname, localname, emptyAttributes);
     }
 
     /**
@@ -697,8 +708,8 @@
      */
     public void sendStartElementEventNS(String localname)
     throws SAXException {
-        this.startElement(this.namespaceURI,
-                          localname, this.ourPrefix+':' + localname, emptyAttributes);
+        startElement(this.namespaceURI,
+                     localname, this.ourPrefix + ':' + localname, emptyAttributes);
     }
 
     /**
@@ -711,7 +722,7 @@
      */
     public void sendStartElementEvent(String localname, Attributes attr)
     throws SAXException {
-        this.startElement("", localname, localname, attr);
+        startElement("", localname, localname, attr);
     }
 
     /**
@@ -724,8 +735,8 @@
      */
     public void sendStartElementEventNS(String localname, Attributes attr)
     throws SAXException {
-        this.startElement(this.namespaceURI,
-                          localname, this.ourPrefix+':' + localname, attr);
+        startElement(this.namespaceURI,
+                     localname, this.ourPrefix + ':' + localname, attr);
     }
 
     /**
@@ -737,7 +748,7 @@
      */
     public void sendEndElementEvent(String localname)
     throws SAXException {
-        this.endElement("", localname, localname);
+        endElement("", localname, localname);
     }
 
     /**
@@ -749,8 +760,8 @@
      */
     public void sendEndElementEventNS(String localname)
     throws SAXException {
-        this.endElement(this.namespaceURI,
-                         localname, this.ourPrefix+':' + localname);
+        endElement(this.namespaceURI,
+                   localname, this.ourPrefix + ':' + localname);
     }
 
     /**
@@ -851,7 +862,7 @@
         if (prefix != null) {
             this.namespaces.add(new String[] {prefix, uri});
         }
-        if (this.namespaceURI != null && this.namespaceURI.equals(uri)) {
+        if (namespaceURI.equals(uri)) {
             this.ourPrefix = prefix;
         }
         if (this.ignoreEventsCount == 0) {
@@ -891,7 +902,7 @@
                 i = l-1;
                 while (!found && i >= 0) {
                     String currentNS = ((String[])this.namespaces.get(i))[1];
-                    if (currentNS.equals(this.namespaceURI)) {
+                    if (namespaceURI.equals(currentNS)) {
                         found = true;
                     } else {
                         i--;

Modified: cocoon/trunk/src/java/org/apache/cocoon/transformation/CIncludeTransformer.java
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/transformation/CIncludeTransformer.java	(original)
+++ cocoon/trunk/src/java/org/apache/cocoon/transformation/CIncludeTransformer.java	Wed Sep 22 05:27:27 2004
@@ -185,7 +185,7 @@
      * Set the namespace
      */
     public CIncludeTransformer() {
-        this.namespaceURI = CINCLUDE_NAMESPACE_URI;
+        super.defaultNamespaceURI = CINCLUDE_NAMESPACE_URI;
     }
 
     /**

Modified: cocoon/trunk/src/java/org/apache/cocoon/transformation/JPathTransformer.java
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/transformation/JPathTransformer.java	(original)
+++ cocoon/trunk/src/java/org/apache/cocoon/transformation/JPathTransformer.java	Wed Sep 22 05:27:27 2004
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 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.
@@ -34,11 +34,11 @@
 /**
  * @cocoon.sitemap.component.documentation
  *  Transformer implementation of the JPath XSP tag library.
- * 
+ *
  * @cocoon.sitemap.component.name   jpath
  * @cocoon.sitemap.component.logger sitemap.transformer.jpath
- * 
- * 
+ *
+ *
  * <p>
  *  This transformer (so far) supports the following jpath elements:
  *
@@ -54,7 +54,7 @@
  * </p>
  *
  * @author <a href="mailto:crafterm@apache.org">Marcus Crafter</a>
- * @version CVS $Id: JPathTransformer.java,v 1.6 2004/06/17 14:55:24 cziegeler Exp $
+ * @version CVS $Id$
  */
 public class JPathTransformer
 extends AbstractSAXTransformer implements Initializable {
@@ -96,14 +96,18 @@
     private Map m_cache;
 
     /**
+     * Constructor. Set namespace.
+     */
+    public JPathTransformer() {
+        super.defaultNamespaceURI = JPATH_NAMESPACE_URI;
+    }
+
+    /**
      * Initialize this transformer.
      *
      * @exception Exception if an error occurs
      */
-    public void initialize()
-        throws Exception {
-
-        namespaceURI = JPATH_NAMESPACE_URI;
+    public void initialize() throws Exception {
         m_re = new RE("id");
         m_cache = new HashMap();
     }

Modified: cocoon/trunk/src/java/org/apache/cocoon/transformation/SimpleFormTransformer.java
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/transformation/SimpleFormTransformer.java	(original)
+++ cocoon/trunk/src/java/org/apache/cocoon/transformation/SimpleFormTransformer.java	Wed Sep 22 05:27:27 2004
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 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.
@@ -43,14 +43,14 @@
 import java.util.List;
 import java.util.Map;
 
-/** 
+/**
  * @cocoon.sitemap.component.documentation
- * Eliminates the need for XSP to use FormValidatorAction or HTML forms. 
+ * Eliminates the need for XSP to use FormValidatorAction or HTML forms.
  * Caveat: Select options need a value attribute to work correctly.
- * 
+ *
  * @cocoon.sitemap.component.name   simple-form
  * @cocoon.sitemap.component.logger sitemap.transformer.simple-form
- * 
+ *
  *
  * <p>This transformer fills all HTML 4 form elements with values from
  * an InputModule, e.g. request, with the same name. It handles select
@@ -77,13 +77,13 @@
  *
  * <p><em>Names of error elements are never augmented by prefix, suffix or
  * form name.</em></p>
- * 
+ *
  * <p>Page parts with multiple occurrences depending on the number of
  * actual parameters can be enclosed in &lt;repeat on="expr" using="var"/&gt;
  * elements. <em>expr</em> is used to determine the number of occurrences
  * and <em>var</em> will be expanded with the ordinary number. Repeat elements
  * can be nested.</p>
- * 
+ *
  * <p>Example:</p>
  * <pre>
  *  <repeat on="mult" using="i"><input type="text" name="mult[${i}]"/></repeat>
@@ -100,9 +100,9 @@
  *
  * <p>Configuration elements:
  * <table>
- *   <tr><td>input-module</td><td>(String) InputModule configuration, 
+ *   <tr><td>input-module</td><td>(String) InputModule configuration,
  *           defaults to an empty configuration and the "request-param" module</td></tr>
- *   <tr><td>fixed-attribute</td><td>(String) Name of the attribute used to 
+ *   <tr><td>fixed-attribute</td><td>(String) Name of the attribute used to
  *           indicate that this element should not be changed. ("fixed")</td></tr>
  *   <tr><td>use-form-name</td><td>(boolean) Add the name of the form to the
  *           name of form elements. Uses default Separator , if default separator is null
@@ -110,7 +110,7 @@
  *   <tr><td>use-form-name-twice</td><td>(boolean) Add the name of the form twice to the
  *           name of form elements. This is useful when the form instance has no
  *           all enclosing root tag and the form name is used instead <em>and</em> the
- *           form name needs to be used to find the form data. Uses default Separator , 
+ *           form name needs to be used to find the form data. Uses default Separator ,
  *           if default separator is null or empty, separator is set to "/".("false")</td></tr>
  *   <tr><td>separator</td><td>(String) Separator between form name and element name ("/")
  *           </td></tr>
@@ -145,7 +145,7 @@
  * </pre></p>
  *
  * @author <a href="mailto:haul@apache.org">Christian Haul</a>
- * @version CVS $Id: SimpleFormTransformer.java,v 1.17 2004/06/24 07:33:28 cziegeler Exp $
+ * @version CVS $Id$
  */
 public class SimpleFormTransformer extends AbstractSAXTransformer implements Recyclable {
 
@@ -276,8 +276,9 @@
     /** Map of {@link ValueList} to track multiple parameters. */
     protected Map formValues = null;
 
+
     /**
-     * Keep track of repeater status. 
+     * Keep track of repeater status.
      */
     protected class RepeaterStatus {
         public String var = null;
@@ -296,7 +297,7 @@
     }
 
     /**
-     * Keep track of multiple values. 
+     * Keep track of multiple values.
      */
     protected static class ValueList {
         private int current = -1;
@@ -318,9 +319,12 @@
         }
     }
 
+
+    /**
+     * Constructor. Set the namespace.
+     */
     public SimpleFormTransformer() {
-        this.defaultNamespaceURI = "";
-        this.namespaceURI = "";
+        super.defaultNamespaceURI = "";
     }
 
     /** set per instance variables to defaults */
@@ -464,7 +468,7 @@
         this.reset();
     }
 
-    /** 
+    /**
      * Generate string representation of attributes. For debug only.
      */
     protected String printAttributes(Attributes attr) {
@@ -761,8 +765,8 @@
 
     /**
      * Start processing a form element. Sets protection indicator if attribute
-     * "fixed" is present and either "true" or "yes". Removes attribute "fixed" 
-     * if present. 
+     * "fixed" is present and either "true" or "yes". Removes attribute "fixed"
+     * if present.
      * @param uri The namespace of the element.
      * @param name The local name of the element.
      * @param raw The qualified name of the element.
@@ -797,7 +801,7 @@
      * Start recording repeat element contents and push repeat expression and
      * variable to repeater stack. Only start recording, if no other recorder is
      * currently running.
-     * 
+     *
      * @param uri
      * @param name
      * @param raw
@@ -826,7 +830,7 @@
     /**
      * Stop recording repeat contents and replay required number of times.
      * Stop only if outmost repeat element is ending.
-     * 
+     *
      * @param uri
      * @param name
      * @param raw
@@ -962,7 +966,7 @@
     /**
      * Remove extra information from element's attributes. Currently only removes
      * the repeater variable from the element's name attribute if present.
-     * 
+     *
      * @param attr
      * @return modified attributes
      */
@@ -1041,7 +1045,7 @@
     /**
      * Obtain values from used InputModule if not done already and return the
      * next value. If no more values exist, returns null.
-     * 
+     *
      * @param name
      * @return
      */
@@ -1114,7 +1118,7 @@
 
     /**
      * Calls the super's method startTransformingElement.
-     * 
+     *
      * @param uri
      * @param name
      * @param raw
@@ -1131,9 +1135,9 @@
      * ignoreEventsCount if skip is true. Increment can be done either before
      * invoking super's method, so that the element itself is skipped, or afterwards,
      * so that only the children are skipped.
-     * 
+     *
      * @param skip
-     * @param skipChildrenOnly 
+     * @param skipChildrenOnly
      * @param uri
      * @param name
      * @param raw
@@ -1172,7 +1176,7 @@
     /**
      * Calls the super's method endTransformingElement and decrements the
      * ignoreEventsCount if larger than zero.
-     * 
+     *
      * @param uri
      * @param name
      * @param raw

Modified: cocoon/trunk/src/java/org/apache/cocoon/transformation/SourceWritingTransformer.java
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/transformation/SourceWritingTransformer.java	(original)
+++ cocoon/trunk/src/java/org/apache/cocoon/transformation/SourceWritingTransformer.java	Wed Sep 22 05:27:27 2004
@@ -229,7 +229,7 @@
  * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
  * @author <a href="mailto:jeremy@apache.org">Jeremy Quinn</a>
  * @author <a href="mailto:gianugo@apache.org">Gianugo Rabellino</a>
- * @version CVS $Id: SourceWritingTransformer.java,v 1.13 2004/06/18 14:17:59 vgritsenko Exp $
+ * @version CVS $Id$
  */
 public class SourceWritingTransformer
     extends AbstractSAXTransformer
@@ -285,11 +285,10 @@
     protected XPathProcessor xpathProcessor;
 
     /**
-     * Constructor.
-     * Sets the namespace.
+     * Constructor. Set the namespace.
      */
     public SourceWritingTransformer() {
-        this.namespaceURI = SWT_URI;
+        super.defaultNamespaceURI = SWT_URI;
     }
 
     /**

Re: svn commit: rev 47047 - in cocoon/trunk/src: blocks/databases/java/org/apache/cocoon/transformation blocks/linkrewriter/java/org/apache/cocoon/transformation blocks/mail/java/org/apache/cocoon/mail/transformation blocks/portal/java/org/apache/cocoon/portal/coplets/basket blocks/portal/java/org/apache/cocoon/portal/transformation blocks/repository/java/org/apache/cocoon/transformation blocks/session-fw/java/org/apache/cocoon/webapps/session/transformation java/org/apache/cocoon/transformation

Posted by Andreas Hartmann <an...@apache.org>.
Andreas Hartmann wrote:
> vgritsenko@apache.org wrote:
> 
> [...]
> 
>> AbstractSAXTransformer cleanup:
>> Make sure namespaceURI is not null
> 
> 
> 
> http://www.saxproject.org/?selected=namespaces
> 
> If I understand this correctly, a null URI should be used
> to denote elements without a namespace (I used to handle
> it like that).
> 
> I just updated the Cocoon trunk and got a NPE in
> AbstractSAXTransformer.endPrefixMapping():
> 
>         if (namespaceURI.equals(uri)) {

Just in case someone is faced with the same problem:

It happened because a transformer did not call
super.setup() when overriding setup(). That's why
the namespaceURI field was not initialized.

-- Andreas


Re: svn commit: rev 47047 - in cocoon/trunk/src: blocks/databases/java/org/apache/cocoon/transformation blocks/linkrewriter/java/org/apache/cocoon/transformation blocks/mail/java/org/apache/cocoon/mail/transformation blocks/portal/java/org/apache/cocoon/portal/coplets/basket blocks/portal/java/org/apache/cocoon/portal/transformation blocks/repository/java/org/apache/cocoon/transformation blocks/session-fw/java/org/apache/cocoon/webapps/session/transformation java/org/apache/cocoon/transformation

Posted by Sylvain Wallez <sy...@apache.org>.
Andreas Hartmann wrote:

> Sylvain Wallez wrote:
>
>> Andreas Hartmann wrote:
>>
>
> [...]
>
>> Nono: what's explained here is that some parsers may not report the 
>> qName if their namespace-prefixes property is false. The 
>> ContentHandler.startElement() javadoc clearly states that the 
>> namespaceURI *is never null* !
>>
>> Passing null namespace URIs is a well known source or crashes for 
>> Xalan :-/
>
>
> Great, thanks for the info!
>
> Does that mean that the empty string is not allowed as a namespace URI?
>
> <foo:bar xmlns:foo=""/>


Aha, good question!

The namespace spec [1] states that the namespace URI "should have the 
characteristics of uniqueness and persistence". The empty string doesn't 
seem explicitely forbidden, but I'm not sure it has the required 
characteristics :-)

Sylvain

[1] http://www.w3.org/TR/REC-xml-names/#ns-decl

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }


Re: svn commit: rev 47047 - in cocoon/trunk/src: blocks/databases/java/org/apache/cocoon/transformation blocks/linkrewriter/java/org/apache/cocoon/transformation blocks/mail/java/org/apache/cocoon/mail/transformation blocks/portal/java/org/apache/cocoon/portal/coplets/basket blocks/portal/java/org/apache/cocoon/portal/transformation blocks/repository/java/org/apache/cocoon/transformation blocks/session-fw/java/org/apache/cocoon/webapps/session/transformation java/org/apache/cocoon/transformation

Posted by Andreas Hartmann <an...@apache.org>.
Sylvain Wallez wrote:
> Andreas Hartmann wrote:
> 

[...]

> Nono: what's explained here is that some parsers may not report the 
> qName if their namespace-prefixes property is false. The 
> ContentHandler.startElement() javadoc clearly states that the 
> namespaceURI *is never null* !
> 
> Passing null namespace URIs is a well known source or crashes for Xalan :-/

Great, thanks for the info!

Does that mean that the empty string is not allowed as a namespace URI?

<foo:bar xmlns:foo=""/>

-- Andreas


Re: svn commit: rev 47047 - in cocoon/trunk/src: blocks/databases/java/org/apache/cocoon/transformation blocks/linkrewriter/java/org/apache/cocoon/transformation blocks/mail/java/org/apache/cocoon/mail/transformation blocks/portal/java/org/apache/cocoon/portal/coplets/basket blocks/portal/java/org/apache/cocoon/portal/transformation blocks/repository/java/org/apache/cocoon/transformation blocks/session-fw/java/org/apache/cocoon/webapps/session/transformation java/org/apache/cocoon/transformation

Posted by Sylvain Wallez <sy...@apache.org>.
Andreas Hartmann wrote:

> vgritsenko@apache.org wrote:
>
> [...]
>
>> AbstractSAXTransformer cleanup:
>> Make sure namespaceURI is not null
>
>
>
> http://www.saxproject.org/?selected=namespaces
>
> If I understand this correctly, a null URI should be used
> to denote elements without a namespace (I used to handle
> it like that).


Nono: what's explained here is that some parsers may not report the 
qName if their namespace-prefixes property is false. The 
ContentHandler.startElement() javadoc clearly states that the 
namespaceURI *is never null* !

Passing null namespace URIs is a well known source or crashes for Xalan :-/

Sylvain

[1] 
http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html#startElement(java.lang.String,%20java.lang.String,%20java.lang.String,%20org.xml.sax.Attributes)

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }


Re: svn commit: rev 47047 - in cocoon/trunk/src: blocks/databases/java/org/apache/cocoon/transformation blocks/linkrewriter/java/org/apache/cocoon/transformation blocks/mail/java/org/apache/cocoon/mail/transformation blocks/portal/java/org/apache/cocoon/portal/coplets/basket blocks/portal/java/org/apache/cocoon/portal/transformation blocks/repository/java/org/apache/cocoon/transformation blocks/session-fw/java/org/apache/cocoon/webapps/session/transformation java/org/apache/cocoon/transformation

Posted by Andreas Hartmann <an...@apache.org>.
vgritsenko@apache.org wrote:

[...]

> AbstractSAXTransformer cleanup:
> Make sure namespaceURI is not null


http://www.saxproject.org/?selected=namespaces

If I understand this correctly, a null URI should be used
to denote elements without a namespace (I used to handle
it like that).

I just updated the Cocoon trunk and got a NPE in
AbstractSAXTransformer.endPrefixMapping():

         if (namespaceURI.equals(uri)) {

So how should this be handled?
In Java 1.5 there is XMLConstants.NULL_NS_URI, is there
something similar in 1.4?


-- Andreas