diff --git a/.hgtags b/.hgtags
index 986d99166594134d8fea14099c0243817d5370d7..8e2227fdb7ad24030538f199ea56942fefdf1e27 100644
--- a/.hgtags
+++ b/.hgtags
@@ -77,3 +77,5 @@ b1903d7528d33b521df42bc9291bdcdd2f444a29 jdk7-b97
820b4e843d5168370a3bf166d19751a3271d8575 jdk7-b100
d58354a69011f3d3354765fa3167567c4c4a9612 jdk7-b101
13029a61b16bec06535d4f0aa98229b358684128 jdk7-b102
+6488b70a23cc6dc4b7e00809bc503c2884bafb28 jdk7-b103
+1a92820132a0221c5bdedd42d0888c57ce4cbb34 jdk7-b104
diff --git a/make/common/Release.gmk b/make/common/Release.gmk
index cf16ea8dd3ad35fb5beab0c74b4c7bf33e62b1ae..bc40dcc9725ad92c0aee793d6ee76bf4ec940953 100644
--- a/make/common/Release.gmk
+++ b/make/common/Release.gmk
@@ -571,6 +571,16 @@ $(NOT_RT_JAR_LIST): FRC
$(ECHO) "META-INF/services/com.sun.tools.xjc.Plugin" >> $@
$(ECHO) "com/sun/tools/" >> $@
$(ECHO) "sun/jvmstat/" >> $@
+ $(ECHO) "sun/nio/cs/ext/" >> $@
+ $(ECHO) "sun/awt/HKSCS.class" >> $@
+ $(ECHO) "sun/awt/motif/X11GB2312$Decoder.class" >> $@
+ $(ECHO) "sun/awt/motif/X11GB2312$Encoder.class" >> $@
+ $(ECHO) "sun/awt/motif/X11GB2312.class" >> $@
+ $(ECHO) "sun/awt/motif/X11GBK$Encoder.class" >> $@
+ $(ECHO) "sun/awt/motif/X11GBK.class" >> $@
+ $(ECHO) "sun/awt/motif/X11KSC5601$Decoder.class" >> $@
+ $(ECHO) "sun/awt/motif/X11KSC5601$Encoder.class" >> $@
+ $(ECHO) "sun/awt/motif/X11KSC5601.class" >> $@
$(ECHO) "sun/rmi/rmic/" >> $@
$(ECHO) "sun/tools/asm/" >> $@
$(ECHO) "sun/tools/java/" >> $@
diff --git a/make/common/shared/Defs-versions.gmk b/make/common/shared/Defs-versions.gmk
index 327f3a49b0162e283643adfa26a4746f6b3cc9ef..870ae229f3bf332631ba410f1d630cf2c4b02644 100644
--- a/make/common/shared/Defs-versions.gmk
+++ b/make/common/shared/Defs-versions.gmk
@@ -191,7 +191,7 @@ endif
# Generic
REQUIRED_ANT_VER = 1.6.3
-REQUIRED_BOOT_VER = 1.5
+REQUIRED_BOOT_VER = 1.6
REQUIRED_FREETYPE_VERSION = 2.3.0
REQUIRED_MAKE_VER = 3.78
REQUIRED_UNZIP_VER = 5.12
diff --git a/make/docs/Makefile b/make/docs/Makefile
index 20150c81a473ac3103c494978ed3a9c8d567b805..a2aaccb130fcf582da1d2617b4a2eb5db4bbb68b 100644
--- a/make/docs/Makefile
+++ b/make/docs/Makefile
@@ -47,9 +47,9 @@ BUG_SUBMIT_LINE = Submit a bug or feature
# Url to devdocs page
# Was: http://java.sun.com/javase/6/webnotes/devdocs-vs-specs.html
-DEV_DOCS_URL-5 = http://java.sun.com/j2se/1.5.0/docs
-DEV_DOCS_URL-6 = http://download.oracle.com/docs/cd/E17409_01/javase/6/docs
-DEV_DOCS_URL-7 = http://download.oracle.com/docs/cd/E17409_01/javase/7/docs
+DEV_DOCS_URL-5 = http://java.sun.com/j2se/1.5.0/docs/index.html
+DEV_DOCS_URL-6 = http://download.oracle.com/javase/6/docs/index.html
+DEV_DOCS_URL-7 = http://download.oracle.com/javase/7/docs/index.html
DEV_DOCS_URL = $(DEV_DOCS_URL-$(JDK_MINOR_VERSION))
# Url to Java Language Spec
@@ -84,6 +84,11 @@ ALL_SOURCE_DIRS = $(SHARE_SRC)/classes \
$(SHARE_SRC)/../solaris/classes \
$(SHARE_SRC)/../windows/classes \
$(SHARE_SRC)/doc/stub
+
+# List of directories that actually exist
+ALL_EXISTING_SOURCE_DIRS := $(wildcard $(ALL_SOURCE_DIRS))
+
+# List with classpath separator between them
EMPTY:=
SPACE:= $(EMPTY) $(EMPTY)
RELEASEDOCS_SOURCEPATH = \
@@ -240,7 +245,8 @@ include NON_CORE_PKGS.gmk
# Default target is same as docs target, create core api and all others it can
#
-all docs: coredocs otherdocs
+all: docs
+docs: coredocs otherdocs
#################################################################
# Production Targets -- USE THESE TARGETS WHEN:
@@ -1178,9 +1184,9 @@ $(TRACING_PACKAGES_FILE): $(DIRECTORY_CACHE) $(call PackageDependencies,$(TRACIN
#
# Get a cache of all the directories
-$(DIRECTORY_CACHE): $(ALL_SOURCE_DIRS)
+$(DIRECTORY_CACHE): $(ALL_EXISTING_SOURCE_DIRS)
$(prep-target)
- @for cp in $(ALL_SOURCE_DIRS) ; do \
+ @for cp in $(ALL_EXISTING_SOURCE_DIRS) ; do \
$(ECHO) "$(FIND) $${cp} -type f >> $@"; \
$(FIND) $${cp} -type f >> $@; \
done
diff --git a/make/java/nio/mapfile-linux b/make/java/nio/mapfile-linux
index 028e4150d50cdd187c931c30f885ee86da699f6f..13cc1cd01ec4e250d8d726b1dd0f0748e9c01c5a 100644
--- a/make/java/nio/mapfile-linux
+++ b/make/java/nio/mapfile-linux
@@ -119,6 +119,7 @@ SUNWprivate_1.1 {
Java_sun_nio_ch_ServerSocketChannelImpl_accept0;
Java_sun_nio_ch_ServerSocketChannelImpl_initIDs;
Java_sun_nio_ch_SocketChannelImpl_checkConnect;
+ Java_sun_nio_ch_SocketChannelImpl_sendOutOfBandData;
Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_accept0;
Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_initIDs;
Java_sun_nio_ch_UnixAsynchronousSocketChannelImpl_checkConnect;
diff --git a/make/java/nio/mapfile-solaris b/make/java/nio/mapfile-solaris
index 11a74f367139e9cd6c10b8c029bbc42f7928ecd7..2b80e4e801ef8acc4c6c0d169ee5383b7b07314f 100644
--- a/make/java/nio/mapfile-solaris
+++ b/make/java/nio/mapfile-solaris
@@ -106,6 +106,7 @@ SUNWprivate_1.1 {
Java_sun_nio_ch_ServerSocketChannelImpl_accept0;
Java_sun_nio_ch_ServerSocketChannelImpl_initIDs;
Java_sun_nio_ch_SocketChannelImpl_checkConnect;
+ Java_sun_nio_ch_SocketChannelImpl_sendOutOfBandData;
Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_accept0;
Java_sun_nio_ch_UnixAsynchronousServerSocketChannelImpl_initIDs;
Java_sun_nio_ch_UnixAsynchronousSocketChannelImpl_checkConnect;
diff --git a/make/sun/nio/cs/Makefile b/make/sun/nio/cs/Makefile
index 26437efca824fa8e44395ee67187c37aaa3e2bd5..e1b4d8d7be5dcbb09fcb7446f4805b27d2356691 100644
--- a/make/sun/nio/cs/Makefile
+++ b/make/sun/nio/cs/Makefile
@@ -57,6 +57,25 @@ CHARSETS_JAR = $(LIBDIR)/charsets.jar
# extcs
FILES_genout_extcs = $(FILES_gen_extcs:%.java=$(GENSRCDIR)/%.java)
+#
+# These sun.awt charsets use sun/nio/cs/ext charsets that only exist
+# in JDK7 charsets.jar, which causes problem when build the symbol
+# table for rt.jar in Release.gmk. They are now removed from the
+# rt.jar when building jdk/jre image (in Release.gmk), so add them
+# into charsets.jar here
+#
+ifeq ($(PLATFORM), windows)
+FILES_src += \
+ sun/awt/HKSCS.java
+else
+# Solaris/Linux
+FILES_src += \
+ sun/awt/HKSCS.java \
+ sun/awt/motif/X11GB2312.java \
+ sun/awt/motif/X11GBK.java \
+ sun/awt/motif/X11KSC5601.java
+endif # PLATFORM
+
#
# Rules
#
diff --git a/src/share/classes/com/sun/jndi/dns/DnsContextFactory.java b/src/share/classes/com/sun/jndi/dns/DnsContextFactory.java
index c7a15dc6eec00a4ab44fe4f5795cd8a47e32b420..c006ebdb5b95743510edd86d6556ae1109c3b26d 100644
--- a/src/share/classes/com/sun/jndi/dns/DnsContextFactory.java
+++ b/src/share/classes/com/sun/jndi/dns/DnsContextFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2010, 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
@@ -132,7 +132,7 @@ public class DnsContextFactory implements InitialContextFactory {
throw new ConfigurationException("DNS pseudo-URL required");
}
- List servers = new ArrayList();
+ List servers = new ArrayList<>();
for (int i = 0; i < urls.length; i++) {
String server = urls[i].getHost();
@@ -142,7 +142,7 @@ public class DnsContextFactory implements InitialContextFactory {
// No server or port given, so look to underlying platform.
// ResolverConfiguration does some limited caching, so the
// following is reasonably efficient even if called rapid-fire.
- List platformServers =
+ List platformServers =
ResolverConfiguration.open().nameservers();
if (!platformServers.isEmpty()) {
servers.addAll(platformServers);
@@ -157,8 +157,7 @@ public class DnsContextFactory implements InitialContextFactory {
? server
: server + ":" + port);
}
- return (String[]) servers.toArray(
- new String[servers.size()]);
+ return servers.toArray(new String[servers.size()]);
}
/*
diff --git a/src/share/classes/com/sun/jndi/ldap/Connection.java b/src/share/classes/com/sun/jndi/ldap/Connection.java
index 77890393387cf2d24dbf6de7772392f0c85c9da0..4503d261fffd78b517406e2dd21a90da3d81eac5 100644
--- a/src/share/classes/com/sun/jndi/ldap/Connection.java
+++ b/src/share/classes/com/sun/jndi/ldap/Connection.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2010, 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
@@ -658,6 +658,11 @@ public final class Connection implements Runnable {
}
}
if (nparent) {
+ LdapRequest ldr = pendingRequests;
+ while (ldr != null) {
+ ldr.notify();
+ ldr = ldr.next;
+ }
parent.processConnectionClosure();
}
}
diff --git a/src/share/classes/com/sun/jndi/ldap/Filter.java b/src/share/classes/com/sun/jndi/ldap/Filter.java
index b40bdcf659569f39b2707304bebb71f4384d4b73..626f1f86f9540ed741924a764bf764dddd163868 100644
--- a/src/share/classes/com/sun/jndi/ldap/Filter.java
+++ b/src/share/classes/com/sun/jndi/ldap/Filter.java
@@ -803,8 +803,7 @@ final class Filter {
//
////////////////////////////////////////////////////////////////////////////
- // private static final boolean dbg = false;
- private static final boolean dbg = true;
+ private static final boolean dbg = false;
private static int dbgIndent = 0;
private static void dprint(String msg) {
diff --git a/src/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java b/src/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java
index 07173c1028c323f3604f18693123924c28a33333..4e34eec6229f8533956d5db09964cab73d2338cb 100644
--- a/src/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java
+++ b/src/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java
@@ -81,7 +81,7 @@ public class RegistryContext implements Context, Referenceable {
}
RMIClientSocketFactory socketFactory =
- (RMIClientSocketFactory) env.get(SOCKET_FACTORY);
+ (RMIClientSocketFactory) environment.get(SOCKET_FACTORY);
registry = getRegistry(host, port, socketFactory);
this.host = host;
this.port = port;
diff --git a/src/share/classes/java/lang/AutoCloseable.java b/src/share/classes/java/lang/AutoCloseable.java
index 0f7ed8e0dd618d5212a42ad5ffce1e592a6011c7..18c28fe887bd099b229cb3b1eb736b356be64ef8 100644
--- a/src/share/classes/java/lang/AutoCloseable.java
+++ b/src/share/classes/java/lang/AutoCloseable.java
@@ -41,6 +41,13 @@ public interface AutoCloseable {
* be declared to throw more specific exceptions (or no exception
* at all, if the close cannot fail).
*
+ *
Note that unlike the {@link java.io.Closeable#close close}
+ * method of {@link java.io.Closeable}, this {@code close} method
+ * is not required to be idempotent. In other words,
+ * calling this {@code close} method more than once may have some
+ * visible side effect, unlike {@code Closeable.close} which is
+ * required to have no effect if called more than once.
+ *
* @throws Exception if this resource cannot be closed
*/
void close() throws Exception;
diff --git a/src/share/classes/java/lang/Throwable.java b/src/share/classes/java/lang/Throwable.java
index 58478f90af4a238782eb6de5e2bd9fbb0eab418c..213f5f86d5cc8c1df842585e7af076b016986d56 100644
--- a/src/share/classes/java/lang/Throwable.java
+++ b/src/share/classes/java/lang/Throwable.java
@@ -28,12 +28,12 @@ import java.io.*;
import java.util.*;
/**
- * The Throwable class is the superclass of all errors and
+ * The {@code Throwable} class is the superclass of all errors and
* exceptions in the Java language. Only objects that are instances of this
* class (or one of its subclasses) are thrown by the Java Virtual Machine or
- * can be thrown by the Java throw statement. Similarly, only
+ * can be thrown by the Java {@code throw} statement. Similarly, only
* this class or one of its subclasses can be the argument type in a
- * catch clause.
+ * {@code catch} clause.
*
* For the purposes of compile-time checking of exceptions, {@code
* Throwable} and any subclass of {@code Throwable} that is not also a
@@ -73,11 +73,11 @@ import java.util.*;
* permit the method to throw the cause directly. For example, suppose
* a persistent collection conforms to the {@link java.util.Collection
* Collection} interface, and that its persistence is implemented atop
- * java.io. Suppose the internals of the add method
+ * {@code java.io}. Suppose the internals of the {@code add} method
* can throw an {@link java.io.IOException IOException}. The implementation
- * can communicate the details of the IOException to its caller
- * while conforming to the Collection interface by wrapping the
- * IOException in an appropriate unchecked exception. (The
+ * can communicate the details of the {@code IOException} to its caller
+ * while conforming to the {@code Collection} interface by wrapping the
+ * {@code IOException} in an appropriate unchecked exception. (The
* specification for the persistent collection should indicate that it is
* capable of throwing such exceptions.)
*
@@ -86,7 +86,7 @@ import java.util.*;
* {@link #initCause(Throwable)} method. New throwable classes that
* wish to allow causes to be associated with them should provide constructors
* that take a cause and delegate (perhaps indirectly) to one of the
- * Throwable constructors that takes a cause. For example:
+ * {@code Throwable} constructors that takes a cause. For example:
*
- * Because the initCause method is public, it allows a cause to be
+ * Because the {@code initCause} method is public, it allows a cause to be
* associated with any throwable, even a "legacy throwable" whose
* implementation predates the addition of the exception chaining mechanism to
- * Throwable. For example:
+ * {@code Throwable}. For example:
*
* try {
* lowLevelOp();
@@ -121,28 +121,28 @@ import java.util.*;
* use the standard exception chaining mechanism, while continuing to
* implement their "legacy" chaining mechanisms for compatibility.
*
- *
Further, as of release 1.4, many general purpose Throwable
+ *
Further, as of release 1.4, many general purpose {@code Throwable}
* classes (for example {@link Exception}, {@link RuntimeException},
* {@link Error}) have been retrofitted with constructors that take
* a cause. This was not strictly necessary, due to the existence of the
- * initCause method, but it is more convenient and expressive to
+ * {@code initCause} method, but it is more convenient and expressive to
* delegate to a constructor that takes a cause.
*
- *
By convention, class Throwable and its subclasses have two
+ *
By convention, class {@code Throwable} and its subclasses have two
* constructors, one that takes no arguments and one that takes a
- * String argument that can be used to produce a detail message.
+ * {@code String} argument that can be used to produce a detail message.
* Further, those subclasses that might likely have a cause associated with
* them should have two more constructors, one that takes a
- * Throwable (the cause), and one that takes a
- * String (the detail message) and a Throwable (the
+ * {@code Throwable} (the cause), and one that takes a
+ * {@code String} (the detail message) and a {@code Throwable} (the
* cause).
*
*
Also introduced in release 1.4 is the {@link #getStackTrace()} method,
* which allows programmatic access to the stack trace information that was
* previously available only in text form, via the various forms of the
* {@link #printStackTrace()} method. This information has been added to the
- * serialized representation of this class so getStackTrace
- * and printStackTrace will operate properly on a throwable that
+ * serialized representation of this class so {@code getStackTrace}
+ * and {@code printStackTrace} will operate properly on a throwable that
* was obtained by deserialization.
*
* @author unascribed
@@ -162,7 +162,7 @@ public class Throwable implements Serializable {
/**
* Specific details about the Throwable. For example, for
- * FileNotFoundException, this contains the name of
+ * {@code FileNotFoundException}, this contains the name of
* the file that could not be found.
*
* @serial
@@ -212,7 +212,7 @@ public class Throwable implements Serializable {
private static final String SUPPRESSED_CAPTION = "Suppressed: ";
/**
- * Constructs a new throwable with null as its detail message.
+ * Constructs a new throwable with {@code null} as its detail message.
* The cause is not initialized, and may subsequently be initialized by a
* call to {@link #initCause}.
*
@@ -242,7 +242,7 @@ public class Throwable implements Serializable {
/**
* Constructs a new throwable with the specified detail message and
* cause.
Note that the detail message associated with
- * cause is not automatically incorporated in
+ * {@code cause} is not automatically incorporated in
* this throwable's detail message.
*
*
The {@link #fillInStackTrace()} method is called to initialize
@@ -251,7 +251,7 @@ public class Throwable implements Serializable {
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A null value is
+ * {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
@@ -264,8 +264,8 @@ public class Throwable implements Serializable {
/**
* Constructs a new throwable with the specified cause and a detail
- * message of (cause==null ? null : cause.toString()) (which
- * typically contains the class and detail message of cause).
+ * message of {@code (cause==null ? null : cause.toString())} (which
+ * typically contains the class and detail message of {@code cause}).
* This constructor is useful for throwables that are little more than
* wrappers for other throwables (for example, {@link
* java.security.PrivilegedActionException}).
@@ -274,7 +274,7 @@ public class Throwable implements Serializable {
* the stack trace data in the newly created throwable.
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A null value is
+ * {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
* @since 1.4
@@ -288,8 +288,8 @@ public class Throwable implements Serializable {
/**
* Returns the detail message string of this throwable.
*
- * @return the detail message string of this Throwable instance
- * (which may be null).
+ * @return the detail message string of this {@code Throwable} instance
+ * (which may be {@code null}).
*/
public String getMessage() {
return detailMessage;
@@ -300,7 +300,7 @@ public class Throwable implements Serializable {
* Subclasses may override this method in order to produce a
* locale-specific message. For subclasses that do not override this
* method, the default implementation returns the same result as
- * getMessage().
+ * {@code getMessage()}.
*
* @return The localized description of this throwable.
* @since JDK1.1
@@ -310,22 +310,22 @@ public class Throwable implements Serializable {
}
/**
- * Returns the cause of this throwable or null if the
+ * Returns the cause of this throwable or {@code null} if the
* cause is nonexistent or unknown. (The cause is the throwable that
* caused this throwable to get thrown.)
*
*
This implementation returns the cause that was supplied via one of
- * the constructors requiring a Throwable, or that was set after
+ * the constructors requiring a {@code Throwable}, or that was set after
* creation with the {@link #initCause(Throwable)} method. While it is
* typically unnecessary to override this method, a subclass can override
* it to return a cause set by some other means. This is appropriate for
* a "legacy chained throwable" that predates the addition of chained
- * exceptions to Throwable. Note that it is not
- * necessary to override any of the PrintStackTrace methods,
- * all of which invoke the getCause method to determine the
+ * exceptions to {@code Throwable}. Note that it is not
+ * necessary to override any of the {@code PrintStackTrace} methods,
+ * all of which invoke the {@code getCause} method to determine the
* cause of a throwable.
*
- * @return the cause of this throwable or null if the
+ * @return the cause of this throwable or {@code null} if the
* cause is nonexistent or unknown.
* @since 1.4
*/
@@ -345,11 +345,11 @@ public class Throwable implements Serializable {
* even once.
*
* @param cause the cause (which is saved for later retrieval by the
- * {@link #getCause()} method). (A null value is
+ * {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
- * @return a reference to this Throwable instance.
- * @throws IllegalArgumentException if cause is this
+ * @return a reference to this {@code Throwable} instance.
+ * @throws IllegalArgumentException if {@code cause} is this
* throwable. (A throwable cannot be its own cause.)
* @throws IllegalStateException if this throwable was
* created with {@link #Throwable(Throwable)} or
@@ -375,7 +375,7 @@ public class Throwable implements Serializable {
*
the result of invoking this object's {@link #getLocalizedMessage}
* method
*
- * If getLocalizedMessage returns null, then just
+ * If {@code getLocalizedMessage} returns {@code null}, then just
* the class name is returned.
*
* @return a string representation of this throwable.
@@ -389,8 +389,8 @@ public class Throwable implements Serializable {
/**
* Prints this throwable and its backtrace to the
* standard error stream. This method prints a stack trace for this
- * Throwable object on the error output stream that is
- * the value of the field System.err. The first line of
+ * {@code Throwable} object on the error output stream that is
+ * the value of the field {@code System.err}. The first line of
* output contains the result of the {@link #toString()} method for
* this object. Remaining lines represent data previously recorded by
* the method {@link #fillInStackTrace()}. The format of this
@@ -435,7 +435,7 @@ public class Throwable implements Serializable {
* at Junk.c(Junk.java:21)
* ... 3 more
*
- * Note the presence of lines containing the characters "...".
+ * Note the presence of lines containing the characters {@code "..."}.
* These lines indicate that the remainder of the stack trace for this
* exception matches the indicated number of frames from the bottom of the
* stack trace of the exception that was caused by this exception (the
@@ -542,14 +542,17 @@ public class Throwable implements Serializable {
/**
* Prints this throwable and its backtrace to the specified print stream.
*
- * @param s PrintStream to use for output
+ * @param s {@code PrintStream} to use for output
*/
public void printStackTrace(PrintStream s) {
printStackTrace(new WrappedPrintStream(s));
}
private void printStackTrace(PrintStreamOrWriter s) {
- Set dejaVu = new HashSet();
+ // Guard against malicious overrides of Throwable.equals by
+ // using a Set with identity equality semantics.
+ Set dejaVu =
+ Collections.newSetFromMap(new IdentityHashMap());
dejaVu.add(this);
synchronized (s.lock()) {
@@ -616,7 +619,7 @@ public class Throwable implements Serializable {
* Prints this throwable and its backtrace to the specified
* print writer.
*
- * @param s PrintWriter to use for output
+ * @param s {@code PrintWriter} to use for output
* @since JDK1.1
*/
public void printStackTrace(PrintWriter s) {
@@ -669,10 +672,10 @@ public class Throwable implements Serializable {
/**
* Fills in the execution stack trace. This method records within this
- * Throwable object information about the current state of
+ * {@code Throwable} object information about the current state of
* the stack frames for the current thread.
*
- * @return a reference to this Throwable instance.
+ * @return a reference to this {@code Throwable} instance.
* @see java.lang.Throwable#printStackTrace()
*/
public synchronized native Throwable fillInStackTrace();
@@ -694,7 +697,7 @@ public class Throwable implements Serializable {
* this throwable is permitted to return a zero-length array from this
* method. Generally speaking, the array returned by this method will
* contain one element for every frame that would be printed by
- * printStackTrace.
+ * {@code printStackTrace}.
*
* @return an array of stack trace elements representing the stack trace
* pertaining to this throwable.
@@ -727,14 +730,14 @@ public class Throwable implements Serializable {
* read from a serialization stream.
*
* @param stackTrace the stack trace elements to be associated with
- * this Throwable. The specified array is copied by this
+ * this {@code Throwable}. The specified array is copied by this
* call; changes in the specified array after the method invocation
- * returns will have no affect on this Throwable's stack
+ * returns will have no affect on this {@code Throwable}'s stack
* trace.
*
- * @throws NullPointerException if stackTrace is
- * null, or if any of the elements of
- * stackTrace are null
+ * @throws NullPointerException if {@code stackTrace} is
+ * {@code null}, or if any of the elements of
+ * {@code stackTrace} are {@code null}
*
* @since 1.4
*/
@@ -761,8 +764,8 @@ public class Throwable implements Serializable {
* package-protection for use by SharedSecrets.
*
* @param index index of the element to return.
- * @throws IndexOutOfBoundsException if index < 0 ||
- * index >= getStackTraceDepth()
+ * @throws IndexOutOfBoundsException if {@code index < 0 ||
+ * index >= getStackTraceDepth() }
*/
native StackTraceElement getStackTraceElement(int index);
@@ -794,14 +797,27 @@ public class Throwable implements Serializable {
* were suppressed, typically by the automatic resource management
* statement, in order to deliver this exception.
*
+ *
Note that when one exception {@linkplain
+ * #initCause(Throwable) causes} another exception, the first
+ * exception is usually caught and then the second exception is
+ * thrown in response. In contrast, when one exception suppresses
+ * another, two exceptions are thrown in sibling code blocks, such
+ * as in a {@code try} block and in its {@code finally} block, and
+ * control flow can only continue with one exception so the second
+ * is recorded as a suppressed exception of the first.
+ *
* @param exception the exception to be added to the list of
* suppressed exceptions
* @throws NullPointerException if {@code exception} is null
+ * @throws IllegalArgumentException if {@code exception} is this
+ * throwable; a throwable cannot suppress itself.
* @since 1.7
*/
public synchronized void addSuppressedException(Throwable exception) {
if (exception == null)
throw new NullPointerException(NULL_CAUSE_MESSAGE);
+ if (exception == this)
+ throw new IllegalArgumentException("Self-suppression not permitted");
if (suppressedExceptions.size() == 0)
suppressedExceptions = new ArrayList();
diff --git a/src/share/classes/java/nio/Bits.java b/src/share/classes/java/nio/Bits.java
index 4adf3e48066c663306f6d45a9bc2a1bdab48c5e4..fa11b6be785540f23bd3f8e2b0df9a20e8b03513 100644
--- a/src/share/classes/java/nio/Bits.java
+++ b/src/share/classes/java/nio/Bits.java
@@ -596,6 +596,9 @@ class Bits { // package-private
return pageSize;
}
+ static int pageCount(long size) {
+ return (int)(size + (long)pageSize() - 1L) / pageSize();
+ }
private static boolean unaligned;
private static boolean unalignedKnown = false;
diff --git a/src/share/classes/java/nio/MappedByteBuffer.java b/src/share/classes/java/nio/MappedByteBuffer.java
index 7e415c67bcaf8bfa22b5e4d65ab556d311455887..4811f41d2e1515deb86f4bfd6409a59fc393e9a4 100644
--- a/src/share/classes/java/nio/MappedByteBuffer.java
+++ b/src/share/classes/java/nio/MappedByteBuffer.java
@@ -25,6 +25,8 @@
package java.nio;
+import sun.misc.Unsafe;
+
/**
* A direct byte buffer whose content is a memory-mapped region of a file.
@@ -93,6 +95,22 @@ public abstract class MappedByteBuffer
throw new UnsupportedOperationException();
}
+ // Returns the distance (in bytes) of the buffer from the page aligned address
+ // of the mapping. Computed each time to avoid storing in every direct buffer.
+ private long mappingOffset() {
+ int ps = Bits.pageSize();
+ long offset = address % ps;
+ return (offset >= 0) ? offset : (ps + offset);
+ }
+
+ private long mappingAddress(long mappingOffset) {
+ return address - mappingOffset;
+ }
+
+ private long mappingLength(long mappingOffset) {
+ return (long)capacity() + mappingOffset;
+ }
+
/**
* Tells whether or not this buffer's content is resident in physical
* memory.
@@ -115,7 +133,9 @@ public abstract class MappedByteBuffer
checkMapped();
if ((address == 0) || (capacity() == 0))
return true;
- return isLoaded0(((DirectByteBuffer)this).address(), capacity());
+ long offset = mappingOffset();
+ long length = mappingLength(offset);
+ return isLoaded0(mappingAddress(offset), length, Bits.pageCount(length));
}
/**
@@ -132,7 +152,20 @@ public abstract class MappedByteBuffer
checkMapped();
if ((address == 0) || (capacity() == 0))
return this;
- load0(((DirectByteBuffer)this).address(), capacity(), Bits.pageSize());
+ long offset = mappingOffset();
+ long length = mappingLength(offset);
+ load0(mappingAddress(offset), length);
+
+ // touch each page
+ Unsafe unsafe = Unsafe.getUnsafe();
+ int ps = Bits.pageSize();
+ int count = Bits.pageCount(length);
+ long a = mappingAddress(offset);
+ for (int i=0; i
* signatureAlgorithm AlgorithmIdentifier
diff --git a/src/share/classes/java/security/cert/X509Certificate.java b/src/share/classes/java/security/cert/X509Certificate.java
index 8ca8c5d4d6651ecc32732261c5b30daea3534bca..cb0e5482433c3aef8670bcbf57ecd40aaa69a4bf 100644
--- a/src/share/classes/java/security/cert/X509Certificate.java
+++ b/src/share/classes/java/security/cert/X509Certificate.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2010, 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
@@ -352,7 +352,7 @@ implements X509Extension {
/**
* Gets the signature algorithm name for the certificate
- * signature algorithm. An example is the string "SHA-1/DSA".
+ * signature algorithm. An example is the string "SHA256withRSA".
* The ASN.1 definition for this is:
*
* signatureAlgorithm AlgorithmIdentifier
diff --git a/src/share/classes/java/util/LinkedList.java b/src/share/classes/java/util/LinkedList.java
index 34685d91ca74343542960885d21bdfa91b6f0a5f..9feb95e54ff4240d433e13bd5f12938957e29d34 100644
--- a/src/share/classes/java/util/LinkedList.java
+++ b/src/share/classes/java/util/LinkedList.java
@@ -26,18 +26,9 @@
package java.util;
/**
- * Linked list implementation of the {@code List} interface. Implements all
- * optional list operations, and permits all elements (including
- * {@code null}). In addition to implementing the {@code List} interface,
- * the {@code LinkedList} class provides uniformly named methods to
- * {@code get}, {@code remove} and {@code insert} an element at the
- * beginning and end of the list. These operations allow linked lists to be
- * used as a stack, {@linkplain Queue queue}, or {@linkplain Deque
- * double-ended queue}.
- *
- *
The class implements the {@code Deque} interface, providing
- * first-in-first-out queue operations for {@code add},
- * {@code poll}, along with other stack and deque operations.
+ * Linked list implementation of the {@link List} and {@link Deque} interfaces.
+ * Implements all optional operations, and permits all elements (including
+ * {@code null}).
*
*
All of the operations perform as could be expected for a doubly-linked
* list. Operations that index into the list will traverse the list from
diff --git a/src/share/classes/sun/net/dns/ResolverConfiguration.java b/src/share/classes/sun/net/dns/ResolverConfiguration.java
index e97d7fe0fe8864b4ee37601529265794cb14645f..4ab30b2935d45b227b9b01f1b9187ae8d5b73df8 100644
--- a/src/share/classes/sun/net/dns/ResolverConfiguration.java
+++ b/src/share/classes/sun/net/dns/ResolverConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2010, 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
@@ -26,7 +26,6 @@
package sun.net.dns;
import java.util.List;
-import java.io.IOException;
/**
* The configuration of the client resolver.
@@ -68,7 +67,7 @@ public abstract class ResolverConfiguration {
*
* @return list of domain names
*/
- public abstract List searchlist();
+ public abstract List searchlist();
/**
* Returns a list of name servers used for host name lookup.
@@ -78,7 +77,7 @@ public abstract class ResolverConfiguration {
*
* @return list of the name servers
*/
- public abstract List nameservers();
+ public abstract List nameservers();
/**
diff --git a/src/share/classes/sun/net/spi/nameservice/dns/DNSNameService.java b/src/share/classes/sun/net/spi/nameservice/dns/DNSNameService.java
index bdc82ad6da28dc280edb68463e54a39d6e84a846..9142de0a3c09c417394a138fcb5bfbbbd920ac0d 100644
--- a/src/share/classes/sun/net/spi/nameservice/dns/DNSNameService.java
+++ b/src/share/classes/sun/net/spi/nameservice/dns/DNSNameService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2010, 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
@@ -45,20 +45,21 @@ import sun.security.action.*;
public final class DNSNameService implements NameService {
// List of domains specified by property
- private LinkedList domainList = null;
+ private LinkedList domainList = null;
// JNDI-DNS URL for name servers specified via property
private String nameProviderUrl = null;
// Per-thread soft cache of the last temporary context
- private static ThreadLocal contextRef = new ThreadLocal();
+ private static ThreadLocal> contextRef =
+ new ThreadLocal<>();
// Simple class to encapsulate the temporary context
private static class ThreadContext {
private DirContext dirCtxt;
- private List nsList;
+ private List nsList;
- public ThreadContext(DirContext dirCtxt, List nsList) {
+ public ThreadContext(DirContext dirCtxt, List nsList) {
this.dirCtxt = dirCtxt;
this.nsList = nsList;
}
@@ -67,16 +68,16 @@ public final class DNSNameService implements NameService {
return dirCtxt;
}
- public List nameservers() {
+ public List nameservers() {
return nsList;
}
}
// Returns a per-thread DirContext
private DirContext getTemporaryContext() throws NamingException {
- SoftReference ref = (SoftReference)contextRef.get();
+ SoftReference ref = contextRef.get();
ThreadContext thrCtxt = null;
- List nsList = null;
+ List nsList = null;
// if no property specified we need to obtain the list of servers
//
@@ -87,7 +88,7 @@ public final class DNSNameService implements NameService {
// specified then we need to check if the DNS configuration
// has changed.
//
- if ((ref != null) && ((thrCtxt = (ThreadContext)ref.get()) != null)) {
+ if ((ref != null) && ((thrCtxt = ref.get()) != null)) {
if (nameProviderUrl == null) {
if (!thrCtxt.nameservers().equals(nsList)) {
// DNS configuration has changed
@@ -98,7 +99,7 @@ public final class DNSNameService implements NameService {
// new thread context needs to be created
if (thrCtxt == null) {
- final Hashtable env = new Hashtable();
+ final Hashtable env = new Hashtable<>();
env.put("java.naming.factory.initial",
"com.sun.jndi.dns.DnsContextFactory");
@@ -119,10 +120,9 @@ public final class DNSNameService implements NameService {
//
DirContext dirCtxt;
try {
- dirCtxt = (DirContext)
- java.security.AccessController.doPrivileged(
- new java.security.PrivilegedExceptionAction() {
- public Object run() throws NamingException {
+ dirCtxt = java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedExceptionAction() {
+ public DirContext run() throws NamingException {
// Create the DNS context using NamingManager rather than using
// the initial context constructor. This avoids having the initial
// context constructor call itself.
@@ -130,7 +130,7 @@ public final class DNSNameService implements NameService {
if (!(ctx instanceof DirContext)) {
return null; // cannot create a DNS context
}
- return ctx;
+ return (DirContext)ctx;
}
});
} catch (java.security.PrivilegedActionException pae) {
@@ -161,18 +161,18 @@ public final class DNSNameService implements NameService {
*
* @throws UnknownHostException if lookup fails or other error.
*/
- private ArrayList resolve(final DirContext ctx, final String name, final String[] ids,
- int depth) throws UnknownHostException
+ private ArrayList resolve(final DirContext ctx, final String name,
+ final String[] ids, int depth)
+ throws UnknownHostException
{
- ArrayList results = new ArrayList();
+ ArrayList results = new ArrayList<>();
Attributes attrs;
// do the query
try {
- attrs = (Attributes)
- java.security.AccessController.doPrivileged(
- new java.security.PrivilegedExceptionAction() {
- public Object run() throws NamingException {
+ attrs = java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedExceptionAction() {
+ public Attributes run() throws NamingException {
return ctx.getAttributes(name, ids);
}
});
@@ -181,7 +181,7 @@ public final class DNSNameService implements NameService {
}
// non-requested type returned so enumeration is empty
- NamingEnumeration ne = attrs.getAll();
+ NamingEnumeration extends Attribute> ne = attrs.getAll();
if (!ne.hasMoreElements()) {
throw new UnknownHostException("DNS record not found");
}
@@ -190,7 +190,7 @@ public final class DNSNameService implements NameService {
UnknownHostException uhe = null;
try {
while (ne.hasMoreElements()) {
- Attribute attr = (Attribute)ne.next();
+ Attribute attr = ne.next();
String attrID = attr.getID();
for (NamingEnumeration e = attr.getAll(); e.hasMoreElements();) {
@@ -251,13 +251,12 @@ public final class DNSNameService implements NameService {
// no property specified so check host DNS resolver configured
// with at least one nameserver in dotted notation.
//
- List nsList = ResolverConfiguration.open().nameservers();
- if (nsList.size() == 0)
+ List nsList = ResolverConfiguration.open().nameservers();
+ if (nsList.isEmpty()) {
throw new RuntimeException("no nameservers provided");
+ }
boolean found = false;
- Iterator i = nsList.iterator();
- while (i.hasNext()) {
- String addr = (String)i.next();
+ for (String addr: nsList) {
if (IPAddressUtil.isIPv4LiteralAddress(addr) ||
IPAddressUtil.isIPv6LiteralAddress(addr)) {
found = true;
@@ -308,8 +307,8 @@ public final class DNSNameService implements NameService {
// suffix if the list has one entry.
if (results == null) {
- List searchList = null;
- Iterator i;
+ List searchList = null;
+ Iterator i;
boolean usingSearchList = false;
if (domainList != null) {
@@ -324,7 +323,7 @@ public final class DNSNameService implements NameService {
// iterator through each domain suffix
while (i.hasNext()) {
- String parentDomain = (String)i.next();
+ String parentDomain = i.next();
int start = 0;
while ((start = parentDomain.indexOf(".")) != -1
&& start < parentDomain.length() -1) {
@@ -407,7 +406,7 @@ public final class DNSNameService implements NameService {
String literalip = "";
String[] ids = { "PTR" };
DirContext ctx;
- ArrayList results = null;
+ ArrayList results = null;
try {
ctx = getTemporaryContext();
} catch (NamingException nx) {
@@ -420,7 +419,7 @@ public final class DNSNameService implements NameService {
literalip += "IN-ADDR.ARPA.";
results = resolve(ctx, literalip, ids, 0);
- host = (String)results.get(0);
+ host = results.get(0);
} else if (addr.length == 16) { // IPv6 Address
/**
* Because RFC 3152 changed the root domain name for reverse
@@ -437,7 +436,7 @@ public final class DNSNameService implements NameService {
try {
results = resolve(ctx, ip6lit, ids, 0);
- host = (String)results.get(0);
+ host = results.get(0);
} catch (UnknownHostException e) {
host = null;
}
@@ -445,7 +444,7 @@ public final class DNSNameService implements NameService {
// IP6.ARPA lookup failed, let's try the older IP6.INT
ip6lit = literalip + "IP6.INT.";
results = resolve(ctx, ip6lit, ids, 0);
- host = (String)results.get(0);
+ host = results.get(0);
}
}
} catch (Exception e) {
@@ -478,11 +477,10 @@ public final class DNSNameService implements NameService {
* @return String containing the JNDI-DNS provider URL
* corresponding to the supplied List of nameservers.
*/
- private static String createProviderURL(List nsList) {
- Iterator i = nsList.iterator();
+ private static String createProviderURL(List nsList) {
StringBuffer sb = new StringBuffer();
- while (i.hasNext()) {
- appendIfLiteralAddress((String)i.next(), sb);
+ for (String s: nsList) {
+ appendIfLiteralAddress(s, sb);
}
return sb.toString();
}
diff --git a/src/share/classes/sun/nio/ch/SocketAdaptor.java b/src/share/classes/sun/nio/ch/SocketAdaptor.java
index 583835727e8c561b6e054b01f28291e5af16739a..7ff9a3075f98e7ab329a69257a8468414f482a5a 100644
--- a/src/share/classes/sun/nio/ch/SocketAdaptor.java
+++ b/src/share/classes/sun/nio/ch/SocketAdaptor.java
@@ -336,7 +336,12 @@ public class SocketAdaptor
}
public void sendUrgentData(int data) throws IOException {
- throw new SocketException("Urgent data not supported");
+ synchronized (sc.blockingLock()) {
+ if (!sc.isBlocking())
+ throw new IllegalBlockingModeException();
+ int n = sc.sendOutOfBandData((byte)data);
+ assert n == 1;
+ }
}
public void setOOBInline(boolean on) throws SocketException {
diff --git a/src/share/classes/sun/nio/ch/SocketChannelImpl.java b/src/share/classes/sun/nio/ch/SocketChannelImpl.java
index 2539007afd10594c865bbd5787715a7413a72e91..ee84a0e626c715e5c7afcef888b9e9e7858d4f7c 100644
--- a/src/share/classes/sun/nio/ch/SocketChannelImpl.java
+++ b/src/share/classes/sun/nio/ch/SocketChannelImpl.java
@@ -498,6 +498,36 @@ class SocketChannelImpl
return write0(Util.subsequence(srcs, offset, length));
}
+ // package-private
+ int sendOutOfBandData(byte b) throws IOException {
+ synchronized (writeLock) {
+ ensureWriteOpen();
+ int n = 0;
+ try {
+ begin();
+ synchronized (stateLock) {
+ if (!isOpen())
+ return 0;
+ writerThread = NativeThread.current();
+ }
+ for (;;) {
+ n = sendOutOfBandData(fd, b);
+ if ((n == IOStatus.INTERRUPTED) && isOpen())
+ continue;
+ return IOStatus.normalize(n);
+ }
+ } finally {
+ writerCleanup();
+ end((n > 0) || (n == IOStatus.UNAVAILABLE));
+ synchronized (stateLock) {
+ if ((n <= 0) && (!isOutputOpen))
+ throw new AsynchronousCloseException();
+ }
+ assert IOStatus.check(n);
+ }
+ }
+ }
+
protected void implConfigureBlocking(boolean block) throws IOException {
IOUtil.configureBlocking(fd, block);
}
@@ -957,6 +987,9 @@ class SocketChannelImpl
boolean block, boolean ready)
throws IOException;
+ private static native int sendOutOfBandData(FileDescriptor fd, byte data)
+ throws IOException;
+
static {
Util.load();
nd = new SocketDispatcher();
diff --git a/src/share/classes/sun/security/krb5/Config.java b/src/share/classes/sun/security/krb5/Config.java
index c885869ff654c87116d41326f79942c3dd329167..21fb4cea7f5b001bc2248b38b1cf497f8c762338 100644
--- a/src/share/classes/sun/security/krb5/Config.java
+++ b/src/share/classes/sun/security/krb5/Config.java
@@ -42,6 +42,8 @@ import java.util.Enumeration;
import java.util.StringTokenizer;
import java.net.InetAddress;
import java.net.UnknownHostException;
+import java.util.List;
+import sun.net.dns.ResolverConfiguration;
import sun.security.krb5.internal.crypto.EType;
import sun.security.krb5.internal.ktab.*;
import sun.security.krb5.internal.Krb5;
@@ -1180,6 +1182,33 @@ public class Config {
}
// get the domain realm mapping from the configuration
String mapRealm = PrincipalName.mapHostToRealm(hostName);
+ if (mapRealm == null) {
+ // No match. Try search and/or domain in /etc/resolv.conf
+ List srchlist = ResolverConfiguration.open().searchlist();
+ for (String domain: srchlist) {
+ realm = checkRealm(domain);
+ if (realm != null) {
+ break;
+ }
+ }
+ } else {
+ realm = checkRealm(mapRealm);
+ }
+ if (realm == null) {
+ throw new KrbException(Krb5.KRB_ERR_GENERIC,
+ "Unable to locate Kerberos realm");
+ }
+ return realm;
+ }
+
+ /**
+ * Check if the provided realm is the correct realm
+ * @return the realm if correct, or null otherwise
+ */
+ private static String checkRealm(String mapRealm) {
+ if (DEBUG) {
+ System.out.println("getRealmFromDNS: trying " + mapRealm);
+ }
String[] records = null;
String newRealm = mapRealm;
while ((records == null) && (newRealm != null)) {
@@ -1188,23 +1217,14 @@ public class Config {
newRealm = Realm.parseRealmComponent(newRealm);
// if no DNS TXT records found, try again using sub-realm
}
- if (records == null) {
- // no DNS TXT records
- throw new KrbException(Krb5.KRB_ERR_GENERIC,
- "Unable to locate Kerberos realm");
- }
- boolean found = false;
- for (int i = 0; i < records.length; i++) {
- if (records[i].equals(mapRealm)) {
- found = true;
- realm = records[i];
+ if (records != null) {
+ for (int i = 0; i < records.length; i++) {
+ if (records[i].equalsIgnoreCase(mapRealm)) {
+ return records[i];
+ }
}
}
- if (found == false) {
- throw new KrbException(Krb5.KRB_ERR_GENERIC,
- "Unable to locate Kerberos realm");
- }
- return realm;
+ return null;
}
/**
@@ -1218,10 +1238,16 @@ public class Config {
String kdcs = null;
String[] srvs = null;
// locate DNS SRV record using UDP
- srvs = KrbServiceLocator.getKerberosService(realm, "_udp.");
+ if (DEBUG) {
+ System.out.println("getKDCFromDNS using UDP");
+ }
+ srvs = KrbServiceLocator.getKerberosService(realm, "_udp");
if (srvs == null) {
// locate DNS SRV record using TCP
- srvs = KrbServiceLocator.getKerberosService(realm, "_tcp.");
+ if (DEBUG) {
+ System.out.println("getKDCFromDNS using UDP");
+ }
+ srvs = KrbServiceLocator.getKerberosService(realm, "_tcp");
}
if (srvs == null) {
// no DNS SRV records
diff --git a/src/share/classes/sun/security/krb5/Credentials.java b/src/share/classes/sun/security/krb5/Credentials.java
index b7ae4aaee6593210fe04e41691ae3200efeb5d33..6896aa18e95fdc49a17cb625ffee61399dd61c8a 100644
--- a/src/share/classes/sun/security/krb5/Credentials.java
+++ b/src/share/classes/sun/security/krb5/Credentials.java
@@ -36,6 +36,7 @@ import sun.security.krb5.internal.ccache.CredentialsCache;
import sun.security.krb5.internal.crypto.EType;
import java.io.IOException;
import java.util.Date;
+import java.util.Locale;
import java.net.InetAddress;
/**
@@ -287,7 +288,7 @@ public class Credentials {
// The default ticket cache on Windows is not a file.
String os = java.security.AccessController.doPrivileged(
new sun.security.action.GetPropertyAction("os.name"));
- if (os.toUpperCase().startsWith("WINDOWS")) {
+ if (os.toUpperCase(Locale.ENGLISH).startsWith("WINDOWS")) {
Credentials creds = acquireDefaultCreds();
if (creds == null) {
if (DEBUG) {
diff --git a/src/share/classes/sun/security/pkcs/PKCS9Attribute.java b/src/share/classes/sun/security/pkcs/PKCS9Attribute.java
index 05b61eb0c32275efa84f376ebe8a7257fb797050..fb1862f6adb58c798cdabc66b73e9d422162e25c 100644
--- a/src/share/classes/sun/security/pkcs/PKCS9Attribute.java
+++ b/src/share/classes/sun/security/pkcs/PKCS9Attribute.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2010, 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
@@ -28,6 +28,7 @@ package sun.security.pkcs;
import java.io.IOException;
import java.io.OutputStream;
import java.security.cert.CertificateException;
+import java.util.Locale;
import java.util.Date;
import java.util.Hashtable;
import sun.security.x509.CertificateExtensions;
@@ -742,7 +743,7 @@ public class PKCS9Attribute implements DerEncoder {
* the name.
*/
public static ObjectIdentifier getOID(String name) {
- return NAME_OID_TABLE.get(name.toLowerCase());
+ return NAME_OID_TABLE.get(name.toLowerCase(Locale.ENGLISH));
}
/**
diff --git a/src/share/classes/sun/security/pkcs11/P11Cipher.java b/src/share/classes/sun/security/pkcs11/P11Cipher.java
index cd6731bae2ce485fb872d36034ff62fa89655542..1ea39e799d1ad9c786c5befcd151ee92e321bf3f 100644
--- a/src/share/classes/sun/security/pkcs11/P11Cipher.java
+++ b/src/share/classes/sun/security/pkcs11/P11Cipher.java
@@ -26,6 +26,7 @@ package sun.security.pkcs11;
import java.nio.ByteBuffer;
import java.util.Arrays;
+import java.util.Locale;
import java.security.*;
import java.security.spec.*;
@@ -201,7 +202,7 @@ final class P11Cipher extends CipherSpi {
}
private int parseMode(String mode) throws NoSuchAlgorithmException {
- mode = mode.toUpperCase();
+ mode = mode.toUpperCase(Locale.ENGLISH);
int result;
if (mode.equals("ECB")) {
result = MODE_ECB;
@@ -222,7 +223,7 @@ final class P11Cipher extends CipherSpi {
throws NoSuchPaddingException {
paddingObj = null;
padBuffer = null;
- padding = padding.toUpperCase();
+ padding = padding.toUpperCase(Locale.ENGLISH);
if (padding.equals("NOPADDING")) {
paddingType = PAD_NONE;
} else if (padding.equals("PKCS5PADDING")) {
diff --git a/src/share/classes/sun/security/pkcs11/P11RSACipher.java b/src/share/classes/sun/security/pkcs11/P11RSACipher.java
index 7a092df10a14f0c5772624aca7bfe037e04ea3a4..18f3ab450efd0d70e0c7748bc0975e4158147d24 100644
--- a/src/share/classes/sun/security/pkcs11/P11RSACipher.java
+++ b/src/share/classes/sun/security/pkcs11/P11RSACipher.java
@@ -29,6 +29,8 @@ import java.security.*;
import java.security.spec.AlgorithmParameterSpec;
import java.security.spec.*;
+import java.util.Locale;
+
import javax.crypto.*;
import javax.crypto.spec.*;
@@ -110,7 +112,7 @@ final class P11RSACipher extends CipherSpi {
protected void engineSetPadding(String padding)
throws NoSuchPaddingException {
- String lowerPadding = padding.toLowerCase();
+ String lowerPadding = padding.toLowerCase(Locale.ENGLISH);
if (lowerPadding.equals("pkcs1Padding")) {
// empty
} else {
diff --git a/src/share/classes/sun/security/provider/certpath/URICertStore.java b/src/share/classes/sun/security/provider/certpath/URICertStore.java
index c0a36b4932ab0e96af38b9d3435f8663351efadb..a27cfa1050510130ee45adf3aa99bffb52ed745b 100644
--- a/src/share/classes/sun/security/provider/certpath/URICertStore.java
+++ b/src/share/classes/sun/security/provider/certpath/URICertStore.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010 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
@@ -52,6 +52,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
+import java.util.Locale;
import sun.security.x509.AccessDescription;
import sun.security.x509.GeneralNameInterface;
import sun.security.x509.URIName;
@@ -162,7 +163,7 @@ class URICertStore extends CertStoreSpi {
}
this.uri = ((URICertStoreParameters) params).uri;
// if ldap URI, use an LDAPCertStore to fetch certs and CRLs
- if (uri.getScheme().toLowerCase().equals("ldap")) {
+ if (uri.getScheme().toLowerCase(Locale.ENGLISH).equals("ldap")) {
if (LDAP.helper() == null)
throw new NoSuchAlgorithmException("LDAP not present");
ldap = true;
diff --git a/src/share/classes/sun/security/util/Debug.java b/src/share/classes/sun/security/util/Debug.java
index df5585096fc606f451525bd569b82a3549926697..5701a80cf9f4a1c3a9f6c10f56c20827829822da 100644
--- a/src/share/classes/sun/security/util/Debug.java
+++ b/src/share/classes/sun/security/util/Debug.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2010, 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
@@ -28,6 +28,7 @@ package sun.security.util;
import java.math.BigInteger;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
+import java.util.Locale;
/**
* A utility class for debuging.
@@ -262,7 +263,7 @@ public class Debug {
source = left;
// convert the rest to lower-case characters
- target.append(source.toString().toLowerCase());
+ target.append(source.toString().toLowerCase(Locale.ENGLISH));
return target.toString();
}
diff --git a/src/share/classes/sun/security/util/DerOutputStream.java b/src/share/classes/sun/security/util/DerOutputStream.java
index f5400c634ece53e3382def801dd87818780b6a1c..c517df8a43ea955c5806fea0a49c90815f2ff7aa 100644
--- a/src/share/classes/sun/security/util/DerOutputStream.java
+++ b/src/share/classes/sun/security/util/DerOutputStream.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2010, 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
@@ -25,17 +25,16 @@
package sun.security.util;
-import java.io.FilterOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
-import java.util.Vector;
import java.util.Comparator;
import java.util.Arrays;
import java.math.BigInteger;
+import java.util.Locale;
/**
@@ -501,7 +500,7 @@ extends ByteArrayOutputStream implements DerEncoder {
pattern = "yyyyMMddHHmmss'Z'";
}
- SimpleDateFormat sdf = new SimpleDateFormat(pattern);
+ SimpleDateFormat sdf = new SimpleDateFormat(pattern, Locale.US);
sdf.setTimeZone(tz);
byte[] time = (sdf.format(d)).getBytes("ISO-8859-1");
diff --git a/src/share/classes/sun/security/x509/AVA.java b/src/share/classes/sun/security/x509/AVA.java
index ce0081523c8152cbf700e1f154464ceb2c56e549..e88947488cc983f23473bcbfe43e7921f9fe3d10 100644
--- a/src/share/classes/sun/security/x509/AVA.java
+++ b/src/share/classes/sun/security/x509/AVA.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2010, 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
@@ -1227,7 +1227,7 @@ class AVAKeyword {
(String keyword, int standard, Map extraKeywordMap)
throws IOException {
- keyword = keyword.toUpperCase();
+ keyword = keyword.toUpperCase(Locale.ENGLISH);
if (standard == AVA.RFC2253) {
if (keyword.startsWith(" ") || keyword.endsWith(" ")) {
throw new IOException("Invalid leading or trailing space " +
diff --git a/src/share/classes/sun/security/x509/AlgorithmId.java b/src/share/classes/sun/security/x509/AlgorithmId.java
index f593304df2955ebbb27619328f09c1247e6455ad..e28c34457187fb8f1ab4137afe450dd5eed3c471 100644
--- a/src/share/classes/sun/security/x509/AlgorithmId.java
+++ b/src/share/classes/sun/security/x509/AlgorithmId.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2010, 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
@@ -553,9 +553,10 @@ public class AlgorithmId implements Serializable, DerEncoder {
for (Enumeration