Re:is it me or is it a bug?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Re:is it me or is it a bug?

Martin Lafaix

> From: "Mike Cowlishaw" <[hidden email]>
> If you want to write buggy code, perhaps.  Consider:  the method
> you call is declared as raising IOException (that's in the
> signals list).  You find out (perhaps by reading the code) that
> in fact it raises FileNotFoundException, so that's what you
> catch. All is well and good until ...

If the method raises FileNotFoundException but declares
IOException in its signal list, then catching
FileNotFoundException does not removes the IOException.

That is, considering the following:

  class foo
    method dummy signals IOException
      ... -- something here signaling FileNotFoundException

  class bar
    method aTest(aFoo = foo) signals IOException
      catch FileNotFoundException

The method aTest _should_ declare IOException in its signal list,
as it is not catched in its body.  Hence the above is safe (in
the sense you don't get unexpected behavior).

Or at least that's how I would like to see it :-)

[hidden email]
Team OS/2

To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>