You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Joerg Heinicke <jo...@gmx.de> on 2004/11/09 19:06:54 UTC

Re: svn commit: rev 57029 - cocoon/branches/BRANCH_2_1_X/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/context

On 09.11.2004 13:43, sylvain@apache.org wrote:

> 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

> @@ -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());

System.err ??

Joerg

Re: svn commit: rev 57029 - cocoon/branches/BRANCH_2_1_X/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/context

Posted by Joerg Heinicke <jo...@gmx.de>.
On 09.11.2004 19:26, Sylvain Wallez wrote:

>>> Log:
>>> Quick workaround for request attributes whose name is not suitable 
>>> for an XML element name
...
>>> +                System.err.println("Cannot create XML element with 
>>> name '" + attrName + "' : " + de.getMessage());
> 
> Yeah, I know, that's ugly. But RequestContext has no logger, and I 
> needed that to be fixed quickly. Writing to System.err ensures we (and 
> Carsten :-) ) see the message so that we do not forget that something 
> has to be done there.

Ah, I see. I had no look into the code, just reviewed the commit message.

Joerg

Re: svn commit: rev 57029 - cocoon/branches/BRANCH_2_1_X/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/context

Posted by Sylvain Wallez <sy...@apache.org>.
Joerg Heinicke wrote:

> On 09.11.2004 13:43, sylvain@apache.org wrote:
>
>> 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
>
>
>> @@ -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());
>
>
> System.err ??


Yeah, I know, that's ugly. But RequestContext has no logger, and I 
needed that to be fixed quickly. Writing to System.err ensures we (and 
Carsten :-) ) see the message so that we do not forget that something 
has to be done there.

Now I'm open to any better solution!

Sylvain

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