You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Gyorgy Orban (JIRA)" <ji...@apache.org> on 2010/01/21 15:59:54 UTC

[jira] Created: (CXF-2628) StaxUtils.writeStartElement(XMLStreamReader reader, XMLStreamWriter writer) does not write namespace for header elements that have a namespace URI and an empty prefix

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
         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.


[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

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ 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.


[jira] Updated: (CXF-2628) StaxUtils.writeStartElement(XMLStreamReader reader, XMLStreamWriter writer) does not write namespace for header elements that have a namespace URI and an empty prefix

Posted by "Gyorgy Orban (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2628?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gyorgy Orban updated CXF-2628:
------------------------------

    Attachment: StaxUtils.patch

> 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
>         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.


[jira] Assigned: (CXF-2628) StaxUtils.writeStartElement(XMLStreamReader reader, XMLStreamWriter writer) does not write namespace for header elements that have a namespace URI and an empty prefix

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2628?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp reassigned CXF-2628:
--------------------------------

    Assignee: Daniel Kulp

> 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
>         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.