Hi Paul

Thanks for the update. I will create a GH Issue to track this and include
in Karaf 4.4.10.

Regards
JB

On Mon, Jan 19, 2026 at 6:50 PM Paul Spencer <[email protected]>
wrote:

> JB,
> Below are my changes, including added logging, that exposes the issue.
>
> ### From bin/karaf session
> karaf@root()> booking:list
> getEncoding() - Begin
> getEncoding() - get encoding from PS
> getEncoding() - getDeclaredField(): charOut
> getEncoding() - end
> ID  | Flight | Customer
> ----+--------+---------
> karaf@root()>
>
> ### From bin/client session
> karaf@root()> booking:list
> getEncoding() - Begin
> getEncoding() - get encoding from PS
> getEncoding() - getDeclaredField(): Unable to make field private
> java.io.OutputStreamWriter java.io.PrintStream.charOut accessible: module
> java.base does not "opens java.io" to unnamed module @5a157034
> getEncoding() - end
> IDz | Flight | Customer
> ----+--------+---------
> karaf@root()>
>
>
> ### My changes to recreated and added logging
>   GitHub Branch - https://github.com/paulsp/karaf/tree/pr-xxxx
>   ListCommand.java -
> https://github.com/paulsp/karaf/blob/pr-xxxx/examples/karaf-command-example/karaf-command-example-command/src/main/java/org/apache/karaf/examples/command/command/ListCommand.java
>   ShellTable.java -
> https://github.com/paulsp/karaf/blob/pr-xxxx/shell/core/src/main/java/org/apache/karaf/shell/support/table/ShellTable.java
>
> Paul Spencer
> > On Jan 19, 2026, at 12:32 PM, Paul Spencer <[email protected]>
> wrote:
> >
> > JB,
> > I have confirmed the issued existing 4.4.10-SNAPSHOT rebase on January
> 19, 2026
> >
> > Tested with Java 17, I get the following error:
> >   Unable to make field private java.io.OutputStreamWriter
> java.io.PrintStream.charOut accessible: module java.base does not "opens
> java.io" to unnamed module @5a157034
> >
> > Another way to recreate the issue is to update ListCommand in artifact
> karaf-command-example-command to used Session.getConsole() for the
> outputStream in table.print()
> > …
> > import org.apache.karaf.shell.api.console.Session;
> > …
> >    @Reference
> >    private Session session;
> > …
> >        table.print(session.getConsole());
> > ...
> >
> > Paul Spencer
> >> On Jan 19, 2026, at 10:20 AM, Paul Spencer <[email protected]>
> wrote:
> >>
> >> JB,
> >> I have not, but ShellTable in 4.4.9 is the same as 4.4.3. Line 190 is
> the source of the illegal access warning.
> >>
> >>
> >> Passing a non-null CharSet to table.print() avoids the encoding
> calculation and warning
> >> Paul Spencer
> >>
> >>> On Jan 19, 2026, at 10:00 AM, Jean-Baptiste Onofré <[email protected]>
> wrote:
> >>>
> >>> Hi Paul
> >>>
> >>> Did you try with Karaf 4.4.9 ?
> >>>
> >>> Regards
> >>> JB
> >>>
> >>> Le ven. 16 janv. 2026 à 16:10, Paul Spencer <
> [email protected]> a écrit :
> >>> To recreated:
> >>> 1. In session #1, Start Karaf using the command bin/karaf
> >>> 2. In session #2, Start Karaf using the command bin/client
> >>> 3. In session #2, execute the command writing the table,
> bugdata:display in this case.
> >>> 4. In session #1, The warning will be displayed only once.
> >>>
> >>> Additional behavior notes:
> >>> - `table.print(System.out)` does not generate the warning
> >>> - `table.print(session.getConsole())` will generate the warning on
> first use.
> >>>
> >>> Paul Spencer
> >>>
> >>>
> >>>> On Jan 16, 2026, at 9:48 AM, Paul Spencer <[email protected]>
> wrote:
> >>>>
> >>>> Karaf: 4.4.3
> >>>> Java Virtual Machine:  OpenJDK 64-Bit Server VM version 11.0.2+9
> >>>>
> >>>> I am seeing the following error when using ShellTable.print() to
> shell's session console.
> >>>>
> >>>> WARNING: An illegal reflective access operation has occurred
> >>>> WARNING: Illegal reflective access by
> org.apache.karaf.shell.support.table.ShellTable
> (jar:bundle://e299aef6-746a-44e6-b810-da872d8d9244_44.0:0/!/) to field
> java.io.PrintStream.charOut
> >>>> WARNING: Please consider reporting this to the maintainers of
> org.apache.karaf.shell.support.table.ShellTable
> >>>> WARNING: Use --illegal-access=warn to enable warnings of further
> illegal reflective access operations
> >>>> WARNING: All illegal access operations will be denied in a future
> release
> >>>>
> >>>> The default for --illegal-access changes to deny in Java 16 and the
> functionality is remove in Java 17.
> >>>>
> https://docs.oracle.com/en/java/javase/16/docs/specs/man/java.html#extra-options-for-java
> >>>>
> >>>> The offending code appears in getEncoding() for
> shell/core/src/main/java/org/apache/karaf/shell/support/table/ShellTable.java
> >>>> Since the Should I create an issue in GitHub?
> >>>>
> >>>> ### Example Code
> >>>> import org.apache.karaf.shell.api.console.Session;
> >>>> import org.apache.karaf.shell.support.table.ShellTable;
> >>>> @Service
> >>>> @Command(scope = "bugdata", name = "appt-display", description =
> "Display an appoiment schedule")
> >>>> public class MyCommand implements Action {
> >>>> @Reference
> >>>> private Session session;
> >>>>
> >>>> @Override
> >>>> public Object execute() throws Exception {
> >>>>  final var output = session.getConsole();
> >>>>  final var table = new ShellTable();
> >>>> ...
> >>>>  table.print(output);
> >>>> }
> >>>> }
> >>>>
> >>>>
> >>>> Paul Spencer
> >>>
> >>>
> >
>
>

Reply via email to