You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by "Lawrence Barry (JIRA)" <ji...@apache.org> on 2011/03/16 16:21:34 UTC

[jira] Created: (PIVOT-717) Issue within BXMLSerializer preventing compatibility with other StAX implementation, particularly woodstox

Issue within BXMLSerializer preventing compatibility with other StAX implementation, particularly woodstox
----------------------------------------------------------------------------------------------------------

                 Key: PIVOT-717
                 URL: https://issues.apache.org/jira/browse/PIVOT-717
             Project: Pivot
          Issue Type: Bug
          Components: core-beans
    Affects Versions: 2.0
         Environment: Woodstox 4.1.1 used as the StAX parser
            Reporter: Lawrence Barry
            Priority: Minor


The behavior of the stream readers getNamespaceURI function for passing nulls appears to vary. The existing implementation breaks Woodstox when there is no attribute namespace. To fix, the following code from processAttributes in BXMLSerializer :

String namespaceURI = xmlStreamReader.getAttributeNamespace(i);
if (namespaceURI == null) {
    namespaceURI = xmlStreamReader.getNamespaceURI("");
}

was replaced with:

String namespaceURI = xmlStreamReader.getAttributeNamespace(i);
if (namespaceURI.isEmpty()) {
     namespaceURI = xmlStreamReader.getNamespaceURI();
}

The == null was replace with an isEmpty call (as this didn't function correctly with Woodstox) and the passing of "" was removed from the getNamespaceURI call.

BXMLSerializer with these changes now functions with Woodstox and also functions as expected with the default parser.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Resolved: (PIVOT-717) Issue within BXMLSerializer preventing compatibility with other StAX implementation, particularly woodstox

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

Sandro Martini resolved PIVOT-717.
----------------------------------

    Resolution: Fixed

Just committed the fix. In case of other StAX related issues, please reopen it and reassign to 2.0.1 and to me. Thank you.

Bye,
Sandro


> Issue within BXMLSerializer preventing compatibility with other StAX implementation, particularly woodstox
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: PIVOT-717
>                 URL: https://issues.apache.org/jira/browse/PIVOT-717
>             Project: Pivot
>          Issue Type: Bug
>          Components: core-beans
>    Affects Versions: 2.0
>         Environment: Woodstox 4.1.1 used as the StAX parser
>            Reporter: Lawrence Barry
>            Assignee: Sandro Martini
>            Priority: Minor
>             Fix For: 2.0.1
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> The behavior of the stream readers getNamespaceURI function for passing nulls appears to vary. The existing implementation breaks Woodstox when there is no attribute namespace. To fix, the following code from processAttributes in BXMLSerializer :
> String namespaceURI = xmlStreamReader.getAttributeNamespace(i);
> if (namespaceURI == null) {
>     namespaceURI = xmlStreamReader.getNamespaceURI("");
> }
> was replaced with:
> String namespaceURI = xmlStreamReader.getAttributeNamespace(i);
> if (namespaceURI.isEmpty()) {
>      namespaceURI = xmlStreamReader.getNamespaceURI();
> }
> The == null was replace with an isEmpty call (as this didn't function correctly with Woodstox) and the passing of "" was removed from the getNamespaceURI call.
> BXMLSerializer with these changes now functions with Woodstox and also functions as expected with the default parser.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (PIVOT-717) Issue within BXMLSerializer preventing compatibility with other StAX implementation, particularly woodstox

Posted by "Lawrence Barry (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIVOT-717?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13007529#comment-13007529 ] 

Lawrence Barry commented on PIVOT-717:
--------------------------------------

I didn't spend much time thinking about this beyond getting it to function in my particular environment. But, what you propose should function just fine.

You need the woodstox-core and stax2-api jars in order for it to function. (http://woodstox.codehaus.org/Home <- for woodstox)

> Issue within BXMLSerializer preventing compatibility with other StAX implementation, particularly woodstox
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: PIVOT-717
>                 URL: https://issues.apache.org/jira/browse/PIVOT-717
>             Project: Pivot
>          Issue Type: Bug
>          Components: core-beans
>    Affects Versions: 2.0
>         Environment: Woodstox 4.1.1 used as the StAX parser
>            Reporter: Lawrence Barry
>            Assignee: Sandro Martini
>            Priority: Minor
>             Fix For: 2.0.1
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> The behavior of the stream readers getNamespaceURI function for passing nulls appears to vary. The existing implementation breaks Woodstox when there is no attribute namespace. To fix, the following code from processAttributes in BXMLSerializer :
> String namespaceURI = xmlStreamReader.getAttributeNamespace(i);
> if (namespaceURI == null) {
>     namespaceURI = xmlStreamReader.getNamespaceURI("");
> }
> was replaced with:
> String namespaceURI = xmlStreamReader.getAttributeNamespace(i);
> if (namespaceURI.isEmpty()) {
>      namespaceURI = xmlStreamReader.getNamespaceURI();
> }
> The == null was replace with an isEmpty call (as this didn't function correctly with Woodstox) and the passing of "" was removed from the getNamespaceURI call.
> BXMLSerializer with these changes now functions with Woodstox and also functions as expected with the default parser.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Updated: (PIVOT-717) Issue within BXMLSerializer preventing compatibility with other StAX implementation, particularly woodstox

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

Sandro Martini updated PIVOT-717:
---------------------------------

    Fix Version/s: 2.0.1
         Assignee: Sandro Martini

Hi,
just a question: to generalize the fix you proposed here, with other StAX implementations (different from Woodstox 4.x), to better handle the null case (if in some case could happen), what do you think on something like this instead ?

if (namespaceURI == null || namespaceURI.isEmpty()) {

And sorry, to reproduce your test environment, is it enough for me to try adding the woodstax jar in classpath ?


What others say on this change ?

Bye,
Sandro


> Issue within BXMLSerializer preventing compatibility with other StAX implementation, particularly woodstox
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: PIVOT-717
>                 URL: https://issues.apache.org/jira/browse/PIVOT-717
>             Project: Pivot
>          Issue Type: Bug
>          Components: core-beans
>    Affects Versions: 2.0
>         Environment: Woodstox 4.1.1 used as the StAX parser
>            Reporter: Lawrence Barry
>            Assignee: Sandro Martini
>            Priority: Minor
>             Fix For: 2.0.1
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> The behavior of the stream readers getNamespaceURI function for passing nulls appears to vary. The existing implementation breaks Woodstox when there is no attribute namespace. To fix, the following code from processAttributes in BXMLSerializer :
> String namespaceURI = xmlStreamReader.getAttributeNamespace(i);
> if (namespaceURI == null) {
>     namespaceURI = xmlStreamReader.getNamespaceURI("");
> }
> was replaced with:
> String namespaceURI = xmlStreamReader.getAttributeNamespace(i);
> if (namespaceURI.isEmpty()) {
>      namespaceURI = xmlStreamReader.getNamespaceURI();
> }
> The == null was replace with an isEmpty call (as this didn't function correctly with Woodstox) and the passing of "" was removed from the getNamespaceURI call.
> BXMLSerializer with these changes now functions with Woodstox and also functions as expected with the default parser.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Commented: (PIVOT-717) Issue within BXMLSerializer preventing compatibility with other StAX implementation, particularly woodstox

Posted by "Sandro Martini (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIVOT-717?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13007533#comment-13007533 ] 

Sandro Martini commented on PIVOT-717:
--------------------------------------

Hi Lawrence,
I'll try the fix (in next days I'll commit another small fix for BXMLSerializer), so if others aren't against this (but I don't see arguments) I can do the fix.

Bye


> Issue within BXMLSerializer preventing compatibility with other StAX implementation, particularly woodstox
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: PIVOT-717
>                 URL: https://issues.apache.org/jira/browse/PIVOT-717
>             Project: Pivot
>          Issue Type: Bug
>          Components: core-beans
>    Affects Versions: 2.0
>         Environment: Woodstox 4.1.1 used as the StAX parser
>            Reporter: Lawrence Barry
>            Assignee: Sandro Martini
>            Priority: Minor
>             Fix For: 2.0.1
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> The behavior of the stream readers getNamespaceURI function for passing nulls appears to vary. The existing implementation breaks Woodstox when there is no attribute namespace. To fix, the following code from processAttributes in BXMLSerializer :
> String namespaceURI = xmlStreamReader.getAttributeNamespace(i);
> if (namespaceURI == null) {
>     namespaceURI = xmlStreamReader.getNamespaceURI("");
> }
> was replaced with:
> String namespaceURI = xmlStreamReader.getAttributeNamespace(i);
> if (namespaceURI.isEmpty()) {
>      namespaceURI = xmlStreamReader.getNamespaceURI();
> }
> The == null was replace with an isEmpty call (as this didn't function correctly with Woodstox) and the passing of "" was removed from the getNamespaceURI call.
> BXMLSerializer with these changes now functions with Woodstox and also functions as expected with the default parser.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira