title: Why am I getting a repeated modifier error when compiling?
body: <pre><code>import java.util.*;
  import java.io.*;
  public final class FileListing2 
  {
      public static void main(String... aArgs) throws FileNotFoundException 
      {
           File startingDirectory= new File(aArgs[0]);
           List&lt;File&gt; files = FileListing.getFileListing(startingDirectory);
           //print out all file names, in the the order of File.compareTo()
           for(File file : files )
           {
                System.out.println(file);
           }
      }
      static public List&lt;File&gt; getFileListing(File aStartingDir) throws FileNotFoundException 
      {
          validateDirectory(aStartingDir);
          List&lt;File&gt; result = getFileListingNoSort(aStartingDir);
          Collections.sort(result);
          return result;
      }
      static private List&lt;File&gt; getFileListingNoSort(File aStartingDir) throws FileNotFoundException 
      {
            List&lt;File&gt; result = new ArrayList&lt;File&gt;();
            File[] filesAndDirs = aStartingDir.listFiles();
            List&lt;File&gt; filesDirs = Arrays.asList(filesAndDirs);
            for(File file : filesDirs) 
            {
              result.add(file); //always add, even if directory
              if ( ! file.isFile() ) 
              {
                     //must be a directory
                     //recursive call!
                     List&lt;File&gt; deeperList = getFileListingNoSort(file);
                     result.addAll(deeperList);
              }
              return result;
            }
  
         }
         static private void validateDirectory (File aDirectory) throws FileNotFoundException 
         {
            if (aDirectory == null) 
            {
                   throw new IllegalArgumentException("Directory should not be null.");
            }
            if (!aDirectory.exists()) 
            {
                   throw new FileNotFoundException("Directory does not exist: " + aDirectory);
            }
            if (!aDirectory.isDirectory()) 
            {
                   throw new IllegalArgumentException("Is not a directory: " + aDirectory);
            }
            if (!aDirectory.canRead()) 
            {
                   throw new IllegalArgumentException("Directory cannot be read: " + aDirectory);
             }
          }
        }
  </code></pre>
  
  <p>I copied this code from <a href="http://www.javapractices.com/topic/TopicAction.do?Id=68" rel="nofollow">this site</a> and am trying to adapt it for our environment. Unfortunately, I can't get the $%!@#*($ thing to compile. I keep getting an error at the main method: error: repeated modifier.</p>
  
  <p><code>public static void main(String... aArgs) throws FileNotFoundException</code> is the line flagged for the error.</p>
  
  <p>I don't see any duplicate modifiers in here,  All my curly braces and parens appear to be in the right places, and I am completely stumped. </p>
  
  <p>This is my first time working with varargs...I'm not sure if ~that's~ giving me an issue? I scanned Java Documentation, but didn't spot any red flags. Besides, it compiles just fine when I change <code>String...</code> to <code>String[]</code>. I feel I may get some null values, so I'd prefer to leave <code>String...</code> in the method.</p>
  
  <p>Anyone see anything that I'm missing? I feel like I'm looking at that Paris in the
  the spring brainteaser.... </p>