### Question:
EditLogFileOutputStream extends EditLogOutputStream { @Override public void close() throws IOException { if (fp == null) { throw new IOException("Trying to use aborted output stream"); } try { if (doubleBuf != null) { doubleBuf.close(); doubleBuf = null; } if (fc != null && fc.isOpen()) { fc.truncate(fc.position()); fc.close(); fc = null; } if (fp != null) { fp.close(); fp = null; } } finally { IOUtils.cleanup(FSNamesystem.LOG, fc, fp); doubleBuf = null; fc = null; fp = null; } fp = null; } EditLogFileOutputStream(File name, int size); @Override void write(FSEditLogOp op); @Override void writeRaw(byte[] bytes, int offset, int length); @Override void create(); @VisibleForTesting static void writeHeader(DataOutputStream out); @Override void close(); @Override void abort(); @Override void setReadyToFlush(); @Override void flushAndSync(boolean durable); @Override boolean shouldForceSync(); @Override String toString(); boolean isOpen(); @VisibleForTesting void setFileChannelForTesting(FileChannel fc); @VisibleForTesting FileChannel getFileChannelForTesting(); @VisibleForTesting static void setShouldSkipFsyncForTesting(boolean skip); static final int MIN_PREALLOCATION_LENGTH; }### Answer:
@Test public void testEditLogFileOutputStreamCloseClose() throws IOException { EditLogFileOutputStream editLogStream = new EditLogFileOutputStream(TEST_EDITS, 0); editLogStream.close(); try { editLogStream.close(); } catch (IOException ioe) { String msg = StringUtils.stringifyException(ioe); assertTrue(msg, msg.contains("Trying to use aborted output stream")); } }