Better tools for adjusting to strong encapsulation

Simon Nash simon at cjnash.com
Fri Mar 24 17:48:04 UTC 2017


On 24/03/2017 13:02, Alan Bateman wrote:
> On 24/03/2017 12:01, Peter Levart wrote:
> 
>>
>> :
>>
>> Just a reminder that System.err field is "writable" and therefore 
>> System.setErr(PrintStream) can be used to redirect output to execute 
>> arbitrary code...
> That's right, it needs to captured at startup or sent directly to stderr.
> 
> -Alan
> 
I think this means that at startup, an application could do
  PrintStream sysErr = System.err;
  System.setErr(myErr);
where myErr is an application subclass of PrintStream that filters out any
unwanted warnings produced by JDK code and sends all other output to sysErr.
Would this work?

Simon


More information about the jigsaw-dev mailing list