This is an automated email from the ASF dual-hosted git repository.
jbonofre pushed a commit to branch karaf-4.4.x
in repository https://gitbox.apache.org/repos/asf/karaf.git
The following commit(s) were added to refs/heads/karaf-4.4.x by this push:
new b908f215c4 Catch StringIndexOutOfBoundException in ConsoleSessionImpl
to workaround an issue in JLine (#2242)
b908f215c4 is described below
commit b908f215c4a7931e19f74dedd38ace5079ac61cb
Author: JB Onofré <[email protected]>
AuthorDate: Wed Jan 28 18:52:12 2026 +0100
Catch StringIndexOutOfBoundException in ConsoleSessionImpl to workaround an
issue in JLine (#2242)
---
.../org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git
a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
index d61509f3cd..a14ee42177 100644
---
a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
+++
b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/ConsoleSessionImpl.java
@@ -465,6 +465,12 @@ public class ConsoleSessionImpl implements Session {
}
} catch (UserInterruptException e) {
command = ""; // Do nothing
+ } catch (StringIndexOutOfBoundsException e) {
+ // Workaround for JLine CompletionMatcherImpl bug: Tab on empty
line triggers
+ // substring(0, 1) on "" in defaultMatchers() before
EMPTY_WORD_OPTIONS check.
+ // Re-prompt instead of exiting the shell.
+ LOGGER.debug("Completion on empty line triggered known JLine edge
case", e);
+ command = "";
} catch (Throwable t) {
ShellUtil.logException(this, t);
} finally {