Not sure why this Java Null Pointer Exception is happening : <p>I have a method that return an array of files in a given directory that is giving me a null pointer exception when executed. I can't figure out why.</p>

<pre><code>private ArrayList&lt;File&gt; getFiles(String path) {

    File f = new File(path);
    ArrayList&lt;File&gt; files = new ArrayList&lt;&gt;(Arrays.asList(f.listFiles()));

    return files;
}
</code></pre>

<p>thanks for your help</p>
