• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

DirectoryIteratorException - List directory NIO2

 
Ranch Hand
Posts: 380
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Ranch Hand
Posts: 924
1
Netbeans IDE Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 583
Firefox Browser Notepad Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic