You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yarn-commits@hadoop.apache.org by zj...@apache.org on 2014/06/06 22:10:14 UTC

svn commit: r1600995 - in /hadoop/common/branches/branch-2/hadoop-yarn-project: ./ hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/security/

Author: zjshen
Date: Fri Jun  6 20:10:14 2014
New Revision: 1600995

URL: http://svn.apache.org/r1600995
Log:
YARN-2117. Fixed the issue that secret file reader is potentially not closed in TimelineAuthenticationFilterInitializer. Contributed by Chen He.
svn merge --ignore-ancestry -c 1600994 ../../trunk/

Modified:
    hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt
    hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/security/TimelineAuthenticationFilterInitializer.java

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt?rev=1600995&r1=1600994&r2=1600995&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt Fri Jun  6 20:10:14 2014
@@ -183,6 +183,9 @@ Release 2.5.0 - UNRELEASED
     YARN-2118. Fixed the type mismatch in Map#containsKey check of
     TimelineWebServices#injectOwnerInfo. (Ted Yu via zjshen)
 
+    YARN-2117. Fixed the issue that secret file reader is potentially not
+    closed in TimelineAuthenticationFilterInitializer. (Chen He via zjshen)
+
 Release 2.4.1 - UNRELEASED
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/security/TimelineAuthenticationFilterInitializer.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/security/TimelineAuthenticationFilterInitializer.java?rev=1600995&r1=1600994&r2=1600995&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/security/TimelineAuthenticationFilterInitializer.java (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/security/TimelineAuthenticationFilterInitializer.java Fri Jun  6 20:10:14 2014
@@ -28,6 +28,7 @@ import org.apache.hadoop.conf.Configurat
 import org.apache.hadoop.http.FilterContainer;
 import org.apache.hadoop.http.FilterInitializer;
 import org.apache.hadoop.http.HttpServer2;
+import org.apache.hadoop.io.IOUtils;
 import org.apache.hadoop.security.SecurityUtil;
 
 /**
@@ -86,15 +87,15 @@ public class TimelineAuthenticationFilte
 
     String signatureSecretFile = filterConfig.get(SIGNATURE_SECRET_FILE);
     if (signatureSecretFile != null) {
+      Reader reader = null;
       try {
         StringBuilder secret = new StringBuilder();
-        Reader reader = new FileReader(signatureSecretFile);
+        reader = new FileReader(signatureSecretFile);
         int c = reader.read();
         while (c > -1) {
           secret.append((char) c);
           c = reader.read();
         }
-        reader.close();
         filterConfig
             .put(TimelineAuthenticationFilter.SIGNATURE_SECRET,
                 secret.toString());
@@ -102,6 +103,8 @@ public class TimelineAuthenticationFilte
         throw new RuntimeException(
             "Could not read HTTP signature secret file: "
                 + signatureSecretFile);
+      } finally {
+        IOUtils.closeStream(reader);
       }
     }