You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by "Colm O hEigeartaigh (Jira)" <ji...@apache.org> on 2020/02/21 07:09:00 UTC

[jira] [Commented] (SANTUARIO-526) XMLSecStartDocumentImpl returns null version instead of default "1.0"

    [ https://issues.apache.org/jira/browse/SANTUARIO-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17041615#comment-17041615 ] 

Colm O hEigeartaigh commented on SANTUARIO-526:
-----------------------------------------------

[~peterdm] FYI I'm planning a release in about 2 weeks, if you want to get a fix in for this before then.

> XMLSecStartDocumentImpl returns null version instead of default "1.0"
> ---------------------------------------------------------------------
>
>                 Key: SANTUARIO-526
>                 URL: https://issues.apache.org/jira/browse/SANTUARIO-526
>             Project: Santuario
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: Java 2.1.4
>            Reporter: Peter De Maeyer
>            Assignee: Colm O hEigeartaigh
>            Priority: Major
>
> While debugging {{XMLSecurityStreamReaderTest.testCorrectness}}, I noticed some inconsistencies/bugs in {{XMLSecStartDocumentImpl}}.
> As per Javadoc of {{StartDocument}}, {{getVersion()}} should default to "1.0" when undefined. However, the value can be {{null}} because it's assigned in the constructor. The initial value "1.0" is never used. The fix is obvious, but would bring it out of sync with the {{XMLStreamReader.getVersion}} API, which per Javadoc is _supposed_ to return {{null}} to indicate the default value. The current behavior also has a rationale to it, so we should be careful when changing this behavior - it will make some tests fail.
> {{XMLStreamReader}} (not the Santuario one, but the underlying Woodstox one) seems to be emitting {{StartDocument}} events for documents that don't have a document declaration. I believe this to be wrong, although I'm not 100% sure yet. It preempts the caller from being able to make the distinction between "there is no document declaration" and "there is a document declaration with version and encoding set to the defaults". Not being able to make that distinction means that the output document can't represent the input document 100% accurately.
> It seems to me that the spirit of the API is this:
> # {{XMLStreamReader}} reflects what's defined in the actual document. If there is no document declaration, then {{getVersion}}, {{getCharacterEncodingScheme}} return {{null}} to  tell the caller "no document declaration, use the defaults" while allowing the caller to still make the distinction with "there is a document declaration, but the values are the defaults".
> # {{StartDocument}} is an event which is supposed to be emitted _only_ when there is an _actual_ document declaration being parsed.
> I'll investigate this a bit more and propose a fix.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)