RFR JDK-8066709 Make some JDK system properties read only
Roger Riggs
Roger.Riggs at Oracle.com
Wed Jun 13 14:10:02 UTC 2018
Hi Joe,
The CSR text is still in draft and got out of sync with the open review
and comments.
The updated apiNote clarifies that changes made through the
System.*property* methods
may not affect the value cached during initialization.
The implementation changes affect a very short list of properties.
The note on the methods is to raise awareness that individual properties
may have
different behavior and may be unpredictable.
On 6/12/2018 10:10 PM, Weijun Wang wrote:
> 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?
There is no change to the ability to set properties on the command line.
The concern is with the predictability of (some) properties changing
dynamically while the application
is running.
The property user.home is used for mime-types and mailcap files and
user.name is used in some
networking cases where a username is needed.
>
> 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.
Right, there is no problem with that
Regards, Roger
>
> 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
That usage was in a tool and I did not modify any tools.
>>
>> 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?
No change to command line setting of properties.
Roger
>>
>> 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