public void rename(String currentPath, String newPath) throws ClientCommandRenameException { logger.debug("rename called with currentPath [" + currentPath + "], newPath [" + newPath + "]"); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ try { String dirBefore = this.ftpClient.printWorkingDirectory(); logger.debug("Working directory before rename = [" + dirBefore + "]"); //$NON-NLS-1$ //$NON-NLS-2$ logger.debug("Current Path = [" + currentPath + "]"); //$NON-NLS-1$ //$NON-NLS-2$ logger.debug("New Path = [" + newPath + "]"); //$NON-NLS-1$ //$NON-NLS-2$ if(!this.ftpClient.rename(currentPath, newPath)) { throw new ClientCommandRenameException("Failed to rename [" + currentPath + "] to [" + newPath + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } logger.debug("Successfully renamed [" + currentPath + "] to [" //$NON-NLS-1$ //$NON-NLS-2$ + newPath + "]"); //$NON-NLS-1$ String dirAfter = this.ftpClient.printWorkingDirectory(); logger.debug("Working directory after rename = [" + dirAfter + "]"); //$NON-NLS-1$ //$NON-NLS-2$ if(!dirBefore.equals(dirAfter)) { this.ftpClient.changeWorkingDirectory(dirBefore); logger.debug("Returning to previous working = [" + dirBefore + "]"); //$NON-NLS-1$//$NON-NLS-2$ } } catch (IOException e) { throw new ClientCommandRenameException("Failed to rename [" + currentPath + "] to [" + newPath + "]", e); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } }
public void rename(String currentPath, String newPath) throws ClientCommandRenameException { logger.debug("rename called with currentPath [" + currentPath + "], newPath [" + newPath + "]"); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ try { String dirBefore = this.ftpClient.printWorkingDirectory(); logger.debug("Working directory before rename = [" + dirBefore + "]"); //$NON-NLS-1$ //$NON-NLS-2$ logger.debug("Current Path = [" + currentPath + "]"); //$NON-NLS-1$ //$NON-NLS-2$ logger.debug("New Path = [" + newPath + "]"); //$NON-NLS-1$ //$NON-NLS-2$ if(!this.ftpClient.rename(currentPath, newPath)) { throw new ClientCommandRenameException("Failed to rename [" + currentPath + "] to [" + newPath + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } logger.debug("Successfully renamed [" + currentPath + "] to [" //$NON-NLS-1$ //$NON-NLS-2$ + newPath + "]"); //$NON-NLS-1$ String dirAfter = this.ftpClient.printWorkingDirectory(); logger.debug("Working directory after rename = [" + dirAfter + "]"); //$NON-NLS-1$ //$NON-NLS-2$ if(!dirBefore.equals(dirAfter)) { this.ftpClient.changeWorkingDirectory(dirBefore); logger.debug("Returning to previous working = [" + dirBefore + "]"); //$NON-NLS-1$//$NON-NLS-2$ } } catch (IOException e) { throw new ClientCommandRenameException("Failed to rename [" + currentPath + "] to [" + newPath + "]", e); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } }
sb.append(']'); sb.trimToSize(); throw new ClientCommandRenameException(sb.toString(), e);