[logback-dev] svn commit: r933 - logback/trunk/logback-core/src/main/java/ch/qos/logback/core/read
noreply.ceki at qos.ch
noreply.ceki at qos.ch
Fri Nov 17 11:06:12 CET 2006
Author: ceki
Date: Fri Nov 17 11:06:12 2006
New Revision: 933
Modified:
logback/trunk/logback-core/src/main/java/ch/qos/logback/core/read/CyclicBufferAppender.java
Log:
- a little more defensive code in case cb == null
Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/read/CyclicBufferAppender.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/read/CyclicBufferAppender.java (original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/read/CyclicBufferAppender.java Fri Nov 17 11:06:12 2006
@@ -15,34 +15,43 @@
public class CyclicBufferAppender extends AppenderBase {
-
CyclicBuffer cb;
int maxSize = 512;
-
+
public void start() {
-
cb = new CyclicBuffer(maxSize);
super.start();
}
-
-
+
+ public void stop() {
+ cb = null;
+ super.stop();
+ }
+
@Override
protected void append(Object eventObject) {
- if(!isStarted()) {
+ if (!isStarted()) {
return;
}
cb.add(eventObject);
}
public int getLength() {
- return cb.length();
+ if (cb != null) {
+ return cb.length();
+ } else {
+ return 0;
+ }
}
public Object get(int i) {
- return cb.get(i);
+ if (cb != null) {
+ return cb.get(i);
+ } else {
+ return null;
+ }
}
-
-
+
public Layout getLayout() {
return null;
}
More information about the logback-dev
mailing list