diff --git a/jdk/make/BuildJdk.gmk b/jdk/make/BuildJdk.gmk index eeb4a533220..ac6d919689f 100644 --- a/jdk/make/BuildJdk.gmk +++ b/jdk/make/BuildJdk.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1995, 2014, 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 @@ -42,8 +42,8 @@ include Setup.gmk # Include Profile information include ProfileNames.gmk -# Include the corresponding custom file, if present. --include $(CUSTOM_MAKE_DIR)/BuildJdk.gmk +# Hook to include the corresponding custom file, if present. +$(eval $(call IncludeCustomExtension, jdk, BuildJdk.gmk)) import: import-only import-only: diff --git a/jdk/make/CompileJavaClasses.gmk b/jdk/make/CompileJavaClasses.gmk index f5e6184eadf..e993d75a8dd 100644 --- a/jdk/make/CompileJavaClasses.gmk +++ b/jdk/make/CompileJavaClasses.gmk @@ -100,8 +100,6 @@ ifneq ($(OPENJDK_TARGET_OS), solaris) EXCLUDES += com/oracle/security endif -EXFILES += WrapperGenerator.java - ifneq ($(OPENJDK_TARGET_OS), windows) # Exclude Window security related files in src/share/classes EXFILES += NTLoginModule.java \ @@ -239,11 +237,6 @@ ifeq (, $(filter $(OPENJDK_TARGET_OS), solaris macosx aix)) EXFILES += sun/nio/fs/PollingWatchService.java endif -# TODO: Fix when converting NIO -# Exclude *-linux-arm.java and *-linux-ppc.java from closed. -EXFILES += -linux-arm.java \ - -linux-ppc.java - ifeq ($(OPENJDK_TARGET_OS), windows) EXFILES += sun/nio/ch/AbstractPollSelectorImpl.java \ sun/nio/ch/PollSelectorProvider.java \ diff --git a/jdk/make/CopyFiles.gmk b/jdk/make/CopyFiles.gmk index 0ac509cc7be..9fba2dd04cc 100644 --- a/jdk/make/CopyFiles.gmk +++ b/jdk/make/CopyFiles.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2014, 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 @@ -570,4 +570,5 @@ COPY_FILES += $(JDK_OUTPUTDIR)/lib/sound.properties ########################################################################################## --include $(CUSTOM_MAKE_DIR)/CopyFiles.gmk +# Hook to include the corresponding custom file, if present. +$(eval $(call IncludeCustomExtension, jdk, CopyFiles.gmk)) diff --git a/jdk/make/CreateJars.gmk b/jdk/make/CreateJars.gmk index 22f0b3b57f5..cda4777e9c6 100644 --- a/jdk/make/CreateJars.gmk +++ b/jdk/make/CreateJars.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2014, 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 @@ -745,7 +745,8 @@ $(IMAGES_OUTPUTDIR)/lib/ext/nashorn.jar: $(NASHORN_DIST)/nashorn.jar ########################################################################################## --include $(CUSTOM_MAKE_DIR)/CreateJars.gmk +# Hook to include the corresponding custom file, if present. +$(eval $(call IncludeCustomExtension, jdk, CreateJars.gmk)) ########################################################################################## diff --git a/jdk/make/Images.gmk b/jdk/make/Images.gmk index 4406a721b80..f5ca8a19f71 100644 --- a/jdk/make/Images.gmk +++ b/jdk/make/Images.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2014, 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 @@ -783,4 +783,5 @@ endif # Profile .PHONY: default images jre-image jdk-image --include $(CUSTOM_MAKE_DIR)/Images.gmk +# Hook to include the corresponding custom file, if present. +$(eval $(call IncludeCustomExtension, jdk, Images.gmk)) diff --git a/jdk/make/Tools.gmk b/jdk/make/Tools.gmk index 661bf3e3b03..52a843bce8e 100644 --- a/jdk/make/Tools.gmk +++ b/jdk/make/Tools.gmk @@ -26,17 +26,11 @@ # Cache all finds needed for this file. Only used on windows. $(eval $(call FillCacheFind, $(JDK_TOPDIR)/make/src/classes)) -TOOLS_SRC := $(JDK_TOPDIR)/make/src/classes - -ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),) - TOOLS_SRC += $(JDK_TOPDIR)/src/solaris/classes/sun/awt/X11/generator -endif - # The exception handling of swing beaninfo which have the own tool directory ifeq (, $(BUILD_TOOLS)) $(eval $(call SetupJavaCompilation,BUILD_TOOLS, \ SETUP := GENERATE_OLDBYTECODE, \ - SRC := $(TOOLS_SRC), \ + SRC := $(JDK_TOPDIR)/make/src/classes, \ BIN := $(JDK_OUTPUTDIR)/btclasses)) endif @@ -111,7 +105,7 @@ TOOL_GENERATENIMBUS = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \ build.tools.generatenimbus.Generator TOOL_WRAPPERGENERATOR = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \ - WrapperGenerator + build.tools.x11wrappergen.WrapperGenerator TOOL_AWT_TOBIN = $(JAVA) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \ build.tools.icondata.awt.ToBin diff --git a/jdk/src/solaris/classes/sun/awt/X11/generator/functions.txt b/jdk/make/data/x11wrappergen/functions.txt similarity index 100% rename from jdk/src/solaris/classes/sun/awt/X11/generator/functions.txt rename to jdk/make/data/x11wrappergen/functions.txt diff --git a/jdk/src/solaris/classes/sun/awt/X11/generator/sizes.32 b/jdk/make/data/x11wrappergen/sizes.32 similarity index 100% rename from jdk/src/solaris/classes/sun/awt/X11/generator/sizes.32 rename to jdk/make/data/x11wrappergen/sizes.32 diff --git a/jdk/src/solaris/classes/sun/awt/X11/generator/sizes.64 b/jdk/make/data/x11wrappergen/sizes.64 similarity index 100% rename from jdk/src/solaris/classes/sun/awt/X11/generator/sizes.64 rename to jdk/make/data/x11wrappergen/sizes.64 diff --git a/jdk/src/solaris/classes/sun/awt/X11/generator/sizes.64-solaris-i386 b/jdk/make/data/x11wrappergen/sizes.64-solaris-i386 similarity index 100% rename from jdk/src/solaris/classes/sun/awt/X11/generator/sizes.64-solaris-i386 rename to jdk/make/data/x11wrappergen/sizes.64-solaris-i386 diff --git a/jdk/src/solaris/classes/sun/awt/X11/generator/xlibtypes.txt b/jdk/make/data/x11wrappergen/xlibtypes.txt similarity index 100% rename from jdk/src/solaris/classes/sun/awt/X11/generator/xlibtypes.txt rename to jdk/make/data/x11wrappergen/xlibtypes.txt diff --git a/jdk/make/gensrc/GensrcMisc.gmk b/jdk/make/gensrc/GensrcMisc.gmk index adb8e858577..32690efd5ee 100644 --- a/jdk/make/gensrc/GensrcMisc.gmk +++ b/jdk/make/gensrc/GensrcMisc.gmk @@ -83,9 +83,9 @@ endif GENSRC_MISC += $(JDK_OUTPUTDIR)/gensrc/sun/nio/ch/SocketOptionRegistry.java -GENSRC_SOR_SRC := $(JDK_TOPDIR)/src/share/native/sun/nio/ch +GENSRC_SOR_SRC := $(JDK_TOPDIR)/make/src/native/genconstants/ch GENSRC_SOR_SRC_FILE := genSocketOptionRegistry.c -GENSRC_SOR_BIN := $(JDK_OUTPUTDIR)/gensrc/genSocketOptionRegistry +GENSRC_SOR_BIN := $(JDK_OUTPUTDIR)/btnative/genSocketOptionRegistry SOR_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_SOR_SRC)/$(GENSRC_SOR_SRC_FILE) | \ $(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }') @@ -100,11 +100,9 @@ $(eval $(call SetupNativeCompilation,BUILD_GENSRC_SOR_EXE, \ OUTPUT_DIR := $(GENSRC_SOR_BIN), \ PROGRAM := genSocketOptionRegistry)) -ifneq ($(wildcard $(JDK_TOPDIR)/src/closed/solaris/classes/sun/nio/ch/SocketOptionRegistry-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java), ) - HAS_SOCKET_OPTION_REGISTRY := true -endif +SOR_PREGEN_FILE := $(JDK_TOPDIR)/src/closed/solaris/classes/sun/nio/ch/SocketOptionRegistry-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java.template -ifneq ($(HAS_SOCKET_OPTION_REGISTRY), true) +ifeq ($(wildcard $(SOR_PREGEN_FILE)), ) $(JDK_OUTPUTDIR)/gensrc/sun/nio/ch/SocketOptionRegistry.java: $(BUILD_GENSRC_SOR_EXE) $(MKDIR) -p $(@D) $(RM) $@ $@.tmp @@ -112,7 +110,7 @@ ifneq ($(HAS_SOCKET_OPTION_REGISTRY), true) $(BUILD_GENSRC_SOR_EXE) >> $@.tmp $(MV) $@.tmp $@ else - $(JDK_OUTPUTDIR)/gensrc/sun/nio/ch/SocketOptionRegistry.java: $(JDK_TOPDIR)/src/closed/solaris/classes/sun/nio/ch/SocketOptionRegistry-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java + $(JDK_OUTPUTDIR)/gensrc/sun/nio/ch/SocketOptionRegistry.java: $(SOR_PREGEN_FILE) $(call install-file) endif @@ -122,9 +120,9 @@ ifneq ($(OPENJDK_TARGET_OS), windows) GENSRC_MISC += $(JDK_OUTPUTDIR)/gensrc/sun/nio/fs/UnixConstants.java - GENSRC_UC_SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/fs + GENSRC_UC_SRC := $(JDK_TOPDIR)/make/src/native/genconstants/fs GENSRC_UC_SRC_FILE := genUnixConstants.c - GENSRC_UC_BIN := $(JDK_OUTPUTDIR)/gensrc/genUnixConstants + GENSRC_UC_BIN := $(JDK_OUTPUTDIR)/btnative/genUnixConstants UC_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_UC_SRC)/$(GENSRC_UC_SRC_FILE) | \ $(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }') @@ -140,11 +138,9 @@ ifneq ($(OPENJDK_TARGET_OS), windows) OUTPUT_DIR := $(GENSRC_UC_BIN), \ PROGRAM := genUnixConstants)) - ifneq ($(wildcard $(JDK_TOPDIR)/src/closed/solaris/classes/sun/nio/fs/UnixConstants-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java), ) - HAS_UNIX_CONSTANTS := true - endif + UC_PREGEN_FILE := $(JDK_TOPDIR)/src/closed/solaris/classes/sun/nio/fs/UnixConstants-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java.template - ifneq ($(HAS_UNIX_CONSTANTS), true) + ifeq ($(wildcard $(UC_PREGEN_FILE)), ) $(JDK_OUTPUTDIR)/gensrc/sun/nio/fs/UnixConstants.java: $(BUILD_GENSRC_UC_EXE) $(MKDIR) -p $(@D) $(RM) $@ $@.tmp @@ -152,7 +148,7 @@ ifneq ($(OPENJDK_TARGET_OS), windows) $(BUILD_GENSRC_UC_EXE) >> $@.tmp $(MV) $@.tmp $@ else - $(JDK_OUTPUTDIR)/gensrc/sun/nio/fs/UnixConstants.java: $(JDK_TOPDIR)/src/closed/solaris/classes/sun/nio/fs/UnixConstants-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java + $(JDK_OUTPUTDIR)/gensrc/sun/nio/fs/UnixConstants.java: $(UC_PREGEN_FILE) $(call install-file) endif @@ -164,9 +160,9 @@ ifeq ($(OPENJDK_TARGET_OS), solaris) GENSRC_MISC += $(JDK_OUTPUTDIR)/gensrc/sun/nio/fs/SolarisConstants.java - GENSRC_SOL_SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/fs + GENSRC_SOL_SRC := $(JDK_TOPDIR)/make/src/native/genconstants/fs GENSRC_SOL_SRC_FILE := genSolarisConstants.c - GENSRC_SOL_BIN := $(JDK_OUTPUTDIR)/gensrc/genSolarisConstants + GENSRC_SOL_BIN := $(JDK_OUTPUTDIR)/btnative/genSolarisConstants SOL_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_SOL_SRC)/$(GENSRC_SOL_SRC_FILE) | \ $(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }') diff --git a/jdk/make/gensrc/GensrcX11Wrappers.gmk b/jdk/make/gensrc/GensrcX11Wrappers.gmk index 0afe0664104..2aff2f48b0a 100644 --- a/jdk/make/gensrc/GensrcX11Wrappers.gmk +++ b/jdk/make/gensrc/GensrcX11Wrappers.gmk @@ -42,7 +42,7 @@ GENSRC_X11WRAPPERS_TMP := $(JDK_OUTPUTDIR)/gensrc_x11wrappers GENSRC_X11WRAPPERS_DST := $(JDK_OUTPUTDIR)/gensrc/sun/awt/X11 # The pre-calculated offset file are stored here: -GENSRC_SIZER_DIR := $(JDK_TOPDIR)/src/solaris/classes/sun/awt/X11/generator +GENSRC_SIZER_DIR := $(JDK_TOPDIR)/make/data/x11wrappergen # Normal case is to generate only according to target bits GENSRC_X11_VERSION := $(OPENJDK_TARGET_CPU_BITS) diff --git a/jdk/make/lib/Awt2dLibraries.gmk b/jdk/make/lib/Awt2dLibraries.gmk index a1263ba5775..140fff2b832 100644 --- a/jdk/make/lib/Awt2dLibraries.gmk +++ b/jdk/make/lib/Awt2dLibraries.gmk @@ -23,6 +23,9 @@ # questions. # +# Hook to include the corresponding custom file, if present. +$(eval $(call IncludeCustomExtension, jdk, lib/Awt2dLibraries.gmk)) + # Openwin is defined on Solaris. OPENWIN_LIB := $(OPENWIN_HOME)/lib @@ -550,10 +553,6 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),) endif ifeq ($(OPENJDK_TARGET_OS), linux) - ifndef OPENJDK - include $(JDK_TOPDIR)/make/closed/xawt.gmk - endif - ifeq ($(DISABLE_XRENDER), true) LIBAWT_XAWT_CFLAGS += -DDISABLE_XRENDER_BY_DEFAULT=true endif diff --git a/jdk/src/solaris/classes/sun/awt/X11/generator/WrapperGenerator.java b/jdk/make/src/classes/build/tools/x11wrappergen/WrapperGenerator.java similarity index 99% rename from jdk/src/solaris/classes/sun/awt/X11/generator/WrapperGenerator.java rename to jdk/make/src/classes/build/tools/x11wrappergen/WrapperGenerator.java index 9da0fd93442..e3a68c42afb 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/generator/WrapperGenerator.java +++ b/jdk/make/src/classes/build/tools/x11wrappergen/WrapperGenerator.java @@ -23,6 +23,8 @@ * questions. */ +package build.tools.x11wrappergen; + import java.util.*; import java.io.*; import java.nio.charset.*; diff --git a/jdk/src/share/native/sun/nio/ch/genSocketOptionRegistry.c b/jdk/make/src/native/genconstants/ch/genSocketOptionRegistry.c similarity index 100% rename from jdk/src/share/native/sun/nio/ch/genSocketOptionRegistry.c rename to jdk/make/src/native/genconstants/ch/genSocketOptionRegistry.c diff --git a/jdk/src/solaris/native/sun/nio/fs/genSolarisConstants.c b/jdk/make/src/native/genconstants/fs/genSolarisConstants.c similarity index 100% rename from jdk/src/solaris/native/sun/nio/fs/genSolarisConstants.c rename to jdk/make/src/native/genconstants/fs/genSolarisConstants.c diff --git a/jdk/src/solaris/native/sun/nio/fs/genUnixConstants.c b/jdk/make/src/native/genconstants/fs/genUnixConstants.c similarity index 100% rename from jdk/src/solaris/native/sun/nio/fs/genUnixConstants.c rename to jdk/make/src/native/genconstants/fs/genUnixConstants.c diff --git a/jdk/src/aix/classes/sun/nio/ch/AixPollPort.java b/jdk/src/aix/classes/sun/nio/ch/AixPollPort.java index 2db99a77b3e..a7a954597e5 100644 --- a/jdk/src/aix/classes/sun/nio/ch/AixPollPort.java +++ b/jdk/src/aix/classes/sun/nio/ch/AixPollPort.java @@ -107,6 +107,7 @@ final class AixPollPort private final ArrayBlockingQueue queue; private final Event NEED_TO_POLL = new Event(null, 0); private final Event EXECUTE_TASK_OR_SHUTDOWN = new Event(null, 0); + private final Event CONTINUE_AFTER_CTL_EVENT = new Event(null, 0); // encapsulates a pollset control event for a file descriptor static class ControlEvent { @@ -342,7 +343,11 @@ final class AixPollPort // To emulate one shot semantic we need to remove // the file descriptor here. - pollsetCtl(pollset, PS_DELETE, fd, 0); + if (fd != sp[0] && fd != ctlSp[0]) { + synchronized (controlQueue) { + pollsetCtl(pollset, PS_DELETE, fd, 0); + } + } // wakeup if (fd == sp[0]) { @@ -351,10 +356,6 @@ final class AixPollPort drain1(sp[0]); } - // This is the only file descriptor without - // one shot semantic => register it again. - pollsetCtl(pollset, PS_ADD, sp[0], Net.POLLIN); - // queue special event if there are more events // to handle. if (n > 0) { @@ -368,12 +369,12 @@ final class AixPollPort if (fd == ctlSp[0]) { synchronized (controlQueue) { drain1(ctlSp[0]); - // This file descriptor does not have - // one shot semantic => register it again. - pollsetCtl(pollset, PS_ADD, ctlSp[0], Net.POLLIN); processControlQueue(); } - continue; + if (n > 0) { + continue; + } + return CONTINUE_AFTER_CTL_EVENT; } PollableChannel channel = fdToChannel.get(fd); @@ -431,6 +432,11 @@ final class AixPollPort continue; } + // contine after we processed a control event + if (ev == CONTINUE_AFTER_CTL_EVENT) { + continue; + } + // handle wakeup to execute task or shutdown if (ev == EXECUTE_TASK_OR_SHUTDOWN) { Runnable task = pollTask(); diff --git a/jdk/src/share/bin/java.c b/jdk/src/share/bin/java.c index b72fa0e6d26..79912d52d0a 100644 --- a/jdk/src/share/bin/java.c +++ b/jdk/src/share/bin/java.c @@ -345,10 +345,10 @@ JLI_Launch(int argc, char ** argv, /* main argc, argc */ } \ } while (JNI_FALSE) -#define CHECK_EXCEPTION_RETURN(CER_return_value) \ +#define CHECK_EXCEPTION_RETURN() \ do { \ if ((*env)->ExceptionOccurred(env)) { \ - return CER_return_value; \ + return; \ } \ } while (JNI_FALSE) @@ -1258,7 +1258,6 @@ static jclass GetApplicationClass(JNIEnv *env) { jmethodID mid; - jobject result; jclass cls = GetLauncherHelperClass(env); NULL_CHECK0(cls); NULL_CHECK0(mid = (*env)->GetStaticMethodID(env, cls, diff --git a/jdk/src/share/bin/parse_manifest.c b/jdk/src/share/bin/parse_manifest.c index 4926824e36b..c17249c0b30 100644 --- a/jdk/src/share/bin/parse_manifest.c +++ b/jdk/src/share/bin/parse_manifest.c @@ -233,7 +233,7 @@ compute_cen(int fd, Byte *bp) jlong base_offset; jlong offset; char buffer[MINREAD]; - p = buffer; + p = (Byte*) buffer; /* * Read the END Header, which is the starting point for ZIP files. * (Clearly designed to make writing a zip file easier than reading @@ -276,7 +276,7 @@ compute_cen(int fd, Byte *bp) if (JLI_Lseek(fd, offset, SEEK_SET) < (jlong)0) { return (-1); } - p = buffer; + p = (Byte*) buffer; base_offset = base_offset - ZIP64_ENDSIZ(p) - ZIP64_ENDOFF(p) - ZIP64_ENDHDR; } else { base_offset = base_offset - ENDSIZ(p) - ENDOFF(p); diff --git a/jdk/src/share/classes/com/sun/security/auth/callback/TextCallbackHandler.java b/jdk/src/share/classes/com/sun/security/auth/callback/TextCallbackHandler.java index 6bebfb4f398..86dfb7fba14 100644 --- a/jdk/src/share/classes/com/sun/security/auth/callback/TextCallbackHandler.java +++ b/jdk/src/share/classes/com/sun/security/auth/callback/TextCallbackHandler.java @@ -28,21 +28,14 @@ package com.sun.security.auth.callback; /* JAAS imports */ import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; -import javax.security.auth.callback.ConfirmationCallback; -import javax.security.auth.callback.NameCallback; -import javax.security.auth.callback.PasswordCallback; -import javax.security.auth.callback.TextOutputCallback; +import javax.security.auth.callback.NameCallback; // javadoc +import javax.security.auth.callback.PasswordCallback; // javadoc import javax.security.auth.callback.UnsupportedCallbackException; /* Java imports */ -import java.io.BufferedReader; import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.PushbackInputStream; -import java.util.Arrays; -import sun.security.util.Password; +import sun.security.util.ConsoleCallbackHandler; /** *

@@ -55,6 +48,7 @@ import sun.security.util.Password; @jdk.Exported public class TextCallbackHandler implements CallbackHandler { + private final CallbackHandler consoleHandler; /** *

Creates a callback handler that prompts and reads from the @@ -63,7 +57,9 @@ public class TextCallbackHandler implements CallbackHandler { * CallbackHandler. */ - public TextCallbackHandler() { } + public TextCallbackHandler() { + this.consoleHandler = new ConsoleCallbackHandler(); + } /** * Handles the specified set of callbacks. @@ -76,187 +72,7 @@ public class TextCallbackHandler implements CallbackHandler { public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { - ConfirmationCallback confirmation = null; - - for (int i = 0; i < callbacks.length; i++) { - if (callbacks[i] instanceof TextOutputCallback) { - TextOutputCallback tc = (TextOutputCallback) callbacks[i]; - - String text; - switch (tc.getMessageType()) { - case TextOutputCallback.INFORMATION: - text = ""; - break; - case TextOutputCallback.WARNING: - text = "Warning: "; - break; - case TextOutputCallback.ERROR: - text = "Error: "; - break; - default: - throw new UnsupportedCallbackException( - callbacks[i], "Unrecognized message type"); - } - - String message = tc.getMessage(); - if (message != null) { - text += message; - } - if (text != null) { - System.err.println(text); - } - - } else if (callbacks[i] instanceof NameCallback) { - NameCallback nc = (NameCallback) callbacks[i]; - - if (nc.getDefaultName() == null) { - System.err.print(nc.getPrompt()); - } else { - System.err.print(nc.getPrompt() + - " [" + nc.getDefaultName() + "] "); - } - System.err.flush(); - - String result = readLine(); - if (result.equals("")) { - result = nc.getDefaultName(); - } - - nc.setName(result); - - } else if (callbacks[i] instanceof PasswordCallback) { - PasswordCallback pc = (PasswordCallback) callbacks[i]; - - System.err.print(pc.getPrompt()); - System.err.flush(); - - pc.setPassword(Password.readPassword(System.in, pc.isEchoOn())); - - } else if (callbacks[i] instanceof ConfirmationCallback) { - confirmation = (ConfirmationCallback) callbacks[i]; - - } else { - throw new UnsupportedCallbackException( - callbacks[i], "Unrecognized Callback"); - } - } - - /* Do the confirmation callback last. */ - if (confirmation != null) { - doConfirmation(confirmation); - } - } - - /* Reads a line of input */ - private String readLine() throws IOException { - String result = new BufferedReader - (new InputStreamReader(System.in)).readLine(); - if (result == null) { - throw new IOException("Cannot read from System.in"); - } - return result; - } - - private void doConfirmation(ConfirmationCallback confirmation) - throws IOException, UnsupportedCallbackException - { - String prefix; - int messageType = confirmation.getMessageType(); - switch (messageType) { - case ConfirmationCallback.WARNING: - prefix = "Warning: "; - break; - case ConfirmationCallback.ERROR: - prefix = "Error: "; - break; - case ConfirmationCallback.INFORMATION: - prefix = ""; - break; - default: - throw new UnsupportedCallbackException( - confirmation, "Unrecognized message type: " + messageType); - } - - class OptionInfo { - String name; - int value; - OptionInfo(String name, int value) { - this.name = name; - this.value = value; - } - } - - OptionInfo[] options; - int optionType = confirmation.getOptionType(); - switch (optionType) { - case ConfirmationCallback.YES_NO_OPTION: - options = new OptionInfo[] { - new OptionInfo("Yes", ConfirmationCallback.YES), - new OptionInfo("No", ConfirmationCallback.NO) - }; - break; - case ConfirmationCallback.YES_NO_CANCEL_OPTION: - options = new OptionInfo[] { - new OptionInfo("Yes", ConfirmationCallback.YES), - new OptionInfo("No", ConfirmationCallback.NO), - new OptionInfo("Cancel", ConfirmationCallback.CANCEL) - }; - break; - case ConfirmationCallback.OK_CANCEL_OPTION: - options = new OptionInfo[] { - new OptionInfo("OK", ConfirmationCallback.OK), - new OptionInfo("Cancel", ConfirmationCallback.CANCEL) - }; - break; - case ConfirmationCallback.UNSPECIFIED_OPTION: - String[] optionStrings = confirmation.getOptions(); - options = new OptionInfo[optionStrings.length]; - for (int i = 0; i < options.length; i++) { - options[i] = new OptionInfo(optionStrings[i], i); - } - break; - default: - throw new UnsupportedCallbackException( - confirmation, "Unrecognized option type: " + optionType); - } - - int defaultOption = confirmation.getDefaultOption(); - - String prompt = confirmation.getPrompt(); - if (prompt == null) { - prompt = ""; - } - prompt = prefix + prompt; - if (!prompt.equals("")) { - System.err.println(prompt); - } - - for (int i = 0; i < options.length; i++) { - if (optionType == ConfirmationCallback.UNSPECIFIED_OPTION) { - // defaultOption is an index into the options array - System.err.println( - i + ". " + options[i].name + - (i == defaultOption ? " [default]" : "")); - } else { - // defaultOption is an option value - System.err.println( - i + ". " + options[i].name + - (options[i].value == defaultOption ? " [default]" : "")); - } - } - System.err.print("Enter a number: "); - System.err.flush(); - int result; - try { - result = Integer.parseInt(readLine()); - if (result < 0 || result > (options.length - 1)) { - result = defaultOption; - } - result = options[result].value; - } catch (NumberFormatException e) { - result = defaultOption; - } - - confirmation.setSelectedIndex(result); + // delegate to console handler + consoleHandler.handle(callbacks); } } diff --git a/jdk/src/share/classes/java/lang/invoke/MethodHandle.java b/jdk/src/share/classes/java/lang/invoke/MethodHandle.java index ce115df85ed..f142076f528 100644 --- a/jdk/src/share/classes/java/lang/invoke/MethodHandle.java +++ b/jdk/src/share/classes/java/lang/invoke/MethodHandle.java @@ -31,8 +31,6 @@ import sun.invoke.util.*; import sun.misc.Unsafe; import static java.lang.invoke.MethodHandleStatics.*; -import java.util.logging.Level; -import java.util.logging.Logger; /** * A method handle is a typed, directly executable reference to an underlying method, diff --git a/jdk/src/share/classes/java/lang/invoke/SimpleMethodHandle.java b/jdk/src/share/classes/java/lang/invoke/SimpleMethodHandle.java index c2d8e583a88..07f08dd6962 100644 --- a/jdk/src/share/classes/java/lang/invoke/SimpleMethodHandle.java +++ b/jdk/src/share/classes/java/lang/invoke/SimpleMethodHandle.java @@ -27,8 +27,6 @@ package java.lang.invoke; import static java.lang.invoke.LambdaForm.*; import static java.lang.invoke.MethodHandleNatives.Constants.*; -import java.util.logging.Level; -import java.util.logging.Logger; /** * A method handle whose behavior is determined only by its LambdaForm. diff --git a/jdk/src/share/classes/java/sql/Clob.java b/jdk/src/share/classes/java/sql/Clob.java index 86bd1cc870c..2cfd4e47018 100644 --- a/jdk/src/share/classes/java/sql/Clob.java +++ b/jdk/src/share/classes/java/sql/Clob.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2014, 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 @@ -309,8 +309,8 @@ public interface Clob { void truncate(long len) throws SQLException; /** - * This method frees the Clob object and releases the resources the resources - * that it holds. The object is invalid once the free method + * This method releases the resources that the Clob object + * holds. The object is invalid once the free method * is called. *

* After free has been called, any attempt to invoke a diff --git a/jdk/src/share/classes/javax/imageio/spi/ServiceRegistry.java b/jdk/src/share/classes/javax/imageio/spi/ServiceRegistry.java index 3f4338d7db9..a3fc54816a2 100644 --- a/jdk/src/share/classes/javax/imageio/spi/ServiceRegistry.java +++ b/jdk/src/share/classes/javax/imageio/spi/ServiceRegistry.java @@ -123,15 +123,6 @@ public class ServiceRegistry { } } - // The following two methods expose functionality from - // sun.misc.Service. If that class is made public, they may be - // removed. - // - // The sun.misc.ServiceConfigurationError class may also be - // exposed, in which case the references to 'an - // Error' below should be changed to 'a - // ServiceConfigurationError'. - /** * Searches for implementations of a particular service class * using the given class loader. diff --git a/jdk/src/share/classes/javax/naming/AuthenticationException.java b/jdk/src/share/classes/javax/naming/AuthenticationException.java index c66f4eaab31..2c0d788bf5a 100644 --- a/jdk/src/share/classes/javax/naming/AuthenticationException.java +++ b/jdk/src/share/classes/javax/naming/AuthenticationException.java @@ -29,7 +29,7 @@ package javax.naming; * This exception is thrown when an authentication error occurs while * accessing the naming or directory service. * An authentication error can happen, for example, when the credentials - * supplied by the user program is invalid or otherwise fails to + * supplied by the user program are invalid or otherwise fail to * authenticate the user to the naming/directory service. *

* If the program wants to handle this exception in particular, it @@ -37,7 +37,7 @@ package javax.naming; * catch NamingException. After catching AuthenticationException, the * program could reattempt the authentication by updating * the resolved context's environment properties with the appropriate - * appropriate credentials. + * credentials. *

* Synchronization and serialization issues that apply to NamingException * apply directly here. diff --git a/jdk/src/share/classes/javax/naming/AuthenticationNotSupportedException.java b/jdk/src/share/classes/javax/naming/AuthenticationNotSupportedException.java index aae22489f44..2287a3c636a 100644 --- a/jdk/src/share/classes/javax/naming/AuthenticationNotSupportedException.java +++ b/jdk/src/share/classes/javax/naming/AuthenticationNotSupportedException.java @@ -67,7 +67,7 @@ public class AuthenticationNotSupportedException extends NamingSecurityException /** * Constructs a new instance of AuthenticationNotSupportedException - * all name resolution fields and explanation initialized to null. + * with all name resolution fields and explanation initialized to null. */ public AuthenticationNotSupportedException() { super(); diff --git a/jdk/src/share/classes/javax/naming/CannotProceedException.java b/jdk/src/share/classes/javax/naming/CannotProceedException.java index 9754bd768e6..da3f55b1087 100644 --- a/jdk/src/share/classes/javax/naming/CannotProceedException.java +++ b/jdk/src/share/classes/javax/naming/CannotProceedException.java @@ -64,7 +64,7 @@ public class CannotProceedException extends NamingException { /** * Contains the remaining unresolved part of the second * "name" argument to Context.rename(). - * This information necessary for + * This information is necessary for * continuing the Context.rename() operation. *

* This field is initialized to null. diff --git a/jdk/src/share/classes/javax/naming/CompositeName.java b/jdk/src/share/classes/javax/naming/CompositeName.java index 7c79d529959..93ef152c64b 100644 --- a/jdk/src/share/classes/javax/naming/CompositeName.java +++ b/jdk/src/share/classes/javax/naming/CompositeName.java @@ -205,7 +205,7 @@ public class CompositeName implements Name { private transient NameImpl impl; /** * Constructs a new composite name instance using the components - * specified by 'comps'. This protected method is intended to be + * specified by 'comps'. This protected method is intended * to be used by subclasses of CompositeName when they override * methods such as clone(), getPrefix(), getSuffix(). * @@ -436,7 +436,7 @@ public class CompositeName implements Name { /** * Determines whether a composite name is a suffix of this composite name. - * A composite name 'n' is a suffix if it it is equal to + * A composite name 'n' is a suffix if it is equal to * getSuffix(size()-n.size())--in other words, this * composite name ends with 'n'. * If n is null or not a composite name, false is returned. diff --git a/jdk/src/share/classes/javax/naming/CompoundName.java b/jdk/src/share/classes/javax/naming/CompoundName.java index 6d41cf861e4..059d951cd71 100644 --- a/jdk/src/share/classes/javax/naming/CompoundName.java +++ b/jdk/src/share/classes/javax/naming/CompoundName.java @@ -165,7 +165,7 @@ public class CompoundName implements Name { /** * Constructs a new compound name instance using the components - * specified in comps and syntax. This protected method is intended to be + * specified in comps and syntax. This protected method is intended * to be used by subclasses of CompoundName when they override * methods such as clone(), getPrefix(), getSuffix(). * @@ -365,7 +365,7 @@ public class CompoundName implements Name { * components in this compound name. * The result and this compound name share the same syntax. * Subsequent changes to - * this compound name does not affect the name that is returned and + * this compound name do not affect the name that is returned and * vice versa. * * @param posn The 0-based index of the component at which to stop. @@ -385,7 +385,7 @@ public class CompoundName implements Name { * components in this compound name. * The result and this compound name share the same syntax. * Subsequent changes to - * this compound name does not affect the name that is returned. + * this compound name do not affect the name that is returned. * * @param posn The 0-based index of the component at which to start. * Must be in the range [0,size()]. @@ -423,7 +423,7 @@ public class CompoundName implements Name { /** * Determines whether a compound name is a suffix of this compound name. - * A compound name 'n' is a suffix if it it is equal to + * A compound name 'n' is a suffix if it is equal to * getSuffix(size()-n.size())--in other words, this * compound name ends with 'n'. * If n is null or not a compound name, false is returned. diff --git a/jdk/src/share/classes/javax/naming/LinkException.java b/jdk/src/share/classes/javax/naming/LinkException.java index 30f3ea4478f..60ce3d16181 100644 --- a/jdk/src/share/classes/javax/naming/LinkException.java +++ b/jdk/src/share/classes/javax/naming/LinkException.java @@ -26,11 +26,11 @@ package javax.naming; /** - * This exception is used to describe problems encounter while resolving links. - * Addition information is added to the base NamingException for pinpointing + * This exception is used to describe problems encountered while resolving links. + * Additional information is added to the base NamingException for pinpointing * the problem with the link. *

- * Analogous to how NamingException captures name resolution information, + * Analogously to how NamingException captures name resolution information, * LinkException captures "link"-name resolution information pinpointing * the problem encountered while resolving a link. All these fields may * be null. @@ -111,7 +111,7 @@ public class LinkException extends NamingException { protected String linkExplanation; /** - * Constructs a new instance of LinkException with an explanation + * Constructs a new instance of LinkException with an explanation. * All the other fields are initialized to null. * @param explanation A possibly null string containing additional * detail about this exception. @@ -176,7 +176,7 @@ public class LinkException extends NamingException { } /** - * Retrieves the explanation associated with the problem encounter + * Retrieves the explanation associated with the problem encountered * when resolving a link. * * @return The possibly null detail string explaining more about the problem @@ -190,7 +190,7 @@ public class LinkException extends NamingException { } /** - * Sets the explanation associated with the problem encounter + * Sets the explanation associated with the problem encountered * when resolving a link. * * @param msg The possibly null detail string explaining more about the problem @@ -211,7 +211,7 @@ public class LinkException extends NamingException { * invoke this method using the resulting composite name. *

* A copy of name is made and stored. - * Subsequent changes to name does not + * Subsequent changes to name do not * affect the copy in this NamingException and vice versa. * * @@ -237,7 +237,7 @@ public class LinkException extends NamingException { * invoke this method using the resulting composite name. *

* A copy of name is made and stored. - * Subsequent changes to name does not + * Subsequent changes to name do not * affect the copy in this NamingException and vice versa. * * @param name The name to set remaining link name to. This can be null. diff --git a/jdk/src/share/classes/javax/naming/LinkLoopException.java b/jdk/src/share/classes/javax/naming/LinkLoopException.java index 58b6a65b42a..6865233cf81 100644 --- a/jdk/src/share/classes/javax/naming/LinkLoopException.java +++ b/jdk/src/share/classes/javax/naming/LinkLoopException.java @@ -27,7 +27,7 @@ package javax.naming; /** * This exception is thrown when - * a loop was detected will attempting to resolve a link, or an implementation + * a loop was detected while attempting to resolve a link, or an implementation * specific limit on link counts has been reached. *

* Synchronization and serialization issues that apply to LinkException @@ -42,7 +42,7 @@ package javax.naming; public class LinkLoopException extends LinkException { /** - * Constructs a new instance of LinkLoopException with an explanation + * Constructs a new instance of LinkLoopException with an explanation. * All the other fields are initialized to null. * @param explanation A possibly null string containing additional * detail about this exception. diff --git a/jdk/src/share/classes/javax/naming/MalformedLinkException.java b/jdk/src/share/classes/javax/naming/MalformedLinkException.java index f23ef9e40f2..1d7e511fd7c 100644 --- a/jdk/src/share/classes/javax/naming/MalformedLinkException.java +++ b/jdk/src/share/classes/javax/naming/MalformedLinkException.java @@ -42,7 +42,7 @@ package javax.naming; public class MalformedLinkException extends LinkException { /** - * Constructs a new instance of MalformedLinkException with an explanation + * Constructs a new instance of MalformedLinkException with an explanation. * All the other fields are initialized to null. * @param explanation A possibly null string containing additional * detail about this exception. diff --git a/jdk/src/share/classes/javax/naming/NamingException.java b/jdk/src/share/classes/javax/naming/NamingException.java index 030acc6a72f..e1252da5f00 100644 --- a/jdk/src/share/classes/javax/naming/NamingException.java +++ b/jdk/src/share/classes/javax/naming/NamingException.java @@ -201,7 +201,7 @@ public class NamingException extends Exception { * invoke this method using the resulting composite name. *

* A copy of name is made and stored. - * Subsequent changes to name does not + * Subsequent changes to name do not * affect the copy in this NamingException and vice versa. * * @param name The possibly null name to set resolved name to. @@ -225,7 +225,7 @@ public class NamingException extends Exception { * invoke this method using the resulting composite name. *

* A copy of name is made and stored. - * Subsequent changes to name does not + * Subsequent changes to name do not * affect the copy in this NamingException and vice versa. * @param name The possibly null name to set remaining name to. * If null, it sets the remaining name field to null. @@ -279,7 +279,7 @@ public class NamingException extends Exception { * a compound name, you should "stringify" the compound name * then invoke the overloaded form that accepts a String parameter. *

- * Subsequent changes to name does not + * Subsequent changes to name do not * affect the remaining name field in this NamingException and vice versa. * @param name The possibly null name containing ordered components to add. * If name is null, this method does not do anything. diff --git a/jdk/src/share/classes/javax/naming/RefAddr.java b/jdk/src/share/classes/javax/naming/RefAddr.java index 92ac4320f5d..3dc90f21adf 100644 --- a/jdk/src/share/classes/javax/naming/RefAddr.java +++ b/jdk/src/share/classes/javax/naming/RefAddr.java @@ -90,7 +90,7 @@ public abstract class RefAddr implements java.io.Serializable { /** * Determines whether obj is equal to this RefAddr. *

- * obj is equal to this RefAddr all of these conditions are true + * obj is equal to this RefAddr if all of these conditions are true *