SCJP, SCJD
Originally posted by Satish Avadhanam:
Sun's provided interface methods throws business specific exceptions and no method throws IOException or any other Exception.
The Data class must implements this method. Now, all IO operations using RAF throw IOException. Now we cannot throw IOExceptions from any of the methods. So what can we do? I mean just catch Exception in the readRecord method and exit the application? Is there any way to pass the exception to the client?
Regards, George
SCJP, SCJD, SCWCD, SCBCD
Originally posted by Pavel Tcheshmedjiev:
Hi Satish,
There are different approaches.
What about catching the IOException and throwing a new RNFE, specifying its message or using Exception chaining.
SCJP, SCJD
Originally posted by Pavel Tcheshmedjiev:
Hi guys,
I guess the exception chaining is an addition to George's 1)
We catch the IOException and throw a new RNFE by using RNFE(Thowable cause) constructor, where cause is our caught IOException.
So when we catch the RNFE we can use RNFE.getCause() to identify what was the cause.
What about this approach ? I'm using it in my implementation.
Regards, George
SCJP, SCJD, SCWCD, SCBCD
SCJP, SCJD
Originally posted by Pavel Tcheshmedjiev:
I'd like to ask if you documented them or it is beyond the exam's requirenments.
Regards, George
SCJP, SCJD, SCWCD, SCBCD
SCJP<br />SCJD
Originally posted by Pavel Tcheshmedjiev:
Hi guys,
I guess the exception chaining is an addition to George's 1)
We catch the IOException and throw a new RNFE by using RNFE(Thowable cause) constructor, where cause is our caught IOException.
So when we catch the RNFE we can use RNFE.getCause() to identify what was the cause.
What about this approach ? I'm using it in my implementation.
Marco Tedone<br />SCJP1.4,SCJP5,SCBCD,SCWCD
You know it is dark times when the trees riot. I think this tiny ad is their leader:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|