tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Igal Sapir <>
Subject Re: Refactoring and Cleanup of OS Name property usage
Date Wed, 03 Oct 2018 18:23:52 GMT
On 10/3/2018 4:41 AM, Mark Thomas wrote:
> On 03/10/18 00:48, Igal Sapir wrote:
>> Regarding this:
>> On 10/2/2018 3:54 PM, Igal Sapir wrote:
>>> Rainer pointed out to me the class JrePlatform [1], which has a helper
>>> field called IS_WINDOWS.
>>> I think that it would make sense to add a constant field OS_NAME, as
>>> well as IS_LINUX and IS_MACOS, and use these fields instead of calling
>>> System.getProperty("") in multiple places - some examples [2]
>>> [3] [4].
>>> If there is no objection, I can go ahead and refactor that.
> Hmm. We do have a lot of calls to System.getProperty("") but they
> nearly all appear to be used alongside other calls to
> System.getProperty(...) and are not further tested for specific OS values.
> I wonder if, from a maintenance point of view, it wouldn't be clearer to
> leave those as they are? I guess I am -0 on that part of the refactoring.

Fair enough.

> <snip/>
>>> [4]
> That one I do think makes sense to pull into JrePlatform.

I have moved [4] above in r1842748.  I used the existing convention in 
the file of setting the string to a static variable, i.e.

      private static final String OS_NAME_WINDOWS_PREFIX = "Windows";
+    private static final String OS_NAME_MAC_OS_LC_PREFIX = "mac os x";

though I personally think that it would make sense to inline it since 
it's only used once.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message