This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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: 4339
    
    7

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: 3418
    
  12
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: exception java.io.IOException is never thrown in body of corresponding try statement
 
Similar Threads
Exception
One more on exceptions
IOMessage
Exception Handling
PrintWrite close() does not catches Exception