RFC: System.console().encoding()

Ulf Zibis Ulf.Zibis at CoSoCo.de
Thu Sep 15 16:35:24 UTC 2016


Am 15.09.2016 um 17:56 schrieb Aleksey Shipilev:

> ...which opens a way to poll this without a Reflection hack. Extended
> the JMH hack with it, but it still fragile:
>   http://hg.openjdk.java.net/code-tools/jmh/rev/8c20adb08b2d

Maybe keep it simple - no need for (prop != null) - and in design line with the 2 other tries:

// Try 3. Try to poll internal properties.
try {
return Charset.forName(System.getProperty("sun.stdout.encoding") );
} catch (Exception e) {
// fall-through
}


-Ulf



More information about the core-libs-dev mailing list