Yeah - they generate checkstyle errors. Not that we seem to pay much attention to the checkstyle report ;-)
Ralph > On Mar 14, 2016, at 9:17 AM, Gary Gregory <[email protected]> wrote: > > Magic numbers need to be refactored to a static IMO. > > Gary > ---------- Forwarded message ---------- > From: <[email protected] <mailto:[email protected]>> > Date: Mon, Mar 14, 2016 at 9:10 AM > Subject: logging-log4j2 git commit: LOG4J2-1296 trim reusable message > StringBuilder to 258 to ensure occasional very long messages do not result in > large char[] arrays being held by the RingBuffer forever > To: [email protected] <mailto:[email protected]> > > > Repository: logging-log4j2 > Updated Branches: > refs/heads/master 05adeefad -> 69999c227 > > > LOG4J2-1296 trim reusable message StringBuilder to 258 to ensure occasional > very long messages do not result in large char[] arrays being held by the > RingBuffer forever > > > Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo > <http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo> > Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/69999c22 > <http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/69999c22> > Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/69999c22 > <http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/69999c22> > Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/69999c22 > <http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/69999c22> > > Branch: refs/heads/master > Commit: 69999c2278bbefdace942ea5de9683226c14b5fe > Parents: 05adeef > Author: rpopma <[email protected] <mailto:[email protected]>> > Authored: Tue Mar 15 03:10:31 2016 +1100 > Committer: rpopma <[email protected] <mailto:[email protected]>> > Committed: Tue Mar 15 03:10:31 2016 +1100 > > ---------------------------------------------------------------------- > .../apache/logging/log4j/core/async/RingBufferLogEvent.java | 6 ++++++ > 1 file changed, 6 insertions(+) > ---------------------------------------------------------------------- > > > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/69999c22/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java > > <http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/69999c22/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java> > ---------------------------------------------------------------------- > diff --git > a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java > > b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java > index e918500..32d73d9 100644 > --- > a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java > +++ > b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/RingBufferLogEvent.java > @@ -338,6 +338,12 @@ public class RingBufferLogEvent implements LogEvent { > null, > 0, 0 // nanoTime > ); > + > + // ensure that excessively long char[] arrays are not kept in memory > forever > + if (messageText != null && messageText.length() > 258) { // resized > more than once from 128 (s=s*2+2) > + messageText.setLength(258); > + messageText.trimToSize(); > + } > } > > private void writeObject(final java.io.ObjectOutputStream out) throws > IOException { > > > > > -- > E-Mail: [email protected] <mailto:[email protected]> | > [email protected] <mailto:[email protected]> > Java Persistence with Hibernate, Second Edition > <http://www.manning.com/bauer3/> > JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> > Spring Batch in Action <http://www.manning.com/templier/> > Blog: http://garygregory.wordpress.com <http://garygregory.wordpress.com/> > Home: http://garygregory.com/ <http://garygregory.com/> > Tweet! http://twitter.com/GaryGregory <http://twitter.com/GaryGregory>
