I have next code:
InputStream is = new FileInputStream("test.txt");
// do something
try {
is.close();
} catch(IOException ex) {
// do nothing
// or
// NOP
// or something else?
}
The question is is there any convention in Java world for comment that tells do nothing? Like in my case I want to do nothing if it is not possible to close InputStream.
Is the “NOP” comment acceptable? It is from Assembler and it means “no operation”.
is complete, clear and succinct.
But you should be using something like Apache Commons IO
IOUtils.closeQuietly(InputStream).