You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Pascal Essiembre (JIRA)" <ji...@apache.org> on 2018/05/25 03:24:00 UTC
[jira] [Comment Edited] (CONFIGURATION-703) xml:space="preserve"
does not handle blank strings properly
[ https://issues.apache.org/jira/browse/CONFIGURATION-703?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16490175#comment-16490175 ]
Pascal Essiembre edited comment on CONFIGURATION-703 at 5/25/18 3:23 AM:
-------------------------------------------------------------------------
Not sure if it impacts anything else negatively, but removing this change in XMLConfiguration#constructHierarchy(...) seems to do solve the issue:
{code:java}
...
else if (w3cNode instanceof Text)
{
//START fix
attributes.remove(ATTR_SPACE_INTERNAL);
//END fix
Text data = (Text) w3cNode;
buffer.append(data.getData());
}
...{code}
was (Author: pascal.essiembre):
Not sure if it impacts anything else negatively, but removing this change in XMLConfiguration#constructHierarchy(...) seems to do solve the issue:
...
{code:java}
else if (w3cNode instanceof Text)
{
//START fix
attributes.remove(ATTR_SPACE_INTERNAL);
//END fix
Text data = (Text) w3cNode;
buffer.append(data.getData());
}{code}
...
> xml:space="preserve" does not handle blank strings properly
> -----------------------------------------------------------
>
> Key: CONFIGURATION-703
> URL: https://issues.apache.org/jira/browse/CONFIGURATION-703
> Project: Commons Configuration
> Issue Type: Bug
> Affects Versions: 2.2
> Reporter: Pascal Essiembre
> Priority: Major
>
> When using XMLConfiguration 2, tags containing only white spaces are not handled properly when xml:space="preserve" is set. 'null' is returned instead of the actual spaces. To reproduce:
>
> {code:java}
> XMLConfiguration xml = new BasicConfigurationBuilder<>(
> XMLConfiguration.class).configure(
> new Parameters().xml()).getConfiguration();
> FileHandler fh = new FileHandler(xml);
> fh.load(new StringReader("<test xml:space=\"preserve\"> </test>"));
> System.out.println("TEST: '" + xml.getString("") + "'");
> // Outputs -> TEST: 'null'
> // Should be -> TEST: ' '
> {code}
>
>
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)