RFR JDK-8066709 Make some JDK system properties read only

Weijun Wang weijun.wang at oracle.com
Wed Jun 13 02:10:57 UTC 2018


In fact, why is setting user.name and user.home always evil? If I only want to set them on the command line so that a special "user environment" is used, why is it a problem?

In fact, we have a test setting user.home to an empty directory to avoid unexpected result because we cannot control the test runner's home directory.

Thanks
Max

> On Jun 13, 2018, at 9:59 AM, Weijun Wang <weijun.wang at oracle.com> wrote:
> 
> Hi Roger
> 
> 1. Should all occurrences of reading of these system properties be updated? For example, the following one is not touched
>  http://hg.openjdk.java.net/jdk/jdk/file/4d2e3f5abb48/src/java.base/share/classes/sun/security/tools/keytool/Main.java#l842
> 
> 2. I assume that with this change not only there is no use calling System.setProperty() in the application but also setting it on the command line is now useless. Is this right? Do we need to make this clear in the CSR?
> 
> Thanks
> Max
> 
> 
>> On Jun 4, 2018, at 9:32 PM, Roger Riggs <Roger.Riggs at oracle.com> wrote:
>> 
>> Please review a change to make the values of java.home, user.home, user.dir, and user.name
>> effectively read-only for internal use.  The values are cached during initialization and the
>> cached values are used.
>> 
>> Webrev:
>>  http://cr.openjdk.java.net/~rriggs/webrev-static-property-8066709/
>> 
>> Issue:
>>  https://bugs.openjdk.java.net/browse/JDK-8066709
>> 
>> CSR:
>>  https://bugs.openjdk.java.net/browse/JDK-8204235
>> 
>> Thanks, Roger
>> 
>> 
> 



More information about the core-libs-dev mailing list