[ https://issues.apache.org/jira/browse/FTPSERVER-450?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13798795#comment-13798795 ]
Uma Maheswara Rao G commented on FTPSERVER-450: ----------------------------------------------- I think we are already calling loadFromFile in the Ctor of PropertiesUserManager. {code} /** * Internal constructor, do not use directly. Use {@link PropertiesUserManagerFactory} instead. */ public PropertiesUserManager(PasswordEncryptor passwordEncryptor, File userDataFile, String adminName) { super(adminName, passwordEncryptor); loadFromFile(userDataFile); } {code} In the loadFromFile, if you pass non null value and files exist means we are calling this.userDataFile = userDataFile; Please look at the below peice of code. {code} private void loadFromFile(File userDataFile) { try { userDataProp = new BaseProperties(); if (userDataFile != null) { LOG.debug("File configured, will try loading"); if (userDataFile.exists()) { this.userDataFile = userDataFile; LOG.debug("File found on file system"); FileInputStream fis = null; try { fis = new FileInputStream(userDataFile); userDataProp.load(fis); } finally { IoUtils.close(fis); } } else { // try loading it from the classpath LOG .debug("File not found on file system, try loading from classpath"); InputStream is = getClass().getClassLoader() .getResourceAsStream(userDataFile.getPath()); if (is != null) { try { userDataProp.load(is); } finally { IoUtils.close(is); } } else { throw new FtpServerConfigurationException( "User data file specified but could not be located, " + "neither on the file system or in the classpath: " + userDataFile.getPath()); } } } } catch (IOException e) { throw new FtpServerConfigurationException( "Error loading user data file : " + userDataFile, e); } } {code} Please ensure file present in classpath. > PropertiesUserManager userDataFile is always NULL. > --------------------------------------------------- > > Key: FTPSERVER-450 > URL: https://issues.apache.org/jira/browse/FTPSERVER-450 > Project: FtpServer > Issue Type: Bug > Components: Core > Affects Versions: 1.0.6 > Environment: JDK 6 > Windows 7 64 BIT > Reporter: Aizaz AZ > Priority: Blocker > > PropertiesUserManager userDataFile is always NULL. Because you didn't set > your class variable value equal to what you get in constructor when > PropertiesUserManagerFactory calls your constructor new > PropertiesUserManager(passwordEncryptor, userDataFile, adminName); of > PropertiesUserManager,just need to do below super this.userDataFile = > userDataFile; and issue is fixed > PropertiesUserManagerFactory propUserManagerFactory = new > PropertiesUserManagerFactory(); > propUserManagerFactory.setFile(new File("ftpusers.properties")); > propUserManagerFactory.setPasswordEncryptor(new > ClearTextPasswordEncryptor()); > mUserManager = (PropertiesUserManager) > propUserManagerFactory.createUserManager(); > mFTPServerFactory.setUserManager(mUserManager); > Set file has no effect because factory will call your constructor > PropertiesUserManager(passwordEncryptor, userDataFile, > adminName) > and you didn't set this.userDataFile = userDataFile; > complete > public PropertiesUserManager(PasswordEncryptor passwordEncryptor, > File userDataFile, String adminName) { > super(adminName, passwordEncryptor); > > this.userDataFile = userDataFile; > > loadFromFile(userDataFile); > } > Issue fixed -- This message was sent by Atlassian JIRA (v6.1#6144)