[
https://issues.apache.org/jira/browse/CONFIGURATION-582?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Oliver Heger resolved CONFIGURATION-582.
----------------------------------------
Resolution: Fixed
Fix Version/s: 2.0
Fixed in SVN in revision 1623874.
> PropertiesConfigurationLayout.getCanonicalComment throws
> StringIndexOutOfBoundsException when line before property has a single space
> -------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CONFIGURATION-582
> URL: https://issues.apache.org/jira/browse/CONFIGURATION-582
> Project: Commons Configuration
> Issue Type: Bug
> Affects Versions: 1.10
> Reporter: Jonathan wu
> Priority: Minor
> Fix For: 2.0
>
>
> When a properties file has a line with a single space in it, calling
> getCanonicalComment(<propertyKey>, false) on the
> PropertiesConfigurationLayout will throw a StringIndexOutOfBoundsException.
> Below is the stack trace:
> {code}
> java.lang.StringIndexOutOfBoundsException: String index out of range: 1
> at java.lang.String.charAt(String.java:686)
> at
> org.apache.commons.configuration.PropertiesConfigurationLayout.stripCommentChar(PropertiesConfigurationLayout.java:768)
> at
> org.apache.commons.configuration.PropertiesConfigurationLayout.trimComment(PropertiesConfigurationLayout.java:741)
> at
> org.apache.commons.configuration.PropertiesConfigurationLayout.constructCanonicalComment(PropertiesConfigurationLayout.java:900)
> at
> org.apache.commons.configuration.PropertiesConfigurationLayout.getCanonicalComment(PropertiesConfigurationLayout.java:212)
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)