DBUserManager.getUserByName misses the lazyInit() function
----------------------------------------------------------

                 Key: FTPSERVER-143
                 URL: https://issues.apache.org/jira/browse/FTPSERVER-143
             Project: FtpServer
          Issue Type: Bug
          Components: Core
            Reporter: Peter van der Velde
            Priority: Minor


In the file DBUserManager.java all database acces functions call the lazyinit 
function before continuing.

    /**
     * Get the user object. Fetch the row from the table.
     */
    public synchronized User getUserByName(String name) throws FtpException {
        
        Statement stmt = null;
        ResultSet rs = null;
        try {
            
            // create sql query
            HashMap<String, Object> map = new HashMap<String, Object>();
            map.put( ATTR_LOGIN, escapeString(name) );
            String sql = StringUtils.replaceString(selectUserStmt, map);
            LOG.info(sql);
            
            // execute query
            stmt = createConnection().createStatement();
            rs = stmt.executeQuery(sql);
...

I think line 1 should be like for instance in the save function

   /**
     * Save user. If new insert a new row, else update the existing row.
     */
    public synchronized void save(User user) throws FtpException {
        lazyInit();
        
        // null value check
        if(user.getName() == null) {
            throw new NullPointerException("User name is null.");
        } 
...

-- 
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