Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4D3B710D69 for ; Thu, 20 Mar 2014 15:55:04 +0000 (UTC) Received: (qmail 44307 invoked by uid 500); 20 Mar 2014 15:55:03 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 44240 invoked by uid 500); 20 Mar 2014 15:55:03 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 44225 invoked by uid 99); 20 Mar 2014 15:55:01 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Mar 2014 15:55:01 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 1BCED986226; Thu, 20 Mar 2014 15:55:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ababiichuk@apache.org To: commits@ambari.apache.org Message-Id: <1b1cd7fa798643b7a38761cc5ab739e9@git.apache.org> X-Mailer: ASF-Git Admin Mailer 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 +0000 (UTC) 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 Authored: Thu Mar 20 17:31:13 2014 +0200 Committer: aBabiichuk 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('
' + App.config.escapeXMLCharacters(xml) + '
'); + newDocument.write('
' + App.config.escapeXMLCharacters(xml, true) + '
'); 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 '>' to '&gt;' to '&amp;gt;', we need // to first unescape all XML chars, and then escape them again. var newValue = String(value).replace(/(&|<|>|"|')/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: '&>"'', + json: '&>"\'' + }, + { + html: '&>', + json: '&>' + }, + { + html: '&&&', + json: '&&&' + }, + { + html: '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`', + 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