Skip to content

KNOX-3278: Update JLine to 3.30.6 - #1181

Open
bonampak wants to merge 43 commits into
apache:masterfrom
bonampak:KNOX-3278
Open

KNOX-3278: Update JLine to 3.30.6#1181
bonampak wants to merge 43 commits into
apache:masterfrom
bonampak:KNOX-3278

Conversation

@bonampak

@bonampak bonampak commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

KNOX-3278 - Update jline to 3.30.6

What changes were proposed in this pull request?

Update groovy to 5.0.4, jline to 3.30.6, jna to 5.18.1, aspectj to 1.9.25.1 and rest-assured to 6.0.0.
Rewrote gateway-shell using JLine 3 and Groovy 5.

How was this patch tested?

Ran example tests and all repl commands (ExampleWebHdfsLs.groovy and ExampleManagerResourceDeployment.groovy both in REPL with :load and as knoxshell.sh arguments. Both work as expected.)

Integration Tests

There is another ticket for adding integration tests:
KNOX-3280 Add integration tests for KnoxShell and KnoxCLI

UI changes

Login Dialog changed as JLine 3 supports password input.

@github-actions

github-actions Bot commented Mar 20, 2026

Copy link
Copy Markdown

Test Results

40 tests   40 ✅  6s ⏱️
 3 suites   0 💤
 3 files     0 ❌

Results for commit 8d478a3.

♻️ This comment has been updated with latest results.

<excludes>
<exclude>schema/**</exclude>
<exclude>**/*.ldif</exclude>
<exclude>META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat</exclude>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we use maven-shade-plugin:3.4.1 and org.apache.logging.log4j:log4j-transform-maven-shade-plugin-extensions, this can be fixed by adding
<transformer implementation="org.apache.logging.log4j.maven.plugins.shade.transformer.Log4j2PluginCacheFileTransformer"/>
Otherwise the Log4j2Plugins.dat will be overwritten by our plugins and will not contain the ones shipped by log4j2.

@bonampak
bonampak marked this pull request as ready for review April 15, 2026 16:22
@bonampak
bonampak requested a review from pzampino April 17, 2026 13:52
checkJava
buildAppJavaOpts
$JAVA "${APP_JAVA_OPTS[@]}" -Dlog4j.configurationFile=conf/knoxshell-log4j2.xml -javaagent:"$APP_BIN_DIR"/../lib/aspectjweaver.jar -cp "$APP_JAR":lib/* org.apache.knox.gateway.shell.Shell "$@" || exit 1
$JAVA "${APP_JAVA_OPTS[@]}" -Dlog4j.configurationFile=conf/knoxshell-log4j2.xml -javaagent:"$APP_BIN_DIR"/../lib/aspectjweaver.jar -cp "$APP_JAR":lib/* -cp "$APP_JAR":lib/* org.apache.knox.gateway.launcher.Launcher "$@" || exit 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the change from shell.Shell to launcher.Launcher?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept Launcher and removed the duplicate classpath option.

It's because our logging configuration is referring to sys:launcher.dir and sys:launcher.name.
The shaded jar is also using Launcher as main class.

Either we specify these properties in the launcher script or we use Launcher.

Otherwise the log file will not be created:

./bin/knoxshell.sh -e "org.apache.logging.log4j.LogManager.getLogger('test').error('hello from knoxshell')"

main ERROR Unable to create file ${sys:launcher.dir}/../logs/${sys:launcher.name}.log java.io.IOException: No such file or directory at java.base/java.io.UnixFileSystem.createFileExclusively(Native Method) at java.base/java.io.File.createNewFile(File.java:1043) at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.lambda$getFileManager$0(RollingFileManager.java:315)

There are currently classloader issues if we would use -jar and we place extra jars, for example database driver jars in the lib folder. So the -cp flag is needed in that case and -jar cannot be used (the shaded jar does not specify a classpath in its manifest). I'll create a separate issue to use launcher and be consistent with other modules.

KnoxLoginDialog dlg = new KnoxLoginDialog();
dlg.collect();
return dlg;
LineReader reader = LineReaderBuilder.builder()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be a re-implementation of the credential collector logic in the name of the JLine upgrade? Is it necessary for the dependency upgrade?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, it's not necessary. Reverted back to KnoxLoginDialog.

bonampak added 21 commits July 28, 2026 16:26
… and cleaning up command handling. Overriding name() so that tab completion after semicolon does not show the name of the command registry.
…(to use Launcher taken from knoxshell.jar manifest main class)
…and making knoxshell-log4j2.xml consistent with other log4j2 configurations.
…is not supported. This will impact performance.
Reverts LoginCommand.execute() to use KnoxLoginDialog for credential collection
instead of JLine3 terminal prompts, restoring the Swing GUI popup dialog behavior.

This maintains consistency with the `:login` command behavior from before KNOX-3278 refactoring, as documented in the original pre-refactor version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants