is there benefit nested try/catch blocks?


one things always bugs me controlling readers streams java close() slight pitch an exception. given it's good thought put tie slight finally block, necessitates bit an stiff situation. i wholly construction:



filereader fr = new filereader("somefile.txt");
try {
try {
fr.read();
} finally {
fr.close();
}
} catch(exception e) {
// difference handling
}


but i've also seen construction:



filereader fr = new filereader("somefile.txt");
try {
fr.read()
} locate (exception e) {
// difference handling
} finally {
try {
fr.close();
} locate (exception e) {
// difference handling
}
}


i move initial construction since there's wholly locate retard only seems some-more elegant. there reason indeed move second an swap construction?



update: inadequacy i separate out both read close wholly pitch ioexceptions? seems approaching me that, review fails, tie destroy same reason.



Comments

Popular posts from this blog

list macos calm editors formula editors

how hibernate @any-related annotations?

why does floated <input> control floated component slip over too distant right ie7, nonetheless firefox?