commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pascal Essiembre (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CONFIGURATION-703) xml:space="preserve" does not handle blank strings properly
Date Sat, 26 May 2018 21:58:00 GMT

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

Pascal Essiembre edited comment on CONFIGURATION-703 at 5/26/18 9:57 PM:
-------------------------------------------------------------------------

It applies on any elements, not just root.  For instance, the second test fails here: 

 
{code:java}
String xml = 
        "<test>"
      + "<tagNoPreserve> </tagNoPreserve>"
      + "<tagPreserve xml:space=\"preserve\">   </tagPreserve>"
      + "</test>";
 
XMLConfiguration c = XMLConfigurationUtil.newXMLConfiguration(xml);
Assert.assertEquals("", c.getString("tagNoPreserve"));
Assert.assertEquals("   ", c.getString("tagPreserve"));
{code}
 

I have not tried running unit tests from the Configuration project itself.  I'll do that
when I get a chance.

FYI, ``ConfigurationUtils`` encapsulates the creation logic described in my original post.


was (Author: pascal.essiembre):
It applies on any elements, not just root.  For instance, the second test fails here:

 

 
{code:java}
String xml = 
        "<test>"
      + "<tagNoPreserve> </tagNoPreserve>"
      + "<tagPreserve xml:space=\"preserve\">   </tagPreserve>"
      + "</test>";
 
XMLConfiguration c = XMLConfigurationUtil.newXMLConfiguration(xml);
Assert.assertEquals("", c.getString("tagNoPreserve"));
Assert.assertEquals("   ", c.getString("tagPreserve"));
{code}
 

I have not tried running unit tests from the Configuration project itself.  I'll do that
when I get a chance.

 

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

Mime
View raw message