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 Hans-Juergen Brand <ha...@gmx.net> on 2006/01/04 12:25:31 UTC

Problem if FtpRequestImpl.m_argument =""

In Class FtpRequestImpl the function hasArgument() returns true if the var
m_argument is "" (not null!)  I change the code  as see below. 


public void parse(String line) {
        
        // notify connection observer
        spyRequest(line);
        
        // parse request
        m_line = line;
        m_command = null;
        m_argument = null;
        int spInd = m_line.indexOf(' ');
        if(spInd != -1) {
            m_argument = m_line.substring(spInd + 1);
            m_command = m_line.substring(0, spInd).toUpperCase();
            
//HJB 03.01.2006 add line , because m_argument="" generates error (Webcam
LevelOne FS1040 sends mkd command <space> and nothing more)


            if (m_argument.equalsIgnoreCase("")) m_argument=null;
        }




        else {
            m_command = m_line.toUpperCase();
        }
        
        if( (m_command.length()>0) && (m_command.charAt(0)=='X') ) {
            m_command = m_command.substring(1);
        }
    }
    

Re: Problem if FtpRequestImpl.m_argument =""

Posted by Rana Bhattacharyya <ra...@yahoo.com>.
Hi,

    Thank you very much! I have comminted the changes.
Along with this change, the ftp request command line
is also trimmed in RequestHandler to avoid this
situation.

Thanks,
Rana Bhattacharyya


--- Hans-Juergen Brand <ha...@gmx.net>
wrote:

> In Class FtpRequestImpl the function hasArgument()
> returns true if the var
> m_argument is "" (not null!)  I change the code  as
> see below. 
> 
> 
> public void parse(String line) {
>         
>         // notify connection observer
>         spyRequest(line);
>         
>         // parse request
>         m_line = line;
>         m_command = null;
>         m_argument = null;
>         int spInd = m_line.indexOf(' ');
>         if(spInd != -1) {
>             m_argument = m_line.substring(spInd +
> 1);
>             m_command = m_line.substring(0,
> spInd).toUpperCase();
>             
> //HJB 03.01.2006 add line , because m_argument=""
> generates error (Webcam
> LevelOne FS1040 sends mkd command <space> and
> nothing more)
> 
> 
>             if (m_argument.equalsIgnoreCase(""))
> m_argument=null;
>         }
> 
> 
> 
> 
>         else {
>             m_command = m_line.toUpperCase();
>         }
>         
>         if( (m_command.length()>0) &&
> (m_command.charAt(0)=='X') ) {
>             m_command = m_command.substring(1);
>         }
>     }
>     
> 



		
__________________________________________ 
Yahoo! DSL – Something to write home about. 
Just $16.99/mo. or less. 
dsl.yahoo.com