[ 
https://issues.apache.org/jira/browse/MAPREDUCE-6096?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14144248#comment-14144248
 ] 

zhangyubiao commented on MAPREDUCE-6096:
----------------------------------------

Thank you very much  for review,It's my first time to Commit a patch. 
No new tests is because this test need jhist File and the exception file is 
large size. You can tests this patch as follow 
1、get jhist  File done into Local File 
2、Test  use this method By use jhist File Path into jobHistoryFilePath
public static SummarizedJob getSummarizedJob(String jobHistoryFilePath) {
                JobInfo jobInfo = null;
                SummarizedJob ts = null;
                Path jobFile = new Path(jobHistoryFile);
                try {
                        Configuration conf = new Configuration();
                        FileSystem fs = jobFile.getFileSystem(conf);
                        JobHistoryParser parser = new JobHistoryParser(fs, 
jobHistoryFile);
                        jobInfo = parser.parse();
                        ts = new SummarizedJob(jobInfo);
                } catch (IOException e) {
                        e.printStackTrace();
                }
                return ts;
        }
3、if you use the current SummarizedJob ,It will throw NullPointerException in 
some jhist File.   If  you change the the order of 
attempt.getTaskStatus().equals (TaskStatus.State.FAILED.toString()) ,
It works well.

> SummarizedJob class NPEs with some jhist files
> ----------------------------------------------
>
>                 Key: MAPREDUCE-6096
>                 URL: https://issues.apache.org/jira/browse/MAPREDUCE-6096
>             Project: Hadoop Map/Reduce
>          Issue Type: Improvement
>          Components: jobhistoryserver
>    Affects Versions: trunk
>            Reporter: zhangyubiao
>            Assignee: zhangyubiao
>              Labels: easyfix, patch
>         Attachments: MAPREDUCE-6096.patch
>
>
> When I Parse  the JobHistory in the HistoryFile,I use the Hadoop System's  
> map-reduce-client-core project 
> org.apache.hadoop.mapreduce.jobhistory.JobHistoryParser  class and 
> HistoryViewer$SummarizedJob to Parse the JobHistoryFile(Just Like 
> job_1408862281971_489761-1410883171851_XXX.jhist)  
> and it throw an Exception Just Like 
> Exception in thread "pool-1-thread-1" java.lang.NullPointerException
>       at 
> org.apache.hadoop.mapreduce.jobhistory.HistoryViewer$SummarizedJob.<init>(HistoryViewer.java:626)
>       at 
> com.jd.hadoop.log.parse.ParseLogService.getJobDetail(ParseLogService.java:70)
> After I'm see the SummarizedJob class I  find that attempt.getTaskStatus() is 
> NULL , So I change the order of 
> attempt.getTaskStatus().equals (TaskStatus.State.FAILED.toString())  to 
> TaskStatus.State.FAILED.toString().equals(attempt.getTaskStatus()) 
> and it works well .
> So I wonder If we can change all  attempt.getTaskStatus()  after 
> TaskStatus.State.XXX.toString() ?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to