commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan wu (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CONFIGURATION-582) PropertiesConfigurationLayout.getCanonicalComment throws StringIndexOutOfBoundsException when line before property has a single space
Date Wed, 18 Jun 2014 04:52:05 GMT
Jonathan wu created CONFIGURATION-582:
-----------------------------------------

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


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.2#6252)

Mime
View raw message