Balakrishnan J created VFS-592:
----------------------------------

             Summary: ftp IPV6 URI always throws 550 Failed to change directory 
to Remote Root Directory
                 Key: VFS-592
                 URL: https://issues.apache.org/jira/browse/VFS-592
             Project: Commons VFS
          Issue Type: Bug
    Affects Versions: 2.0
            Reporter: Balakrishnan J
            Priority: Critical


FTP URI when connected with IPV6 machine always throws either of the following 

1) 550 Failed to change directory to Remote Root Directory
2) org.apache.commons.vfs2.FileSystemException: Could not determine the type of 
file

The code snippet :
-----------------------------

public FtpResult performScript(String pScript) throws IOException
        {
                FtpResult result=null;
                                        
                // First verify that the Remote and Local Directories do exist 
as directories
                try {

                        //FileObject remoteRootDir = resolveDir(remoteDir);
                        FileObject remoteRootDir = 
m_FsManager.resolveFile("ftp://adc00pcf.us.oracle.com/abc";, m_SrcTargetOptions);
                        if (remoteRootDir.getType()!=FileType.FOLDER) {
                                String msg = 
resfunction.getString("FTP.550FailedToChangeDirectoryToRemoteRoot").replaceAll("\\{0\\}",
 remoteDir);
                                ftpTrace = handleActionMessage(msg, lineNumber);
                                if (m_stopFTPOnError)
                                        return new FtpResult(Status.ERROR, 
ftpTrace);
                        }
                }
                catch (FileSystemException fsx) {
                final Writer exWriter = new StringWriter();
                fsx.printStackTrace(new PrintWriter(exWriter));
                        ftpTrace = exWriter.toString();
                        AgentLogger.log(Level.INFO, "Validate RemoteDirectory 
raised ", fsx);
                        return new FtpResult(Status.ERROR, ftpTrace);
                }
                
                try {
                        FileObject localRootDir =  
m_FsManager.resolveFile(m_SchemeLocalDir);
                        if (localRootDir.getType()!=FileType.FOLDER) {
                                String msg = 
resfunction.getString("FTP.550FailedToChangeDirectoryToLocalRoot").replaceAll("\\{0\\}",
 m_SchemeLocalDir);
                                ftpTrace = handleActionMessage(msg, lineNumber);
                                if (m_stopFTPOnError)
                                        return new FtpResult(Status.ERROR, 
ftpTrace);
                        }
                }
                catch (FileSystemException fsx) {
                        ftpTrace = 
handleActionMessage(resfunction.getString("FTP.550FailedToChangeDirectoryToLocalRoot"),
 lineNumber);
                        ftpTrace += fsx.getLocalizedMessage();
                        AgentLogger.log(Level.FINE, "Validate LocalDirectory 
raised ", fsx);
                        if (m_stopFTPOnError)
                                return new FtpResult(Status.ERROR, ftpTrace);
                }                       

                FileObject fileToRename=null;
                BufferedReader cmdReader = new BufferedReader(new 
StringReader(pScript));
                
                        
                        try {
                                        
                                        // MKD aa succeeds if aa does not exist
                                        // MKD aa/bb succeeds if aa does exist; 
fails if aa does not exist
                                        // MKD ./aa created /tmp/./aa
                                        actionMessage = 
resfunction.getString("FTP.550CreateDirectoryOperationFailed");
                                        FileObject newDir = 
resolveFile(getRemoteDir(relativeDir), "mynewdir");
                                        if (!newDir.exists())
                                                {
                                                        newDir.createFolder();
                                                        if (newDir.exists())
                                                                actionMessage = 
resfunction.getString("FTP.257DirectoryCreated").replaceAll("\\{0\\}", 
handleProtocol(newDir));
                                                }
                                        }                                       
        
                                
                        } 
                        catch (Exception ex) {
                                AgentLogger.log(Level.FINE, "FTP Cmd="+cmd, ex);
                                
                        } // end of processing the command
                        
                }
                
                return result;
                
        }




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to