From d1b9b852442cb93b413eff8a137db6213e730d9c Mon Sep 17 00:00:00 2001 From: Xuan Date: Thu, 24 Sep 2015 15:01:17 -0700 Subject: [PATCH] YARN-3624. ApplicationHistoryServer should not reverse the order of the filters it gets. Contributed by Mit Desai --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../ApplicationHistoryServer.java | 13 ++++++++----- .../TestApplicationHistoryServer.java | 4 ++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 999d82f2c95..f7ea26ef7a6 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -991,6 +991,9 @@ Release 2.7.2 - UNRELEASED YARN-3975. WebAppProxyServlet should not redirect to RM page if AHS is enabled (Mit Desai via jlowe) + YARN-3624. ApplicationHistoryServer should not reverse the order of the + filters it gets. (Mit Desai via xgong) + Release 2.7.1 - 2015-07-06 INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java index 0ec27d75d20..dd571f8f22f 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java @@ -242,17 +242,20 @@ public class ApplicationHistoryServer extends CompositeService { if(conf.getBoolean(YarnConfiguration .TIMELINE_SERVICE_HTTP_CROSS_ORIGIN_ENABLED, YarnConfiguration .TIMELINE_SERVICE_HTTP_CROSS_ORIGIN_ENABLED_DEFAULT)) { - initializers = CrossOriginFilterInitializer.class.getName() + "," - + initializers; + if (initializers.length() != 0) { + initializers += ","; + } + initializers += CrossOriginFilterInitializer.class.getName(); modifiedInitializers = true; } } if (!initializers.contains(TimelineAuthenticationFilterInitializer.class .getName())) { - initializers = - TimelineAuthenticationFilterInitializer.class.getName() + "," - + initializers; + if (initializers.length() != 0) { + initializers += ","; + } + initializers += TimelineAuthenticationFilterInitializer.class.getName(); modifiedInitializers = true; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryServer.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryServer.java index a7e7daa1c58..01c309cd77a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryServer.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryServer.java @@ -138,8 +138,8 @@ public class TestApplicationHistoryServer { HashMap driver = new HashMap(); driver.put("", TimelineAuthenticationFilterInitializer.class.getName()); driver.put(StaticUserWebFilter.class.getName(), - TimelineAuthenticationFilterInitializer.class.getName() + "," - + StaticUserWebFilter.class.getName()); + StaticUserWebFilter.class.getName() + "," + + TimelineAuthenticationFilterInitializer.class.getName()); driver.put(AuthenticationFilterInitializer.class.getName(), TimelineAuthenticationFilterInitializer.class.getName()); driver.put(TimelineAuthenticationFilterInitializer.class.getName(),