ceki 2003/03/18 13:41:52
Modified: src/java/org/apache/log4j/spi ThrowableInformation.java
TriggeringEventEvaluator.java RootCategory.java
src/java/org/apache/log4j AppenderSkeleton.java
Log:
- Made code confirms to checkstyle 3.0.
- Jalopy formatting.
Revision Changes Path
1.10 +74 -36
jakarta-log4j/src/java/org/apache/log4j/spi/ThrowableInformation.java
Index: ThrowableInformation.java
===================================================================
RCS file:
/home/cvs/jakarta-log4j/src/java/org/apache/log4j/spi/ThrowableInformation.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ThrowableInformation.java 9 Oct 2002 22:50:06 -0000 1.9
+++ ThrowableInformation.java 18 Mar 2003 21:41:51 -0000 1.10
@@ -1,16 +1,60 @@
/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
*
- * This software is published under the terms of the Apache Software
- * License version 1.1, a copy of which has been included with this
- * distribution in the LICENSE.txt file. */
+ * Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modifica-
+ * tion, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if any, must
+ * include the following acknowledgment: "This product includes software
+ * developed by the Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself, if
+ * and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "log4j" and "Apache Software Foundation" must not be used to
+ * endorse or promote products derived from this software without prior
+ * written permission. For written permission, please contact
+ * [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache", nor may
+ * "Apache" appear in their name, without prior written permission of the
+ * Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * on behalf of the Apache Software Foundation. For more information on the
+ * Apache Software Foundation, please see <http://www.apache.org/>.
+ *
+ */
package org.apache.log4j.spi;
-import java.io.Writer;
import java.io.PrintWriter;
+import java.io.Writer;
+
import java.util.Vector;
+
/**
* ThrowableInformation is log4j's internal representation of
* throwables. It essentially consists of a string array, called
@@ -25,78 +69,72 @@
*
* */
public class ThrowableInformation implements java.io.Serializable {
-
static final long serialVersionUID = -4748765566864322735L;
-
private transient Throwable throwable;
private String[] rep;
-
- public
- ThrowableInformation(Throwable throwable) {
+
+ public ThrowableInformation(Throwable throwable) {
this.throwable = throwable;
}
- public
- Throwable getThrowable() {
+ public Throwable getThrowable() {
return throwable;
}
-
- public
- String[] getThrowableStrRep() {
- if(rep != null) {
+
+ public String[] getThrowableStrRep() {
+ if (rep != null) {
return (String[]) rep.clone();
} else {
VectorWriter vw = new VectorWriter();
throwable.printStackTrace(vw);
rep = vw.toStringArray();
+
return rep;
}
}
}
+
/**
* VectorWriter is a seemingly trivial implemtantion of PrintWriter.
* The throwable instance that we are trying to represnt is asked to
- * print itself to a VectorWriter.
+ * print itself to a VectorWriter.
*
* By our design choice, r string representation of the throwable
* does not contain any line separators. It follows that println()
* methods of VectorWriter ignore the 'ln' part.
* */
class VectorWriter extends PrintWriter {
-
private Vector v;
-
+
VectorWriter() {
super(new NullWriter());
v = new Vector();
}
- public void print(Object o) {
+ public void print(Object o) {
v.addElement(o.toString());
}
-
+
public void print(char[] chars) {
v.addElement(new String(chars));
}
-
+
public void print(String s) {
v.addElement(s);
}
- public void println(Object o) {
+ public void println(Object o) {
v.addElement(o.toString());
}
-
+
// JDK 1.1.x apprenly uses this form of println while in
// printStackTrace()
- public
- void println(char[] chars) {
+ public void println(char[] chars) {
v.addElement(new String(chars));
}
-
- public
- void println(String s) {
+
+ public void println(String s) {
v.addElement(s);
}
@@ -109,26 +147,27 @@
}
public void write(String s, int off, int len) {
- v.addElement(s.substring(off, off+len));
+ v.addElement(s.substring(off, off + len));
}
public void write(String s) {
- v.addElement(s);
+ v.addElement(s);
}
public String[] toStringArray() {
int len = v.size();
String[] sa = new String[len];
- for(int i = 0; i < len; i++) {
+
+ for (int i = 0; i < len; i++) {
sa[i] = (String) v.elementAt(i);
}
+
return sa;
}
+}
-}
-class NullWriter extends Writer {
-
+class NullWriter extends Writer {
public void close() {
// blank
}
@@ -141,4 +180,3 @@
// blank
}
}
-
1.5 +49 -7
jakarta-log4j/src/java/org/apache/log4j/spi/TriggeringEventEvaluator.java
Index: TriggeringEventEvaluator.java
===================================================================
RCS file:
/home/cvs/jakarta-log4j/src/java/org/apache/log4j/spi/TriggeringEventEvaluator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TriggeringEventEvaluator.java 5 Jul 2001 19:07:22 -0000 1.4
+++ TriggeringEventEvaluator.java 18 Mar 2003 21:41:51 -0000 1.5
@@ -1,14 +1,57 @@
/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
*
- * This software is published under the terms of the Apache Software
- * License version 1.1, a copy of which has been included with this
- * distribution in the LICENSE.txt file. */
+ * Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modifica-
+ * tion, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if any, must
+ * include the following acknowledgment: "This product includes software
+ * developed by the Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself, if
+ * and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "log4j" and "Apache Software Foundation" must not be used to
+ * endorse or promote products derived from this software without prior
+ * written permission. For written permission, please contact
+ * [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache", nor may
+ * "Apache" appear in their name, without prior written permission of the
+ * Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * on behalf of the Apache Software Foundation. For more information on the
+ * Apache Software Foundation, please see <http://www.apache.org/>.
+ *
+ */
package org.apache.log4j.spi;
+
/**
-
+
Implementions of this interface allow certain appenders to decide
when to perform an appender specific action.
@@ -19,10 +62,9 @@
@author Ceki Gülcü
@since version 1.0
-
+
*/
public interface TriggeringEventEvaluator {
-
/**
Is this the triggering event?
*/
1.10 +59 -28 jakarta-log4j/src/java/org/apache/log4j/spi/RootCategory.java
Index: RootCategory.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/spi/RootCategory.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- RootCategory.java 4 Sep 2001 20:06:23 -0000 1.9
+++ RootCategory.java 18 Mar 2003 21:41:51 -0000 1.10
@@ -1,14 +1,57 @@
/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
*
- * This software is published under the terms of the Apache Software
- * License version 1.1, a copy of which has been included with this
- * distribution in the LICENSE.txt file. */
+ * Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modifica-
+ * tion, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if any, must
+ * include the following acknowledgment: "This product includes software
+ * developed by the Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself, if
+ * and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "log4j" and "Apache Software Foundation" must not be used to
+ * endorse or promote products derived from this software without prior
+ * written permission. For written permission, please contact
+ * [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache", nor may
+ * "Apache" appear in their name, without prior written permission of the
+ * Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * on behalf of the Apache Software Foundation. For more information on the
+ * Apache Software Foundation, please see <http://www.apache.org/>.
+ *
+ */
package org.apache.log4j.spi;
-import org.apache.log4j.*;
-import org.apache.log4j.helpers.LogLog;
+import org.apache.log4j.*;
+import org.apache.log4j.helpers.LogLog;
+
// Contibutors: Mathias Bogaert
@@ -24,26 +67,21 @@
@author Ceki Gülcü
*/
-final public class RootCategory extends Logger {
-
+public final class RootCategory extends Logger {
/**
The root category names itself as "root". However, the root
- category cannot be retrieved by name.
+ category cannot be retrieved by name.
*/
- public
- RootCategory(Level level) {
+ public RootCategory(Level level) {
super("root");
setLevel(level);
}
-
/**
Return the assigned level value without walking the category
hierarchy.
*/
- final
- public
- Level getChainedLevel() {
+ public final Level getChainedLevel() {
return level;
}
@@ -52,23 +90,16 @@
results. We prevent this here.
@since 0.8.3 */
- final
- public
- void setLevel(Level level) {
- if(level == null) {
- LogLog.error("You have tried to set a null level to root.",
- new Throwable());
- }
- else {
+ public final void setLevel(Level level) {
+ if (level == null) {
+ LogLog.error(
+ "You have tried to set a null level to root.", new Throwable());
+ } else {
this.level = level;
}
}
- final
- public
- void setPriority(Level level) {
+ public final void setPriority(Level level) {
setLevel(level);
}
-
-
}
1.24 +2 -2 jakarta-log4j/src/java/org/apache/log4j/AppenderSkeleton.java
Index: AppenderSkeleton.java
===================================================================
RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/AppenderSkeleton.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- AppenderSkeleton.java 18 Mar 2003 21:17:42 -0000 1.23
+++ AppenderSkeleton.java 18 Mar 2003 21:41:52 -0000 1.24
@@ -127,7 +127,7 @@
headFilter = newFilter;
tailFilter = newFilter;
} else {
- tailFilter.next = newFilter;
+ tailFilter.setNext(newFilter);
tailFilter = newFilter;
}
}
@@ -264,7 +264,7 @@
break FILTER_LOOP;
case Filter.NEUTRAL:
- f = f.next;
+ f = f.getNext();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]