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("os.name") 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("os.name") 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]
https://github.com/apache/tomcat/blob/trunk/test/org/apache/tomcat/util/net/TesterSupport.java#L196
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.

Igal


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to