You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ftpserver-dev@incubator.apache.org by "Noah Vihinen (JIRA)" <ji...@apache.org> on 2007/05/28 11:55:17 UTC

[jira] Created: (FTPSERVER-90) NPE in FtpStatisticsImpl

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.


[jira] Commented: (FTPSERVER-90) NPE in FtpStatisticsImpl

Posted by "Noah Vihinen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FTPSERVER-90?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499607 ] 

Noah Vihinen commented on FTPSERVER-90:
---------------------------------------

Yep, with trunk the exception is gone.  Thanks.

> 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
>            Assignee: Niklas Gustavsson
>            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.


[jira] Closed: (FTPSERVER-90) NPE in FtpStatisticsImpl

Posted by "Niklas Gustavsson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FTPSERVER-90?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niklas Gustavsson closed FTPSERVER-90.
--------------------------------------

    Resolution: Cannot Reproduce
      Assignee: Niklas Gustavsson

You seem to be using some fairly old code. I can not reproduce this using your example code and HEAD. Of course, I don't know what's in your Spring config but I created a vanilla server.

Please reopen if the problem persists with HEAD.

> 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
>            Assignee: Niklas Gustavsson
>            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.