8304911: Use OperatingSystem enum in some modules

Reviewed-by: naoto, lancea, iris, jpai
This commit is contained in:
Roger Riggs 2023-04-10 15:51:01 +00:00
parent 76975da59e
commit ba90dc7795
12 changed files with 70 additions and 100 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -44,6 +44,7 @@ import java.security.PrivilegedExceptionAction;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import jdk.internal.util.OperatingSystem;
import sun.net.dns.ResolverConfiguration;
import sun.security.action.GetPropertyAction;
import sun.security.krb5.internal.crypto.EType;
@ -159,8 +160,7 @@ public class Config {
private static boolean isMacosLionOrBetter() {
// split the "10.x.y" version number
String osname = GetPropertyAction.privilegedGetProperty("os.name");
if (!osname.contains("OS X")) {
if (!OperatingSystem.isMacOS()) {
return false;
}
@ -892,8 +892,7 @@ public class Config {
*/
private String getNativeFileName() {
String name = null;
String osname = GetPropertyAction.privilegedGetProperty("os.name");
if (osname.startsWith("Windows")) {
if (OperatingSystem.isWindows()) {
try {
Credentials.ensureLoaded();
} catch (Exception e) {
@ -926,7 +925,7 @@ public class Config {
if (name == null) {
name = "c:\\winnt\\krb5.ini";
}
} else if (osname.contains("OS X")) {
} else if (OperatingSystem.isMacOS()) {
name = findMacosConfigFile();
} else {
name = "/etc/krb5.conf";
@ -1193,8 +1192,7 @@ public class Config {
new java.security.PrivilegedAction<String>() {
@Override
public String run() {
String osname = System.getProperty("os.name");
if (osname.startsWith("Windows")) {
if (OperatingSystem.isWindows()) {
return System.getenv("USERDNSDOMAIN");
}
return null;
@ -1241,8 +1239,7 @@ public class Config {
new java.security.PrivilegedAction<String>() {
@Override
public String run() {
String osname = System.getProperty("os.name");
if (osname.startsWith("Windows")) {
if (OperatingSystem.isWindows()) {
String logonServer = System.getenv("LOGONSERVER");
if (logonServer != null
&& logonServer.startsWith("\\\\")) {