pig-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Weijun Qian (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (PIG-5254) Hit Ctrl-D to quit grunt shell fail
Date Thu, 03 Aug 2017 01:25:00 GMT

     [ https://issues.apache.org/jira/browse/PIG-5254?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Weijun Qian updated PIG-5254:
-----------------------------
    Affects Version/s: 0.17.1
                       0.18.0
                 Tags: PIG-5254
               Status: Patch Available  (was: Open)

Cause:
When hit Ctrl + D in grunt shell, the method ConsoleLineInputStream.read() in ConsoleReaderInputStream.java
will call reader.readline(), which will return null. In this case, if we use the null to call
getBytes(), it will throw a NullPointerException.

Solution:
Define a temporary String buff to store the return value from reader.readline(), check if
it is null(the reason why it returns null could be found in jline.console.ConsoleReader.readLine()),
if yes, assign "quit" to the temp buff, and then it will function as if we input a quit in
the console.

Possible Improvement: There do exist a EOF token, a quit() hook in PigScriptParser.jj, and
a corresponding case of EOF could also be found in PigScriptParser.java, however the process
of converting a bytestream we get from ConsoleLineInputStream to a token recognizable by PigScriptParser
is not clear(relates to a bunch of java.io files). If we can figure out how it works, we may
resolve this problem in a more elegant way.
https://issues.apache.org/jira/browse/PIG-5254

> Hit Ctrl-D to quit grunt shell fail
> -----------------------------------
>
>                 Key: PIG-5254
>                 URL: https://issues.apache.org/jira/browse/PIG-5254
>             Project: Pig
>          Issue Type: Bug
>          Components: impl
>    Affects Versions: 0.18.0, 0.17.1
>            Reporter: Daniel Dai
>            Assignee: Weijun Qian
>             Fix For: 0.18.0, 0.17.1
>
>
> Exception:
> {code}
> java.lang.NullPointerException
>         at org.apache.pig.tools.grunt.ConsoleReaderInputStream$ConsoleLineInputStream.read(ConsoleReaderInputStream.java:107)
>         at java.io.InputStream.read(InputStream.java:170)
>         at java.io.SequenceInputStream.read(SequenceInputStream.java:207)
>         at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
>         at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
>         at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
>         at java.io.InputStreamReader.read(InputStreamReader.java:184)
>         at java.io.BufferedReader.fill(BufferedReader.java:161)
>         at java.io.BufferedReader.read1(BufferedReader.java:212)
>         at java.io.BufferedReader.read(BufferedReader.java:286)
>         at org.apache.pig.tools.pigscript.parser.JavaCharStream.FillBuff(JavaCharStream.java:143)
>         at org.apache.pig.tools.pigscript.parser.JavaCharStream.ReadByte(JavaCharStream.java:171)
>         at org.apache.pig.tools.pigscript.parser.JavaCharStream.readChar(JavaCharStream.java:274)
>         at org.apache.pig.tools.pigscript.parser.JavaCharStream.BeginToken(JavaCharStream.java:193)
>         at org.apache.pig.tools.pigscript.parser.PigScriptParserTokenManager.getNextToken(PigScriptParserTokenManager.java:3215)
>         at org.apache.pig.tools.pigscript.parser.PigScriptParser.jj_ntk(PigScriptParser.java:1511)
>         at org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:117)
>         at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:230)
>         at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:205)
>         at org.apache.pig.tools.grunt.Grunt.run(Grunt.java:66)
>         at org.apache.pig.Main.run(Main.java:564)
>         at org.apache.pig.Main.main(Main.java:175)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)
>         at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
>         at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message