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

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().

Reviewed-by: dcubed, phh, ohair, katleman
This commit is contained in:
James Melvin 2012-03-16 15:13:22 -04:00 committed by James Melvin
parent 7d0f6b051c
commit c3183e79ed
2 changed files with 12 additions and 12 deletions

View File

@ -1,5 +1,5 @@
/*
* 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.
*
* This code is free software; you can redistribute it and/or modify it
@ -217,8 +217,8 @@ abstract class ConnectorImpl implements Connector {
}
protected void checkNativeLink(SecurityManager sm, String os) {
if (os.equals("SunOS") || os.equals("Linux")) {
// link "saproc" - SA native library on SunOS and Linux?
if (os.equals("SunOS") || os.equals("Linux") || os.contains("OS X")) {
// link "saproc" - SA native library on SunOS, Linux, and Mac OS X
sm.checkLink("saproc");
} else if (os.startsWith("Windows")) {
// link "sawindbg" - SA native library on Windows.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2003, 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.
*
* This code is free software; you can redistribute it and/or modify it
@ -43,7 +43,7 @@ public class PlatformInfo {
return "bsd";
} else if (os.equals("OpenBSD")) {
return "bsd";
} else if (os.equals("Darwin") || os.startsWith("Mac OS X")) {
} else if (os.equals("Darwin") || os.contains("OS X")) {
return "bsd";
} else if (os.startsWith("Windows")) {
return "win32";
@ -52,17 +52,17 @@ public class PlatformInfo {
}
}
/* Returns "sparc" if on SPARC, "x86" if on x86. */
/* Returns "sparc" for SPARC based platforms and "x86" for x86 based
platforms. Otherwise returns the value of os.arch. If the value
is not recognized as supported, an exception is thrown instead. */
public static String getCPU() throws UnsupportedPlatformException {
String cpu = System.getProperty("os.arch");
if (cpu.equals("i386")) {
if (cpu.equals("i386") || cpu.equals("x86")) {
return "x86";
} else if (cpu.equals("sparc") || cpu.equals("x86") || cpu.equals("ia64")) {
return cpu;
} else if (cpu.equals("sparcv9")) {
} else if (cpu.equals("sparc") || cpu.equals("sparcv9")) {
return "sparc";
} else if (cpu.equals("x86_64") || cpu.equals("amd64")) {
return "amd64";
} else if (cpu.equals("ia64") || cpu.equals("amd64") || cpu.equals("x86_64")) {
return cpu;
} else {
throw new UnsupportedPlatformException("CPU type " + cpu + " not yet supported");
}