You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Daniel H. Peger (Jira)" <ji...@apache.org> on 2020/10/23 09:19:00 UTC
[jira] [Updated] (CONFIGURATION-795) Blanc lines before always 0
for first property despite header comment
[ https://issues.apache.org/jira/browse/CONFIGURATION-795?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel H. Peger updated CONFIGURATION-795:
------------------------------------------
Description:
Given a properties file like the one described in [PropertiesConfigurationLayout|https://commons.apache.org/proper/commons-configuration/apidocs/org/apache/commons/configuration2/PropertiesConfigurationLayout.html]:
{noformat}
# A demo configuration file
# for Demo App 1.42
# Application name
AppName=Demo App
# Application vendor
AppVendor=DemoSoft
# GUI properties
# Window Color
windowColors=0xFFFFFF,0x000000
# Include some setting
include=settings.properties
# Another vendor
AppVendor=TestSoft
{noformat}
The documentation states
bq. For the property {{AppName}} one comment line and one leading blanc line is stored.
But the format actually thinks there is no leading blanc line for {{AppName}} :
{code}
final PropertiesConfiguration properties = new Configurations().properties(new File("demo.properties"));
final int blancLinesBefore = properties.getLayout().getBlancLinesBefore("AppName");
assert blancLinesBefore == 1 : "Blanc lines before for first property not correct";
{code}
was:
Given a properties like the one described in [PropertiesConfigurationLayout|https://commons.apache.org/proper/commons-configuration/apidocs/org/apache/commons/configuration2/PropertiesConfigurationLayout.html]:
{noformat}
# A demo configuration file
# for Demo App 1.42
# Application name
AppName=Demo App
# Application vendor
AppVendor=DemoSoft
# GUI properties
# Window Color
windowColors=0xFFFFFF,0x000000
# Include some setting
include=settings.properties
# Another vendor
AppVendor=TestSoft
{noformat}
The documentation states
bq. For the property {{AppName}} one comment line and one leading blanc line is stored.
But the format actually thinks there is no leading blanc line for {{AppName}} :
{code}
final PropertiesConfiguration properties = new Configurations().properties(new File("demo.properties"));
final int blancLinesBefore = properties.getLayout().getBlancLinesBefore("AppName");
assert blancLinesBefore == 1 : "Blanc lines before for first property not correct";
{code}
> Blanc lines before always 0 for first property despite header comment
> ---------------------------------------------------------------------
>
> Key: CONFIGURATION-795
> URL: https://issues.apache.org/jira/browse/CONFIGURATION-795
> Project: Commons Configuration
> Issue Type: Bug
> Components: Format
> Affects Versions: 2.7
> Reporter: Daniel H. Peger
> Priority: Major
>
> Given a properties file like the one described in [PropertiesConfigurationLayout|https://commons.apache.org/proper/commons-configuration/apidocs/org/apache/commons/configuration2/PropertiesConfigurationLayout.html]:
> {noformat}
> # A demo configuration file
> # for Demo App 1.42
> # Application name
> AppName=Demo App
> # Application vendor
> AppVendor=DemoSoft
> # GUI properties
> # Window Color
> windowColors=0xFFFFFF,0x000000
> # Include some setting
> include=settings.properties
> # Another vendor
> AppVendor=TestSoft
> {noformat}
> The documentation states
> bq. For the property {{AppName}} one comment line and one leading blanc line is stored.
> But the format actually thinks there is no leading blanc line for {{AppName}} :
> {code}
> final PropertiesConfiguration properties = new Configurations().properties(new File("demo.properties"));
> final int blancLinesBefore = properties.getLayout().getBlancLinesBefore("AppName");
> assert blancLinesBefore == 1 : "Blanc lines before for first property not correct";
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)