[ https://issues.apache.org/jira/browse/PIG-4967?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15436729#comment-15436729 ]
Xiang Li commented on PIG-4967: ------------------------------- Looking into the exception which breaks UT against patch 1. It seems that I can not call the following statement {code} j.getJob().getStatus() {code} to check if status is null, in order to avoid NPE. Here is the code of Job#getStatus(): {code} public JobStatus getStatus() throws IOException, InterruptedException { ensureState(JobState.RUNNING); updateStatus(); return status; } {code} At the beginning, job state is DEFINE which causes the exception in ensureState(JobState.RUNNING). When calling Job#getJobName() directly(the original code or in patch 0), it will check if state is DEFINE firstly and returns conf.getJobName() if state is DEFINE. I might need to change it back to use try...catch. Does it make any sense to you? > NPE in PigJobControl.run() when job status is null > -------------------------------------------------- > > Key: PIG-4967 > URL: https://issues.apache.org/jira/browse/PIG-4967 > Project: Pig > Issue Type: Bug > Affects Versions: 0.15.0 > Reporter: Xiang Li > Assignee: Xiang Li > Priority: Critical > Fix For: 0.16.0 > > Attachments: PIG-4967-0.patch, PIG-4967-1.patch > > > {code} > [JobControl] ERROR org.apache.pig.backend.hadoop23.PigJobControl - Error > while trying to run jobs. > java.lang.NullPointerException > at org.apache.hadoop.mapreduce.Job.getJobName(Job.java:426) > at > org.apache.hadoop.mapreduce.lib.jobcontrol.ControlledJob.toString(ControlledJob.java:93) > at java.lang.String.valueOf(String.java:2982) > at java.lang.StringBuilder.append(StringBuilder.java:131) > at > org.apache.pig.backend.hadoop23.PigJobControl.run(PigJobControl.java:182) > at java.lang.Thread.run(Thread.java:745) > at > org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher$1.run(MapReduceLauncher.java:276) > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)