Error: Checked exception 'java.io.IOException' is signalled but is not signalled by overridden method

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Error: Checked exception 'java.io.IOException' is signalled but is not signalled by overridden method

kenner
method actionPerformed(evt=ActionEvent)
         if Debug_Level > 3 then trace results
         select
                         when evt.getSource() == advanceThruDeck then do
                                         ShowNextCard(Rand1)
                         end
                         when evt.getSource() == SaveExit then do
                                         WriteAndLeave(DaScore)
                         end
                         when evt.getSource() == Submit_Check then do
                                         Submit_Check(A_answer)
                         end
                         when evt.getSource() == PbtRevertToZeros then
                             do
                                         PbtRevertToZeros()
                                         DisplayScore(DaScore)

                     end
                 otherwise say "This should not have happened, darn." -- we don't expect anything else
                         finally DisplayScore(DaScore)
         end

I just don't get it. I could have sworn I had this working with the WriteAndLeave method doing some file writing and hence the chance of an IOException. The buttons on my frame have setActionLIstener defined and this button should write the files and exit the program. Does this mean there is no way to have a button that can do file IO?

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Error: Checked exception 'java.io.IOException' is signalled but is not signalled by overridden method

rvjansen
Hi Kenneth,

some exceptions are categorized as 'checked exceptions' - an unfortunate name I think for an unfortunate concept - but it means that they must be accompanied by a 'catch' in your source. You can either:

1) declare them (with 'signals' on the method declaration
2) wrap them in a 'do' ... 'catch' block.

When you choose 1, it is good to catch them in the invoking code.

So a button press can certainly invoke some method that does I/O, but the exception should be caught somewhere, as indicated above.

best regards,

René Jansen.


On 4 feb. 2013, at 20:40, Kenneth Klein (TEMA TPC) <[hidden email]> wrote:

> method actionPerformed(evt=ActionEvent)
> if Debug_Level > 3 then trace results
> select
> when evt.getSource() == advanceThruDeck then do
> ShowNextCard(Rand1)
> end
> when evt.getSource() == SaveExit then do
> WriteAndLeave(DaScore)
> end
> when evt.getSource() == Submit_Check then do
> Submit_Check(A_answer)
> end
> when evt.getSource() == PbtRevertToZeros then
>     do
> PbtRevertToZeros()
> DisplayScore(DaScore)
>
>                    end
>         otherwise say "This should not have happened, darn." -- we don't expect anything else
> finally DisplayScore(DaScore)
> end
>
> I just don't get it. I could have sworn I had this working with the WriteAndLeave method doing some file writing and hence the chance of an IOException. The buttons on my frame have setActionLIstener defined and this button should write the files and exit the program. Does this mean there is no way to have a button that can do file IO?
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/