SCEA EE5, CSM, PMP, IBM OOAD with UML, SCDJWS, SCWCD, SCJP 1.5
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Will this limit my freedom in custom handling the exception?
SCEA EE5, CSM, PMP, IBM OOAD with UML, SCDJWS, SCWCD, SCJP 1.5
Shiv Swaminathan wrote:
The error shown: The exception FileNotFoundException is already caught by the alternative IOException
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
SCEA EE5, CSM, PMP, IBM OOAD with UML, SCDJWS, SCWCD, SCJP 1.5
Shiv Swaminathan wrote:@Rob, probably I misunderstood, so you are saying the reference variable is final but not the exception object itself?
Which means we must be able to modify the exception object caught like quoted to @James above. (An arbitrary example)
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
This method of SQLException makes it mutable, and I thought that was the only well‑known example.Rob Spoor wrote:. . . Although it's very unusual to have mutable exceptions (apart from the cause that is, but that only be set once).
SCEA EE5, CSM, PMP, IBM OOAD with UML, SCDJWS, SCWCD, SCJP 1.5
SCEA EE5, CSM, PMP, IBM OOAD with UML, SCDJWS, SCWCD, SCJP 1.5
Shiv Swaminathan wrote:May be Java should in the future enhance its compiler to identify the exception types in multiple catch block and not make the exception argument final.
Compiler should check against all exception types instead of making this workaround. When it knows to do for single exception hierarchy why not for one more in the expression...
SCEA EE5, CSM, PMP, IBM OOAD with UML, SCDJWS, SCWCD, SCJP 1.5
Shiv Swaminathan wrote:
But it will be good to have both single catch and multiple catch exception argument to be treated in a consistent way...
Please correct my English.
Manuel Petermann wrote:
Shiv Swaminathan wrote:
But it will be good to have both single catch and multiple catch exception argument to be treated in a consistent way...
Problem being if you would allow that, you would make assignment of objects inconsistent, which I think is far more important.
SCEA EE5, CSM, PMP, IBM OOAD with UML, SCDJWS, SCWCD, SCJP 1.5
I've got no option but to sell you all for scientific experiments. Or a tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
|