You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2013/11/12 18:11:17 UTC

[jira] [Commented] (LOG4J2-448) StringIndexOutOfBounds when using property substitution

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

Gary Gregory commented on LOG4J2-448:
-------------------------------------

Can you provide a specific example? Better yet, a unit test?

Thank you,
Gary

> StringIndexOutOfBounds  when using property substitution 
> ---------------------------------------------------------
>
>                 Key: LOG4J2-448
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-448
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: API
>    Affects Versions: 2.0-beta9
>         Environment: All
>            Reporter: X86core
>
> @org.apache.logging.log4j.core.lookup.StrSubstitutor# substitute(LogEvent , StringBuilder , int , int , List<String> ) @ Line 816-817 @new String(chars,   offset, length). The String should be new String(chars,				offset, length + lengthChange) this is because of the character deletion that might have happened for '$".
> See trace below:
> Exception in thread "main" java.lang.ExceptionInInitializerError
> Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 63
> 	at java.lang.String.<init>(String.java:201)
> 	at org.apache.logging.log4j.core.lookup.StrSubstitutor.substitute(StrSubstitutor.java:848)
> 	at org.apache.logging.log4j.core.lookup.StrSubstitutor.substitute(StrSubstitutor.java:761)
> 	at org.apache.logging.log4j.core.lookup.StrSubstitutor.substitute(StrSubstitutor.java:737)
> 	at org.apache.logging.log4j.core.lookup.StrSubstitutor.replace(StrSubstitutor.java:306)
> 	at org.apache.logging.log4j.core.config.BaseConfiguration.createPluginObject(BaseConfiguration.java:720)
> 	at org.apache.logging.log4j.core.config.BaseConfiguration.createConfiguration(BaseConfiguration.java:595)
> 	at org.apache.logging.log4j.core.config.BaseConfiguration.createConfiguration(BaseConfiguration.java:587)
> 	at org.apache.logging.log4j.core.config.BaseConfiguration.doConfigure(BaseConfiguration.java:244)
> 	at org.apache.logging.log4j.core.config.BaseConfiguration.start(BaseConfiguration.java:142)
> 	at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:339)
> 	at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:378)
> 	at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:149)
> 	at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:85)
> 	at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:34)
> 	at org.apache.logging.log4j.LogManager.getContext(LogManager.java:200)
> 	at org.slf4j.helpers.Log4jLoggerFactory$PrivateManager.getContext(Log4jLoggerFactory.java:104)
> 	at org.slf4j.helpers.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:90)
> 	at org.slf4j.helpers.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:46)
> 	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:270)
> 	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:281)



--
This message was sent by Atlassian JIRA
(v6.1#6144)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org