Browse Source

MAPREDUCE-4315. jobhistory.jsp throws 500 when a .txt file is found in /done. (sandyr via tucu)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1@1434506 13f79535-47bb-0310-9956-ffa450edef68
Alejandro Abdelnur 12 years ago
parent
commit
e9bab48cce
2 changed files with 17 additions and 1 deletions
  1. 3 0
      CHANGES.txt
  2. 14 1
      src/webapps/history/jobhistoryhome.jsp

+ 3 - 0
CHANGES.txt

@@ -434,6 +434,9 @@ Release 1.2.0 - unreleased
     MAPREDUCE-4924. flakey test: org.apache.hadoop.mapred.TestClusterMRNotification.testMR. 
     MAPREDUCE-4924. flakey test: org.apache.hadoop.mapred.TestClusterMRNotification.testMR. 
     (rkanter via tucu)
     (rkanter via tucu)
 
 
+    MAPREDUCE-4315. jobhistory.jsp throws 500 when a .txt file is found in /done. 
+    (sandyr via tucu)
+
 Release 1.1.2 - Unreleased
 Release 1.1.2 - Unreleased
 
 
   INCOMPATIBLE CHANGES
   INCOMPATIBLE CHANGES

+ 14 - 1
src/webapps/history/jobhistoryhome.jsp

@@ -152,11 +152,24 @@ window.location.href = url;
                  || fileName.split("_")[FILENAME_JOBNAME_PART].toLowerCase()
                  || fileName.split("_")[FILENAME_JOBNAME_PART].toLowerCase()
                        .contains(jobnameKeywordInFname);
                        .contains(jobnameKeywordInFname);
       }
       }
+      
+      private boolean isHistoryFile(String fileName) {      	
+        String[] tokens = null;
+        try {
+          String dp = JobHistory.JobInfo.decodeJobHistoryFileName(fileName);
+          tokens = dp.split("_");
+        } catch (IOException ioe) {
+        }
+	    
+        return tokens != null && !fileName.endsWith(".xml") && tokens.length > 3
+            && tokens[1].matches("\\d+")  && tokens[2].matches("\\d+")
+            && tokens[3].matches("\\d+");
+      }
 
 
       public boolean accept(Path path) {
       public boolean accept(Path path) {
         String name = path.getName();
         String name = path.getName();
 
 
-        return !(name.endsWith(".xml")) && matchUser(name) && matchJobName(name);
+        return isHistoryFile(name) && matchUser(name) && matchJobName(name);
       }
       }
     };
     };