You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2015/05/18 13:31:49 UTC

[2/2] stratos git commit: Fixing login error in CLI

Fixing login error in CLI


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/d2f9f456
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/d2f9f456
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/d2f9f456

Branch: refs/heads/master
Commit: d2f9f456b3fa146ad7a281bdd0b12a958d46c260
Parents: 1cc7c1f
Author: anuruddhal <an...@gmail.com>
Authored: Mon May 18 15:22:54 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Mon May 18 17:01:26 2015 +0530

----------------------------------------------------------------------
 .../java/org/apache/stratos/cli/RestCommandLineService.java | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/d2f9f456/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
index 3e60294..1979eba 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
@@ -28,6 +28,8 @@ import org.apache.axis2.description.TransportOutDescription;
 import org.apache.axis2.transport.http.HttpTransportProperties;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.http.HttpResponse;
+import org.apache.http.auth.MalformedChallengeException;
+import org.apache.http.client.ClientProtocolException;
 import org.apache.http.impl.client.DefaultHttpClient;
 import org.apache.stratos.cli.exception.CommandException;
 import org.apache.stratos.cli.exception.ExceptionMapper;
@@ -214,7 +216,7 @@ public class RestCommandLineService {
                     if (responseCode == 200) {
                         return true;
                     } else {
-                        System.out.println("Invalid STRATOS_URL");
+                        System.out.println("Invalid value is set for STRATOS_URL");
                     }
                 }
                 return false;
@@ -231,6 +233,11 @@ public class RestCommandLineService {
             printError(message, e);
             return false;
         } catch (Exception e) {
+            if(e.getCause() instanceof MalformedChallengeException){
+                String message="Authentication failed. Please check your username/password";
+                printError(message,e);
+                return  false;
+            }
             String message = "An unknown error occurred: " + e.getMessage();
             printError(message, e);
             return false;