1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.waarp.ftp.core.command.access;
21
22 import org.waarp.common.command.NextCommandReply;
23 import org.waarp.common.command.exception.Reply421Exception;
24 import org.waarp.common.command.exception.Reply501Exception;
25 import org.waarp.common.command.exception.Reply502Exception;
26 import org.waarp.common.command.exception.Reply530Exception;
27 import org.waarp.ftp.core.command.AbstractCommand;
28
29
30
31
32 public class ACCT extends AbstractCommand {
33 @Override
34 public final void exec()
35 throws Reply501Exception, Reply421Exception, Reply530Exception,
36 Reply502Exception {
37 if (!hasArg()) {
38 invalidCurrentCommand();
39 throw new Reply501Exception("Need an account as argument");
40 }
41 final String account = getArg();
42 final NextCommandReply nextCommandReply;
43 try {
44 nextCommandReply = getSession().getAuth().setAccount(account);
45 } catch (final Reply530Exception e) {
46 getSession().reinitFtpAuth();
47 throw e;
48 }
49 setExtraNextCommand(nextCommandReply.command);
50 getSession().setReplyCode(nextCommandReply.reply, nextCommandReply.message);
51 }
52
53 }