Author: tucu
Date: Wed Jan 16 23:56:04 2013
New Revision: 1434506

URL: http://svn.apache.org/viewvc?rev=1434506&view=rev
Log:
MAPREDUCE-4315. jobhistory.jsp throws 500 when a .txt file is found in /done. 
(sandyr via tucu)

Modified:
    hadoop/common/branches/branch-1/CHANGES.txt
    hadoop/common/branches/branch-1/src/webapps/history/jobhistoryhome.jsp

Modified: hadoop/common/branches/branch-1/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/CHANGES.txt?rev=1434506&r1=1434505&r2=1434506&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1/CHANGES.txt Wed Jan 16 23:56:04 2013
@@ -434,6 +434,9 @@ Release 1.2.0 - unreleased
     MAPREDUCE-4924. flakey test: 
org.apache.hadoop.mapred.TestClusterMRNotification.testMR. 
     (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
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/branches/branch-1/src/webapps/history/jobhistoryhome.jsp
URL: 
http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/webapps/history/jobhistoryhome.jsp?rev=1434506&r1=1434505&r2=1434506&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/webapps/history/jobhistoryhome.jsp 
(original)
+++ hadoop/common/branches/branch-1/src/webapps/history/jobhistoryhome.jsp Wed 
Jan 16 23:56:04 2013
@@ -152,11 +152,24 @@ window.location.href = url;
                  || fileName.split("_")[FILENAME_JOBNAME_PART].toLowerCase()
                        .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) {
         String name = path.getName();
 
-        return !(name.endsWith(".xml")) && matchUser(name) && 
matchJobName(name);
+        return isHistoryFile(name) && matchUser(name) && matchJobName(name);
       }
     };
     


Reply via email to