sqlline icon indicating copy to clipboard operation
sqlline copied to clipboard

MalformedInputException while sqlline start

Open masayuki038 opened this issue 5 years ago • 1 comments

When ~/sqlline/history contains code that does not fit into UTF-8, it fail to start sqlline.

Exception in thread "main" java.io.UncheckedIOException: java.nio.charset.MalformedInputException: Input length = 1
        at java.io.BufferedReader$1.hasNext(Unknown Source)
        at java.util.Iterator.forEachRemaining(Unknown Source)
        at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
        at java.util.stream.ReferencePipeline$Head.forEach(Unknown Source)
        at org.jline.reader.impl.history.DefaultHistory.load(DefaultHistory.java:87)
        at org.jline.reader.impl.history.DefaultHistory.attach(DefaultHistory.java:70)
        at sqlline.SqlLine.getConsoleReader(SqlLine.java:616)
        at sqlline.SqlLine.begin(SqlLine.java:512)
        at sqlline.SqlLine.start(SqlLine.java:263)
        at sqlline.SqlLine.main(SqlLine.java:194)
Caused by: java.nio.charset.MalformedInputException: Input length = 1
        at java.nio.charset.CoderResult.throwException(Unknown Source)
        at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
        at sun.nio.cs.StreamDecoder.read(Unknown Source)
        at java.io.InputStreamReader.read(Unknown Source)
        at java.io.BufferedReader.fill(Unknown Source)
        at java.io.BufferedReader.readLine(Unknown Source)
        at java.io.BufferedReader.readLine(Unknown Source)
        ... 10 more

The workaround for this issue is to delete ~/sqlline/history and restart it.

I think that it should display warning messege and then start without reading the history file.

masayuki038 avatar Mar 21 '19 14:03 masayuki038

Related to #105 and a workaround was noted in the commit that fixed it, bf495f9.

julianhyde avatar Mar 21 '19 23:03 julianhyde