cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sylv...@apache.org
Subject svn commit: rev 57029 - cocoon/branches/BRANCH_2_1_X/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/context
Date Tue, 09 Nov 2004 12:43:54 GMT
Author: sylvain
Date: Tue Nov  9 04:43:54 2004
New Revision: 57029

Modified:
   cocoon/branches/BRANCH_2_1_X/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/context/RequestSessionContext.java
Log:
Quick workaround for request attributes whose name is not suitable for an XML element name

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/context/RequestSessionContext.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/context/RequestSessionContext.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/context/RequestSessionContext.java
Tue Nov  9 04:43:54 2004
@@ -32,6 +32,7 @@
 import org.apache.excalibur.source.SourceParameters;
 import org.apache.excalibur.xml.sax.SAXParser;
 import org.apache.excalibur.xml.xpath.XPathProcessor;
+import org.w3c.dom.DOMException;
 import org.w3c.dom.Document;
 import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Element;
@@ -111,7 +112,7 @@
  *  - getAuthType()
  *
  * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
- * @version CVS $Id: RequestSessionContext.java,v 1.7 2004/03/19 14:16:55 cziegeler Exp $
+ * @version CVS $Id$
 */
 public final class RequestSessionContext
 implements SessionContext {
@@ -281,9 +282,15 @@
         Enumeration all = this.request.getAttributeNames();
         while (all.hasMoreElements() == true) {
             attrName = (String) all.nextElement();
-            attr = doc.createElementNS(null, attrName);
-            attrElement.appendChild(attr);
-            DOMUtil.valueOf(attr, this.request.getAttribute(attrName));
+            try {
+                attr = doc.createElementNS(null, attrName);
+                attrElement.appendChild(attr);
+                DOMUtil.valueOf(attr, this.request.getAttribute(attrName));
+            } catch(DOMException de) {
+                // Some request attributes have names that are invalid as element names.
+                // Example : "FOM JavaScript GLOBAL SCOPE/file://my/path/to/flow/script.js"
+                System.err.println("Cannot create XML element with name '" + attrName + "'
: " + de.getMessage());
+            }
         }
     }
 

Mime
View raw message