tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: Refactoring and Cleanup of OS Name property usage
Date Wed, 03 Oct 2018 11:41:05 GMT
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.

>> [1]
>> https://github.com/apache/tomcat/blob/trunk/java/org/apache/tomcat/util/compat/JrePlatform.java
>>
>>
>> [2]
>> https://github.com/apache/tomcat/blob/trunk/java/org/apache/catalina/util/ServerInfo.java#L113
>>
>>
>> [3]
>> https://github.com/apache/tomcat/blob/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java#L56
>>
>>
> 
> Example [3] above is in a separate module, so perhaps those should not
> be dependent on org.apache.tomcat?  I'm not sure but wanted to point it
> out.

The jdbc-pool module only has a dependency on JULI - tomcat's logging
framework - which itself has no other dependencies. I don't think the
benefits of this change justify adding tomcat-util.jar as an additional
dependency.


>> [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.

Mark

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


Mime
View raw message