File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP 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: 4425
    
    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: 3720
    
  16
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.
 
jQuery in Action, 2nd edition
 
subject: exception java.io.IOException is never thrown in body of corresponding try statement