Android - FTPClient - mlistFile is returning null
<p>I'm working on an app that needs to be connected at a FTP server. Then, I need to get the size of a particular file called "new_order.txt". So I'm using the method mlistFile(String filePath) which was working perfectly the last time I was working on that app. But now, mlistFile is returning null, and when I use getSize(), then my app is crashing (but I'm connected to the server). I really need some help to find what's going wrong.</p>

<p>Here's the code:</p>

<pre><code>try {
        String filePath = "new_order.txt";
        FTPFile ftpFile = mFtpClient.mlistFile(filePath);
        sizeFileFTPServer = ftpFile.getSize();

        File downloadedFile = new File(mainActivity.getDir("JSONDir", Context.MODE_PRIVATE), "new_order.txt");
        sizeDownloadedFile = downloadedFile.length();

    } catch (IOException e) {
        e.printStackTrace();
    }

    Log.d("SIZE FTP", Long.toString(sizeFileFTPServer));
    Log.d("SIZE LOCAL", Long.toString(sizeDownloadedFile));

    return (sizeDownloadedFile == sizeFileFTPServer);
</code></pre>

<p>And here's my error:</p>

<pre><code>Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'long org.apache.commons.net.ftp.FTPFile.getSize()' on a null object reference
                                                                         at test.taxi.comincar.GetUpdate.fileOrderVerification(GetUpdate.java:249)
                                                                         at test.taxi.comincar.GetUpdate.get_new_order(GetUpdate.java:151)
                                                                         at test.taxi.comincar.GetUpdate.doInBackground(GetUpdate.java:75)
                                                                         at test.taxi.comincar.GetUpdate.doInBackground(GetUpdate.java:43)
                                                                         at android.os.AsyncTask$2.call(AsyncTask.java:288)
</code></pre>

<p>I'm connected to the server, the file specified exists, my code was working well the last time I was working on this app, now it doesn't. I'm lost.</p>