提交 0a89064d 编写于 作者: J jmelvin

7130404: [macosx] "os.arch" value should be "x86_64" for compatibility with Apple JDK6

Summary: On Mac OS X, align system property "os.arch" with Apple legacy JDKs.  Also, improve os.name string matching by using .contains() method instead of .startsWith(). This fix spans multiple repositories.
Reviewed-by: dcubed, phh, ohair, katleman
上级 a8f9b5c8
# #
# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -111,10 +111,10 @@ CC_OPT = $(CC_OPT/$(OPTIMIZATION_LEVEL)) ...@@ -111,10 +111,10 @@ CC_OPT = $(CC_OPT/$(OPTIMIZATION_LEVEL))
# For all platforms, do not omit the frame pointer register usage. # For all platforms, do not omit the frame pointer register usage.
# We need this frame pointer to make it easy to walk the stacks. # We need this frame pointer to make it easy to walk the stacks.
# This should be the default on X86, but ia64 and amd64 may not have this # This should be the default on X86, but ia64, and x86_64
# as the default. # may not have this as the default.
CFLAGS_REQUIRED_amd64 += -m64 -fno-omit-frame-pointer -D_LITTLE_ENDIAN CFLAGS_REQUIRED_x86_64 += -m64 -fno-omit-frame-pointer -D_LITTLE_ENDIAN
LDFLAGS_COMMON_amd64 += -m64 LDFLAGS_COMMON_x86_64 += -m64
CFLAGS_REQUIRED_i586 += -m32 -fno-omit-frame-pointer -D_LITTLE_ENDIAN CFLAGS_REQUIRED_i586 += -m32 -fno-omit-frame-pointer -D_LITTLE_ENDIAN
LDFLAGS_COMMON_i586 += -m32 LDFLAGS_COMMON_i586 += -m32
CFLAGS_REQUIRED_ia64 += -m64 -fno-omit-frame-pointer -D_LITTLE_ENDIAN CFLAGS_REQUIRED_ia64 += -m64 -fno-omit-frame-pointer -D_LITTLE_ENDIAN
...@@ -168,7 +168,7 @@ PIC_CODE_LARGE = -fPIC ...@@ -168,7 +168,7 @@ PIC_CODE_LARGE = -fPIC
PIC_CODE_SMALL = -fpic PIC_CODE_SMALL = -fpic
GLOBAL_KPIC = $(PIC_CODE_LARGE) GLOBAL_KPIC = $(PIC_CODE_LARGE)
CFLAGS_COMMON += $(GLOBAL_KPIC) $(GCC_WARNINGS) CFLAGS_COMMON += $(GLOBAL_KPIC) $(GCC_WARNINGS)
ifeq ($(ARCH), amd64) ifeq ($(ARCH), x86_64)
CFLAGS_COMMON += -pipe CFLAGS_COMMON += -pipe
endif endif
......
# #
# Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -264,7 +264,7 @@ ifeq ($(PLATFORM), macosx) ...@@ -264,7 +264,7 @@ ifeq ($(PLATFORM), macosx)
echo sparc \ echo sparc \
;; \ ;; \
x86_64) \ x86_64) \
echo amd64 \ echo x86_64 \
;; \ ;; \
universal) \ universal) \
echo universal \ echo universal \
......
/* /*
* Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -60,7 +60,7 @@ abstract class AbstractPlainDatagramSocketImpl extends DatagramSocketImpl ...@@ -60,7 +60,7 @@ abstract class AbstractPlainDatagramSocketImpl extends DatagramSocketImpl
/** /**
* flag set if the native connect() call not to be used * flag set if the native connect() call not to be used
*/ */
private final static boolean connectDisabled = os.startsWith("Mac OS"); private final static boolean connectDisabled = os.contains("OS X");
/** /**
* Load net library into runtime. * Load net library into runtime.
......
/* /*
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -609,7 +609,7 @@ class Bits { // package-private ...@@ -609,7 +609,7 @@ class Bits { // package-private
String arch = AccessController.doPrivileged( String arch = AccessController.doPrivileged(
new sun.security.action.GetPropertyAction("os.arch")); new sun.security.action.GetPropertyAction("os.arch"));
unaligned = arch.equals("i386") || arch.equals("x86") unaligned = arch.equals("i386") || arch.equals("x86")
|| arch.equals("amd64"); || arch.equals("amd64") || arch.equals("x86_64");
unalignedKnown = true; unalignedKnown = true;
return unaligned; return unaligned;
} }
......
/* /*
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -293,7 +293,7 @@ public abstract class Preferences { ...@@ -293,7 +293,7 @@ public abstract class Preferences {
String platformFactory; String platformFactory;
if (osName.startsWith("Windows")) { if (osName.startsWith("Windows")) {
platformFactory = "java.util.prefs.WindowsPreferencesFactory"; platformFactory = "java.util.prefs.WindowsPreferencesFactory";
} else if (osName.startsWith("Mac OS X")) { } else if (osName.contains("OS X")) {
platformFactory = "java.util.prefs.MacOSXPreferencesFactory"; platformFactory = "java.util.prefs.MacOSXPreferencesFactory";
} else { } else {
platformFactory = "java.util.prefs.FileSystemPreferencesFactory"; platformFactory = "java.util.prefs.FileSystemPreferencesFactory";
......
/* /*
* Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -101,7 +101,7 @@ public class OSInfo { ...@@ -101,7 +101,7 @@ public class OSInfo {
return SOLARIS; return SOLARIS;
} }
if (osName.startsWith("Mac OS X")) { if (osName.contains("OS X")) {
return MACOSX; return MACOSX;
} }
......
/* /*
* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -78,7 +78,7 @@ public final class FontUtilities { ...@@ -78,7 +78,7 @@ public final class FontUtilities {
isLinux = osName.startsWith("Linux"); isLinux = osName.startsWith("Linux");
isMacOSX = osName.startsWith("Mac OS X"); // TODO: MacOSX isMacOSX = osName.contains("OS X"); // TODO: MacOSX
String t2kStr = System.getProperty("sun.java2d.font.scaler"); String t2kStr = System.getProperty("sun.java2d.font.scaler");
if (t2kStr != null) { if (t2kStr != null) {
......
/* /*
* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -381,7 +381,7 @@ public enum LauncherHelper { ...@@ -381,7 +381,7 @@ public enum LauncherHelper {
PrintStream ostream = (printToStderr) ? System.err : System.out; PrintStream ostream = (printToStderr) ? System.err : System.out;
ostream.println(getLocalizedMessage("java.launcher.X.usage", ostream.println(getLocalizedMessage("java.launcher.X.usage",
File.pathSeparator)); File.pathSeparator));
if (System.getProperty("os.name").startsWith("Mac OS")) { if (System.getProperty("os.name").contains("OS X")) {
ostream.println(getLocalizedMessage("java.launcher.X.macosx.usage", ostream.println(getLocalizedMessage("java.launcher.X.macosx.usage",
File.pathSeparator)); File.pathSeparator));
} }
......
/* /*
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -1280,7 +1280,7 @@ public class ExtendedCharsets ...@@ -1280,7 +1280,7 @@ public class ExtendedCharsets
String osName = AccessController.doPrivileged( String osName = AccessController.doPrivileged(
new GetPropertyAction("os.name")); new GetPropertyAction("os.name"));
if ("SunOS".equals(osName) || "Linux".equals(osName) if ("SunOS".equals(osName) || "Linux".equals(osName)
|| osName.startsWith("Mac OS")) { || osName.contains("OS X")) {
charset("x-COMPOUND_TEXT", "COMPOUND_TEXT", charset("x-COMPOUND_TEXT", "COMPOUND_TEXT",
new String[] { new String[] {
"COMPOUND_TEXT", // JDK historical "COMPOUND_TEXT", // JDK historical
......
/* /*
* Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -1567,7 +1567,7 @@ public class PSPrinterJob extends RasterPrinterJob { ...@@ -1567,7 +1567,7 @@ public class PSPrinterJob extends RasterPrinterJob {
} }
String osname = System.getProperty("os.name"); String osname = System.getProperty("os.name");
if (osname.equals("Linux") || osname.startsWith("Mac OS X")) { if (osname.equals("Linux") || osname.contains("OS X")) {
execCmd = new String[ncomps]; execCmd = new String[ncomps];
execCmd[n++] = "/usr/bin/lpr"; execCmd[n++] = "/usr/bin/lpr";
if ((pFlags & PRINTER) != 0) { if ((pFlags & PRINTER) != 0) {
......
/* /*
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -90,7 +90,7 @@ public final class SunNativeProvider extends Provider { ...@@ -90,7 +90,7 @@ public final class SunNativeProvider extends Provider {
"libgssapi_krb5.so", "libgssapi_krb5.so",
"libgssapi_krb5.so.2", "libgssapi_krb5.so.2",
}; };
} else if (osname.startsWith("Mac OS X")) { } else if (osname.contains("OS X")) {
gssLibs = new String[]{ gssLibs = new String[]{
"/usr/lib/sasl2/libgssapiv2.2.so", "/usr/lib/sasl2/libgssapiv2.2.so",
}; };
......
/* /*
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -737,7 +737,7 @@ public class Config { ...@@ -737,7 +737,7 @@ public class Config {
} }
} else if (osname.startsWith("SunOS")) { } else if (osname.startsWith("SunOS")) {
name = "/etc/krb5/krb5.conf"; name = "/etc/krb5/krb5.conf";
} else if (osname.startsWith("Mac")) { } else if (osname.contains("OS X")) {
if (isMacosLionOrBetter()) return ""; if (isMacosLionOrBetter()) return "";
name = findMacosConfigFile(); name = findMacosConfigFile();
} else { } else {
......
/* /*
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -289,7 +289,7 @@ public class Credentials { ...@@ -289,7 +289,7 @@ public class Credentials {
String os = java.security.AccessController.doPrivileged( String os = java.security.AccessController.doPrivileged(
new sun.security.action.GetPropertyAction("os.name")); new sun.security.action.GetPropertyAction("os.name"));
if (os.toUpperCase(Locale.ENGLISH).startsWith("WINDOWS") || if (os.toUpperCase(Locale.ENGLISH).startsWith("WINDOWS") ||
os.toUpperCase(Locale.ENGLISH).startsWith("MAC")) { os.toUpperCase(Locale.ENGLISH).contains("OS X")) {
Credentials creds = acquireDefaultCreds(); Credentials creds = acquireDefaultCreds();
if (creds == null) { if (creds == null) {
if (DEBUG) { if (DEBUG) {
...@@ -478,7 +478,7 @@ public class Credentials { ...@@ -478,7 +478,7 @@ public class Credentials {
java.security.AccessController.doPrivileged( java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void> () { new java.security.PrivilegedAction<Void> () {
public Void run() { public Void run() {
if (System.getProperty("os.name").startsWith("Mac")) { if (System.getProperty("os.name").contains("OS X")) {
System.loadLibrary("osxkrb5"); System.loadLibrary("osxkrb5");
} else { } else {
System.loadLibrary("w2k_lsa_auth"); System.loadLibrary("w2k_lsa_auth");
......
/* /*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -95,7 +95,8 @@ final class ByteArrayAccess { ...@@ -95,7 +95,8 @@ final class ByteArrayAccess {
private static boolean unaligned() { private static boolean unaligned() {
String arch = java.security.AccessController.doPrivileged String arch = java.security.AccessController.doPrivileged
(new sun.security.action.GetPropertyAction("os.arch", "")); (new sun.security.action.GetPropertyAction("os.arch", ""));
return arch.equals("i386") || arch.equals("x86") || arch.equals("amd64"); return arch.equals("i386") || arch.equals("x86") || arch.equals("amd64")
|| arch.equals("x86_64");
} }
/** /**
......
/* /*
* Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -50,7 +50,7 @@ public class DefaultAsynchronousChannelProvider { ...@@ -50,7 +50,7 @@ public class DefaultAsynchronousChannelProvider {
return new SolarisAsynchronousChannelProvider(); return new SolarisAsynchronousChannelProvider();
if (osname.equals("Linux")) if (osname.equals("Linux"))
return new LinuxAsynchronousChannelProvider(); return new LinuxAsynchronousChannelProvider();
if (osname.startsWith("Mac OS")) if (osname.contains("OS X"))
return new BsdAsynchronousChannelProvider(); return new BsdAsynchronousChannelProvider();
throw new InternalError("platform not recognized"); throw new InternalError("platform not recognized");
} }
......
/* /*
* Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -68,7 +68,7 @@ public class DefaultFileSystemProvider { ...@@ -68,7 +68,7 @@ public class DefaultFileSystemProvider {
return createProvider("sun.nio.fs.SolarisFileSystemProvider"); return createProvider("sun.nio.fs.SolarisFileSystemProvider");
if (osname.equals("Linux")) if (osname.equals("Linux"))
return createProvider("sun.nio.fs.LinuxFileSystemProvider"); return createProvider("sun.nio.fs.LinuxFileSystemProvider");
if (osname.equals("Darwin") || osname.startsWith("Mac OS X")) if (osname.equals("Darwin") || osname.contains("OS X"))
return createProvider("sun.nio.fs.BsdFileSystemProvider"); return createProvider("sun.nio.fs.BsdFileSystemProvider");
throw new AssertionError("Platform not recognized"); throw new AssertionError("Platform not recognized");
} }
......
/* /*
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -120,7 +120,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup ...@@ -120,7 +120,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
static boolean isBSD() { static boolean isBSD() {
return (osname.equals("Linux") || return (osname.equals("Linux") ||
osname.startsWith("Mac OS X")); osname.contains("OS X"));
} }
static final int UNINITIALIZED = -1; static final int UNINITIALIZED = -1;
......
/* /*
* Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -124,7 +124,7 @@ public class DemoRun { ...@@ -124,7 +124,7 @@ public class DemoRun {
String os_name = System.getProperty("os.name"); String os_name = System.getProperty("os.name");
String libprefix = os_name.contains("Windows")?"":"lib"; String libprefix = os_name.contains("Windows")?"":"lib";
String libsuffix = os_name.contains("Windows")?".dll": String libsuffix = os_name.contains("Windows")?".dll":
os_name.startsWith("Mac OS")?".dylib":".so"; os_name.contains("OS X")?".dylib":".so";
boolean d64 = ( os_name.contains("Solaris") || boolean d64 = ( os_name.contains("Solaris") ||
os_name.contains("SunOS") ) os_name.contains("SunOS") )
&& ( os_arch.equals("sparcv9") || && ( os_arch.equals("sparcv9") ||
......
/* /*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -51,7 +51,7 @@ public class GetXSpace { ...@@ -51,7 +51,7 @@ public class GetXSpace {
private static final String dfFormat; private static final String dfFormat;
static { static {
if (name.equals("SunOS") || name.equals("Linux") if (name.equals("SunOS") || name.equals("Linux")
|| name.startsWith("Mac OS")) { || name.contains("OS X")) {
// FileSystem Total Used Available Use% MountedOn // FileSystem Total Used Available Use% MountedOn
dfFormat = "([^\\s]+)\\s+(\\d+)\\s+\\d+\\s+(\\d+)\\s+\\d+%\\s+([^\\s]+)"; dfFormat = "([^\\s]+)\\s+(\\d+)\\s+\\d+\\s+(\\d+)\\s+\\d+%\\s+([^\\s]+)";
} else if (name.startsWith("Windows")) { } else if (name.startsWith("Windows")) {
......
/* /*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -597,7 +597,7 @@ public class Basic { ...@@ -597,7 +597,7 @@ public class Basic {
static class MacOSX { static class MacOSX {
public static boolean is() { return is; } public static boolean is() { return is; }
private static final String osName = System.getProperty("os.name"); private static final String osName = System.getProperty("os.name");
private static final boolean is = osName.startsWith("Mac OS"); private static final boolean is = osName.contains("OS X");
} }
static class True { static class True {
......
/* /*
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -34,7 +34,7 @@ public class Zombies { ...@@ -34,7 +34,7 @@ public class Zombies {
static final String os = System.getProperty("os.name"); static final String os = System.getProperty("os.name");
static final String TrueCommand = os.startsWith("Mac OS")? static final String TrueCommand = os.contains("OS X")?
"/usr/bin/true" : "/bin/true"; "/usr/bin/true" : "/bin/true";
public static void main(String[] args) throws Throwable { public static void main(String[] args) throws Throwable {
......
/* /*
* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -76,7 +76,7 @@ public class InvokeGenericTest { ...@@ -76,7 +76,7 @@ public class InvokeGenericTest {
String name = properties.getProperty("java.vm.name"); String name = properties.getProperty("java.vm.name");
String arch = properties.getProperty("os.arch"); String arch = properties.getProperty("os.arch");
if ((arch.equals("amd64") || arch.equals("i386") || arch.equals("x86") || if ((arch.equals("amd64") || arch.equals("i386") || arch.equals("x86") ||
arch.equals("sparc") || arch.equals("sparcv9")) && arch.equals("x86_64") || arch.equals("sparc") || arch.equals("sparcv9")) &&
(name.contains("Client") || name.contains("Server")) (name.contains("Client") || name.contains("Server"))
) { ) {
platformOK = true; platformOK = true;
......
/* /*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -80,7 +80,7 @@ public class GetSystemLoadAverage { ...@@ -80,7 +80,7 @@ public class GetSystemLoadAverage {
} }
private static String LOAD_AVERAGE_TEXT private static String LOAD_AVERAGE_TEXT
= System.getProperty("os.name").startsWith("Mac OS") = System.getProperty("os.name").contains("OS X")
? "load averages:" ? "load averages:"
: "load average:"; : "load average:";
...@@ -99,7 +99,7 @@ public class GetSystemLoadAverage { ...@@ -99,7 +99,7 @@ public class GetSystemLoadAverage {
System.out.println("Load average returned from uptime = " + output); System.out.println("Load average returned from uptime = " + output);
System.out.println("getSystemLoadAverage() returned " + loadavg); System.out.println("getSystemLoadAverage() returned " + loadavg);
String[] lavg = System.getProperty("os.name").startsWith("Mac OS") String[] lavg = System.getProperty("os.name").contains("OS X")
? output.split(" ") ? output.split(" ")
: output.split(","); : output.split(",");
double expected = Double.parseDouble(lavg[0]); double expected = Double.parseDouble(lavg[0]);
......
/* /*
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -69,7 +69,7 @@ public class Size { ...@@ -69,7 +69,7 @@ public class Size {
// Windows and Linux can't handle the really large file sizes for a truncate // Windows and Linux can't handle the really large file sizes for a truncate
// or a positional write required by the test for 4563125 // or a positional write required by the test for 4563125
String osName = System.getProperty("os.name"); String osName = System.getProperty("os.name");
if (osName.startsWith("SunOS") || osName.startsWith("Mac OS")) { if (osName.startsWith("SunOS") || osName.contains("OS X")) {
blah = File.createTempFile("blah", null); blah = File.createTempFile("blah", null);
long testSize = ((long)Integer.MAX_VALUE) * 2; long testSize = ((long)Integer.MAX_VALUE) * 2;
initTestFile(blah, 10); initTestFile(blah, 10);
......
/* /*
* Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -228,7 +228,7 @@ public class Transfer { ...@@ -228,7 +228,7 @@ public class Transfer {
// Windows and Linux can't handle the really large file sizes for a // Windows and Linux can't handle the really large file sizes for a
// truncate or a positional write required by the test for 4563125 // truncate or a positional write required by the test for 4563125
String osName = System.getProperty("os.name"); String osName = System.getProperty("os.name");
if (!(osName.startsWith("SunOS") || osName.startsWith("Mac OS"))) if (!(osName.startsWith("SunOS") || osName.contains("OS X")))
return; return;
File source = File.createTempFile("blah", null); File source = File.createTempFile("blah", null);
source.deleteOnExit(); source.deleteOnExit();
......
/* /*
* Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -76,7 +76,7 @@ public class Basic { ...@@ -76,7 +76,7 @@ public class Basic {
checkSupported(fs, "posix", "unix", "owner", "acl", "user"); checkSupported(fs, "posix", "unix", "owner", "acl", "user");
if (os.equals("Linux")) if (os.equals("Linux"))
checkSupported(fs, "posix", "unix", "owner", "dos", "user"); checkSupported(fs, "posix", "unix", "owner", "dos", "user");
if (os.startsWith("Mac OS")) if (os.contains("OS X"))
checkSupported(fs, "posix", "unix", "owner"); checkSupported(fs, "posix", "unix", "owner");
if (os.equals("Windows")) if (os.equals("Windows"))
checkSupported(fs, "owner", "dos", "acl", "user"); checkSupported(fs, "owner", "dos", "acl", "user");
......
/* /*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2012 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -39,7 +39,7 @@ public class SelProvider { ...@@ -39,7 +39,7 @@ public class SelProvider {
expected = "sun.nio.ch.DevPollSelectorProvider"; expected = "sun.nio.ch.DevPollSelectorProvider";
} else if ("Linux".equals(osname)) { } else if ("Linux".equals(osname)) {
expected = "sun.nio.ch.EPollSelectorProvider"; expected = "sun.nio.ch.EPollSelectorProvider";
} else if (osname.startsWith("Mac OS")) { } else if (osname.contains("OS X")) {
expected = "sun.nio.ch.KQueueSelectorProvider"; expected = "sun.nio.ch.KQueueSelectorProvider";
} else } else
return; return;
......
...@@ -66,7 +66,7 @@ public class TestHelper { ...@@ -66,7 +66,7 @@ public class TestHelper {
static final boolean isWindows = static final boolean isWindows =
System.getProperty("os.name", "unknown").startsWith("Windows"); System.getProperty("os.name", "unknown").startsWith("Windows");
static final boolean isMacOSX = static final boolean isMacOSX =
System.getProperty("os.name", "unknown").startsWith("Mac"); System.getProperty("os.name", "unknown").contains("OS X");
static final boolean is64Bit = static final boolean is64Bit =
System.getProperty("sun.arch.data.model").equals("64"); System.getProperty("sun.arch.data.model").equals("64");
static final boolean is32Bit = static final boolean is32Bit =
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册