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 ce...@apache.org on 2004/11/09 19:23:26 UTC
cvs commit: logging-log4j/src/java/org/apache/log4j/helpers QuietWriter.java
ceki 2004/11/09 10:23:26
Modified: src/java/org/apache/log4j/helpers QuietWriter.java
Log:
Indentation changes only.
Revision Changes Path
1.4 +41 -33 logging-log4j/src/java/org/apache/log4j/helpers/QuietWriter.java
Index: QuietWriter.java
===================================================================
RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/helpers/QuietWriter.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- QuietWriter.java 5 Jul 2001 19:09:45 -0000 1.3
+++ QuietWriter.java 9 Nov 2004 18:23:26 -0000 1.4
@@ -1,65 +1,73 @@
/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
+ * Copyright 1999,2004 The Apache Software Foundation.
*
- * 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.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.apache.log4j.helpers;
-import java.io.Writer;
+import org.apache.log4j.spi.ErrorCode;
+import org.apache.log4j.spi.ErrorHandler;
+
import java.io.FilterWriter;
import java.io.IOException;
-import org.apache.log4j.spi.ErrorHandler;
-import org.apache.log4j.spi.ErrorCode;
+import java.io.Writer;
/**
- QuietWriter does not throw exceptions when things go
- wrong. Instead, it delegates error handling to its {@link ErrorHandler}.
-
- @author Ceki Gülcü
-
- @since 0.7.3
+ * QuietWriter does not throw exceptions when things go
+ * wrong. Instead, it delegates error handling to its {@link ErrorHandler}.
+ *
+ * @author Ceki Gülcü
+ *
+ * @since 0.7.3
*/
public class QuietWriter extends FilterWriter {
-
protected ErrorHandler errorHandler;
- public
- QuietWriter(Writer writer, ErrorHandler errorHandler) {
+ public QuietWriter(Writer writer, ErrorHandler errorHandler) {
super(writer);
setErrorHandler(errorHandler);
}
- public
- void write(String string) {
+ public Writer getWriter() {
+ return out;
+ }
+
+ public void write(String string) {
try {
out.write(string);
- } catch(IOException e) {
- errorHandler.error("Failed to write ["+string+"].", e,
- ErrorCode.WRITE_FAILURE);
+ } catch (IOException e) {
+ errorHandler.error(
+ "Failed to write [" + string + "].", e, ErrorCode.WRITE_FAILURE);
}
}
- public
- void flush() {
+ public void flush() {
try {
out.flush();
- } catch(IOException e) {
- errorHandler.error("Failed to flush writer,", e,
- ErrorCode.FLUSH_FAILURE);
- }
+ } catch (IOException e) {
+ errorHandler.error(
+ "Failed to flush writer,", e, ErrorCode.FLUSH_FAILURE);
+ }
}
-
- public
- void setErrorHandler(ErrorHandler eh) {
- if(eh == null) {
+ public void setErrorHandler(ErrorHandler eh) {
+ if (eh == null) {
// This is a programming error on the part of the enclosing appender.
- throw new IllegalArgumentException("Attempted to set null ErrorHandler.");
- } else {
+ throw new IllegalArgumentException(
+ "Attempted to set null ErrorHandler.");
+ } else {
this.errorHandler = eh;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org