Example usage for java.util.logging ErrorManager CLOSE_FAILURE

List of usage examples for java.util.logging ErrorManager CLOSE_FAILURE

Introduction

In this page you can find the example usage for java.util.logging ErrorManager CLOSE_FAILURE.

Prototype

int CLOSE_FAILURE

To view the source code for java.util.logging ErrorManager CLOSE_FAILURE.

Click Source Link

Document

CLOSE_FAILURE is used when a close of an output stream fails.

Usage

From source file:FileErrorManager.java

/**
 * Null safe close method./*ww w .ja  va  2s. c  o  m*/
 *
 * @param out closes the given stream.
 */
private void close(OutputStream out) {
    if (out != null) {
        try {
            out.close();
        } catch (IOException IOE) {
            super.error(out.toString(), IOE, ErrorManager.CLOSE_FAILURE);
        }
    }
}

From source file:FileErrorManager.java

/**
 * Null safe delete method.//from   ww  w . j  a v  a  2s .  co  m
 *
 * @param tmp the file to delete.
 */
private void delete(File tmp) {
    if (tmp != null) {
        try {
            if (!tmp.delete() && tmp.exists()) {
                try {
                    try {
                        tmp.deleteOnExit();
                    } catch (final LinkageError shutdown) {
                        throw new RuntimeException(shutdown);
                    }
                } catch (final RuntimeException shutdown) {
                    if (!tmp.delete()) {
                        super.error(tmp.getAbsolutePath(), shutdown, ErrorManager.CLOSE_FAILURE);
                    }
                }
            }
        } catch (SecurityException SE) {
            super.error(tmp.toString(), SE, ErrorManager.CLOSE_FAILURE);
        }
    }
}