NPE in FtpStatisticsImpl
------------------------

                 Key: FTPSERVER-90
                 URL: https://issues.apache.org/jira/browse/FTPSERVER-90
             Project: FtpServer
          Issue Type: Bug
          Components: Core
            Reporter: Noah Vihinen
            Priority: Trivial


I get the following NPE:

java.lang.NullPointerException
        at 
org.apache.ftpserver.FtpStatisticsImpl.setLogin(FtpStatisticsImpl.java:265)
        at org.apache.ftpserver.command.PASS.execute(PASS.java:153)
        at org.apache.ftpserver.RequestHandler.service(RequestHandler.java:277)
        at org.apache.ftpserver.RequestHandler.run(RequestHandler.java:242)
        at java.lang.Thread.run(Thread.java:613)

by running code similar to the following:

      /**
       * Load our configuration.
       */
      new File(FTP_WORK).mkdirs();
      appContext = new ClassPathXmlApplicationContext("/embeddedRemoteFon.xml");

      /**
       * Start the FTP server.
       */
      FtpServer ftpServer = (FtpServer) appContext.getBean("ftpServer");
      ftpServer.start();

      /**
       * Create a mock user.
       */
      BaseUser user = new BaseUser();
      user.setName(MOCK_USERNAME);
      user.setPassword(MOCK_PASSWORD);
      user.setEnabled(true);
      String testuserFtpDirPath = MOCK_USER_HOMEDIR;
      File testuserFtpDir = new File(testuserFtpDirPath);
      testuserFtpDir.mkdirs();
      user.setHomeDirectory(testuserFtpDirPath);
      user.setWritePermission(true);
      ftpServer.getFtpConfig().getUserManager().save(user);

    // Try logging in using commons-net.
    FTPClient ftp = new FTPClient();
    String host = "localhost";
    String username = MOCK_USERNAME;
    String password = MOCK_PASSWORD;
    ftp.connect(host, FTPSERVER_PORT);
    if (!ftp.login(username, password))
      fail("Login failed.");

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to