jQuery in Action, 2nd edition*
The moose likes Beginning Java and the fly likes exception java.io.IOException is never thrown in body of corresponding try statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "exception java.io.IOException is never thrown in body of corresponding try statement" Watch "exception java.io.IOException is never thrown in body of corresponding try statement" New topic
Author

exception java.io.IOException is never thrown in body of corresponding try statement

Bud Tippins
Ranch Hand

Joined: Jan 28, 2011
Posts: 52
I'm getting an error "exception java.io.IOException is never thrown in body of corresponding try statement" on line #16.

What is wrong with my code? Any insights appreciated. Thank you.


Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4370
    
    8

Have a look at the Javadocs for the File class. What exceptions can the constructor and mkdir throw?
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3487
    
  13
It's saying that catching an IOException is unnecessary because none of the code in the try block ever throws an IOException. In other words you don't need to surround lines 14 and 15 in a try/catch.


Joanne
Bud Tippins
Ranch Hand

Joined: Jan 28, 2011
Posts: 52
Thanks guys. Based on your comments I got it fixed.
 
 
subject: exception java.io.IOException is never thrown in body of corresponding try statement