[OpenJDK 2D-Dev] Please review 7u6 fix for 7124536: [macosx] PrintServiceLookup.lookupDefaultPrintService() return null

Mike Swingler swingler at apple.com
Wed Jun 20 00:41:22 UTC 2012


On Jun 19, 2012, at 4:45 PM, Phil Race wrote:

> Mike,
> 
> On 6/19/2012 3:37 PM, Mike Swingler wrote:
>> Currently, JDK 7 uses JRSCopyOSName() so that the difference between "Mac OS X" and "Mac OS X Server" can be distinguished.
> Is there a better (standard) way? If it matters at all to distinguish server vs. client ?
> On Windows we care about server only to decide not to use D3D by default..  but we query standard platform APIs for that
> and set properties appropriately.

Not as far as I know from Java. Perhaps this distinction is no longer important, and os.name could be hardcoded if there is a greater case to be made for letting old code continue to use an out-of-sync name.

>> I am recommending the use of .contains("OS X") to more robustly determine if you are on the OS X platform, and still retain the ability to distinguish between client and server in cases where it is important to do so.
> 
> So does that mean JRSCopyOSName() will change what its reporting ?

I can't say that it will or will not change in any specific release, but as currently implemented, it should accurately report the value of ProductName in /System/Library/CoreServices/SystemVersion.plist.

We have documented several detection techniques for developers using os.name and os.version at: <https://developer.apple.com/library/mac/#technotes/tn2002/tn2110.html>.

Regards,
Mike Swingler
Apple Inc.

> -phil.
> 
>> 
>> Regards,
>> Mike Swingler
>> Apple Inc.
>> 
>> On Jun 19, 2012, at 11:53 AM, Phil Race wrote:
>> 
>>> On 6/19/2012 11:33 AM, Artem Ananiev wrote:
>>>> On 6/19/2012 8:49 PM, Phil Race wrote:
>>>>> startsWith("Mac") is what we use in FX and I don't see a problem with it
>>>>> and its surely more reliable to type and efficient than contains("OS X");
>>>>> If its meant to be targeted to a specific version that could break if
>>>>> there's an OS XI ..
>>>>> And startsWith("Win") is a common pattern. So I don't agree with the advice
>>>>> anyway.
>>>> startsWith("Mac") vs contains("OS X") was already discussed on the macosx-port-dev alias. The problem with the former is that starting from 10.8, OS name will be just "OS X", without "Mac" prefix.
>>>> 
>>>> The code in java_props_macosx.c makes me believe we set "os.name" tp the value returned by JRSCopyOSName() from JavaRuntimeSupport framework. Is it possible to get "OS X 10.8" from that function?
>>> This sounds like a JDK bug.
>>> We really must not let that drive changing the "os.name" property else we are
>>> completely at the whim of whatever a platform vendor's marketing dept thinks is
>>> the flavour of the day.
>>> 
>>> -phil.
>>> 
>>>> Thanks,
>>>> 
>>>> Artem
>>>> 
>>>>> -phil.
>>>>> 
>>>>> 
>>>>> On 6/19/2012 9:36 AM, Sergey Bylokhov wrote:
>>>>>> Hi,Phil.
>>>>>> 
>>>>>> According to these CR macosx check should be: .contains("OS X").
>>>>>> http://monaco.sfbay.sun.com/detail.jsf?cr=7147461
>>>>>> http://monaco.sfbay.sun.com/detail.jsf?cr=7130404
>>>>>> 
>>>>>> On 19.06.2012 20:13, Phil Race wrote:
>>>>>>> 7124536: [macosx] PrintServiceLookup.lookupDefaultPrintService()
>>>>>>> return null
>>>>>>> http://cr.openjdk.java.net/~prr/7124536.7u6/
>>>>>>> 
>>>>>>> -phil.
>>>>>> 
> 




More information about the 2d-dev mailing list