[jboss-jira] [JBoss JIRA] (LOGMGR-141) StringIndexOutOfBoundsException throw while formatting log with truncation

RH Bugzilla Integration (JIRA) issues at jboss.org
Tue Sep 20 01:08:00 EDT 2016


    [ https://issues.jboss.org/browse/LOGMGR-141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13295404#comment-13295404 ] 

RH Bugzilla Integration commented on LOGMGR-141:
------------------------------------------------

Fedor Gavrilov <fgavrilo at redhat.com> changed the Status of [bug 1350757|https://bugzilla.redhat.com/show_bug.cgi?id=1350757] from NEW to ASSIGNED

> StringIndexOutOfBoundsException throw while formatting log with truncation
> --------------------------------------------------------------------------
>
>                 Key: LOGMGR-141
>                 URL: https://issues.jboss.org/browse/LOGMGR-141
>             Project: JBoss Log Manager
>          Issue Type: Bug
>            Reporter: James Perkins
>            Assignee: James Perkins
>             Fix For: 2.1.0.Beta1
>
>
> When value in left-justified field is longer than maximum width following exception is thrown:
> {code}
> java.lang.StringIndexOutOfBoundsException
>         at java.lang.AbstractStringBuilder.delete(AbstractStringBuilder.java:733)
>         at java.lang.StringBuilder.delete(StringBuilder.java:244)
>         at org.jboss.logmanager.formatters.Formatters$JustifyingFormatStep.render(Formatters.java:212)
>         at org.jboss.logmanager.formatters.MultistepFormatter.format(MultistepFormatter.java:83)
>         at org.jboss.logmanager.ExtFormatter.format(ExtFormatter.java:32)
>         at org.jboss.logmanager.handlers.WriterHandler.doPublish(WriterHandler.java:46)
>         at org.jboss.logmanager.ExtHandler.publish(ExtHandler.java:76)
>         at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:302)
>         at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:310)
>         at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:310)
>         at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:310)
>         at org.jboss.logmanager.Logger.logRaw(Logger.java:719)
>         at org.jboss.logmanager.Logger.log(Logger.java:670)
>         at org.jboss.logging.JBossLogManagerLogger.doLogf(JBossLogManagerLogger.java:50)
>         at org.jboss.logging.Logger.logf(Logger.java:2096)
> {code}
> Steps to Reproduce:
> 1. Configure formatter with left-justified field with maximum width:
> {code}
> /subsystem=logging/periodic-rotating-file-handler=FILE:write-attribute(name=formatter,value="%d{HH:mm:ss,SSS} %-5p [%c{1.}] [%-20.-20t] %s%E%n")
> {code}
> (in the example above thread name should be truncated to 20 characters, left-justified)
> 2. Write a log from a thread which has a name containg 21 characters or more. During server startup logs are written by "MSC service thread 1-7" thread.
> It seems there is an error in {{org.jboss.logmanager.formatters.Formatters()}} class, line 212. There is:
> {code:java}
> builder.delete(oldLen, overflow + 1);
> {code}
> but should be:
> {code:java}
> builder.delete(oldLen, oldLen + overflow);
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list