cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Kulp (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (CXF-2628) StaxUtils.writeStartElement(XMLStreamReader reader, XMLStreamWriter writer) does not write namespace for header elements that have a namespace URI and an empty prefix
Date Wed, 27 Jan 2010 15:50:34 GMT

     [ https://issues.apache.org/jira/browse/CXF-2628?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Daniel Kulp resolved CXF-2628.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.2.7

> StaxUtils.writeStartElement(XMLStreamReader reader, XMLStreamWriter writer) does not
write namespace for header elements that have a namespace URI and an empty prefix
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-2628
>                 URL: https://issues.apache.org/jira/browse/CXF-2628
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.2.6
>         Environment: apache-cxf-2.2.6-SNAPSHOT 20100119 and STAX RI (the one included
in JDK 1.6.0_16)
>            Reporter: Gyorgy Orban
>            Assignee: Daniel Kulp
>             Fix For: 2.2.7
>
>         Attachments: StaxUtils.patch
>
>
> Please see attached patch. The patch changes the order of these two codeblocks:
> //codeblock1:
>         if (uri != null) {
>             writeElementNS = true;
>             Iterator<String> it = CastUtils.cast(writer.getNamespaceContext().getPrefixes(uri));
>             while (it != null && it.hasNext()) {
>                 String s = it.next();
>                 if (s == null) {
>                     s = "";
>                 }
>                 if (s.equals(prefix)) {
>                     writeElementNS = false;
>                 }
>             }
>         }
> //codeblock2:
>         if (uri != null) {
>             if (prefix.length() == 0 && StringUtils.isEmpty(uri)) {
>                 writer.writeStartElement(local);
>             } else {
>                 writer.writeStartElement(prefix, local, uri);
>             }
>         } else {
>             writer.writeStartElement(local);
>         }
> The issue happens because:
> 1) writer.writeStartElement(prefix, local, uri);  gets executed
> 2) because of 1),  writer.getNamespaceContext().getPrefixes(uri) returns an iterator
with the "" prefix for the namespace uri
> 3) writeElementNS is set to false because of 2)
> 4) W3CDOMStreamReader.getNamespaceCount() always returns 0
> 5) because of 3) and 4), writer.writeDefaultNamespace(uri) never gets executed

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message