AMBARI-14963. Cannot login due to a JS error (alexantonenko)

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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: d9faf7412c5d1968ba74d1eab3487b7e374ea002
Parents: 5352638
Author: Alex Antonenko <hiv...@gmail.com>
Authored: Tue Feb 9 01:41:32 2016 +0200
Committer: Alex Antonenko <hiv...@gmail.com>
Committed: Tue Feb 9 02:41:31 2016 +0200

----------------------------------------------------------------------
 ambari-web/app/router.js | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d9faf741/ambari-web/app/router.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js
index 809979e..720ac0b 100644
--- a/ambari-web/app/router.js
+++ b/ambari-web/app/router.js
@@ -349,9 +349,18 @@ App.Router = Em.Router.extend({
   /**
    * success callback of router.login.message
    * @param {object} data
+   * @param {object} opt
+   * @param {object} params
    */
   showLoginMessage: function (data, opt, params){
-    var response = JSON.parse(data.Settings.content.replace(/\n/g, "\\n")),
+    try {
+      var response = JSON.parse(data.Settings.content.replace(/\n/g, "\\n"))
+    } catch (e) {
+      this.setClusterData(data, opt, params);
+      return false;
+    }
+
+    var
       text = response.text ? response.text : "",
       buttonText = response.button ? response.button : Em.I18n.t('ok'),
       status = response.status && response.status == "true" ? true : false,

Reply via email to