-
Bug
-
Resolution: Done
-
Minor
-
None
-
2.1.0.CR1
-
None
cli/src/main/java/org/jboss/as/cli/scriptsupport/CLI.java
public void connect() {
checkAlreadyConnected();
try
catch (CliInitializationException e)
{ throw new IllegalStateException("Unable to initialize command context.", e); }catch (CommandLineException e)
{ throw new IllegalStateException("Unable to connect to controller.", e); }}
also applicable to the other connects of course.
If the connection fails in the connect method, a subsequent connect will hit:
private void checkAlreadyConnected()
{ if (ctx != null) throw new IllegalStateException("Already connected to server."); }and will fail for the wrong reason... as while ctx !=null is true, but the connection had failed.
ergo, upon failure in connect, the ctx should be reset to avoid this