ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ababiic...@apache.org
Subject git commit: AMBARI-5160 Error in picking up LzoCodecs in Ambari-deployed Oracle 6.3 and CentOS5. (ababiichuk)
Date Thu, 20 Mar 2014 15:55:01 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk b6b56cfeb -> 442f73229


AMBARI-5160 Error in picking up LzoCodecs in Ambari-deployed Oracle 6.3 and CentOS5. (ababiichuk)


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

Branch: refs/heads/trunk
Commit: 442f73229dedb0bb6969afe3a5ad7a89bf7d5d70
Parents: b6b56cf
Author: aBabiichuk <ababiichuk@cybervisiontech.com>
Authored: Thu Mar 20 17:31:13 2014 +0200
Committer: aBabiichuk <ababiichuk@cybervisiontech.com>
Committed: Thu Mar 20 17:54:15 2014 +0200

----------------------------------------------------------------------
 .../main/mirroring/jobs_controller.js           |  2 +-
 ambari-web/app/utils/config.js                  | 12 +++++---
 ambari-web/test/utils/config_test.js            | 32 ++++++++++++++++++++
 3 files changed, 41 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/442f7322/ambari-web/app/controllers/main/mirroring/jobs_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/mirroring/jobs_controller.js b/ambari-web/app/controllers/main/mirroring/jobs_controller.js
index d8e6d47..607efb1 100644
--- a/ambari-web/app/controllers/main/mirroring/jobs_controller.js
+++ b/ambari-web/app/controllers/main/mirroring/jobs_controller.js
@@ -163,7 +163,7 @@ App.MainDatasetJobsController = Em.Controller.extend({
   openInfoInNewTab: function (xml) {
     var newWindow = window.open('');
     var newDocument = newWindow.document;
-    newDocument.write('<pre>' + App.config.escapeXMLCharacters(xml) + '</pre>');
+    newDocument.write('<pre>' + App.config.escapeXMLCharacters(xml, true) + '</pre>');
     newWindow.focus();
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/442f7322/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index 3911bf4..e979d08 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -57,16 +57,20 @@ App.config = Em.Object.create({
    * Special characters in XML are defined at
    * http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML
    */
-  escapeXMLCharacters: function(value) {
+  escapeXMLCharacters: function(value, toXML) {
     var self = this;
     // To prevent double/triple replacing '&gt;' to '&amp;gt;' to '&amp;amp;gt;',
we need
     // to first unescape all XML chars, and then escape them again.
     var newValue = String(value).replace(/(&amp;|&lt;|&gt;|&quot;|&apos;)/g,
function (s) {
       return self.xmlUnEscapeMap[s];
     });
-    return String(newValue).replace(/[&<>"']/g, function (s) {
-      return self.xmlEscapeMap[s];
-    });
+    if (toXML) {
+      return String(newValue).replace(/[&<>"']/g, function (s) {
+        return self.xmlEscapeMap[s];
+      });
+    } else {
+      return newValue;
+    }
   },
   preDefinedServiceConfigs: function () {
     var configs = this.get('preDefinedGlobalProperties');

http://git-wip-us.apache.org/repos/asf/ambari/blob/442f7322/ambari-web/test/utils/config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/config_test.js b/ambari-web/test/utils/config_test.js
index b91202e..56551ca 100644
--- a/ambari-web/test/utils/config_test.js
+++ b/ambari-web/test/utils/config_test.js
@@ -230,4 +230,36 @@ describe('App.config', function () {
       expect(result.length).to.equal(1);
     });
   });
+
+  describe('#escapeXMLCharacters', function () {
+
+    var testConfigs = [
+      {
+        html: '&>"',
+        json: '&>"'
+      },
+      {
+        html: '&amp;&gt;&quot;&apos;',
+        json: '&>"\''
+      },
+      {
+        html: '&&gt;',
+        json: '&>'
+      },
+      {
+        html: '&&&amp;',
+        json: '&&&'
+      },
+      {
+        html: 'LD_LIBRARY_PATH=/usr/lib/hadoop/lib/native:/usr/lib/hadoop/lib/native/`$JAVA_HOME/bin/java
-d32 -version &amp;&gt; /dev/null;if [ $? -eq 0 ]; then echo Linux-i386-32; else echo
Linux-amd64-64;fi`',
+        json: 'LD_LIBRARY_PATH=/usr/lib/hadoop/lib/native:/usr/lib/hadoop/lib/native/`$JAVA_HOME/bin/java
-d32 -version &> /dev/null;if [ $? -eq 0 ]; then echo Linux-i386-32; else echo Linux-amd64-64;fi`'
+      }
+    ];
+    testConfigs.forEach(function(t){
+      it('parsing html ' + t.html, function () {
+        expect(t.json).to.equal(App.config.escapeXMLCharacters(t.html));
+      });
+    });
+
+  });
 });
\ No newline at end of file


Mime
View raw message