[ 
https://issues.apache.org/jira/browse/FTPSERVER-450?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13798934#comment-13798934
 ] 

Uma Maheswara Rao G edited comment on FTPSERVER-450 at 10/18/13 9:12 AM:
-------------------------------------------------------------------------

Please check this is addressing your issue?

I got your point, i.e, since the path based file may not exist but file might 
present in classpath. So, it is loading from classpath but we are not setting 
userDataFile in that else condition. Is that you mean? 

Attached a patch to address this.

{quote}
Let me know how can I format my code like you did, because it is very difficult 
to read code for you .. even me.
{quote}
You can just add {noformat} {code} {noformat} tags surrounding to your code 
peice.
Ex: {noformat}
           {code}
                code peice
          {code}
      {noformat}       



was (Author: umamaheswararao):
Please check this is addressing your issue?

I got your point, i.e, since the path based file may not exist but file might 
present in classpath. So, it is loading from classpath but we are not setting 
userDataFile in that else condition. Is that you mean? 

Attached a patch to address this.



> 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
>         Attachments: FTPSERVER-450.patch, PropertiesUserManager.java
>
>
> 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)

Reply via email to