[jira] [Commented] (CONFIGURATION-703) xml:space="preserve" does not handle blank strings properly

2018-06-09 Thread Pascal Essiembre (JIRA)


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

Pascal Essiembre commented on CONFIGURATION-703:


Sure, here you go:

{code:xml}
Pascal Essiembre
pascal.essiem...@norconex.com
Norconex Inc.
https://www.norconex.com

developer

-4
{code}

 Thanks.

> 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
> Fix For: 2.3
>
>
> 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(""));
> System.out.println("TEST: '" + xml.getString("") + "'");
> // Outputs   -> TEST: 'null'
> // Should be -> TEST: ''
> {code}
>  
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CONFIGURATION-703) xml:space="preserve" does not handle blank strings properly

2018-06-06 Thread Pascal Essiembre (JIRA)


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

Pascal Essiembre commented on CONFIGURATION-703:


OK, I gave it a serious look and provided a simple fix that resolves the issue 
and does not break any tests: 
https://github.com/apache/commons-configuration/pull/11/

> 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(""));
> System.out.println("TEST: '" + xml.getString("") + "'");
> // Outputs   -> TEST: 'null'
> // Should be -> TEST: ''
> {code}
>  
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CONFIGURATION-703) xml:space="preserve" does not handle blank strings properly

2018-06-05 Thread Pascal Essiembre (JIRA)


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

Pascal Essiembre commented on CONFIGURATION-703:


It all makes sense.  What should it be then?  I think it is logical for a 
missing element to be null while any empty element should be an empty string, 
unless there are white spaces and xml:space="preserve" is set.

Is that what you have in mind?

> 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(""));
> System.out.println("TEST: '" + xml.getString("") + "'");
> // Outputs   -> TEST: 'null'
> // Should be -> TEST: ''
> {code}
>  
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CONFIGURATION-703) xml:space="preserve" does not handle blank strings properly

2018-06-04 Thread Pascal Essiembre (JIRA)


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

Pascal Essiembre commented on CONFIGURATION-703:


I did a bit of research, and it seems the XML specs says {{}} and 
{{}} should both be treated the same: empty string.  {{null}} 
can be returned if the element does not exist at all.  The one that is unclear 
to me is when an element has an {{xsi:nil="true"}} attribute.  That attribute 
signifies an element is {{null}}.  It looks as if that special flag is used to 
indicate no values when dealing with enums since technically an empty string is 
not a valid value for those.

> 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(""));
> System.out.println("TEST: '" + xml.getString("") + "'");
> // Outputs   -> TEST: 'null'
> // Should be -> TEST: ''
> {code}
>  
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CONFIGURATION-703) xml:space="preserve" does not handle blank strings properly

2018-06-01 Thread Pascal Essiembre (JIRA)


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

Pascal Essiembre commented on CONFIGURATION-703:


Some of the tests fail when I do not consider child attributes.  The reason 
seems to be that some tests expect {{null}} while others expect an empty string 
when we are not preserving spaces and there is no content.  Shouldn't it be 
consistent? If so, I have a fix, but for it to work we would have to settle on 
one or the other and modify a few tests accordingly.

> 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(""));
> System.out.println("TEST: '" + xml.getString("") + "'");
> // Outputs   -> TEST: 'null'
> // Should be -> TEST: ''
> {code}
>  
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CONFIGURATION-703) xml:space="preserve" does not handle blank strings properly

2018-05-31 Thread Pascal Essiembre (JIRA)


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

Pascal Essiembre commented on CONFIGURATION-703:


Yes, but now that I think about it, even if the tests pass, I think the 
following would be safer (just reducing the count when dealing with space 
preserve):

{code:java}
boolean childrenFlag = hasChildren || (attributes.size() - 
(VALUE_PRESERVE.equals(attributes.get(ATTR_SPACE)) ? 1 : 0)  > 1);
{code}

That makes me wonder.  I am not familiar with the entire logic, but why are we 
considering attributes as "children" for the purpose of preserving spaces?  
Shouldn't we care about child "elements" only?  I mean, don't we want to 
preserve spaces in this context:

{code:xml}
   
{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(""));
> System.out.println("TEST: '" + xml.getString("") + "'");
> // Outputs   -> TEST: 'null'
> // Should be -> TEST: ''
> {code}
>  
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CONFIGURATION-703) xml:space="preserve" does not handle blank strings properly

2018-05-30 Thread Pascal Essiembre (JIRA)


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

Pascal Essiembre commented on CONFIGURATION-703:


OK, I've got a fix that does not break any tests.

In XMLConfiguration#constructHierarchy, where the "childrenFlag" is set, the 
attribute size is "wrongfully" 2 when the "xml:space" attribute is present, 
since "config-xml:space" get added by the code.  So the following is my fix for 
it, without modifying the attributes gathered so far:
{code:java}
boolean childrenFlag = hasChildren || (attributes.size() > 1 && 
!VALUE_PRESERVE.equals(attributes.get(ATTR_SPACE)));{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(""));
> System.out.println("TEST: '" + xml.getString("") + "'");
> // Outputs   -> TEST: 'null'
> // Should be -> TEST: ''
> {code}
>  
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Comment Edited] (CONFIGURATION-703) xml:space="preserve" does not handle blank strings properly

2018-05-26 Thread Pascal Essiembre (JIRA)

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

Pascal Essiembre edited comment on CONFIGURATION-703 at 5/26/18 11:56 PM:
--

With my suggested fix, this test fails:  
TestHierarchicalXMLConfiguration#testXmlNodeTypes 

So we probably need another one.

I also discovered that child with spaces will get returned properly if the 
parent tag owns the xml:space="preserve".  In other words this works :
{code:java}

  
   
  
{code}
White this does not:
{code:java}

  
   
  
{code}
 

Shouldn't "tagChild" spaces be preserved in both cases?


was (Author: pascal.essiembre):
 

With my suggested fix, this test fails:  
TestHierarchicalXMLConfiguration#testXmlNodeTypes 

So we probably need another one.

I also discovered that child with spaces will get returned properly if the 
parent tag owns the xml:space="preserve".  In other words this works :
  
   
  
White this does not:
  
   
  
 

Shouldn't "tagChild" spaces be preserved in both cases?

> 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(""));
> System.out.println("TEST: '" + xml.getString("") + "'");
> // Outputs   -> TEST: 'null'
> // Should be -> TEST: ''
> {code}
>  
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CONFIGURATION-703) xml:space="preserve" does not handle blank strings properly

2018-05-26 Thread Pascal Essiembre (JIRA)

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

Pascal Essiembre commented on CONFIGURATION-703:


 

With my suggested fix, this test fails:  
TestHierarchicalXMLConfiguration#testXmlNodeTypes 

So we probably need another one.

I also discovered that child with spaces will get returned properly if the 
parent tag owns the xml:space="preserve".  In other words this works :
  
   
  
White this does not:
  
   
  
 

Shouldn't "tagChild" spaces be preserved in both cases?

> 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(""));
> System.out.println("TEST: '" + xml.getString("") + "'");
> // Outputs   -> TEST: 'null'
> // Should be -> TEST: ''
> {code}
>  
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Comment Edited] (CONFIGURATION-703) xml:space="preserve" does not handle blank strings properly

2018-05-26 Thread Pascal Essiembre (JIRA)

[ 
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 = 
""
  + " "
  + "   "
  + "";
 
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 = 
""
  + " "
  + "   "
  + "";
 
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(""));
> System.out.println("TEST: '" + xml.getString("") + "'");
> // Outputs   -> TEST: 'null'
> // Should be -> TEST: ''
> {code}
>  
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CONFIGURATION-703) xml:space="preserve" does not handle blank strings properly

2018-05-26 Thread Pascal Essiembre (JIRA)

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

Pascal Essiembre commented on CONFIGURATION-703:


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

 

 
{code:java}
String xml = 
""
  + " "
  + "   "
  + "";
 
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(""));
> System.out.println("TEST: '" + xml.getString("") + "'");
> // Outputs   -> TEST: 'null'
> // Should be -> TEST: ''
> {code}
>  
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Comment Edited] (CONFIGURATION-703) xml:space="preserve" does not handle blank strings properly

2018-05-26 Thread Pascal Essiembre (JIRA)

[ 
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:55 PM:
-

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

 

 
{code:java}
String xml = 
""
  + " "
  + "   "
  + "";
 
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.

 


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

 

 
{code:java}
String xml = 
""
  + " "
  + "   "
  + "";
 
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(""));
> System.out.println("TEST: '" + xml.getString("") + "'");
> // Outputs   -> TEST: 'null'
> // Should be -> TEST: ''
> {code}
>  
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Comment Edited] (CONFIGURATION-703) xml:space="preserve" does not handle blank strings properly

2018-05-24 Thread Pascal Essiembre (JIRA)

[ 
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(""));
> System.out.println("TEST: '" + xml.getString("") + "'");
> // Outputs   -> TEST: 'null'
> // Should be -> TEST: ''
> {code}
>  
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CONFIGURATION-703) xml:space="preserve" does not handle blank strings properly

2018-05-24 Thread Pascal Essiembre (JIRA)

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

Pascal Essiembre commented on CONFIGURATION-703:


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(""));
> System.out.println("TEST: '" + xml.getString("") + "'");
> // Outputs   -> TEST: 'null'
> // Should be -> TEST: ''
> {code}
>  
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (CONFIGURATION-703) xml:space="preserve" does not handle blank strings properly

2018-05-24 Thread Pascal Essiembre (JIRA)
Pascal Essiembre created CONFIGURATION-703:
--

 Summary: 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


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(""));
System.out.println("TEST: '" + xml.getString("") + "'");
// Outputs   -> TEST: 'null'
// Should be -> TEST: ''
{code}
 

 

 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)