This commit is contained in:
Sean Mullan 2014-02-17 11:37:46 -05:00
commit 2ef59ffae4
85 changed files with 473 additions and 967 deletions

View File

@ -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. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -42,8 +42,8 @@ include Setup.gmk
# Include Profile information # Include Profile information
include ProfileNames.gmk include ProfileNames.gmk
# Include the corresponding custom file, if present. # Hook to include the corresponding custom file, if present.
-include $(CUSTOM_MAKE_DIR)/BuildJdk.gmk $(eval $(call IncludeCustomExtension, jdk, BuildJdk.gmk))
import: import-only import: import-only
import-only: import-only:

View File

@ -100,8 +100,6 @@ ifneq ($(OPENJDK_TARGET_OS), solaris)
EXCLUDES += com/oracle/security EXCLUDES += com/oracle/security
endif endif
EXFILES += WrapperGenerator.java
ifneq ($(OPENJDK_TARGET_OS), windows) ifneq ($(OPENJDK_TARGET_OS), windows)
# Exclude Window security related files in src/share/classes # Exclude Window security related files in src/share/classes
EXFILES += NTLoginModule.java \ EXFILES += NTLoginModule.java \
@ -239,11 +237,6 @@ ifeq (, $(filter $(OPENJDK_TARGET_OS), solaris macosx aix))
EXFILES += sun/nio/fs/PollingWatchService.java EXFILES += sun/nio/fs/PollingWatchService.java
endif 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) ifeq ($(OPENJDK_TARGET_OS), windows)
EXFILES += sun/nio/ch/AbstractPollSelectorImpl.java \ EXFILES += sun/nio/ch/AbstractPollSelectorImpl.java \
sun/nio/ch/PollSelectorProvider.java \ sun/nio/ch/PollSelectorProvider.java \

View File

@ -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. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -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))

View File

@ -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. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -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))
########################################################################################## ##########################################################################################

View File

@ -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. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -783,4 +783,5 @@ endif # Profile
.PHONY: default images jre-image jdk-image .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))

View File

@ -26,17 +26,11 @@
# Cache all finds needed for this file. Only used on windows. # Cache all finds needed for this file. Only used on windows.
$(eval $(call FillCacheFind, $(JDK_TOPDIR)/make/src/classes)) $(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 # The exception handling of swing beaninfo which have the own tool directory
ifeq (, $(BUILD_TOOLS)) ifeq (, $(BUILD_TOOLS))
$(eval $(call SetupJavaCompilation,BUILD_TOOLS, \ $(eval $(call SetupJavaCompilation,BUILD_TOOLS, \
SETUP := GENERATE_OLDBYTECODE, \ SETUP := GENERATE_OLDBYTECODE, \
SRC := $(TOOLS_SRC), \ SRC := $(JDK_TOPDIR)/make/src/classes, \
BIN := $(JDK_OUTPUTDIR)/btclasses)) BIN := $(JDK_OUTPUTDIR)/btclasses))
endif endif
@ -111,7 +105,7 @@ TOOL_GENERATENIMBUS = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
build.tools.generatenimbus.Generator build.tools.generatenimbus.Generator
TOOL_WRAPPERGENERATOR = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \ TOOL_WRAPPERGENERATOR = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
WrapperGenerator build.tools.x11wrappergen.WrapperGenerator
TOOL_AWT_TOBIN = $(JAVA) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \ TOOL_AWT_TOBIN = $(JAVA) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
build.tools.icondata.awt.ToBin build.tools.icondata.awt.ToBin

View File

@ -83,9 +83,9 @@ endif
GENSRC_MISC += $(JDK_OUTPUTDIR)/gensrc/sun/nio/ch/SocketOptionRegistry.java 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_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) | \ SOR_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_SOR_SRC)/$(GENSRC_SOR_SRC_FILE) | \
$(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }') $(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')
@ -100,11 +100,9 @@ $(eval $(call SetupNativeCompilation,BUILD_GENSRC_SOR_EXE, \
OUTPUT_DIR := $(GENSRC_SOR_BIN), \ OUTPUT_DIR := $(GENSRC_SOR_BIN), \
PROGRAM := genSocketOptionRegistry)) PROGRAM := genSocketOptionRegistry))
ifneq ($(wildcard $(JDK_TOPDIR)/src/closed/solaris/classes/sun/nio/ch/SocketOptionRegistry-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java), ) SOR_PREGEN_FILE := $(JDK_TOPDIR)/src/closed/solaris/classes/sun/nio/ch/SocketOptionRegistry-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java.template
HAS_SOCKET_OPTION_REGISTRY := true
endif
ifneq ($(HAS_SOCKET_OPTION_REGISTRY), true) ifeq ($(wildcard $(SOR_PREGEN_FILE)), )
$(JDK_OUTPUTDIR)/gensrc/sun/nio/ch/SocketOptionRegistry.java: $(BUILD_GENSRC_SOR_EXE) $(JDK_OUTPUTDIR)/gensrc/sun/nio/ch/SocketOptionRegistry.java: $(BUILD_GENSRC_SOR_EXE)
$(MKDIR) -p $(@D) $(MKDIR) -p $(@D)
$(RM) $@ $@.tmp $(RM) $@ $@.tmp
@ -112,7 +110,7 @@ ifneq ($(HAS_SOCKET_OPTION_REGISTRY), true)
$(BUILD_GENSRC_SOR_EXE) >> $@.tmp $(BUILD_GENSRC_SOR_EXE) >> $@.tmp
$(MV) $@.tmp $@ $(MV) $@.tmp $@
else 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) $(call install-file)
endif endif
@ -122,9 +120,9 @@ ifneq ($(OPENJDK_TARGET_OS), windows)
GENSRC_MISC += $(JDK_OUTPUTDIR)/gensrc/sun/nio/fs/UnixConstants.java 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_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) | \ UC_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_UC_SRC)/$(GENSRC_UC_SRC_FILE) | \
$(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }') $(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')
@ -140,11 +138,9 @@ ifneq ($(OPENJDK_TARGET_OS), windows)
OUTPUT_DIR := $(GENSRC_UC_BIN), \ OUTPUT_DIR := $(GENSRC_UC_BIN), \
PROGRAM := genUnixConstants)) PROGRAM := genUnixConstants))
ifneq ($(wildcard $(JDK_TOPDIR)/src/closed/solaris/classes/sun/nio/fs/UnixConstants-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java), ) UC_PREGEN_FILE := $(JDK_TOPDIR)/src/closed/solaris/classes/sun/nio/fs/UnixConstants-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java.template
HAS_UNIX_CONSTANTS := true
endif
ifneq ($(HAS_UNIX_CONSTANTS), true) ifeq ($(wildcard $(UC_PREGEN_FILE)), )
$(JDK_OUTPUTDIR)/gensrc/sun/nio/fs/UnixConstants.java: $(BUILD_GENSRC_UC_EXE) $(JDK_OUTPUTDIR)/gensrc/sun/nio/fs/UnixConstants.java: $(BUILD_GENSRC_UC_EXE)
$(MKDIR) -p $(@D) $(MKDIR) -p $(@D)
$(RM) $@ $@.tmp $(RM) $@ $@.tmp
@ -152,7 +148,7 @@ ifneq ($(OPENJDK_TARGET_OS), windows)
$(BUILD_GENSRC_UC_EXE) >> $@.tmp $(BUILD_GENSRC_UC_EXE) >> $@.tmp
$(MV) $@.tmp $@ $(MV) $@.tmp $@
else 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) $(call install-file)
endif endif
@ -164,9 +160,9 @@ ifeq ($(OPENJDK_TARGET_OS), solaris)
GENSRC_MISC += $(JDK_OUTPUTDIR)/gensrc/sun/nio/fs/SolarisConstants.java 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_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) | \ SOL_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_SOL_SRC)/$(GENSRC_SOL_SRC_FILE) | \
$(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }') $(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')

View File

@ -42,7 +42,7 @@ GENSRC_X11WRAPPERS_TMP := $(JDK_OUTPUTDIR)/gensrc_x11wrappers
GENSRC_X11WRAPPERS_DST := $(JDK_OUTPUTDIR)/gensrc/sun/awt/X11 GENSRC_X11WRAPPERS_DST := $(JDK_OUTPUTDIR)/gensrc/sun/awt/X11
# The pre-calculated offset file are stored here: # 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 # Normal case is to generate only according to target bits
GENSRC_X11_VERSION := $(OPENJDK_TARGET_CPU_BITS) GENSRC_X11_VERSION := $(OPENJDK_TARGET_CPU_BITS)

View File

@ -23,6 +23,9 @@
# questions. # questions.
# #
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, jdk, lib/Awt2dLibraries.gmk))
# Openwin is defined on Solaris. # Openwin is defined on Solaris.
OPENWIN_LIB := $(OPENWIN_HOME)/lib OPENWIN_LIB := $(OPENWIN_HOME)/lib
@ -550,10 +553,6 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
endif endif
ifeq ($(OPENJDK_TARGET_OS), linux) ifeq ($(OPENJDK_TARGET_OS), linux)
ifndef OPENJDK
include $(JDK_TOPDIR)/make/closed/xawt.gmk
endif
ifeq ($(DISABLE_XRENDER), true) ifeq ($(DISABLE_XRENDER), true)
LIBAWT_XAWT_CFLAGS += -DDISABLE_XRENDER_BY_DEFAULT=true LIBAWT_XAWT_CFLAGS += -DDISABLE_XRENDER_BY_DEFAULT=true
endif endif

View File

@ -23,6 +23,8 @@
* questions. * questions.
*/ */
package build.tools.x11wrappergen;
import java.util.*; import java.util.*;
import java.io.*; import java.io.*;
import java.nio.charset.*; import java.nio.charset.*;

View File

@ -107,6 +107,7 @@ final class AixPollPort
private final ArrayBlockingQueue<Event> queue; private final ArrayBlockingQueue<Event> queue;
private final Event NEED_TO_POLL = new Event(null, 0); private final Event NEED_TO_POLL = new Event(null, 0);
private final Event EXECUTE_TASK_OR_SHUTDOWN = 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 // encapsulates a pollset control event for a file descriptor
static class ControlEvent { static class ControlEvent {
@ -342,7 +343,11 @@ final class AixPollPort
// To emulate one shot semantic we need to remove // To emulate one shot semantic we need to remove
// the file descriptor here. // 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 // wakeup
if (fd == sp[0]) { if (fd == sp[0]) {
@ -351,10 +356,6 @@ final class AixPollPort
drain1(sp[0]); 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 // queue special event if there are more events
// to handle. // to handle.
if (n > 0) { if (n > 0) {
@ -368,12 +369,12 @@ final class AixPollPort
if (fd == ctlSp[0]) { if (fd == ctlSp[0]) {
synchronized (controlQueue) { synchronized (controlQueue) {
drain1(ctlSp[0]); drain1(ctlSp[0]);
// This file descriptor does not have
// one shot semantic => register it again.
pollsetCtl(pollset, PS_ADD, ctlSp[0], Net.POLLIN);
processControlQueue(); processControlQueue();
} }
continue; if (n > 0) {
continue;
}
return CONTINUE_AFTER_CTL_EVENT;
} }
PollableChannel channel = fdToChannel.get(fd); PollableChannel channel = fdToChannel.get(fd);
@ -431,6 +432,11 @@ final class AixPollPort
continue; continue;
} }
// contine after we processed a control event
if (ev == CONTINUE_AFTER_CTL_EVENT) {
continue;
}
// handle wakeup to execute task or shutdown // handle wakeup to execute task or shutdown
if (ev == EXECUTE_TASK_OR_SHUTDOWN) { if (ev == EXECUTE_TASK_OR_SHUTDOWN) {
Runnable task = pollTask(); Runnable task = pollTask();

View File

@ -345,10 +345,10 @@ JLI_Launch(int argc, char ** argv, /* main argc, argc */
} \ } \
} while (JNI_FALSE) } while (JNI_FALSE)
#define CHECK_EXCEPTION_RETURN(CER_return_value) \ #define CHECK_EXCEPTION_RETURN() \
do { \ do { \
if ((*env)->ExceptionOccurred(env)) { \ if ((*env)->ExceptionOccurred(env)) { \
return CER_return_value; \ return; \
} \ } \
} while (JNI_FALSE) } while (JNI_FALSE)
@ -1258,7 +1258,6 @@ static jclass
GetApplicationClass(JNIEnv *env) GetApplicationClass(JNIEnv *env)
{ {
jmethodID mid; jmethodID mid;
jobject result;
jclass cls = GetLauncherHelperClass(env); jclass cls = GetLauncherHelperClass(env);
NULL_CHECK0(cls); NULL_CHECK0(cls);
NULL_CHECK0(mid = (*env)->GetStaticMethodID(env, cls, NULL_CHECK0(mid = (*env)->GetStaticMethodID(env, cls,

View File

@ -233,7 +233,7 @@ compute_cen(int fd, Byte *bp)
jlong base_offset; jlong base_offset;
jlong offset; jlong offset;
char buffer[MINREAD]; char buffer[MINREAD];
p = buffer; p = (Byte*) buffer;
/* /*
* Read the END Header, which is the starting point for ZIP files. * Read the END Header, which is the starting point for ZIP files.
* (Clearly designed to make writing a zip file easier than reading * (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) { if (JLI_Lseek(fd, offset, SEEK_SET) < (jlong)0) {
return (-1); return (-1);
} }
p = buffer; p = (Byte*) buffer;
base_offset = base_offset - ZIP64_ENDSIZ(p) - ZIP64_ENDOFF(p) - ZIP64_ENDHDR; base_offset = base_offset - ZIP64_ENDSIZ(p) - ZIP64_ENDOFF(p) - ZIP64_ENDHDR;
} else { } else {
base_offset = base_offset - ENDSIZ(p) - ENDOFF(p); base_offset = base_offset - ENDSIZ(p) - ENDOFF(p);

View File

@ -28,21 +28,14 @@ package com.sun.security.auth.callback;
/* JAAS imports */ /* JAAS imports */
import javax.security.auth.callback.Callback; import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.ConfirmationCallback; import javax.security.auth.callback.NameCallback; // javadoc
import javax.security.auth.callback.NameCallback; import javax.security.auth.callback.PasswordCallback; // javadoc
import javax.security.auth.callback.PasswordCallback;
import javax.security.auth.callback.TextOutputCallback;
import javax.security.auth.callback.UnsupportedCallbackException; import javax.security.auth.callback.UnsupportedCallbackException;
/* Java imports */ /* Java imports */
import java.io.BufferedReader;
import java.io.IOException; 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;
/** /**
* <p> * <p>
@ -55,6 +48,7 @@ import sun.security.util.Password;
@jdk.Exported @jdk.Exported
public class TextCallbackHandler implements CallbackHandler { public class TextCallbackHandler implements CallbackHandler {
private final CallbackHandler consoleHandler;
/** /**
* <p>Creates a callback handler that prompts and reads from the * <p>Creates a callback handler that prompts and reads from the
@ -63,7 +57,9 @@ public class TextCallbackHandler implements CallbackHandler {
* CallbackHandler. * CallbackHandler.
*/ */
public TextCallbackHandler() { } public TextCallbackHandler() {
this.consoleHandler = new ConsoleCallbackHandler();
}
/** /**
* Handles the specified set of callbacks. * Handles the specified set of callbacks.
@ -76,187 +72,7 @@ public class TextCallbackHandler implements CallbackHandler {
public void handle(Callback[] callbacks) public void handle(Callback[] callbacks)
throws IOException, UnsupportedCallbackException throws IOException, UnsupportedCallbackException
{ {
ConfirmationCallback confirmation = null; // delegate to console handler
consoleHandler.handle(callbacks);
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);
} }
} }

View File

@ -31,8 +31,6 @@ import sun.invoke.util.*;
import sun.misc.Unsafe; import sun.misc.Unsafe;
import static java.lang.invoke.MethodHandleStatics.*; 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, * A method handle is a typed, directly executable reference to an underlying method,

View File

@ -27,8 +27,6 @@ package java.lang.invoke;
import static java.lang.invoke.LambdaForm.*; import static java.lang.invoke.LambdaForm.*;
import static java.lang.invoke.MethodHandleNatives.Constants.*; 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. * A method handle whose behavior is determined only by its LambdaForm.

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -309,8 +309,8 @@ public interface Clob {
void truncate(long len) throws SQLException; void truncate(long len) throws SQLException;
/** /**
* This method frees the <code>Clob</code> object and releases the resources the resources * This method releases the resources that the <code>Clob</code> object
* that it holds. The object is invalid once the <code>free</code> method * holds. The object is invalid once the <code>free</code> method
* is called. * is called.
* <p> * <p>
* After <code>free</code> has been called, any attempt to invoke a * After <code>free</code> has been called, any attempt to invoke a

View File

@ -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
// <code>Error</code>' below should be changed to 'a
// <code>ServiceConfigurationError</code>'.
/** /**
* Searches for implementations of a particular service class * Searches for implementations of a particular service class
* using the given class loader. * using the given class loader.

View File

@ -29,7 +29,7 @@ package javax.naming;
* This exception is thrown when an authentication error occurs while * This exception is thrown when an authentication error occurs while
* accessing the naming or directory service. * accessing the naming or directory service.
* An authentication error can happen, for example, when the credentials * 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. * authenticate the user to the naming/directory service.
*<p> *<p>
* If the program wants to handle this exception in particular, it * If the program wants to handle this exception in particular, it
@ -37,7 +37,7 @@ package javax.naming;
* catch NamingException. After catching AuthenticationException, the * catch NamingException. After catching AuthenticationException, the
* program could reattempt the authentication by updating * program could reattempt the authentication by updating
* the resolved context's environment properties with the appropriate * the resolved context's environment properties with the appropriate
* appropriate credentials. * credentials.
* <p> * <p>
* Synchronization and serialization issues that apply to NamingException * Synchronization and serialization issues that apply to NamingException
* apply directly here. * apply directly here.

View File

@ -67,7 +67,7 @@ public class AuthenticationNotSupportedException extends NamingSecurityException
/** /**
* Constructs a new instance of AuthenticationNotSupportedException * 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() { public AuthenticationNotSupportedException() {
super(); super();

View File

@ -64,7 +64,7 @@ public class CannotProceedException extends NamingException {
/** /**
* Contains the remaining unresolved part of the second * Contains the remaining unresolved part of the second
* "name" argument to Context.rename(). * "name" argument to Context.rename().
* This information necessary for * This information is necessary for
* continuing the Context.rename() operation. * continuing the Context.rename() operation.
* <p> * <p>
* This field is initialized to null. * This field is initialized to null.

View File

@ -205,7 +205,7 @@ public class CompositeName implements Name {
private transient NameImpl impl; private transient NameImpl impl;
/** /**
* Constructs a new composite name instance using the components * 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 * to be used by subclasses of CompositeName when they override
* methods such as clone(), getPrefix(), getSuffix(). * 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. * 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 * getSuffix(size()-n.size())--in other words, this
* composite name ends with 'n'. * composite name ends with 'n'.
* If n is null or not a composite name, false is returned. * If n is null or not a composite name, false is returned.

View File

@ -165,7 +165,7 @@ public class CompoundName implements Name {
/** /**
* Constructs a new compound name instance using the components * 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 * to be used by subclasses of CompoundName when they override
* methods such as clone(), getPrefix(), getSuffix(). * methods such as clone(), getPrefix(), getSuffix().
* *
@ -365,7 +365,7 @@ public class CompoundName implements Name {
* components in this compound name. * components in this compound name.
* The result and this compound name share the same syntax. * The result and this compound name share the same syntax.
* Subsequent changes to * 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. * vice versa.
* *
* @param posn The 0-based index of the component at which to stop. * @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. * components in this compound name.
* The result and this compound name share the same syntax. * The result and this compound name share the same syntax.
* Subsequent changes to * 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. * @param posn The 0-based index of the component at which to start.
* Must be in the range [0,size()]. * 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. * 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 * getSuffix(size()-n.size())--in other words, this
* compound name ends with 'n'. * compound name ends with 'n'.
* If n is null or not a compound name, false is returned. * If n is null or not a compound name, false is returned.

View File

@ -26,11 +26,11 @@
package javax.naming; package javax.naming;
/** /**
* This exception is used to describe problems encounter while resolving links. * This exception is used to describe problems encountered while resolving links.
* Addition information is added to the base NamingException for pinpointing * Additional information is added to the base NamingException for pinpointing
* the problem with the link. * the problem with the link.
*<p> *<p>
* Analogous to how NamingException captures name resolution information, * Analogously to how NamingException captures name resolution information,
* LinkException captures "link"-name resolution information pinpointing * LinkException captures "link"-name resolution information pinpointing
* the problem encountered while resolving a link. All these fields may * the problem encountered while resolving a link. All these fields may
* be null. * be null.
@ -111,7 +111,7 @@ public class LinkException extends NamingException {
protected String linkExplanation; 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. * All the other fields are initialized to null.
* @param explanation A possibly null string containing additional * @param explanation A possibly null string containing additional
* detail about this exception. * 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. * when resolving a link.
* *
* @return The possibly null detail string explaining more about the problem * @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. * when resolving a link.
* *
* @param msg The possibly null detail string explaining more about the problem * @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. * invoke this method using the resulting composite name.
*<p> *<p>
* A copy of <code>name</code> is made and stored. * A copy of <code>name</code> is made and stored.
* Subsequent changes to <code>name</code> does not * Subsequent changes to <code>name</code> do not
* affect the copy in this NamingException and vice versa. * 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. * invoke this method using the resulting composite name.
*<p> *<p>
* A copy of <code>name</code> is made and stored. * A copy of <code>name</code> is made and stored.
* Subsequent changes to <code>name</code> does not * Subsequent changes to <code>name</code> do not
* affect the copy in this NamingException and vice versa. * affect the copy in this NamingException and vice versa.
* *
* @param name The name to set remaining link name to. This can be null. * @param name The name to set remaining link name to. This can be null.

View File

@ -27,7 +27,7 @@ package javax.naming;
/** /**
* This exception is thrown when * 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. * specific limit on link counts has been reached.
* <p> * <p>
* Synchronization and serialization issues that apply to LinkException * Synchronization and serialization issues that apply to LinkException
@ -42,7 +42,7 @@ package javax.naming;
public class LinkLoopException extends LinkException { 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. * All the other fields are initialized to null.
* @param explanation A possibly null string containing additional * @param explanation A possibly null string containing additional
* detail about this exception. * detail about this exception.

View File

@ -42,7 +42,7 @@ package javax.naming;
public class MalformedLinkException extends LinkException { 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. * All the other fields are initialized to null.
* @param explanation A possibly null string containing additional * @param explanation A possibly null string containing additional
* detail about this exception. * detail about this exception.

View File

@ -201,7 +201,7 @@ public class NamingException extends Exception {
* invoke this method using the resulting composite name. * invoke this method using the resulting composite name.
*<p> *<p>
* A copy of <code>name</code> is made and stored. * A copy of <code>name</code> is made and stored.
* Subsequent changes to <code>name</code> does not * Subsequent changes to <code>name</code> do not
* affect the copy in this NamingException and vice versa. * affect the copy in this NamingException and vice versa.
* *
* @param name The possibly null name to set resolved name to. * @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. * invoke this method using the resulting composite name.
*<p> *<p>
* A copy of <code>name</code> is made and stored. * A copy of <code>name</code> is made and stored.
* Subsequent changes to <code>name</code> does not * Subsequent changes to <code>name</code> do not
* affect the copy in this NamingException and vice versa. * affect the copy in this NamingException and vice versa.
* @param name The possibly null name to set remaining name to. * @param name The possibly null name to set remaining name to.
* If null, it sets the remaining name field to null. * 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 * a compound name, you should "stringify" the compound name
* then invoke the overloaded form that accepts a String parameter. * then invoke the overloaded form that accepts a String parameter.
*<p> *<p>
* Subsequent changes to <code>name</code> does not * Subsequent changes to <code>name</code> do not
* affect the remaining name field in this NamingException and vice versa. * affect the remaining name field in this NamingException and vice versa.
* @param name The possibly null name containing ordered components to add. * @param name The possibly null name containing ordered components to add.
* If name is null, this method does not do anything. * If name is null, this method does not do anything.

View File

@ -90,7 +90,7 @@ public abstract class RefAddr implements java.io.Serializable {
/** /**
* Determines whether obj is equal to this RefAddr. * Determines whether obj is equal to this RefAddr.
*<p> *<p>
* 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
*<ul> *<ul>
*<li> non-null *<li> non-null
*<li> instance of RefAddr *<li> instance of RefAddr

View File

@ -218,8 +218,8 @@ public class Reference implements Cloneable, java.io.Serializable {
* String.compareTo() is used to test the equality of the address types. * String.compareTo() is used to test the equality of the address types.
* *
* @param addrType The non-null address type for which to find the address. * @param addrType The non-null address type for which to find the address.
* @return The address in this reference with address type 'addrType; * @return The address in this reference with address type 'addrType';
* null if no such address exist. * null if no such address exists.
*/ */
public RefAddr get(String addrType) { public RefAddr get(String addrType) {
int len = addrs.size(); int len = addrs.size();

View File

@ -33,7 +33,7 @@ package javax.naming;
* objects which themselves are not directly bound to the naming system. * objects which themselves are not directly bound to the naming system.
* Such objects can implement the Referenceable interface as a way * Such objects can implement the Referenceable interface as a way
* for programs that use that object to determine what its Reference is. * for programs that use that object to determine what its Reference is.
* For example, when binding a object, if an object implements the * For example, when binding an object, if an object implements the
* Referenceable interface, getReference() can be invoked on the object to * Referenceable interface, getReference() can be invoked on the object to
* get its Reference to use for binding. * get its Reference to use for binding.
* *

View File

@ -1475,7 +1475,7 @@ public class MidiSystem {
/** /**
* Obtains the set of services currently installed on the system * Obtains the set of services currently installed on the system
* using sun.misc.Service, the SPI mechanism in 1.3. * using the SPI mechanism in 1.3.
* @return a List of instances of providers for the requested service. * @return a List of instances of providers for the requested service.
* If no providers are available, a List of length 0 will be returned. * If no providers are available, a List of length 0 will be returned.
*/ */

View File

@ -1622,7 +1622,7 @@ public class AudioSystem {
/** /**
* Obtains the set of services currently installed on the system * Obtains the set of services currently installed on the system
* using sun.misc.Service, the SPI mechanism in 1.3. * using the SPI mechanism in 1.3.
* @return a List of instances of providers for the requested service. * @return a List of instances of providers for the requested service.
* If no providers are available, a vector of length 0 will be returned. * If no providers are available, a vector of length 0 will be returned.
*/ */

View File

@ -31,7 +31,6 @@ import java.net.URL;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.awt.*; import java.awt.*;
import java.applet.*; import java.applet.*;
import sun.tools.jar.*;
/** /**

View File

@ -1,434 +0,0 @@
/*
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.misc;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.TreeSet;
/**
* A simple service-provider lookup mechanism. A <i>service</i> is a
* well-known set of interfaces and (usually abstract) classes. A <i>service
* provider</i> is a specific implementation of a service. The classes in a
* provider typically implement the interfaces and subclass the classes defined
* in the service itself. Service providers may be installed in an
* implementation of the Java platform in the form of extensions, that is, jar
* files placed into any of the usual extension directories. Providers may
* also be made available by adding them to the applet or application class
* path or by some other platform-specific means.
*
* <p> In this lookup mechanism a service is represented by an interface or an
* abstract class. (A concrete class may be used, but this is not
* recommended.) A provider of a given service contains one or more concrete
* classes that extend this <i>service class</i> with data and code specific to
* the provider. This <i>provider class</i> will typically not be the entire
* provider itself but rather a proxy that contains enough information to
* decide whether the provider is able to satisfy a particular request together
* with code that can create the actual provider on demand. The details of
* provider classes tend to be highly service-specific; no single class or
* interface could possibly unify them, so no such class has been defined. The
* only requirement enforced here is that provider classes must have a
* zero-argument constructor so that they may be instantiated during lookup.
*
* <p> A service provider identifies itself by placing a provider-configuration
* file in the resource directory <tt>META-INF/services</tt>. The file's name
* should consist of the fully-qualified name of the abstract service class.
* The file should contain a list of fully-qualified concrete provider-class
* names, one per line. Space and tab characters surrounding each name, as
* well as blank lines, are ignored. The comment character is <tt>'#'</tt>
* (<tt>0x23</tt>); on each line all characters following the first comment
* character are ignored. The file must be encoded in UTF-8.
*
* <p> If a particular concrete provider class is named in more than one
* configuration file, or is named in the same configuration file more than
* once, then the duplicates will be ignored. The configuration file naming a
* particular provider need not be in the same jar file or other distribution
* unit as the provider itself. The provider must be accessible from the same
* class loader that was initially queried to locate the configuration file;
* note that this is not necessarily the class loader that found the file.
*
* <p> <b>Example:</b> Suppose we have a service class named
* <tt>java.io.spi.CharCodec</tt>. It has two abstract methods:
*
* <pre>
* public abstract CharEncoder getEncoder(String encodingName);
* public abstract CharDecoder getDecoder(String encodingName);
* </pre>
*
* Each method returns an appropriate object or <tt>null</tt> if it cannot
* translate the given encoding. Typical <tt>CharCodec</tt> providers will
* support more than one encoding.
*
* <p> If <tt>sun.io.StandardCodec</tt> is a provider of the <tt>CharCodec</tt>
* service then its jar file would contain the file
* <tt>META-INF/services/java.io.spi.CharCodec</tt>. This file would contain
* the single line:
*
* <pre>
* sun.io.StandardCodec # Standard codecs for the platform
* </pre>
*
* To locate an encoder for a given encoding name, the internal I/O code would
* do something like this:
*
* <pre>
* CharEncoder getEncoder(String encodingName) {
* Iterator ps = Service.providers(CharCodec.class);
* while (ps.hasNext()) {
* CharCodec cc = (CharCodec)ps.next();
* CharEncoder ce = cc.getEncoder(encodingName);
* if (ce != null)
* return ce;
* }
* return null;
* }
* </pre>
*
* The provider-lookup mechanism always executes in the security context of the
* caller. Trusted system code should typically invoke the methods in this
* class from within a privileged security context.
*
* @author Mark Reinhold
* @since 1.3
*/
public final class Service<S> {
private static final String prefix = "META-INF/services/";
private Service() { }
private static void fail(Class<?> service, String msg, Throwable cause)
throws ServiceConfigurationError
{
ServiceConfigurationError sce
= new ServiceConfigurationError(service.getName() + ": " + msg);
sce.initCause(cause);
throw sce;
}
private static void fail(Class<?> service, String msg)
throws ServiceConfigurationError
{
throw new ServiceConfigurationError(service.getName() + ": " + msg);
}
private static void fail(Class<?> service, URL u, int line, String msg)
throws ServiceConfigurationError
{
fail(service, u + ":" + line + ": " + msg);
}
/**
* Parse a single line from the given configuration file, adding the name
* on the line to both the names list and the returned set iff the name is
* not already a member of the returned set.
*/
private static int parseLine(Class<?> service, URL u, BufferedReader r, int lc,
List<String> names, Set<String> returned)
throws IOException, ServiceConfigurationError
{
String ln = r.readLine();
if (ln == null) {
return -1;
}
int ci = ln.indexOf('#');
if (ci >= 0) ln = ln.substring(0, ci);
ln = ln.trim();
int n = ln.length();
if (n != 0) {
if ((ln.indexOf(' ') >= 0) || (ln.indexOf('\t') >= 0))
fail(service, u, lc, "Illegal configuration-file syntax");
int cp = ln.codePointAt(0);
if (!Character.isJavaIdentifierStart(cp))
fail(service, u, lc, "Illegal provider-class name: " + ln);
for (int i = Character.charCount(cp); i < n; i += Character.charCount(cp)) {
cp = ln.codePointAt(i);
if (!Character.isJavaIdentifierPart(cp) && (cp != '.'))
fail(service, u, lc, "Illegal provider-class name: " + ln);
}
if (!returned.contains(ln)) {
names.add(ln);
returned.add(ln);
}
}
return lc + 1;
}
/**
* Parse the content of the given URL as a provider-configuration file.
*
* @param service
* The service class for which providers are being sought;
* used to construct error detail strings
*
* @param url
* The URL naming the configuration file to be parsed
*
* @param returned
* A Set containing the names of provider classes that have already
* been returned. This set will be updated to contain the names
* that will be yielded from the returned <tt>Iterator</tt>.
*
* @return A (possibly empty) <tt>Iterator</tt> that will yield the
* provider-class names in the given configuration file that are
* not yet members of the returned set
*
* @throws ServiceConfigurationError
* If an I/O error occurs while reading from the given URL, or
* if a configuration-file format error is detected
*/
private static Iterator<String> parse(Class<?> service, URL u, Set<String> returned)
throws ServiceConfigurationError
{
InputStream in = null;
BufferedReader r = null;
ArrayList<String> names = new ArrayList<>();
try {
in = u.openStream();
r = new BufferedReader(new InputStreamReader(in, "utf-8"));
int lc = 1;
while ((lc = parseLine(service, u, r, lc, names, returned)) >= 0);
} catch (IOException x) {
fail(service, ": " + x);
} finally {
try {
if (r != null) r.close();
if (in != null) in.close();
} catch (IOException y) {
fail(service, ": " + y);
}
}
return names.iterator();
}
/**
* Private inner class implementing fully-lazy provider lookup
*/
private static class LazyIterator<S> implements Iterator<S> {
Class<S> service;
ClassLoader loader;
Enumeration<URL> configs = null;
Iterator<String> pending = null;
Set<String> returned = new TreeSet<>();
String nextName = null;
private LazyIterator(Class<S> service, ClassLoader loader) {
this.service = service;
this.loader = loader;
}
public boolean hasNext() throws ServiceConfigurationError {
if (nextName != null) {
return true;
}
if (configs == null) {
try {
String fullName = prefix + service.getName();
if (loader == null)
configs = ClassLoader.getSystemResources(fullName);
else
configs = loader.getResources(fullName);
} catch (IOException x) {
fail(service, ": " + x);
}
}
while ((pending == null) || !pending.hasNext()) {
if (!configs.hasMoreElements()) {
return false;
}
pending = parse(service, configs.nextElement(), returned);
}
nextName = pending.next();
return true;
}
public S next() throws ServiceConfigurationError {
if (!hasNext()) {
throw new NoSuchElementException();
}
String cn = nextName;
nextName = null;
Class<?> c = null;
try {
c = Class.forName(cn, false, loader);
} catch (ClassNotFoundException x) {
fail(service,
"Provider " + cn + " not found");
}
if (!service.isAssignableFrom(c)) {
fail(service,
"Provider " + cn + " not a subtype");
}
try {
return service.cast(c.newInstance());
} catch (Throwable x) {
fail(service,
"Provider " + cn + " could not be instantiated: " + x,
x);
}
return null; /* This cannot happen */
}
public void remove() {
throw new UnsupportedOperationException();
}
}
/**
* Locates and incrementally instantiates the available providers of a
* given service using the given class loader.
*
* <p> This method transforms the name of the given service class into a
* provider-configuration filename as described above and then uses the
* <tt>getResources</tt> method of the given class loader to find all
* available files with that name. These files are then read and parsed to
* produce a list of provider-class names. The iterator that is returned
* uses the given class loader to lookup and then instantiate each element
* of the list.
*
* <p> Because it is possible for extensions to be installed into a running
* Java virtual machine, this method may return different results each time
* it is invoked. <p>
*
* @param service
* The service's abstract service class
*
* @param loader
* The class loader to be used to load provider-configuration files
* and instantiate provider classes, or <tt>null</tt> if the system
* class loader (or, failing that the bootstrap class loader) is to
* be used
*
* @return An <tt>Iterator</tt> that yields provider objects for the given
* service, in some arbitrary order. The iterator will throw a
* <tt>ServiceConfigurationError</tt> if a provider-configuration
* file violates the specified format or if a provider class cannot
* be found and instantiated.
*
* @throws ServiceConfigurationError
* If a provider-configuration file violates the specified format
* or names a provider class that cannot be found and instantiated
*
* @see #providers(java.lang.Class)
* @see #installedProviders(java.lang.Class)
*/
public static <S> Iterator<S> providers(Class<S> service, ClassLoader loader)
throws ServiceConfigurationError
{
return new LazyIterator<S>(service, loader);
}
/**
* Locates and incrementally instantiates the available providers of a
* given service using the context class loader. This convenience method
* is equivalent to
*
* <pre>
* ClassLoader cl = Thread.currentThread().getContextClassLoader();
* return Service.providers(service, cl);
* </pre>
*
* @param service
* The service's abstract service class
*
* @return An <tt>Iterator</tt> that yields provider objects for the given
* service, in some arbitrary order. The iterator will throw a
* <tt>ServiceConfigurationError</tt> if a provider-configuration
* file violates the specified format or if a provider class cannot
* be found and instantiated.
*
* @throws ServiceConfigurationError
* If a provider-configuration file violates the specified format
* or names a provider class that cannot be found and instantiated
*
* @see #providers(java.lang.Class, java.lang.ClassLoader)
*/
public static <S> Iterator<S> providers(Class<S> service)
throws ServiceConfigurationError
{
ClassLoader cl = Thread.currentThread().getContextClassLoader();
return Service.providers(service, cl);
}
/**
* Locates and incrementally instantiates the available providers of a
* given service using the extension class loader. This convenience method
* simply locates the extension class loader, call it
* <tt>extClassLoader</tt>, and then does
*
* <pre>
* return Service.providers(service, extClassLoader);
* </pre>
*
* If the extension class loader cannot be found then the system class
* loader is used; if there is no system class loader then the bootstrap
* class loader is used.
*
* @param service
* The service's abstract service class
*
* @return An <tt>Iterator</tt> that yields provider objects for the given
* service, in some arbitrary order. The iterator will throw a
* <tt>ServiceConfigurationError</tt> if a provider-configuration
* file violates the specified format or if a provider class cannot
* be found and instantiated.
*
* @throws ServiceConfigurationError
* If a provider-configuration file violates the specified format
* or names a provider class that cannot be found and instantiated
*
* @see #providers(java.lang.Class, java.lang.ClassLoader)
*/
public static <S> Iterator<S> installedProviders(Class<S> service)
throws ServiceConfigurationError
{
ClassLoader cl = ClassLoader.getSystemClassLoader();
ClassLoader prev = null;
while (cl != null) {
prev = cl;
cl = cl.getParent();
}
return Service.providers(service, prev);
}
}

View File

@ -1,62 +0,0 @@
/*
* Copyright (c) 1999, 2011, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.misc;
/**
* Error thrown when something goes wrong while looking up service providers.
* In particular, this error will be thrown in the following situations:
*
* <ul>
* <li> A concrete provider class cannot be found,
* <li> A concrete provider class cannot be instantiated,
* <li> The format of a provider-configuration file is illegal, or
* <li> An IOException occurs while reading a provider-configuration file.
* </ul>
*
* @author Mark Reinhold
* @since 1.3
*/
public class ServiceConfigurationError extends Error {
static final long serialVersionUID = 8769866263384244465L;
/**
* Constructs a new instance with the specified detail string.
*/
public ServiceConfigurationError(String msg) {
super(msg);
}
/**
* Constructs a new instance that wraps the specified throwable.
*/
public ServiceConfigurationError(Throwable x) {
super(x);
}
}

View File

@ -25,7 +25,6 @@
package sun.security.jgss; package sun.security.jgss;
import com.sun.security.auth.callback.TextCallbackHandler;
import javax.security.auth.Subject; import javax.security.auth.Subject;
import javax.security.auth.kerberos.KerberosPrincipal; import javax.security.auth.kerberos.KerberosPrincipal;
import javax.security.auth.kerberos.KerberosTicket; import javax.security.auth.kerberos.KerberosTicket;
@ -48,6 +47,7 @@ import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.login.LoginContext; import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException; import javax.security.auth.login.LoginException;
import sun.security.action.GetBooleanAction; import sun.security.action.GetBooleanAction;
import sun.security.util.ConsoleCallbackHandler;
/** /**
* The GSSUtilImplementation that knows how to work with the internals of * The GSSUtilImplementation that knows how to work with the internals of
@ -243,7 +243,7 @@ public class GSSUtil {
if ((defaultHandler != null) && (defaultHandler.length() != 0)) { if ((defaultHandler != null) && (defaultHandler.length() != 0)) {
cb = null; cb = null;
} else { } else {
cb = new TextCallbackHandler(); cb = new ConsoleCallbackHandler();
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -1035,6 +1035,9 @@ class RevocationChecker extends PKIXRevocationChecker {
boolean signFlag = true; boolean signFlag = true;
List<? extends Certificate> cpList = List<? extends Certificate> cpList =
cpbr.getCertPath().getCertificates(); cpbr.getCertPath().getCertificates();
if (cpList.isEmpty()) {
return;
}
try { try {
for (int i = cpList.size()-1; i >= 0; i-- ) { for (int i = cpList.size()-1; i >= 0; i-- ) {
X509Certificate cert = (X509Certificate)cpList.get(i); X509Certificate cert = (X509Certificate)cpList.get(i);

View File

@ -0,0 +1,247 @@
/*
* Copyright (c) 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.security.util;
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.UnsupportedCallbackException;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
/**
* A {@code CallbackHandler} that prompts and reads from the command line
* for answers to authentication questions.
*/
public class ConsoleCallbackHandler implements CallbackHandler {
/**
* Creates a callback handler that prompts and reads from the
* command line for answers to authentication questions.
*/
public ConsoleCallbackHandler() { }
/**
* Handles the specified set of callbacks.
*
* @param callbacks the callbacks to handle
* @throws IOException if an input or output error occurs.
* @throws UnsupportedCallbackException if the callback is not an
* instance of NameCallback or PasswordCallback
*/
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);
}
}

View File

@ -153,7 +153,6 @@ Agent_OnLoad(JavaVM *vm, char *tail, void * reserved) {
char * options; char * options;
jarAttribute* attributes; jarAttribute* attributes;
char * premainClass; char * premainClass;
char * agentClass;
char * bootClassPath; char * bootClassPath;
/* /*

View File

@ -33,6 +33,7 @@
#endif /* _WIN32 */ #endif /* _WIN32 */
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h>
#include "jni.h" #include "jni.h"
#include "manifest_info.h" #include "manifest_info.h"

View File

@ -325,7 +325,7 @@ static void *findJniFunction(JNIEnv *env, void *handle,
void *entryName = NULL; void *entryName = NULL;
char *jniFunctionName; char *jniFunctionName;
int i; int i;
int len; size_t len;
// Check for JNI_On(Un)Load<_libname> function // Check for JNI_On(Un)Load<_libname> function
if (isLoad) { if (isLoad) {
@ -501,9 +501,9 @@ Java_java_lang_ClassLoader_00024NativeLibrary_findBuiltinLib
{ {
const char *cname; const char *cname;
char *libName; char *libName;
int prefixLen = (int) strlen(JNI_LIB_PREFIX); size_t prefixLen = strlen(JNI_LIB_PREFIX);
int suffixLen = (int) strlen(JNI_LIB_SUFFIX); size_t suffixLen = strlen(JNI_LIB_SUFFIX);
int len; size_t len;
jstring lib; jstring lib;
void *ret; void *ret;
const char *onLoadSymbols[] = JNI_ONLOAD_SYMBOLS; const char *onLoadSymbols[] = JNI_ONLOAD_SYMBOLS;

View File

@ -44,7 +44,7 @@
* `this' so you can write 'throw e.fillInStackTrace();' * `this' so you can write 'throw e.fillInStackTrace();'
*/ */
JNIEXPORT jobject JNICALL JNIEXPORT jobject JNICALL
Java_java_lang_Throwable_fillInStackTrace(JNIEnv *env, jobject throwable, int dummy) Java_java_lang_Throwable_fillInStackTrace(JNIEnv *env, jobject throwable, jint dummy)
{ {
JVM_FillInStackTrace(env, throwable); JVM_FillInStackTrace(env, throwable);
return throwable; return throwable;

View File

@ -55,6 +55,9 @@
* @author Martin Schlaeffer <schlaeff@sbox.tugraz.at> * @author Martin Schlaeffer <schlaeff@sbox.tugraz.at>
*/ */
#ifndef _PKCS11WRAPPER_H
#define _PKCS11WRAPPER_H 1
/* disable asserts in product mode */ /* disable asserts in product mode */
#ifndef DEBUG #ifndef DEBUG
#ifndef NDEBUG #ifndef NDEBUG
@ -461,3 +464,5 @@ void p11free(void *p, char *file, int line);
#define free(c) (p11free((c), THIS_FILE, __LINE__)) #define free(c) (p11free((c), THIS_FILE, __LINE__))
#endif #endif
#endif /* _PKCS11WRAPPER_H */

View File

@ -35,6 +35,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <dlfcn.h> #include <dlfcn.h>
#include <pthread.h> #include <pthread.h>
#include <inttypes.h>
#include "sun_management_OperatingSystemImpl.h" #include "sun_management_OperatingSystemImpl.h"
struct ticks { struct ticks {
@ -57,7 +58,7 @@ static struct perfbuf {
ticks *cpus; ticks *cpus;
} counters; } counters;
#define DEC_64 "%lld" #define DEC_64 "%"SCNd64
static void next_line(FILE *f) { static void next_line(FILE *f) {
while (fgetc(f) != '\n'); while (fgetc(f) != '\n');

View File

@ -39,12 +39,15 @@ Java_sun_nio_fs_MacOSXNativeDispatcher_normalizepath(JNIEnv* env, jclass this,
jint form) jint form)
{ {
jcharArray result = NULL; jcharArray result = NULL;
char chars_buf[(PATH_MAX + 1) * 2]; // utf16 + zero padding char *chars;
CFMutableStringRef csref = CFStringCreateMutable(NULL, 0); CFMutableStringRef csref = CFStringCreateMutable(NULL, 0);
if (csref == NULL) { if (csref == NULL) {
JNU_ThrowOutOfMemoryError(env, "native heap"); JNU_ThrowOutOfMemoryError(env, "native heap");
} else { return NULL;
char *chars = (char*)(*env)->GetPrimitiveArrayCritical(env, path, 0); }
chars = (char*)(*env)->GetPrimitiveArrayCritical(env, path, 0);
if (chars != NULL) {
char chars_buf[(PATH_MAX + 1) * 2]; // utf16 + zero padding
jsize len = (*env)->GetArrayLength(env, path); jsize len = (*env)->GetArrayLength(env, path);
CFStringAppendCharacters(csref, (const UniChar*)chars, len); CFStringAppendCharacters(csref, (const UniChar*)chars, len);
(*env)->ReleasePrimitiveArrayCritical(env, path, chars, 0); (*env)->ReleasePrimitiveArrayCritical(env, path, chars, 0);
@ -53,24 +56,26 @@ Java_sun_nio_fs_MacOSXNativeDispatcher_normalizepath(JNIEnv* env, jclass this,
if (len < PATH_MAX) { if (len < PATH_MAX) {
if (CFStringGetCString(csref, chars_buf, sizeof(chars_buf), kCFStringEncodingUTF16)) { if (CFStringGetCString(csref, chars_buf, sizeof(chars_buf), kCFStringEncodingUTF16)) {
result = (*env)->NewCharArray(env, len); result = (*env)->NewCharArray(env, len);
(*env)->SetCharArrayRegion(env, result, 0, len, (jchar*)&chars_buf); if (result != NULL) {
(*env)->SetCharArrayRegion(env, result, 0, len, (jchar*)&chars_buf);
}
} }
} else { } else {
int ulen = (len + 1) * 2; int ulen = (len + 1) * 2;
chars = malloc(ulen); chars = malloc(ulen);
if (chars == NULL) { if (chars == NULL) {
CFRelease(csref);
JNU_ThrowOutOfMemoryError(env, "native heap"); JNU_ThrowOutOfMemoryError(env, "native heap");
return result;
} else { } else {
if (CFStringGetCString(csref, chars, ulen, kCFStringEncodingUTF16)) { if (CFStringGetCString(csref, chars, ulen, kCFStringEncodingUTF16)) {
result = (*env)->NewCharArray(env, len); result = (*env)->NewCharArray(env, len);
(*env)->SetCharArrayRegion(env, result, 0, len, (jchar*)chars); if (result != NULL) {
(*env)->SetCharArrayRegion(env, result, 0, len, (jchar*)chars);
}
} }
free(chars); free(chars);
} }
} }
CFRelease(csref);
} }
CFRelease(csref);
return result; return result;
} }

View File

@ -32,6 +32,7 @@
#include <jni_util.h> #include <jni_util.h>
#include "j2secmod.h" #include "j2secmod.h"
#include "wrapper/pkcs11wrapper.h"
void *findFunction(JNIEnv *env, jlong jHandle, const char *functionName) { void *findFunction(JNIEnv *env, jlong jHandle, const char *functionName) {
void *hModule = (void*)jlong_to_ptr(jHandle); void *hModule = (void*)jlong_to_ptr(jHandle);

View File

@ -56,6 +56,9 @@
/* defines for UNIX platforms *************************************************/ /* defines for UNIX platforms *************************************************/
#ifndef _P11_MD_H
#define _P11_MD_H 1
#define CK_PTR * #define CK_PTR *
#define CK_DEFINE_FUNCTION(returnType, name) returnType name #define CK_DEFINE_FUNCTION(returnType, name) returnType name
#define CK_DECLARE_FUNCTION(returnType, name) returnType name #define CK_DECLARE_FUNCTION(returnType, name) returnType name
@ -83,3 +86,5 @@ struct ModuleData {
}; };
typedef struct ModuleData ModuleData; typedef struct ModuleData ModuleData;
#endif /* _P11_MD_H */

View File

@ -42,7 +42,6 @@ void* JDK_FindJvmEntry(const char* name) {
JNIEXPORT HMODULE JDK_LoadSystemLibrary(const char* name) { JNIEXPORT HMODULE JDK_LoadSystemLibrary(const char* name) {
HMODULE handle = NULL; HMODULE handle = NULL;
char path[MAX_PATH]; char path[MAX_PATH];
int ret;
if (GetSystemDirectory(path, sizeof(path)) != 0) { if (GetSystemDirectory(path, sizeof(path)) != 0) {
strcat(path, "\\"); strcat(path, "\\");

View File

@ -360,7 +360,6 @@ Java_java_io_WinNTFileSystem_getBooleanAttributes(JNIEnv *env, jobject this,
jobject file) jobject file)
{ {
jint rv = 0; jint rv = 0;
jint pathlen;
WCHAR *pathbuf = fileToNTPath(env, file, ids.path); WCHAR *pathbuf = fileToNTPath(env, file, ids.path);
if (pathbuf == NULL) if (pathbuf == NULL)

View File

@ -79,7 +79,7 @@ win32Error(JNIEnv *env, const WCHAR *functionName)
/*Good suggestion about 2-bytes-per-symbol in localized error reports*/ /*Good suggestion about 2-bytes-per-symbol in localized error reports*/
char utf8_javaMessage[MESSAGE_LENGTH*2]; char utf8_javaMessage[MESSAGE_LENGTH*2];
const int errnum = (int)GetLastError(); const int errnum = (int)GetLastError();
int n = os_error_message(errnum, utf16_OSErrorMsg, ARRAY_SIZE(utf16_OSErrorMsg)); size_t n = os_error_message(errnum, utf16_OSErrorMsg, ARRAY_SIZE(utf16_OSErrorMsg));
n = (n > 0) n = (n > 0)
? swprintf(utf16_javaMessage, MESSAGE_LENGTH, L"%s error=%d, %s", functionName, errnum, utf16_OSErrorMsg) ? swprintf(utf16_javaMessage, MESSAGE_LENGTH, L"%s error=%d, %s", functionName, errnum, utf16_OSErrorMsg)
: swprintf(utf16_javaMessage, MESSAGE_LENGTH, L"%s failed, error=%d", functionName, errnum); : swprintf(utf16_javaMessage, MESSAGE_LENGTH, L"%s failed, error=%d", functionName, errnum);

View File

@ -83,7 +83,7 @@ chmod -fR 777 bug
${TESTJAVA}${FS}bin${FS}javac -d . bug${FS}*.java ${TESTJAVA}${FS}bin${FS}javac -d . bug${FS}*.java
${TESTJAVA}${FS}bin${FS}java -cp . bug/JavaBug > test.out 2>&1 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp . bug/JavaBug > test.out 2>&1
grep "NullPointerException" test.out grep "NullPointerException" test.out

View File

@ -47,7 +47,7 @@ ${TESTJAVA}/bin/javac -d ${TESTCLASSES} DeleteFont.java
cd ${TESTCLASSES} cd ${TESTCLASSES}
numfiles0=`ls ${TESTCLASSES} | wc -l` numfiles0=`ls ${TESTCLASSES} | wc -l`
${TESTJAVA}/bin/java -Djava.io.tmpdir=${TESTCLASSES} DeleteFont ${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.io.tmpdir=${TESTCLASSES} DeleteFont
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then

View File

@ -165,7 +165,7 @@ export CC SYST ARCH LD_LIBRARY_PATH
${JAVAC} -d . ${TESTSRC}${FS}MyCanvas.java ${JAVAC} -d . ${TESTSRC}${FS}MyCanvas.java
${JAVAH} -jni -classpath . -d . MyCanvas ${JAVAH} -jni -classpath . -d . MyCanvas
${MAKE} -f ${MAKEFILE} ${MAKE} -f ${MAKEFILE}
${JAVA} -classpath . MyCanvas ${JAVA} ${TESTVMOPTS} -classpath . MyCanvas
exit $? exit $?

View File

@ -58,7 +58,7 @@ else
JAVA_HOME=$TESTJAVA JAVA_HOME=$TESTJAVA
fi fi
$JAVA_HOME/bin/java -cp "${CP}" StringWidth $JAVA_HOME/bin/java ${TESTVMOPTS} -cp "${CP}" StringWidth
checkstatus checkstatus
exit 0 exit 0

View File

@ -175,7 +175,7 @@ chmod 777 ./*
# pass, you should be able to cut and paste it into here and it will # pass, you should be able to cut and paste it into here and it will
# run with the test harness. # run with the test harness.
${TESTJAVA}/bin/java ShowExitTest ${TESTJAVA}/bin/java ${TESTVMOPTS} ShowExitTest
############### END YOUR TEST CODE !!!!! ############ ############### END YOUR TEST CODE !!!!! ############
#Be sure the last command executed above this line returns 0 for success, #Be sure the last command executed above this line returns 0 for success,

View File

@ -28,10 +28,10 @@ export DISPLAY
OS=`uname -s` OS=`uname -s`
case "$OS" in case "$OS" in
SunOS ) SunOS )
${TESTJAVA}/bin/java BadDisplayTest ${TESTJAVA}/bin/java ${TESTVMOPTS} BadDisplayTest
;; ;;
Linux ) Linux )
${TESTJAVA}/bin/java BadDisplayTest ${TESTJAVA}/bin/java ${TESTVMOPTS} BadDisplayTest
;; ;;
* ) * )
echo "Unsupported System: ${OS}" echo "Unsupported System: ${OS}"

View File

@ -146,13 +146,13 @@ chmod 777 ./*
case "$OS" in case "$OS" in
Windows* | CYGWIN* ) Windows* | CYGWIN* )
${TESTJAVA}/bin/java -Djava.awt.headless=true \ ${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.awt.headless=true \
TestWrapped sun.awt.windows.WToolkit TestWrapped sun.awt.windows.WToolkit
status=$? status=$?
if [ ! $status -eq "0" ]; then if [ ! $status -eq "0" ]; then
fail "Test FAILED: toolkit wrapped into HeadlessToolkit is not an instance of sun.awt.windows.WToolkit"; fail "Test FAILED: toolkit wrapped into HeadlessToolkit is not an instance of sun.awt.windows.WToolkit";
fi fi
${TESTJAVA}/bin/java -Djava.awt.headless=true \ ${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.awt.headless=true \
-Dawt.toolkit=sun.awt.windows.WToolkit \ -Dawt.toolkit=sun.awt.windows.WToolkit \
TestWrapped sun.awt.windows.WToolkit TestWrapped sun.awt.windows.WToolkit
status=$? status=$?
@ -162,14 +162,15 @@ case "$OS" in
;; ;;
SunOS | Linux ) SunOS | Linux )
${TESTJAVA}/bin/java -Djava.awt.headless=true \ ${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.awt.headless=true \
-Dawt.toolkit=sun.awt.X11.XToolkit \ -Dawt.toolkit=sun.awt.X11.XToolkit \
TestWrapped sun.awt.X11.XToolkit TestWrapped sun.awt.X11.XToolkit
status=$? status=$?
if [ ! $status -eq "0" ]; then if [ ! $status -eq "0" ]; then
fail "Test FAILED: toolkit wrapped into HeadlessToolkit is not an instance of sun.awt.xawt.XToolkit"; fail "Test FAILED: toolkit wrapped into HeadlessToolkit is not an instance of sun.awt.xawt.XToolkit";
fi fi
AWT_TOOLKIT=XToolkit ${TESTJAVA}/bin/java -Djava.awt.headless=true \ AWT_TOOLKIT=XToolkit ${TESTJAVA}/bin/java ${TESTVMOPTS} \
-Djava.awt.headless=true \
TestWrapped sun.awt.X11.XToolkit TestWrapped sun.awt.X11.XToolkit
status=$? status=$?
if [ ! $status -eq "0" ]; then if [ ! $status -eq "0" ]; then
@ -178,13 +179,13 @@ case "$OS" in
;; ;;
Darwin) Darwin)
${TESTJAVA}/bin/java -Djava.awt.headless=true \ ${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.awt.headless=true \
TestWrapped sun.lwawt.macosx.LWCToolkit TestWrapped sun.lwawt.macosx.LWCToolkit
status=$? status=$?
if [ ! $status -eq "0" ]; then if [ ! $status -eq "0" ]; then
fail "Test FAILED: toolkit wrapped into HeadlessToolkit is not an instance of sun.lwawt.macosx.LWCToolkit"; fail "Test FAILED: toolkit wrapped into HeadlessToolkit is not an instance of sun.lwawt.macosx.LWCToolkit";
fi fi
${TESTJAVA}/bin/java -Djava.awt.headless=true \ ${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.awt.headless=true \
-Dawt.toolkit=sun.lwawt.macosx.LWCToolkit \ -Dawt.toolkit=sun.lwawt.macosx.LWCToolkit \
TestWrapped sun.lwawt.macosx.LWCToolkit TestWrapped sun.lwawt.macosx.LWCToolkit
status=$? status=$?

View File

@ -66,14 +66,15 @@ public class B4769350 {
this.allowerror = allowerror; this.allowerror = allowerror;
} }
@Override
public void run () { public void run () {
try { try {
URI u = new URI ("http", authority, path, null, null); URI u = new URI ("http", authority, path, null, null);
URL url = u.toURL(); URL url = u.toURL();
URLConnection urlc = url.openConnection(); URLConnection urlc = url.openConnection();
InputStream is = urlc.getInputStream(); try (InputStream is = urlc.getInputStream()) {
read (is); read (is);
is.close(); }
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
System.out.println (e); System.out.println (e);
error = true; error = true;
@ -91,8 +92,6 @@ public class B4769350 {
class Server implements AutoCloseable { class Server implements AutoCloseable {
HttpServer server; HttpServer server;
Executor executor; Executor executor;
CyclicBarrier t1Cond1;
CyclicBarrier t1Cond2;
public String getAddress() { public String getAddress() {
return server.getAddress().getHostName(); return server.getAddress().getHostName();
@ -126,8 +125,7 @@ public class B4769350 {
new AuthenticationHandlerT3bc()); new AuthenticationHandlerT3bc());
server.createContext("/test/realm4/t3c", server.createContext("/test/realm4/t3c",
new AuthenticationHandlerT3bc()); new AuthenticationHandlerT3bc());
t1Cond1 = new CyclicBarrier(2); t1Cond1 = new CyclicBarrier(3);
t1Cond2 = new CyclicBarrier(2);
server.start(); server.start();
} }
@ -135,6 +133,7 @@ public class B4769350 {
return server.getAddress().getPort(); return server.getAddress().getPort();
} }
@Override
public void close() { public void close() {
if (executor != null) if (executor != null)
((ExecutorService)executor).shutdownNow(); ((ExecutorService)executor).shutdownNow();
@ -163,7 +162,6 @@ public class B4769350 {
break; break;
case 1: case 1:
t1Cond1.await(); t1Cond1.await();
t1cond2latch.await();
AuthenticationHandler.okReply(exchange); AuthenticationHandler.okReply(exchange);
break; break;
default: default:
@ -192,8 +190,6 @@ public class B4769350 {
break; break;
case 1: case 1:
t1Cond1.await(); t1Cond1.await();
t1cond1latch.countDown();
t1cond2latch.await();
AuthenticationHandler.okReply(exchange); AuthenticationHandler.okReply(exchange);
break; break;
default: default:
@ -216,13 +212,6 @@ public class B4769350 {
case 0: case 0:
AuthenticationHandler.errorReply(exchange, AuthenticationHandler.errorReply(exchange,
"Basic realm=\"realm1\""); "Basic realm=\"realm1\"");
try {
t1Cond2.await();
} catch (InterruptedException |
BrokenBarrierException e)
{
throw new RuntimeException(e);
}
break; break;
case 1: case 1:
AuthenticationHandler.okReply(exchange); AuthenticationHandler.okReply(exchange);
@ -244,14 +233,6 @@ public class B4769350 {
case 0: case 0:
AuthenticationHandler.errorReply(exchange, AuthenticationHandler.errorReply(exchange,
"Basic realm=\"realm2\""); "Basic realm=\"realm2\"");
try {
t1Cond2.await();
} catch (InterruptedException |
BrokenBarrierException e)
{
throw new RuntimeException(e);
}
t1cond2latch.countDown();
break; break;
case 1: case 1:
AuthenticationHandler.okReply(exchange); AuthenticationHandler.okReply(exchange);
@ -377,9 +358,9 @@ public class B4769350 {
exchange.getResponseHeaders().add("Connection", "close"); exchange.getResponseHeaders().add("Connection", "close");
String response = "Hello ."; String response = "Hello .";
exchange.sendResponseHeaders(200, response.getBytes().length); exchange.sendResponseHeaders(200, response.getBytes().length);
OutputStream os = exchange.getResponseBody(); try (OutputStream os = exchange.getResponseBody()) {
os.write(response.getBytes()); os.write(response.getBytes());
os.close(); }
exchange.close(); exchange.close();
} }
} }
@ -391,10 +372,9 @@ public class B4769350 {
static Client c1,c2,c3,c4,c5,c6,c7,c8,c9; static Client c1,c2,c3,c4,c5,c6,c7,c8,c9;
static CountDownLatch t1cond1latch;
static CountDownLatch t1cond2latch;
static CountDownLatch t2condlatch; static CountDownLatch t2condlatch;
static CountDownLatch t3cond1; static CountDownLatch t3cond1;
static CyclicBarrier t1Cond1;
static void doServerTests (String authority, Server server) throws Exception static void doServerTests (String authority, Server server) throws Exception
{ {
@ -404,10 +384,8 @@ public class B4769350 {
c2 = new Client (authority, "/test/realm2/t1b", false); c2 = new Client (authority, "/test/realm2/t1b", false);
c3 = new Client (authority, "/test/realm1/t1c", false); c3 = new Client (authority, "/test/realm1/t1c", false);
c4 = new Client (authority, "/test/realm2/t1d", false); c4 = new Client (authority, "/test/realm2/t1d", false);
t1cond1latch = new CountDownLatch(1);
t1cond2latch = new CountDownLatch(1);
c1.start(); c2.start(); c1.start(); c2.start();
t1cond1latch.await(); t1Cond1.await();
c3.start(); c4.start(); c3.start(); c4.start();
c1.join(); c2.join(); c3.join(); c4.join(); c1.join(); c2.join(); c3.join(); c4.join();

View File

@ -56,4 +56,7 @@ grant {
}; };
POLICY POLICY
${TESTJAVA}/bin/java -Djava.security.policy=file:./policy -Dsun.net.spi.nameservice.provider.1=simple,sun -cp ${TESTCLASSES}${PS}${TESTSRC} LookupTest -runtest ${port} ${TESTJAVA}/bin/java ${TESTVMOPTS} \
-Djava.security.policy=file:./policy \
-Dsun.net.spi.nameservice.provider.1=simple,sun \
-cp ${TESTCLASSES}${PS}${TESTSRC} LookupTest -runtest ${port}

View File

@ -109,7 +109,7 @@ failures=0
go() { go() {
echo '' echo ''
sh -xc "$JAVA $DFLAG $1 $2 $3 $4 $5 $6 $7 $8" 2>&1 sh -xc "$JAVA ${TESTVMOPTS} $DFLAG $1 $2 $3 $4 $5 $6 $7 $8" 2>&1
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
} }

View File

@ -24,7 +24,9 @@
/* /*
* @test * @test
* @bug 4105900 * @bug 4105900
* @summary MarshalledObject with null throws NullPointerException * @summary MarshalledObject with null throws NullPointerException.
* This test does not affect VM global state, so othervm
* is not required.
* @author Ken Arnold * @author Ken Arnold
* *
* @run main NullReference * @run main NullReference

View File

@ -24,7 +24,8 @@
/* @test /* @test
* @bug 4442373 * @bug 4442373
* @summary Verify that RMI can successfully unmarshal Class objects for * @summary Verify that RMI can successfully unmarshal Class objects for
* primitive types. * primitive types. This test does not affect VM global state,
* so othervm is not required.
* @run main PrimitiveClasses * @run main PrimitiveClasses
*/ */

View File

@ -211,7 +211,8 @@ mkdir ./test_classes
# split application classes and test plugin classes # split application classes and test plugin classes
mv ./UserPluginMetadataFormatTest*.class ./test_classes mv ./UserPluginMetadataFormatTest*.class ./test_classes
$TESTJAVA/bin/java MetadataFormatTest test_classes UserPluginMetadataFormatTest $TESTJAVA/bin/java ${TESTVMOPTS} \
MetadataFormatTest test_classes UserPluginMetadataFormatTest
############### END YOUR TEST CODE !!!!! ############ ############### END YOUR TEST CODE !!!!! ############
status=$? status=$?

View File

@ -212,7 +212,8 @@ mkdir ./test_classes
# split application classes and test plugin classes # split application classes and test plugin classes
mv ./UserPluginMetadataFormatTest*.class ./test_classes mv ./UserPluginMetadataFormatTest*.class ./test_classes
$TESTJAVA/bin/java MetadataFormatThreadTest test_classes UserPluginMetadataFormatTest $TESTJAVA/bin/java ${TESTVMOPTS} \
MetadataFormatThreadTest test_classes UserPluginMetadataFormatTest
############### END YOUR TEST CODE !!!!! ############ ############### END YOUR TEST CODE !!!!! ############
status=$? status=$?

View File

@ -198,14 +198,15 @@ if [ $? -ne 0 ] ; then
fi fi
# Verify that all classoladers are destroyed # Verify that all classoladers are destroyed
${TESTJAVA}/bin/java -cp Test.jar test.Main ${TESTJAVA}/bin/java ${TESTVMOPTS} -cp Test.jar test.Main
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
fail "Test FAILED: some classloaders weren't destroyed." fail "Test FAILED: some classloaders weren't destroyed."
fi fi
# Verify that ImageIO shutdown hook works correcly # Verify that ImageIO shutdown hook works correcly
${TESTJAVA}/bin/java -cp Test.jar -DforgetSomeStreams=true test.Main ${TESTJAVA}/bin/java ${TESTVMOPTS} \
-cp Test.jar -DforgetSomeStreams=true test.Main
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
fail "Test FAILED: some classloaders weren't destroyed of shutdown hook failed." fail "Test FAILED: some classloaders weren't destroyed of shutdown hook failed."
fi fi

View File

@ -46,6 +46,9 @@ EOF
createJavaPolicyFile createJavaPolicyFile
${TESTJAVA}/bin/java -Djava.security.manager -Djava.security.policy=${TESTCLASSES}/print.policy -cp ${TESTCLASSES} PrintSE ${TESTJAVA}/bin/java ${TESTVMOPTS} \
-Djava.security.manager \
-Djava.security.policy=${TESTCLASSES}/print.policy \
-cp ${TESTCLASSES} PrintSE
exit $? exit $?

View File

@ -25,6 +25,8 @@
* @test * @test
* @bug 4932837 6582235 * @bug 4932837 6582235
* @summary Test SslRMI[Client|Server]SocketFactory equals() and hashCode(). * @summary Test SslRMI[Client|Server]SocketFactory equals() and hashCode().
* This test does not affect VM global state, so othervm is
* not required.
* @author Daniel Fuchs * @author Daniel Fuchs
* *
* @run main SocketFactoryTest * @run main SocketFactoryTest

View File

@ -41,7 +41,7 @@ NO_J2D_DGA=true
J2D_PIXMAPS=shared J2D_PIXMAPS=shared
export NO_J2D_DGA J2D_PIXMAPS export NO_J2D_DGA J2D_PIXMAPS
${TESTJAVA}/bin/java SharedMemoryPixmapsTest ${TESTJAVA}/bin/java ${TESTVMOPTS} SharedMemoryPixmapsTest
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Test failed!" echo "Test failed!"

View File

@ -25,6 +25,7 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.net.ConnectException; import java.net.ConnectException;
import java.net.ServerSocket;
import java.rmi.NoSuchObjectException; import java.rmi.NoSuchObjectException;
import java.rmi.registry.LocateRegistry; import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry; import java.rmi.registry.Registry;
@ -255,26 +256,23 @@ public class JMXStartStopTest {
private static List<Failure> failures = new ArrayList<>(); private static List<Failure> failures = new ArrayList<>();
public static void main(String args[]) throws Exception { public static void main(String args[]) throws Exception {
for (int i=0;i<3;i++) { for (Method m : JMXStartStopTest.class.getDeclaredMethods()) {
System.out.println("=== PASS " + i + " ==="); if (m.getName().startsWith("test_")) {
for (Method m : JMXStartStopTest.class.getDeclaredMethods()) { try {
if (m.getName().startsWith("test_")) { m.invoke(null);
try { System.out.println("=== PASSED\n");
m.invoke(null); } catch (Throwable e) {
System.out.println("=== PASSED\n"); failures.add(new Failure(e, m.getName() + " failed"));
} catch (Throwable e) {
failures.add(new Failure(e, m.getName() + " failed"));
}
} }
} }
}
if (!failures.isEmpty()) { if (!failures.isEmpty()) {
for(Failure f : failures) { for(Failure f : failures) {
System.err.println(f.getMsg()); System.err.println(f.getMsg());
f.getCause().printStackTrace(System.err); f.getCause().printStackTrace(System.err);
}
throw new Error();
} }
throw new Error();
} }
} }
@ -371,6 +369,7 @@ public class JMXStartStopTest {
)); ));
pbArgs.addAll(Arrays.asList(args)); pbArgs.addAll(Arrays.asList(args));
pbArgs.add("JMXStartStopDoSomething"); pbArgs.add("JMXStartStopDoSomething");
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
pbArgs.toArray(new String[pbArgs.size()]) pbArgs.toArray(new String[pbArgs.size()])
); );
@ -596,14 +595,16 @@ public class JMXStartStopTest {
jcmd(CMD_STOP); jcmd(CMD_STOP);
jcmd(CMD_STOP); jcmd(CMD_STOP);
ServerSocket ss = new ServerSocket(0);
jcmd( jcmd(
line -> { line -> {
if (line.contains("Port already in use: 22")) { if (line.contains("Port already in use: " + ss.getLocalPort())) {
checks[2] = true; checks[2] = true;
} }
}, },
CMD_START, CMD_START,
"jmxremote.port=22", "jmxremote.port=" + ss.getLocalPort(),
"jmxremote.rmi.port=" + port2, "jmxremote.rmi.port=" + port2,
"jmxremote.authenticate=false", "jmxremote.authenticate=false",
"jmxremote.ssl=false"); "jmxremote.ssl=false");
@ -616,7 +617,7 @@ public class JMXStartStopTest {
"report an invalid agent state"); "report an invalid agent state");
} }
if (!checks[2]) { if (!checks[2]) {
throw new Exception("Starting agent on port 22 should " + throw new Exception("Starting agent on port " + ss.getLocalPort() + " should " +
"report port in use"); "report port in use");
} }
} finally { } finally {
@ -627,7 +628,7 @@ public class JMXStartStopTest {
private static void test_07() throws Exception { private static void test_07() throws Exception {
// Run an app without JMX enabled, but with some properties set // Run an app without JMX enabled, but with some properties set
// in command line. // in command line.
// make sure these properties overriden corectly // make sure these properties overridden corectly
System.out.println("**** Test seven ****"); System.out.println("**** Test seven ****");
@ -654,7 +655,7 @@ public class JMXStartStopTest {
// Run an app with JMX enabled and with some properties set // Run an app with JMX enabled and with some properties set
// in command line. // in command line.
// stop JMX agent and then start it again with different property values // stop JMX agent and then start it again with different property values
// make sure these properties overriden corectly // make sure these properties overridden corectly
System.out.println("**** Test eight ****"); System.out.println("**** Test eight ****");
@ -690,7 +691,7 @@ public class JMXStartStopTest {
// stop JMX agent and then start it again with different property values // stop JMX agent and then start it again with different property values
// specifing some property in management config file and some of them // specifing some property in management config file and some of them
// in command line // in command line
// make sure these properties overriden corectly // make sure these properties overridden corectly
System.out.println("**** Test nine ****"); System.out.println("**** Test nine ****");
@ -725,7 +726,7 @@ public class JMXStartStopTest {
// in command line. // in command line.
// stop JMX agent and then start it again with different property values // stop JMX agent and then start it again with different property values
// stop JMX agent again and then start it without property value // stop JMX agent again and then start it without property value
// make sure these properties overriden corectly // make sure these properties overridden corectly
System.out.println("**** Test ten ****"); System.out.println("**** Test ten ****");
@ -800,7 +801,7 @@ public class JMXStartStopTest {
// Run an app with -javaagent make sure it works as expected - // Run an app with -javaagent make sure it works as expected -
// system properties are ignored // system properties are ignored
System.out.println("**** Test fourteen ****"); System.out.println("**** Test thirteen ****");
String agent = TEST_JDK + "/jre/lib/management-agent.jar"; String agent = TEST_JDK + "/jre/lib/management-agent.jar";
if (!new File(agent).exists()) { if (!new File(agent).exists()) {

View File

@ -24,7 +24,7 @@
/* /*
* @test * @test
* @bug 6887710 * @bug 6887710
* @summary Verify the impact of sun.misc.JarIndex.metaInfFilenames on Service loaders * @summary Verify the impact of sun.misc.JarIndex.metaInfFilenames on ServiceLoader
* @run main/othervm Basic * @run main/othervm Basic
*/ */
@ -48,9 +48,8 @@ import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer; import com.sun.net.httpserver.HttpServer;
/** /**
* Verifies the impact of sun.misc.JarIndex.metaInfFilenames on service loaders * Verifies the impact of sun.misc.JarIndex.metaInfFilenames on ServiceLoader
* (sun.misc.Service & java.util.ServiceLoader), as well as finding resources * and on finding resources via Class.getResource.
* through Class.getResouce.
* *
* 1) Compile the test sources: * 1) Compile the test sources:
* jarA: * jarA:
@ -214,23 +213,13 @@ public class Basic {
int failed = 0; int failed = 0;
// Tests using sun.misc.Service
if (!sunMiscServiceTest(baseURL, messageService, true, false, true)) {
System.out.println("Test: sun.misc.Service looking for " + messageService + ", failed");
failed++;
}
if (!sunMiscServiceTest(baseURL, unknownService, false, false, false)) {
System.out.println("Test: sun.misc.Service looking for " + unknownService + " failed");
failed++;
}
// Tests using java.util.SerivceLoader // Tests using java.util.SerivceLoader
if (!javaUtilServiceLoaderTest(baseURL, messageService, true, false, true)) { if (!javaUtilServiceLoaderTest(baseURL, messageService, true, false, true)) {
System.out.println("Test: sun.misc.Service looking for " + messageService + ", failed"); System.out.println("Test: ServiceLoader looking for " + messageService + ", failed");
failed++; failed++;
} }
if (!javaUtilServiceLoaderTest(baseURL, unknownService, false, false, false)) { if (!javaUtilServiceLoaderTest(baseURL, unknownService, false, false, false)) {
System.out.println("Test: sun.misc.Service looking for " + unknownService + " failed"); System.out.println("Test: ServiceLoader looking for " + unknownService + " failed");
failed++; failed++;
} }
@ -248,48 +237,6 @@ public class Basic {
throw new RuntimeException("Failed: " + failed + " tests"); throw new RuntimeException("Failed: " + failed + " tests");
} }
static boolean sunMiscServiceTest(URL baseURL,
String serviceClass,
boolean expectToFind,
boolean expectbDotJar,
boolean expectcDotJar) throws IOException {
debug("----------------------------------");
debug("Running test with sun.misc.Service looking for " + serviceClass);
URLClassLoader loader = getLoader(baseURL);
httpServer.reset();
Class<?> messageServiceClass = null;
try {
messageServiceClass = loader.loadClass(serviceClass);
} catch (ClassNotFoundException cnfe) {
System.err.println(cnfe);
throw new RuntimeException("Error in test: " + cnfe);
}
Iterator<?> iterator = sun.misc.Service.providers(messageServiceClass, loader);
if (expectToFind && !iterator.hasNext()) {
debug(messageServiceClass + " NOT found.");
return false;
}
while (iterator.hasNext()) {
debug("found " + iterator.next() + " " + messageService);
}
debug("HttpServer: " + httpServer);
if (!expectbDotJar && httpServer.bDotJar > 0) {
debug("Unexpeced request sent to the httpserver for b.jar");
return false;
}
if (!expectcDotJar && httpServer.cDotJar > 0) {
debug("Unexpeced request sent to the httpserver for c.jar");
return false;
}
return true;
}
static boolean javaUtilServiceLoaderTest(URL baseURL, static boolean javaUtilServiceLoaderTest(URL baseURL,
String serviceClass, String serviceClass,
boolean expectToFind, boolean expectToFind,

View File

@ -25,7 +25,7 @@
* @bug 4094889 * @bug 4094889
* @summary rmid can have a corrupted log * @summary rmid can have a corrupted log
* *
* @run main LogAlignmentTest * @run main/othervm LogAlignmentTest
*/ */
/* Fault: ReliableLog used RandomAccessFile.skipBytes() to seek past the end /* Fault: ReliableLog used RandomAccessFile.skipBytes() to seek past the end

View File

@ -26,7 +26,7 @@
* @summary Verify that ReliableLog.snapshotSize() returns correct snapshot * @summary Verify that ReliableLog.snapshotSize() returns correct snapshot
* file size even if LogHandler doesn't flush. * file size even if LogHandler doesn't flush.
* *
* @run main SnapshotSize * @run main/othervm SnapshotSize
*/ */
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -26,9 +26,10 @@
*/ */
/* @test /* @test
* @bug 6610897 * @bug 6610897 8030844
* @summary New constructor in sun.tools.java.ClassPath builds a path using * @summary New constructor in sun.tools.java.ClassPath builds a path using
* File.separator instead of File.pathSeparator * File.separator instead of File.pathSeparator. This test does
* not affect VM global state, so othervm is not required.
* @run main RMICClassPathTest * @run main RMICClassPathTest
*/ */
@ -37,12 +38,13 @@ import java.io.File;
import sun.rmi.rmic.BatchEnvironment; import sun.rmi.rmic.BatchEnvironment;
public class RMICClassPathTest { public class RMICClassPathTest {
private final static String SRC_PATH = System.getProperty("test.src", ".");
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
String sysPath = "/home/~user/jdk/jre/lib/rt.jar"; String sysPath = SRC_PATH + "/jdk/jre/lib/rt.jar";
String extDir = ""; String extDir = "";
String clPath = "/home/~user/user.jar" + File.pathSeparator + String clPath = SRC_PATH + "/user.jar" + File.pathSeparator +
"/home/~user/user2.jar" + File.pathSeparator + SRC_PATH + "/user2.jar" + File.pathSeparator +
"/home/~user/user3.jar"; SRC_PATH + "/user3.jar";
String cpStr = BatchEnvironment.createClassPath(clPath, sysPath, extDir).toString(); String cpStr = BatchEnvironment.createClassPath(clPath, sysPath, extDir).toString();

View File

@ -40,5 +40,5 @@ fi
$COMPILEJAVA/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . \ $COMPILEJAVA/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . \
${TESTSRC}/NamingManager.java ${TESTSRC}/DNS.java ${TESTSRC}/NamingManager.java ${TESTSRC}/DNS.java
$TESTJAVA/bin/java -Xbootclasspath/p:. DNS $TESTJAVA/bin/java ${TESTVMOPTS} -Xbootclasspath/p:. DNS

View File

@ -106,7 +106,7 @@ cp ${NSS}${FS}db${FS}secmod.db .
chmod u+w key3.db chmod u+w key3.db
chmod u+w cert8.db chmod u+w cert8.db
echo | ${TESTJAVA}${FS}bin${FS}java -Dnss \ echo | ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Dnss \
-Dnss.lib=${LIBNAME} \ -Dnss.lib=${LIBNAME} \
KeyToolTest KeyToolTest
status=$? status=$?

View File

@ -102,7 +102,7 @@ ${TESTJAVA}/bin/javac -d "${TESTCLASSES}" ${CP} -g \
"${TESTSRC}"/"${TARGETCLASS}".java "${TESTSRC}"/"${TARGETCLASS}".java
# #
#Run the test class, again with the classpath we need: #Run the test class, again with the classpath we need:
${TESTJAVA}/bin/java ${CP} ${TARGETCLASS} ${TESTJAVA}/bin/java ${TESTVMOPTS} ${CP} ${TARGETCLASS}
status=$? status=$?
echo "test status was: $status" echo "test status was: $status"
if [ $status -eq "0" ]; if [ $status -eq "0" ];

View File

@ -104,7 +104,7 @@ ${TESTJAVA}/bin/javac -d "${TESTCLASSES}" ${CP} -g \
"${TESTSRC}"/"${TARGETCLASS}".java "${TESTSRC}"/"${TARGETCLASS}".java
# #
#Run the test class, again with the classpath we need: #Run the test class, again with the classpath we need:
${TESTJAVA}/bin/java ${CP} ${TARGETCLASS} ${TESTJAVA}/bin/java ${TESTVMOPTS} ${CP} ${TARGETCLASS}
status=$? status=$?
echo "test status was: $status" echo "test status was: $status"
if [ $status -eq "0" ]; if [ $status -eq "0" ];