Richard Hierlmeier created KARAF-7547:
-----------------------------------------

             Summary: Karaf console terminates immediately when history file 
contains an invalid character
                 Key: KARAF-7547
                 URL: https://issues.apache.org/jira/browse/KARAF-7547
             Project: Karaf
          Issue Type: Bug
          Components: karaf
    Affects Versions: 4.3.7
            Reporter: Richard Hierlmeier



When the karaf.history file contains an invalid character, the Karaf console 
terminates immediately. The following error appears in karaf.log.

{noformat}
2022-09-12 14:41:20,664 | ERROR | Karaf ssh console user de | 
org.apache.karaf.shell.support.ShellUtil | 215 - org.apache.karaf.shell.core - 
4.3.6      | Exception caught while executing command | 
java.io.UncheckedIOException: java.nio.charset.MalformedInputException: Input 
length = 1    
        at java.io.BufferedReader$1.hasNext(BufferedReader.java:574) 
~[?:1.8.0_292]    
        at java.util.Iterator.forEachRemaining(Iterator.java:115) 
~[?:1.8.0_292]    
        at 
java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
 ~[?:1.8.0_292]    
        at 
java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:647) 
~[?:1.8.0_292]    
        at 
org.jline.reader.impl.history.DefaultHistory.load(DefaultHistory.java:86) 
~[!/:?]    
        at 
org.jline.reader.impl.history.DefaultHistory.attach(DefaultHistory.java:69) 
~[!/:?]    
        at 
org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:603) ~[!/:?]  
  
        at 
org.apache.karaf.shell.impl.console.ConsoleSessionImpl.readCommand(ConsoleSessionImpl.java:444)
 [!/:4.3.6]    
        at 
org.apache.karaf.shell.impl.console.ConsoleSessionImpl.run(ConsoleSessionImpl.java:402)
 [!/:4.3.6]    
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_292]
Caused by: java.nio.charset.MalformedInputException: Input length = 1    at 
java.nio.charset.CoderResult.throwException(CoderResult.java:281) 
~[?:1.8.0_292]    
        at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:339) 
~[?:1.8.0_292]    
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178) ~[?:1.8.0_292] 
   
        at java.io.InputStreamReader.read(InputStreamReader.java:184) 
~[?:1.8.0_292]    
        at java.io.BufferedReader.fill(BufferedReader.java:161) ~[?:1.8.0_292]  
  at java.io.BufferedReader.readLine(BufferedReader.java:324) ~[?:1.8.0_292]    
        at java.io.BufferedReader.readLine(BufferedReader.java:389) 
~[?:1.8.0_292]    
        at java.io.BufferedReader$1.hasNext(BufferedReader.java:571) 
~[?:1.8.0_292]    ... 9 more
{noformat}

The problem was caused by an editor that does not support UTF-8 encoding. The 
user modified the file manually with this editor.
The user could no longer connect to Karaf.

Desired behavior:

Karaf should ignore the history file in this case.






--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to