On 9/22/05, [EMAIL PROTECTED] (Olle Mulmo) wrote: >Peter's example is "standard to the language". It's just not used much >by those influenced by other idioms prior to learning Java. > >I guess another way of saying this is: the people on this list are >getting old. :-)
I guess insisting on correct error handling is just for old people. Peter's example: > try { > int idx = 0; > > while (true) { > displayProductInfo(prodnums[idx]); > idx++; > } > } > catch (IndexOutOfBoundException ex) { > // nil > } has a serious bug in error handling. We do not know where the IndexOutOfBoundException was raised. Was it raised in the while loop, the expected case; or was it raised in the displayProductInfo method, due to some bug in that method? (It could also be raised in some other method called by displayProductInfo.) In order for this code to be correct, we would have to prove that the displayProductInfo method either could not raise this exception, or that it caught and handled any IndexOutOfBoundException exceptions raised in it or in methods it calls. In either case, we must examine the details of displayProductInfo, and depend on our conclusions remaining correct during maintenance. This level of coupling between caller and callee is too risky for reliable software. Cheers - Bill --------------------------------------------------------------------- Bill Frantz | The first thing you need | Periwinkle (408)356-8506 | when using a perimeter | 16345 Englewood Ave www.pwpconsult.com | defense is a perimeter. | Los Gatos, CA 95032 --------------------------------------------------------------------- The Cryptography Mailing List Unsubscribe by sending "unsubscribe cryptography" to [EMAIL PROTECTED]