FileDocCategorySizeDatePackage
ErrorManager.javaAPI DocAndroid 1.5 API4290Wed May 06 22:41:04 BST 2009java.util.logging

ErrorManager

public class ErrorManager extends Object
An error reporting facility for {@link Handler} implementations to record any error that may happen during logging. {@code Handlers} should report errors to an {@code ErrorManager}, instead of throwing exceptions, which would interfere with the log issuer's execution.
since
Android 1.0

Fields Summary
public static final int
GENERIC_FAILURE
The error code indicating a failure that does not fit in any of the specific types of failures that follow.
public static final int
WRITE_FAILURE
The error code indicating a failure when writing to an output stream.
public static final int
FLUSH_FAILURE
The error code indicating a failure when flushing an output stream.
public static final int
CLOSE_FAILURE
The error code indicating a failure when closing an output stream.
public static final int
OPEN_FAILURE
The error code indicating a failure when opening an output stream.
public static final int
FORMAT_FAILURE
The error code indicating a failure when formatting the error messages.
private static final String[]
FAILURES
private boolean
called
An indicator for determining if the error manager has been called at least once before.
Constructors Summary
public ErrorManager()
Constructs an instance of {@code ErrorManager}.

since
Android 1.0


                   
      
        super();
    
Methods Summary
public voiderror(java.lang.String message, java.lang.Exception exception, int errorCode)

Reports an error using the given message, exception and error code. This implementation will write out the message to {@link System#err} on the first call and all subsequent calls are ignored. A subclass of this class should override this method.

param
message the error message, which may be {@code null}.
param
exception the exception associated with the error, which may be {@code null}.
param
errorCode the error code that identifies the type of error; see the constant fields of this class for possible values.
since
Android 1.0

        synchronized (this) {
            if (called) {
                return;
            }
            called = true;
        }
        System.err.println(this.getClass().getName()
            + ": " + FAILURES[errorCode]); //$NON-NLS-1$
        if (message != null) {
            // logging.1E=Error message - {0}
            System.err.println(Messages.getString("logging.1E", message)); //$NON-NLS-1$
        }
        if (exception != null) {
            // logging.1F=Exception - {0}
            System.err.println(Messages.getString("logging.1F", exception)); //$NON-NLS-1$
        }