View | Details | Raw Unified | Return to bug 63248
Collapse All | Expand All

(-)a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java (-2 / +34 lines)
Lines 89-94 public class FTP extends Task implements FTPTaskConfig { Link Here
89
    protected static final int CHMOD = 5;
89
    protected static final int CHMOD = 5;
90
    protected static final int RM_DIR = 6;
90
    protected static final int RM_DIR = 6;
91
    protected static final int SITE_CMD = 7;
91
    protected static final int SITE_CMD = 7;
92
    protected static final int FEAT = 8;
92
    /** return code of ftp */
93
    /** return code of ftp */
93
    private static final int CODE_521 = 521;
94
    private static final int CODE_521 = 521;
94
    private static final int CODE_550 = 550;
95
    private static final int CODE_550 = 550;
Lines 2176-2181 public class FTP extends Task implements FTPTaskConfig { Link Here
2176
    }
2177
    }
2177
    /**
2178
    /**
2179
     * Sends the feat command to the ftp server
2180
     * @param ftp ftp client
2181
     * @throws IOException  in unknown circumstances
2182
     * @throws BuildException in unknown circumstances
2183
     */
2184
    protected void doFeatCommand(FTPClient ftp)
2185
        throws IOException, BuildException {
2186
2187
        log("Doing Feat Command: ", Project.MSG_VERBOSE);
2188
2189
        // use commons-net 1.4 compatible syntax although there
2190
        // are alternatives for newer versions
2191
        if (ftp.sendCommand("FEAT") != 211) {
2192
            log("Failed to issue Feat Command: ", Project.MSG_WARN);
2193
        } else {
2194
            for (String reply : ftp.getReplyStrings()) {
2195
                if (reply != null && !reply.contains("211")) {
2196
                    log(reply, Project.MSG_WARN);
2197
                }
2198
            }
2199
        }
2200
    }
2201
2202
    /**
2178
     * Sends a single file to the remote host. <code>filename</code> may
2203
     * Sends a single file to the remote host. <code>filename</code> may
2179
     * contain a relative path specification. When this is the case, <code>sendFile</code>
2204
     * contain a relative path specification. When this is the case, <code>sendFile</code>
2180
     * will attempt to create any necessary parent directories before sending
2205
     * will attempt to create any necessary parent directories before sending
Lines 2590-2595 public class FTP extends Task implements FTPTaskConfig { Link Here
2590
                executeRetryable(new RetryHandler(this.retriesAllowed, this),
2615
                executeRetryable(new RetryHandler(this.retriesAllowed, this),
2591
                    () -> doSiteCommand(lftp, FTP.this.siteCommand),
2616
                    () -> doSiteCommand(lftp, FTP.this.siteCommand),
2592
                    "Site Command: " + this.siteCommand);
2617
                    "Site Command: " + this.siteCommand);
2618
            } else if (action == FEAT) {
2619
                final FTPClient lftp = ftp;
2620
                executeRetryable(new RetryHandler(this.retriesAllowed, this),
2621
                    () -> doFeatCommand(lftp),
2622
                    "Feat Command");
2593
            } else {
2623
            } else {
2594
                if (remotedir != null) {
2624
                if (remotedir != null) {
2595
                    log("changing the remote directory to " + remotedir,
2625
                    log("changing the remote directory to " + remotedir,
Lines 2644-2656 public class FTP extends Task implements FTPTaskConfig { Link Here
2644
    /**
2674
    /**
2645
     * an action to perform, one of
2675
     * an action to perform, one of
2646
     * "send", "put", "recv", "get", "del", "delete", "list", "mkdir", "chmod",
2676
     * "send", "put", "recv", "get", "del", "delete", "list", "mkdir", "chmod",
2647
     * "rmdir"
2677
     * "rmdir", "feat"
2648
     */
2678
     */
2649
    public static class Action extends EnumeratedAttribute {
2679
    public static class Action extends EnumeratedAttribute {
2650
        private static final String[] VALID_ACTIONS = {
2680
        private static final String[] VALID_ACTIONS = {
2651
            "send", "put", "recv", "get", "del", "delete", "list", "mkdir",
2681
            "send", "put", "recv", "get", "del", "delete", "list", "mkdir",
2652
            "chmod", "rmdir", "site"
2682
            "chmod", "rmdir", "site", "feat"
2653
        };
2683
        };
2654
        /**
2684
        /**
Lines 2689-2694 public class FTP extends Task implements FTPTaskConfig { Link Here
2689
                return RM_DIR;
2719
                return RM_DIR;
2690
            case "site":
2720
            case "site":
2691
                return SITE_CMD;
2721
                return SITE_CMD;
2722
            case "feat":
2723
                return FEAT;
2692
            default:
2724
            default:
2693
                return SEND_FILES;
2725
                return SEND_FILES;
2694
            }
2726
            }

Return to bug 63248