[ https://issues.apache.org/jira/browse/PIG-4967?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15438597#comment-15438597 ]
Xiang Li commented on PIG-4967: ------------------------------- Daniel, thanks for clarification! Got your idea. I found it breaks UT (and also breaks Pig run on a cluster) if we would like to use j.getJob().getStatus() to check if job status is null. Job#getStatus() calls ensureState() at the very beginning, to check if the state is RUNNING. If it is not, throw IllegalStateException, as {code} [JobControl] ERROR org.apache.pig.backend.hadoop23.PigJobControl - Error while trying to run jobs. java.lang.IllegalStateException: Job in state DEFINE instead of RUNNING at org.apache.hadoop.mapreduce.Job.ensureState(Job.java:292) at org.apache.hadoop.mapreduce.Job.getStatus(Job.java:337) at org.apache.pig.backend.hadoop23.PigJobControl.run(PigJobControl.java:190) at java.lang.Thread.run(Thread.java:745) at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher$1.run(MapReduceLauncher.java:276) {code} The code of Job#getStatus() is {code} public JobStatus getStatus() throws IOException, InterruptedException { ensureState(JobState.RUNNING); updateStatus(); return status; } {code} I think the easiest way to fix this JIRA is to surround {code} log.debug("Checking state of job " + j); {code} with try block and catch NPE. Do you think so? > 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)