File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes DirectoryIteratorException   - List directory NIO2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "DirectoryIteratorException   - List directory NIO2" Watch "DirectoryIteratorException   - List directory NIO2" New topic
Author

DirectoryIteratorException - List directory NIO2

Shivani Chandna
Ranch Hand

Joined: Sep 18, 2004
Posts: 380

In NIO2 oracle tutorial it says: http://docs.oracle.com/javase/tutorial/essential/io/dirs.html#listdir
Note that if there is an exception during directory iteration then DirectoryIteratorException is thrown with the IOException as the cause. Iterator methods cannot throw exception exceptions.


Can someone elaborate on that?

Thanks


/** Code speaks louder than words */
gurpeet singh
Ranch Hand

Joined: Apr 04, 2012
Posts: 923
    
    1

DirectoryIteratorException is an unchecked exception. what the docs says is that the iterator method cannot throw exception exceptions, meaning they cannot throw checked exceptions. also the cause of the DirectorIteratorException is IOException which is a checked exception , but this exception is wrapped and thrown as DirectoryIteratorException


OCPJP 6(100 %) OCEWCD 6(91 %) OCPJBCD(93%)
saloni jhanwar
Ranch Hand

Joined: Feb 09, 2012
Posts: 583

gurpeet singh wrote:DirectoryIteratorException is an unchecked exception. what the docs says is that the iterator method cannot throw exception exceptions, meaning they cannot throw checked exceptions. also the cause of the DirectorIteratorException is IOException which is a checked exception , but this exception is wrapped and thrown as DirectoryIteratorException


Hmm i think it is in new OCJP 7.


Tell the difficulties that i am difficult.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DirectoryIteratorException - List directory NIO2
 
Similar Threads
Exception in thread "main" NoClassDefFoundError
What is difference between Checked and Uncheched exceptions ?
How do I stop Path.copyTo (nio2 method)?
JFileChooser for selecting only .jar file from open dialog box ?
NIO2 file copy DirectoryNotEmptyException