You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Daniel Dai (JIRA)" <ji...@apache.org> on 2014/02/18 18:16:19 UTC

[jira] [Commented] (PIG-3746) NPE is thrown if Pig fails before PigStats is intialized

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

Daniel Dai commented on PIG-3746:
---------------------------------

+1

> NPE is thrown if Pig fails before PigStats is intialized
> --------------------------------------------------------
>
>                 Key: PIG-3746
>                 URL: https://issues.apache.org/jira/browse/PIG-3746
>             Project: Pig
>          Issue Type: Bug
>            Reporter: Cheolsoo Park
>            Assignee: Cheolsoo Park
>             Fix For: 0.13.0
>
>         Attachments: PIG-3746-1.patch
>
>
> This is a regression of PIG-3525 where I moved the initialization of PigStats into the PigServer constructor. The problem is that if Pig fails even before PigServer is created, PigStats remains null resulting in NPE in PigStatsUtil.
> {code:title=PigStatsUtil}
>     public static void setErrorMessage(String msg) {
>         PigStats.get().setErrorMessage(msg); //---> PigStats.get() returns null
>     }
>     public static void setErrorCode(int code) {
>         PigStats.get().setErrorCode(code); //---> PigStats.get() returns null
>     }
> {code}
> To reproduce the issue, run the following command-
> {code}
> pig -x -f script.pig  #---> Note -x is missing the argument
> {code}
> The stack trace looks like this-
> {code}
> Exception in thread "main" java.lang.NullPointerException
> 	at org.apache.pig.tools.pigstats.PigStatsUtil.setErrorMessage(PigStatsUtil.java:145)
> 	at org.apache.pig.Main.run(Main.java:618)
> 	at org.apache.pig.Main.main(Main.java:156)
> {code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)