1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package goldengate.ftp.core.command.internal;
22
23 import goldengate.common.command.ReplyCode;
24 import goldengate.common.command.exception.Reply503Exception;
25 import goldengate.common.logging.GgInternalLogger;
26 import goldengate.common.logging.GgInternalLoggerFactory;
27 import goldengate.ftp.core.command.AbstractCommand;
28 import goldengate.ftp.core.command.FtpCommandCode;
29 import goldengate.ftp.core.command.info.NOOP;
30
31
32
33
34
35
36
37 public class IncorrectCommand extends AbstractCommand {
38
39
40
41 private static final GgInternalLogger logger = GgInternalLoggerFactory
42 .getLogger(IncorrectCommand.class);
43
44
45
46
47
48
49 public void exec() throws Reply503Exception {
50 getSession().setReplyCode(
51 ReplyCode.REPLY_503_BAD_SEQUENCE_OF_COMMANDS,
52 "Bas sequence of commands: " + getCommand() + " following " +
53 getSession().getPreviousCommand().getCommand());
54 logger.warn(getSession().getAnswer());
55 if (getSession().getPreviousCommand().getCode() != FtpCommandCode.Connection &&
56 getSession().getPreviousCommand().getCode() != FtpCommandCode.PASS &&
57 getSession().getPreviousCommand().getCode() != FtpCommandCode.USER) {
58 getSession().setNextCommand(new NOOP(getSession()));
59 } else {
60 invalidCurrentCommand();
61 }
62 throw new Reply503Exception(getSession().getReplyCode().getMesg());
63 }
64 }