# HG changeset patch # User mchung # Date 1232496995 28800 # Node ID dd4ba253de9f92818be51603408c1e94e25e46e6 # Parent fe2556ead53791bc47b5e8b44e753f2c5db9d1a0# Parent be60e53173118dc24eb627755502aca7215f87e0 Merge diff -r fe2556ead537 -r dd4ba253de9f jdk/src/share/classes/java/net/DatagramSocket.java --- a/jdk/src/share/classes/java/net/DatagramSocket.java Tue Jan 20 13:04:19 2009 -0800 +++ b/jdk/src/share/classes/java/net/DatagramSocket.java Tue Jan 20 16:16:35 2009 -0800 @@ -41,10 +41,11 @@ * one machine to another may be routed differently, and may arrive in * any order. * - *
UDP broadcasts sends are always enabled on a DatagramSocket. - * In order to receive broadcast packets a DatagramSocket - * should be bound to the wildcard address. In some - * implementations, broadcast packets may also be received when + *
Where possible, a newly constructed {@code DatagramSocket} has the + * {@link SocketOptions#SO_BROADCAST SO_BROADCAST} socket option enabled so as + * to allow the transmission of broadcast datagrams. In order to receive + * broadcast packets a DatagramSocket should be bound to the wildcard address. + * In some implementations, broadcast packets may also be received when * a DatagramSocket is bound to a more specific address. *
* Example: @@ -1017,9 +1018,18 @@ /** * Enable/disable SO_BROADCAST. - * @param on whether or not to have broadcast turned on. - * @exception SocketException if there is an error - * in the underlying protocol, such as an UDP error. + * + *
Some operating systems may require that the Java virtual machine be + * started with implementation specific privileges to enable this option or + * send broadcast datagrams. + * + * @param on + * whether or not to have broadcast turned on. + * + * @throws SocketException + * if there is an error in the underlying protocol, such as an UDP + * error. + * * @since 1.4 * @see #getBroadcast() */ diff -r fe2556ead537 -r dd4ba253de9f jdk/src/share/classes/java/util/Collection.java --- a/jdk/src/share/classes/java/util/Collection.java Tue Jan 20 13:04:19 2009 -0800 +++ b/jdk/src/share/classes/java/util/Collection.java Tue Jan 20 16:16:35 2009 -0800 @@ -427,7 +427,7 @@ * contract for the Object.hashCode method, programmers should * take note that any class that overrides the Object.equals * method must also override the Object.hashCode method in order - * to satisfy the general contract for the Object.hashCodemethod. + * to satisfy the general contract for the Object.hashCode method. * In particular, c1.equals(c2) implies that * c1.hashCode()==c2.hashCode(). * diff -r fe2556ead537 -r dd4ba253de9f jdk/src/share/classes/java/util/Random.java --- a/jdk/src/share/classes/java/util/Random.java Tue Jan 20 13:04:19 2009 -0800 +++ b/jdk/src/share/classes/java/util/Random.java Tue Jan 20 16:16:35 2009 -0800 @@ -32,7 +32,7 @@ * An instance of this class is used to generate a stream of * pseudorandom numbers. The class uses a 48-bit seed, which is * modified using a linear congruential formula. (See Donald Knuth, - * The Art of Computer Programming, Volume 3, Section 3.2.1.) + * The Art of Computer Programming, Volume 2, Section 3.2.1.) *
* If two instances of {@code Random} are created with the same
* seed, and the same sequence of method calls is made for each, they
diff -r fe2556ead537 -r dd4ba253de9f jdk/src/share/classes/sun/security/krb5/Config.java
--- a/jdk/src/share/classes/sun/security/krb5/Config.java Tue Jan 20 13:04:19 2009 -0800
+++ b/jdk/src/share/classes/sun/security/krb5/Config.java Tue Jan 20 16:16:35 2009 -0800
@@ -1,5 +1,5 @@
/*
- * Portions Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Portions Copyright 2000-2009 Sun Microsystems, Inc. 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
@@ -74,7 +74,7 @@
private String defaultRealm; // default kdc realm.
// used for native interface
- private static native String getWindowsDirectory();
+ private static native String getWindowsDirectory(boolean isSystem);
/**
@@ -661,38 +661,37 @@
}
/**
- * Gets the default configuration file name. The file will be searched
- * in a list of possible loations in the following order:
- * 1. the location and file name defined by system property
- * "java.security.krb5.conf",
- * 2. at Java home lib\security directory with "krb5.conf" name,
- * 3. "krb5.ini" at Java home,
- * 4. at windows directory with the name of "krb5.ini" for Windows,
- * /etc/krb5/krb5.conf for Solaris, /etc/krb5.conf for Linux.
+ * Gets the default configuration file name. This method will never
+ * return null.
+ *
+ * If the system property "java.security.krb5.conf" is defined, we'll
+ * use its value, no matter if the file exists or not. Otherwise,
+ * the file will be searched in a list of possible loations in the
+ * following order:
+ *
+ * 1. at Java home lib\security directory with "krb5.conf" name,
+ * 2. at windows directory with the name of "krb5.ini" for Windows,
+ * /etc/krb5/krb5.conf for Solaris, /etc/krb5.conf otherwise.
+ *
+ * Note: When the Terminal Service is started in Windows (from 2003),
+ * there are two kinds of Windows directories: A system one (say,
+ * C:\Windows), and a user-private one (say, C:\Users\Me\Windows).
+ * We will first look for krb5.ini in the user-private one. If not
+ * found, try the system one instead.
*/
private String getFileName() {
String name =
java.security.AccessController.doPrivileged(
new sun.security.action.
GetPropertyAction("java.security.krb5.conf"));
- if (name != null) {
- boolean temp =
- java.security.AccessController.doPrivileged(
- new FileExistsAction(name));
- if (temp)
- return name;
- } else {
+ if (name == null) {
name = java.security.AccessController.doPrivileged(
new sun.security.action.
GetPropertyAction("java.home")) + File.separator +
"lib" + File.separator + "security" +
File.separator + "krb5.conf";
- boolean temp =
- java.security.AccessController.doPrivileged(
- new FileExistsAction(name));
- if (temp) {
- return name;
- } else {
+ if (!fileExists(name)) {
+ name = null;
String osname =
java.security.AccessController.doPrivileged(
new sun.security.action.GetPropertyAction("os.name"));
@@ -703,19 +702,35 @@
// ignore exceptions
}
if (Credentials.alreadyLoaded) {
- if ((name = getWindowsDirectory()) == null) {
- name = "c:\\winnt\\krb5.ini";
- } else if (name.endsWith("\\")) {
- name += "krb5.ini";
- } else {
- name += "\\krb5.ini";
+ String path = getWindowsDirectory(false);
+ if (path != null) {
+ if (path.endsWith("\\")) {
+ path = path + "krb5.ini";
+ } else {
+ path = path + "\\krb5.ini";
+ }
+ if (fileExists(path)) {
+ name = path;
+ }
}
- } else {
+ if (name == null) {
+ path = getWindowsDirectory(true);
+ if (path != null) {
+ if (path.endsWith("\\")) {
+ path = path + "krb5.ini";
+ } else {
+ path = path + "\\krb5.ini";
+ }
+ name = path;
+ }
+ }
+ }
+ if (name == null) {
name = "c:\\winnt\\krb5.ini";
}
} else if (osname.startsWith("SunOS")) {
name = "/etc/krb5/krb5.conf";
- } else if (osname.startsWith("Linux")) {
+ } else {
name = "/etc/krb5.conf";
}
}
@@ -1171,6 +1186,11 @@
return kdcs;
}
+ private boolean fileExists(String name) {
+ return java.security.AccessController.doPrivileged(
+ new FileExistsAction(name));
+ }
+
static class FileExistsAction
implements java.security.PrivilegedAction