code: public String[] getDirectoryNames() throws IOException
     {
        return SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<String[]>()
        {
           public String[] run() throws Exception
           {
              File[] dirs = baseDir.listFiles(new FileFilter()
              {
                 public boolean accept(File pathname)
                 {
                    return pathname.isDirectory();
                 }
              });
              if (dirs != null)
              {
                 String[] names = new String[dirs.length];
                 for (int i = 0; i < dirs.length; i++)
                 {
                    names[i] = dirs[i].getName();
                 }
                 return names;
              }
              else
              {
                 throw new IOException("listFiles for " + baseDir.getPath() + " returned null");
              }
           }
        });
     }
docs: {@inheritDoc}