This commit is contained in:
Lana Steuck 2012-02-15 15:28:15 -08:00
commit 7ca7e599a5
115 changed files with 1398 additions and 2197 deletions

View File

@ -47,7 +47,6 @@ SUBDIRS_enterprise = crypto/provider jndi \
org rowset net/httpserver org rowset net/httpserver
SUBDIRS_misc = $(SCRIPT_SUBDIR) tracing servicetag nio demo SUBDIRS_misc = $(SCRIPT_SUBDIR) tracing servicetag nio demo
# Omit mirror since it's built with the apt tool.
SUBDIRS_tools = tools SUBDIRS_tools = tools
include $(BUILDDIR)/common/Subdirs.gmk include $(BUILDDIR)/common/Subdirs.gmk

View File

@ -29,11 +29,11 @@
ifneq ($(PLATFORM), windows) ifneq ($(PLATFORM), windows)
FILES_export = \ FILES_export = \
sun/nio/ch/SctpAssocChange.java \ sun/nio/ch/sctp/AssociationChange.java \
sun/nio/ch/SctpChannelImpl.java \ sun/nio/ch/sctp/SctpChannelImpl.java \
sun/nio/ch/SctpNet.java \ sun/nio/ch/sctp/SctpNet.java \
sun/nio/ch/SctpPeerAddrChange.java \ sun/nio/ch/sctp/PeerAddrChange.java \
sun/nio/ch/SctpResultContainer.java \ sun/nio/ch/sctp/ResultContainer.java \
sun/nio/ch/SctpServerChannelImpl.java \ sun/nio/ch/sctp/SctpServerChannelImpl.java \
sun/nio/ch/SctpStdSocketOption.java sun/nio/ch/sctp/SctpStdSocketOption.java
endif endif

View File

@ -42,25 +42,25 @@ FILES_java = \
com/sun/nio/sctp/SendFailedNotification.java \ com/sun/nio/sctp/SendFailedNotification.java \
com/sun/nio/sctp/ShutdownNotification.java \ com/sun/nio/sctp/ShutdownNotification.java \
\ \
sun/nio/ch/SctpMessageInfoImpl.java \ sun/nio/ch/sctp/MessageInfoImpl.java \
sun/nio/ch/SctpStdSocketOption.java sun/nio/ch/sctp/SctpStdSocketOption.java
ifneq ($(PLATFORM), windows) ifneq ($(PLATFORM), windows)
FILES_java += \ FILES_java += \
sun/nio/ch/SctpAssocChange.java \ sun/nio/ch/sctp/AssociationChange.java \
sun/nio/ch/SctpAssociationImpl.java \ sun/nio/ch/sctp/AssociationImpl.java \
sun/nio/ch/SctpChannelImpl.java \ sun/nio/ch/sctp/PeerAddrChange.java \
sun/nio/ch/SctpMultiChannelImpl.java \ sun/nio/ch/sctp/ResultContainer.java \
sun/nio/ch/SctpNet.java \ sun/nio/ch/sctp/SctpChannelImpl.java \
sun/nio/ch/SctpNotification.java \ sun/nio/ch/sctp/SctpMultiChannelImpl.java \
sun/nio/ch/SctpPeerAddrChange.java \ sun/nio/ch/sctp/SctpNet.java \
sun/nio/ch/SctpResultContainer.java \ sun/nio/ch/sctp/SctpNotification.java \
sun/nio/ch/SctpSendFailed.java \ sun/nio/ch/sctp/SctpServerChannelImpl.java \
sun/nio/ch/SctpServerChannelImpl.java \ sun/nio/ch/sctp/SendFailed.java \
sun/nio/ch/SctpShutdown.java sun/nio/ch/sctp/Shutdown.java
else else
FILES_java += \ FILES_java += \
sun/nio/ch/SctpChannelImpl.java \ sun/nio/ch/sctp/SctpChannelImpl.java \
sun/nio/ch/SctpMultiChannelImpl.java \ sun/nio/ch/sctp/SctpMultiChannelImpl.java \
sun/nio/ch/SctpServerChannelImpl.java sun/nio/ch/sctp/SctpServerChannelImpl.java
endif endif

View File

@ -47,14 +47,16 @@ include $(BUILDDIR)/common/Library.gmk
# #
# Find platform-specific C source files # Find platform-specific C source files
# #
vpath %.c $(PLATFORM_SRC)/native/sun/nio/ch vpath %.c $(PLATFORM_SRC)/native/sun/nio/ch/sctp
# #
# Include nio.h, net_util.h, sun_nio_ch_IOStatus.h, etc # Include nio.h, net_util.h, sun_nio_ch_IOStatus.h, etc
# #
OTHER_INCLUDES += \ OTHER_INCLUDES += \
-I$(SHARE_SRC)/native/sun/nio/ch \ -I$(SHARE_SRC)/native/sun/nio/ch \
-I$(SHARE_SRC)/native/sun/nio/ch/sctp \
-I$(SHARE_SRC)/native/java/net \ -I$(SHARE_SRC)/native/java/net \
-I$(PLATFORM_SRC)/native/sun/nio/ch \
-I$(PLATFORM_SRC)/native/java/net \ -I$(PLATFORM_SRC)/native/java/net \
-I$(CLASSHDRDIR)/../../../../java/java.nio/nio/CClassHeaders -I$(CLASSHDRDIR)/../../../../java/java.nio/nio/CClassHeaders
@ -75,5 +77,5 @@ endif # ifneq windows
clean clobber:: clean clobber::
$(RM) -r $(CLASSDESTDIR)/com/sun/nio/sctp $(RM) -r $(CLASSDESTDIR)/com/sun/nio/sctp
$(RM) -r $(CLASSDESTDIR)/sun/nio/ch $(RM) -r $(CLASSDESTDIR)/sun/nio/ch/sctp

View File

@ -25,30 +25,30 @@
SUNWprivate_1.1 { SUNWprivate_1.1 {
global: global:
Java_sun_nio_ch_SctpNet_init; Java_sun_nio_ch_sctp_SctpNet_init;
Java_sun_nio_ch_SctpNet_socket0; Java_sun_nio_ch_sctp_SctpNet_socket0;
Java_sun_nio_ch_SctpNet_bindx; Java_sun_nio_ch_sctp_SctpNet_bindx;
Java_sun_nio_ch_SctpNet_branch0; Java_sun_nio_ch_sctp_SctpNet_branch0;
Java_sun_nio_ch_SctpNet_listen0; Java_sun_nio_ch_sctp_SctpNet_listen0;
Java_sun_nio_ch_SctpNet_connect0; Java_sun_nio_ch_sctp_SctpNet_connect0;
Java_sun_nio_ch_SctpNet_close0; Java_sun_nio_ch_sctp_SctpNet_close0;
Java_sun_nio_ch_SctpNet_preClose0; Java_sun_nio_ch_sctp_SctpNet_preClose0;
Java_sun_nio_ch_SctpNet_getLocalAddresses0; Java_sun_nio_ch_sctp_SctpNet_getLocalAddresses0;
Java_sun_nio_ch_SctpNet_getRemoteAddresses0; Java_sun_nio_ch_sctp_SctpNet_getRemoteAddresses0;
Java_sun_nio_ch_SctpNet_getPrimAddrOption0; Java_sun_nio_ch_sctp_SctpNet_getPrimAddrOption0;
Java_sun_nio_ch_SctpNet_setPrimAddrOption0; Java_sun_nio_ch_sctp_SctpNet_setPrimAddrOption0;
Java_sun_nio_ch_SctpNet_setPeerPrimAddrOption0; Java_sun_nio_ch_sctp_SctpNet_setPeerPrimAddrOption0;
Java_sun_nio_ch_SctpNet_getInitMsgOption0; Java_sun_nio_ch_sctp_SctpNet_getInitMsgOption0;
Java_sun_nio_ch_SctpNet_setInitMsgOption0; Java_sun_nio_ch_sctp_SctpNet_setInitMsgOption0;
Java_sun_nio_ch_SctpNet_getIntOption0; Java_sun_nio_ch_sctp_SctpNet_getIntOption0;
Java_sun_nio_ch_SctpNet_setIntOption0; Java_sun_nio_ch_sctp_SctpNet_setIntOption0;
Java_sun_nio_ch_SctpNet_shutdown0; Java_sun_nio_ch_sctp_SctpNet_shutdown0;
Java_sun_nio_ch_SctpChannelImpl_initIDs; Java_sun_nio_ch_sctp_SctpChannelImpl_initIDs;
Java_sun_nio_ch_SctpChannelImpl_checkConnect; Java_sun_nio_ch_sctp_SctpChannelImpl_checkConnect;
Java_sun_nio_ch_SctpChannelImpl_receive0; Java_sun_nio_ch_sctp_SctpChannelImpl_receive0;
Java_sun_nio_ch_SctpChannelImpl_send0; Java_sun_nio_ch_sctp_SctpChannelImpl_send0;
Java_sun_nio_ch_SctpServerChannelImpl_initIDs; Java_sun_nio_ch_sctp_SctpServerChannelImpl_initIDs;
Java_sun_nio_ch_SctpServerChannelImpl_accept0; Java_sun_nio_ch_sctp_SctpServerChannelImpl_accept0;
JNI_OnLoad; JNI_OnLoad;
local: local:
*; *;

View File

@ -132,7 +132,6 @@ endif
JDK_MAN_PAGES = \ JDK_MAN_PAGES = \
$(JRE_MAN_PAGES) \ $(JRE_MAN_PAGES) \
appletviewer.1 \ appletviewer.1 \
apt.1 \
extcheck.1 \ extcheck.1 \
idlj.1 \ idlj.1 \
jar.1 \ jar.1 \
@ -264,7 +263,6 @@ SOURCES = \
com/sun/java/swing \ com/sun/java/swing \
com/sun/javadoc \ com/sun/javadoc \
com/sun/jmx \ com/sun/jmx \
com/sun/mirror \
com/sun/source \ com/sun/source \
com/sun/naming \ com/sun/naming \
com/sun/security/auth \ com/sun/security/auth \
@ -346,7 +344,6 @@ TOOLS = \
com/sun/javadoc \ com/sun/javadoc \
com/sun/jdi \ com/sun/jdi \
com/sun/jarsigner \ com/sun/jarsigner \
com/sun/mirror \
com/sun/source \ com/sun/source \
com/sun/tools/classfile \ com/sun/tools/classfile \
com/sun/tools/doclets \ com/sun/tools/doclets \
@ -356,16 +353,16 @@ TOOLS = \
com/sun/tools/hat \ com/sun/tools/hat \
com/sun/tools/javac \ com/sun/tools/javac \
com/sun/tools/javadoc \ com/sun/tools/javadoc \
com/sun/tools/apt \
com/sun/tools/javah \ com/sun/tools/javah \
com/sun/tools/javap \ com/sun/tools/javap \
com/sun/tools/corba \ com/sun/tools/corba \
com/sun/tools/internal/xjc \ com/sun/tools/internal/xjc \
com/sun/tools/internal/ws \ com/sun/tools/internal/ws \
META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory \ META-INF/services/com.sun.tools.internal.ws.wscompile.Plugin \
META-INF/services/com.sun.tools.xjc.Plugin \ META-INF/services/com.sun.tools.internal.xjc.Plugin \
com/sun/istack/internal/tools \ com/sun/istack/internal/tools \
com/sun/istack/internal/ws \ com/sun/tools/internal/jxc/ap \
com/sun/tools/internal/ws/wscompile/plugin/at_generated \
com/sun/codemodel \ com/sun/codemodel \
com/sun/tools/internal/jxc \ com/sun/tools/internal/jxc \
com/sun/xml/internal/rngom \ com/sun/xml/internal/rngom \
@ -438,7 +435,6 @@ NOTJRETOOLS = \
java-rmi.cgi \ java-rmi.cgi \
javac$(EXE_SUFFIX) \ javac$(EXE_SUFFIX) \
javadoc$(EXE_SUFFIX) \ javadoc$(EXE_SUFFIX) \
apt$(EXE_SUFFIX) \
javah$(EXE_SUFFIX) \ javah$(EXE_SUFFIX) \
javap$(EXE_SUFFIX) \ javap$(EXE_SUFFIX) \
jcmd$(EXE_SUFFIX) \ jcmd$(EXE_SUFFIX) \
@ -525,13 +521,10 @@ $(NOT_RT_JAR_LIST): FRC
$(ECHO) "com/sun/javadoc/" >> $@ $(ECHO) "com/sun/javadoc/" >> $@
$(ECHO) "com/sun/jdi/" >> $@ $(ECHO) "com/sun/jdi/" >> $@
$(ECHO) "com/sun/jarsigner/" >> $@ $(ECHO) "com/sun/jarsigner/" >> $@
$(ECHO) "com/sun/mirror/" >> $@
$(ECHO) "com/sun/source/" >> $@ $(ECHO) "com/sun/source/" >> $@
$(ECHO) "com/sun/istack/internal/tools/" >> $@ $(ECHO) "com/sun/istack/internal/tools/" >> $@
$(ECHO) "com/sun/istack/internal/ws/" >> $@
$(ECHO) "META-INF/services/com.sun.jdi.connect.Connector" >> $@ $(ECHO) "META-INF/services/com.sun.jdi.connect.Connector" >> $@
$(ECHO) "META-INF/services/com.sun.jdi.connect.spi.TransportService" >> $@ $(ECHO) "META-INF/services/com.sun.jdi.connect.spi.TransportService" >> $@
$(ECHO) "META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory" >> $@
$(ECHO) "META-INF/services/com.sun.tools.xjc.Plugin" >> $@ $(ECHO) "META-INF/services/com.sun.tools.xjc.Plugin" >> $@
$(ECHO) "com/sun/tools/" >> $@ $(ECHO) "com/sun/tools/" >> $@
$(ECHO) "sun/jvmstat/" >> $@ $(ECHO) "sun/jvmstat/" >> $@
@ -1000,7 +993,7 @@ initial-image-jdk:: initial-image-jdk-setup \
@# @#
@# files that might not exist need to be touched. @# files that might not exist need to be touched.
@# @#
$(TOUCH) $(CLASSBINDIR)/META-INF/services/com.sun.tools.xjc.Plugin $(TOUCH) $(CLASSBINDIR)/META-INF/services/com.sun.tools.internal.xjc.Plugin
@# @#
@# lib/tools.jar @# lib/tools.jar
@# @#

View File

@ -34,7 +34,6 @@ IMPORT_RT_PACKAGES += \
javax/xml/ws \ javax/xml/ws \
javax/jws \ javax/jws \
javax/annotation \ javax/annotation \
com/sun/istack/internal \
com/sun/xml/internal/bind \ com/sun/xml/internal/bind \
com/sun/xml/internal/fastinfoset \ com/sun/xml/internal/fastinfoset \
com/sun/xml/internal/messaging \ com/sun/xml/internal/messaging \
@ -42,13 +41,13 @@ IMPORT_RT_PACKAGES += \
com/sun/xml/internal/txw2 \ com/sun/xml/internal/txw2 \
com/sun/xml/internal/ws \ com/sun/xml/internal/ws \
com/sun/xml/internal/stream/buffer com/sun/xml/internal/stream/buffer
NOT_USED_PACKAGES += \ NOT_USED_PACKAGES += \
com/sun/tools/internal/txw2 com/sun/tools/internal/txw2
IMPORT_TOOLS_PACKAGES += \ IMPORT_TOOLS_PACKAGES += \
com/sun/codemodel \ com/sun/codemodel \
com/sun/istack/internal/tools \ com/sun/istack/internal/tools \
com/sun/istack/internal/ws \
com/sun/xml/internal/rngom \ com/sun/xml/internal/rngom \
com/sun/xml/internal/xsom \ com/sun/xml/internal/xsom \
com/sun/xml/internal/dtdparser \ com/sun/xml/internal/dtdparser \
@ -56,6 +55,9 @@ IMPORT_TOOLS_PACKAGES += \
com/sun/tools/internal/ws \ com/sun/tools/internal/ws \
com/sun/tools/internal/jxc \ com/sun/tools/internal/jxc \
org/relaxng \ org/relaxng \
META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory \ META-INF/services/com.sun.tools.internal.ws.wscompile.Plugin \
META-INF/services/com.sun.tools.internal.xjc.Plugin META-INF/services/com.sun.tools.internal.xjc.Plugin \
com/sun/tools/internal/jxc/ap \
com/sun/tools/internal/ws/wscompile/plugin/at_generated

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2012, 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
@ -32,9 +32,7 @@ IMPORT_RT_PACKAGES += \
IMPORT_TOOLS_PACKAGES += \ IMPORT_TOOLS_PACKAGES += \
com/sun/javadoc \ com/sun/javadoc \
com/sun/mirror \
com/sun/source \ com/sun/source \
com/sun/tools/apt \
com/sun/tools/classfile \ com/sun/tools/classfile \
com/sun/tools/doclets \ com/sun/tools/doclets \
com/sun/tools/javac \ com/sun/tools/javac \

View File

@ -1,4 +1,4 @@
# Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2012, 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
@ -356,64 +356,6 @@ $(COREAPI_PACKAGES_FILE): $(DIRECTORY_CACHE) $(call PackageDependencies,$(CORE_P
$(prep-target) $(prep-target)
$(call PackageFilter,$(CORE_PKGS)) $(call PackageFilter,$(CORE_PKGS))
#############################################################
#
# mirrordocs
#
# Part of langtools
ifdef LANGTOOLS_DIST
ALL_OTHER_TARGETS += mirrordocs
endif
MIRROR_DOCDIR := $(JDK_API_DOCSDIR)/apt/mirror
MIRROR2COREAPI := ../../$(JDKJRE2COREAPI)
MIRROR_DOCTITLE := Mirror API
MIRROR_WINDOWTITLE := Mirror API
MIRROR_HEADER := <strong>Mirror API</strong>
MIRROR_BOTTOM := $(call CommonBottom,$(MIRROR_FIRST_COPYRIGHT_YEAR))
MIRROR_GROUPNAME := Packages
MIRROR_OVERVIEW := $(IMPORTSRCDIR)/com/sun/mirror/overview.html
MIRROR_REGEXP := com.sun.mirror.*
# MIRROR_PKGS is located in NON_CORE_PKGS.gmk
# The index.html, options, and packages files
MIRROR_INDEX_FILE = $(MIRROR_DOCDIR)/index.html
MIRROR_OPTIONS_FILE = $(DOCSTMPDIR)/mirror.options
MIRROR_PACKAGES_FILE = $(DOCSTMPDIR)/mirror.packages
mirrordocs: $(MIRROR_INDEX_FILE)
# Set relative location to core api document root
$(MIRROR_INDEX_FILE): GET2DOCSDIR=$(MIRROR2COREAPI)/..
# Run javadoc if the index file is out of date or missing
$(MIRROR_INDEX_FILE): $(MIRROR_OPTIONS_FILE) $(MIRROR_PACKAGES_FILE)
$(prep-javadoc)
$(call JavadocSummary,$(MIRROR_OPTIONS_FILE),$(MIRROR_PACKAGES_FILE))
$(JAVADOC_CMD) $(JAVADOC_VM_MEMORY_FLAGS) -d $(@D) \
@$(MIRROR_OPTIONS_FILE) @$(MIRROR_PACKAGES_FILE)
# Create file with javadoc options in it
$(MIRROR_OPTIONS_FILE): $(MIRROR_OVERVIEW)
$(prep-target)
@($(call OptionOnly,$(COMMON_JAVADOCFLAGS)) ; \
$(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
$(call OptionPair,-encoding,ascii) ; \
$(call OptionPair,-overview,$(MIRROR_OVERVIEW)) ; \
$(call OptionPair,-doctitle,$(MIRROR_DOCTITLE)) ; \
$(call OptionPair,-windowtitle,$(MIRROR_WINDOWTITLE) $(DRAFT_WINTITLE));\
$(call OptionPair,-header,$(MIRROR_HEADER)$(DRAFT_HEADER)) ; \
$(call OptionPair,-bottom,$(MIRROR_BOTTOM)$(DRAFT_BOTTOM)) ; \
$(call OptionTrip,-group,$(MIRROR_GROUPNAME),$(MIRROR_REGEXP)); \
$(call OptionTrip,-linkoffline,$(MIRROR2COREAPI),$(COREAPI_DOCSDIR)); \
) >> $@
# Create a file with the package names in it
$(MIRROR_PACKAGES_FILE): $(DIRECTORY_CACHE) $(call PackageDependencies,$(MIRROR_PKGS))
$(prep-target)
$(call PackageFilter,$(MIRROR_PKGS))
############################################################# #############################################################
# #
# docletapidocs # docletapidocs

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # 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
@ -71,11 +71,6 @@ DOCLETAPI_PKGS = com.sun.javadoc
TAGLETAPI_FILE = com/sun/tools/doclets/Taglet.java TAGLETAPI_FILE = com/sun/tools/doclets/Taglet.java
MIRROR_PKGS = com.sun.mirror.apt \
com.sun.mirror.declaration \
com.sun.mirror.type \
com.sun.mirror.util
ATTACH_PKGS = com.sun.tools.attach \ ATTACH_PKGS = com.sun.tools.attach \
com.sun.tools.attach.spi com.sun.tools.attach.spi

View File

@ -54,9 +54,6 @@ SUNWprivate_1.1 {
Java_sun_management_GcInfoBuilder_getLastGcInfo0; Java_sun_management_GcInfoBuilder_getLastGcInfo0;
Java_sun_management_GcInfoBuilder_getNumGcExtAttributes; Java_sun_management_GcInfoBuilder_getNumGcExtAttributes;
Java_sun_management_HotSpotDiagnostic_dumpHeap; Java_sun_management_HotSpotDiagnostic_dumpHeap;
Java_sun_management_HotSpotDiagnostic_executeDiagnosticCommand0;
Java_sun_management_HotSpotDiagnostic_getDiagnosticCommandInfo0;
Java_sun_management_HotSpotDiagnostic_getDiagnosticCommands0;
Java_sun_management_HotspotThread_getInternalThreadCount; Java_sun_management_HotspotThread_getInternalThreadCount;
Java_sun_management_HotspotThread_getInternalThreadTimes0; Java_sun_management_HotspotThread_getInternalThreadTimes0;
Java_sun_management_MemoryImpl_getMemoryManagers0; Java_sun_management_MemoryImpl_getMemoryManagers0;

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2004, 2012, 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
@ -55,7 +55,6 @@ endif
define make-all-launchers define make-all-launchers
$(make-appletviewer) $(make-appletviewer)
$(call make-launcher, apt, com.sun.tools.apt.Main, , )
$(call make-launcher, extcheck, com.sun.tools.extcheck.Main, , ) $(call make-launcher, extcheck, com.sun.tools.extcheck.Main, , )
$(call make-launcher, idlj, com.sun.tools.corba.se.idl.toJavaPortable.Compile, , ) $(call make-launcher, idlj, com.sun.tools.corba.se.idl.toJavaPortable.Compile, , )
$(call make-launcher, jar, sun.tools.jar.Main, , ) $(call make-launcher, jar, sun.tools.jar.Main, , )

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2004, 2012, 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
@ -47,10 +47,6 @@ ifndef MAIN_CLASS
endif endif
# Some tools need the wildcard expansion option # Some tools need the wildcard expansion option
ifeq ($(PROGRAM),apt)
WILDCARDS=true
NEVER_ACT_AS_SERVER_CLASS_MACHINE=true
endif
ifeq ($(PROGRAM),javac) ifeq ($(PROGRAM),javac)
WILDCARDS=true WILDCARDS=true
MAIN_JAVA_ARGS += -J-Xss4m -J-ea:com.sun.tools... MAIN_JAVA_ARGS += -J-Xss4m -J-ea:com.sun.tools...

View File

@ -1,153 +0,0 @@
." Copyright (c) 2004, 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.
."
." 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.
."
.TH apt 1 "10 May 2011"
.LP
.SH "NAME"
.LP
.LP
\f2apt\fP \- annotation processing tool
.LP
.SH "SYNOPSIS"
.LP
.LP
\f2apt [\-classpath \fP\f2classpath\fP] [\-sourcepath \f2sourcepath\fP] [\-d \f2directory\fP] [\-s \f2directory\fP] [\-factorypath \f2path\fP] [\-factory \f2class\fP] [\-print] [\-nocompile] [\-A\f2key\fP[\f2=val\fP] ...] [\f2javac option\fP] sourcefiles [@files]
.LP
.SH "PARAMETERS"
.LP
.LP
Options may be in any order. For a discussion of parameters which apply to a specific option, see OPTIONS below.
.LP
.RS 3
.TP 3
sourcefiles
Zero or more source files to be processed.
.TP 3
@files
One or more files that list source files or other options
.RE
.LP
.SH "DESCRIPTION"
.LP
.LP
\f3Note\fP: The \f2apt\fP tool and its associated API contained in the package \f2com.sun.mirror\fP have been deprecated since JDK 7 and are planned to be removed in the next major JDK release. Use the options available in the \f2javac(1)\fP tool and the APIs contained in the packages \f2javax.annotation.processing\fP and \f2javax.lang.model\fP to process annotations.
.LP
.LP
The tool \f2apt\fP, annotation processing tool, includes reflective APIs and supporting infrastructure to process program annotations. The \f2apt\fP reflective APIs provide a build\-time, source\-based, read\-only view of program structure. These reflective APIs are designed to cleanly model the Java(TM) programming language's type system after the addition of generics. First, \f2apt\fP runs annotation processors that can produce new source code and other files. Next, \f2apt\fP can cause compilation of both original and generated source files, easing development. The reflective APIs and other APIs used to interact with the tool are subpackages of \f2com.sun.mirror\fP.
.LP
.LP
A fuller discussion of how the tool operates as well as instructions for developing with \f2apt\fP are in
.na
\f4Getting Started with \fP\f4apt\fP. @
.fi
http://download.oracle.com/javase/7/docs/technotes/guides/apt/GettingStarted.html
.LP
.SH "OPTIONS"
.LP
.SS
apt specific options
.LP
.RS 3
.TP 3
\-s dir
Specify the directory root under which processor\-generated source files will be placed; files are placed in subdirectories based on package namespace.
.TP 3
\-nocompile
Do not compile source files to class files.
.TP 3
\-print
Print out textual representation of specified types; perform no annotation processing or compilation.
.TP 3
\-A[key[=val]]
Options to pass to annotation processors \-\- these are not interpreted by \f2apt\fP directly, but are made available for use by individual processors
.TP 3
\-factorypath path
Specify where to find annotation processor factories; if this option is used, the classpath is \f2not\fP searched for factories.
.TP 3
\-factory classname
Name of annotation processor factory to use; bypasses default discovery process
.TP 3
\-version
Print version information.
.TP 3
\-X
Display information about non\-standard options.
.RE
.LP
.SS
Options shared with javac
.LP
.RS 3
.TP 3
\-d dir
Specify where to place processor and javac generated class files
.TP 3
\-cp path or \-classpath path
Specify where to find user class files and annotation processor factories. If \f2\-factorypath\fP is given, the classpath is not searched for factories.
.RE
.LP
.LP
Consult the javac(1) man page for information on \f2javac\fP options.
.LP
.SS
Non\-Standard Options
.LP
.RS 3
.TP 3
\-XListAnnotationTypes
List found annotation types.
.TP 3
\-XListDeclarations
List specified and included declarations.
.TP 3
\-XPrintAptRounds
Print information about initial and recursive \f2apt\fP rounds.
.TP 3
\-XPrintFactoryInfo
Print information about which annotations a factory is asked to process.
.TP 3
\-XclassesAsDecls
Treat both class and source files as declarations to process.
.RE
.LP
.LP
\f3Note\fP: Because these options are non\-standard, they are subject to change without notice.
.LP
.SH "NOTES"
.LP
.LP
The \f2apt\fP tool and its associated API contained in the package \f2com.sun.mirror\fP have been deprecated since JDK 7 and are planned to be removed in the next major JDK release. Use the options available in the \f2javac(1)\fP tool and the APIs contained in the packages \f2javax.annotation.processing\fP and \f2javax.lang.model\fP to process annotations.
.LP
.SH "SEE ALSO"
.LP
.RS 3
.TP 2
o
javac(1), java(1)
.RE
.LP

View File

@ -1,153 +0,0 @@
." Copyright (c) 2004, 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.
."
." 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.
."
.TH apt 1 "07 May 2011"
.LP
.SH "NAME"
.LP
.LP
\f2apt\fP \- 注釈処理ツール
.LP
.SH "形式"
.LP
.LP
\f2apt [\-classpath \fP\f2classpath\fP] [\-sourcepath \f2sourcepath\fP] [\-d \f2directory\fP] [\-s \f2directory\fP] [\-factorypath \f2path\fP] [\-factory \f2class\fP] [\-print] [\-nocompile] [\-A\f2key\fP[\f2=val\fP] ...] [\f2javac option\fP] sourcefiles [@files]
.LP
.SH "パラメータ"
.LP
.LP
オプションの指定順序に決まりはありません。特定のオプションに適用されるパラメータについては、下記の「オプション」を参照してください。
.LP
.RS 3
.TP 3
sourcefiles
ゼロ、1 つ、または複数の処理対象のソースファイル
.TP 3
@files
ソースファイルまたは他のオプションを一覧表示する 1 つまたは複数のファイル
.RE
.LP
.SH "説明"
.LP
.LP
\f3\fP: \f2apt\fP ツールと、パッケージ \f2com.sun.mirror\fP に含まれているそれに関連した API は、JDK 7 以降非推奨になっており、JDK の次のメジャーリリースで削除される予定です。\f2javac(1)\fP ツールで利用可能なオプションと、パッケージ \f2javax.annotation.processing\fP および \f2javax.lang.model\fP に含まれている API を使用して、注釈を処理してください。
.LP
.LP
注釈処理ツール \f2apt\fP は、リフレクト API とサポートインフラストラクチャーから構成され、プログラム注釈を処理します。\f2apt\fP リフレクト API は、 構築時のソースベースで、プログラム構造に関する読み取り専用ビューを提供します。これらのリフレクト API は、総称を追加した後に、Java(TM) プログラミング言語の型システムを正しくモデル化するように設計されています。最初に、\f2apt\fP は、新しいソースコードと他のファイルを作成する注釈プロセッサを実行します。次に、\f2apt\fP は、元のソースファイルと生成したソースファイルの両方をコンパイルするため、開発が楽になります。ツールとのインタフェースに使用されるリフレクト API などの API は、\f2com.sun.mirror\fP のサブパッケージです。
.LP
.LP
ツールの機能に関する詳細と、\f2apt\fP を使用した開発方法については、
.na
\f4「apt 入門」\fP @
.fi
http://java.sun.com/javase/6/docs/technotes/guides/apt/GettingStarted.htmlを参照してください。
.LP
.SH "オプション"
.LP
.SS
apt 固有のオプション
.LP
.RS 3
.TP 3
\-s dir
プロセッサの生成するソースファイルを置くディレクトリルートを指定します。 ファイルは、パッケージの名前空間に基づいてサブディレクトリに置かれます。
.TP 3
\-nocompile
ソースファイルをクラスファイルにコンパイルしません。
.TP 3
\-print
指定したタイプのテキスト表現を出力します。 注釈処理またはコンパイルは行いません。
.TP 3
\-A[key[=val]]
注釈プロセッサへ渡すオプションです。 このオプションは、\f2apt\fP が直接解釈するのではなく、それぞれのプロセッサによって使用できるように変えられます。
.TP 3
\-factorypath path
注釈プロセッサファクトリを検索する場所を指定します。 このオプションを使用する場合、クラスパスのファクトリは検索されません。
.TP 3
\-factory classname
使用する注釈プロセッサファクトリの名前です。 デフォルトの検出プロセスを省略します。
.TP 3
\-version
バージョン情報を出力します。
.TP 3
\-X
非標準オプションに関する情報を表示します。
.RE
.LP
.SS
javac と共用するオプション
.LP
.RS 3
.TP 3
\-d dir
プロセッサと javac 生成のクラスファイルを置く場所を指定します。
.TP 3
\-cp path または \-classpath path
ユーザークラスファイルと注釈プロセッサファクトリを検索する場所を指定します。\f2\-factorypath\fP が指定されている場合、クラスパスのファクトリは検索されません。
.RE
.LP
.LP
\f2javac\fP オプションの詳細については、javac(1) のマニュアルページを参照してください。
.LP
.SS
非標準オプション
.LP
.RS 3
.TP 3
\-XListAnnotationTypes
注釈の型に検出されるリスト.
.TP 3
\-XListDeclarations
指定および宣言がインクルードされるリスト.
.TP 3
\-XPrintAptRounds
初期および再帰的な \f2apt\fP ラウンドに関する情報を出力する.
.TP 3
\-XPrintFactoryInfo
処理を要求するファクトリの注釈に関する情報を出力する.
.TP 3
\-XclassesAsDecls
クラスファイルとソースファイルの両方を、処理対象の宣言として処理します。
.RE
.LP
.LP
\f3\fP: これらは非標準オプションなので、予告なく変更される可能性があります。
.LP
.SH "注"
.LP
.LP
\f2apt\fP ツールと、パッケージ \f2com.sun.mirror\fP に含まれているそれに関連した API は、JDK 7 以降非推奨になっており、JDK の次のメジャーリリースで削除される予定です。\f2javac(1)\fP ツールで利用可能なオプションと、パッケージ \f2javax.annotation.processing\fP および \f2javax.lang.model\fP に含まれている API を使用して、注釈を処理してください。
.LP
.SH "関連項目"
.LP
.RS 3
.TP 2
o
javac(1), java(1)
.RE
.LP

View File

@ -55,11 +55,14 @@ final class PBEKey implements SecretKey {
// Should allow an empty password. // Should allow an empty password.
passwd = new char[0]; passwd = new char[0];
} }
// Accept "\0" to signify "zero-length password with no terminator".
if (!(passwd.length == 1 && passwd[0] == 0)) {
for (int i=0; i<passwd.length; i++) { for (int i=0; i<passwd.length; i++) {
if ((passwd[i] < '\u0020') || (passwd[i] > '\u007E')) { if ((passwd[i] < '\u0020') || (passwd[i] > '\u007E')) {
throw new InvalidKeySpecException("Password is not ASCII"); throw new InvalidKeySpecException("Password is not ASCII");
} }
} }
}
this.key = new byte[passwd.length]; this.key = new byte[passwd.length];
for (int i=0; i<passwd.length; i++) for (int i=0; i<passwd.length; i++)
this.key[i] = (byte) (passwd[i] & 0x7f); this.key[i] = (byte) (passwd[i] & 0x7f);

View File

@ -60,11 +60,16 @@ final class PKCS12PBECipherCore {
static byte[] derive(char[] chars, byte[] salt, static byte[] derive(char[] chars, byte[] salt,
int ic, int n, int type) { int ic, int n, int type) {
// Add in trailing NULL terminator. // Add in trailing NULL terminator. Special case:
// no terminator if password is "\0".
int length = chars.length*2; int length = chars.length*2;
if (length != 0) { if (length == 2 && chars[0] == 0) {
chars = new char[0];
length = 0;
} else {
length += 2; length += 2;
} }
byte[] passwd = new byte[length]; byte[] passwd = new byte[length];
for (int i = 0, j = 0; i < chars.length; i++, j+=2) { for (int i = 0, j = 0; i < chars.length; i++, j+=2) {
passwd[j] = (byte) ((chars[i] >>> 8) & 0xFF); passwd[j] = (byte) ((chars[i] >>> 8) & 0xFF);
@ -133,6 +138,9 @@ final class PKCS12PBECipherCore {
} }
private static void concat(byte[] src, byte[] dst, int start, int len) { private static void concat(byte[] src, byte[] dst, int start, int len) {
if (src.length == 0) {
return;
}
int loop = len / src.length; int loop = len / src.length;
int off, i; int off, i;
for (i = 0, off = 0; i < loop; i++, off += src.length) for (i = 0, off = 0; i < loop; i++, off += src.length)

View File

@ -1,151 +0,0 @@
/*
* Copyright (c) 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 com.sun.management;
import java.beans.ConstructorProperties;
/**
* Diagnostic Command Argument information. It contains the description
* of one parameter of the diagnostic command. A parameter can either be an
* option or an argument. Options are identified by the option name while
* arguments are identified by their position in the command line. The generic
* syntax of a diagnostic command is:
* <blockquote>
* &lt;command name&gt; [&lt;option&gt;=&lt;value&gt;] [&lt;argument_value&gt;]
* </blockquote>
* Example:
* <blockquote>
* command_name option1=value1 option2=value argumentA argumentB argumentC
* </blockquote>
* In this command line, the diagnostic command receives five parameters, two
* options named {@code option1} and {@code option2}, and three arguments.
* argumentA's position is 0, argumentB's position is 1 and argumentC's
* position is 2.
*
* @author Frederic Parain
* @since 7u4
*/
public class DiagnosticCommandArgumentInfo {
private final String name;
private final String description;
private final String type;
private final String defaultValue;
private final boolean mandatory;
private final boolean option;
private final int position;
/**
* Returns the argument name
*
* @return the argument name
*/
public String getName() {
return name;
}
/**
* Returns the argument description
*
* @return the argument description
*/
public String getDescription() {
return description;
}
/**
* Returns the argument type
*
* @return the argument type
*/
public String getType() {
return type;
}
/**
* Returns the default value as a String if a default value
* is defined, null otherwise.
*
* @return the default value as a String if a default value
* is defined, null otherwise.
*/
public String getDefault() {
return defaultValue;
}
/**
* Returns {@code true} if the argument is mandatory,
* {@code false} otherwise
*
* @return {@code true} if the argument is mandatory,
* {@code false} otherwise
*/
public boolean isMandatory() {
return mandatory;
}
/**
* Returns {@code true} if the argument is an option,
* {@code false} otherwise. Options have to be specified using the
* &lt;key&gt;=&lt;value&gt; syntax on the command line, while other
* arguments are specified with a single &lt;value&gt; field and are
* identified by their position on command line.
*
* @return {@code true} if the argument is an option,
* {@code false} otherwise
*/
public boolean isOption() {
return option;
}
/**
* Returns the expected position of this argument if it is not an option,
* -1 otherwise. Argument position if defined from left to right,
* starting at zero and ignoring the diagnostic command name and
* options.
*
* @return the expected position of this argument if it is not an option,
* -1 otherwise.
*/
public int getPosition() {
return position;
}
@ConstructorProperties({"name","description","type","default",
"mandatory","option","position"})
public DiagnosticCommandArgumentInfo(String name, String description,
String type, String defaultValue,
boolean mandatory, boolean option,
int position) {
this.name = name;
this.description = description;
this.type = type;
this.defaultValue = defaultValue;
this.mandatory = mandatory;
this.option = option;
this.position = position;
}
}

View File

@ -1,110 +0,0 @@
/*
* Copyright (c) 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 com.sun.management;
import java.beans.ConstructorProperties;
import java.util.List;
/**
* Diagnostic command information. It contains the description of a
* diagnostic command.
*
* @author Frederic Parain
* @since 7u4
*/
public class DiagnosticCommandInfo {
private final String name;
private final String description;
private final String impact;
private final boolean enabled;
private final List<DiagnosticCommandArgumentInfo> arguments;
/**
* Returns the diagnostic command name
*
* @return the diagnostic command name
*/
public String getName() {
return name;
}
/**
* Returns the diagnostic command description
*
* @return the diagnostic command description
*/
public String getDescription() {
return description;
}
/**
* Returns the potential impact of the diagnostic command execution
* on the Java virtual machine behavior
*
* @return the potential impact of the diagnostic command execution
* on the Java virtual machine behavior
*/
public String getImpact() {
return impact;
}
/**
* Returns {@code true} if the diagnostic command is enabled,
* {@code false} otherwise. The enabled/disabled
* status of a diagnostic command can evolve during
* the lifetime of the Java virtual machine.
*
* @return {@code true} if the diagnostic command is enabled,
* {@code false} otherwise
*/
public boolean isEnabled() {
return enabled;
}
/**
* Returns the list of the diagnostic command arguments description.
* If the diagnostic command has no arguments, it returns an empty list.
*
* @return a list of the diagnostic command arguments description
*/
public List<DiagnosticCommandArgumentInfo> getArgumentsInfo() {
return arguments;
}
@ConstructorProperties({"name", "description","impact","enabled",
"argumentsInfo"})
public DiagnosticCommandInfo(String name, String description,
String impact, boolean enabled,
List<DiagnosticCommandArgumentInfo> arguments)
{
this.name = name;
this.description = description;
this.impact = impact;
this.enabled = enabled;
this.arguments = arguments;
}
}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2012, 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
@ -31,11 +31,6 @@ import java.lang.management.PlatformManagedObject;
/** /**
* Diagnostic management interface for the HotSpot Virtual Machine. * Diagnostic management interface for the HotSpot Virtual Machine.
* *
* <p>{@linkplain #getDiagnosticCommands Diagnostic commands}
* are actions that can be invoked dynamically and
* executed in a target Java virtual machine, mainly for troubleshooting
* and diagnosis.
*
* <p>The diagnostic MBean is registered to the platform MBeanServer * <p>The diagnostic MBean is registered to the platform MBeanServer
* as are other platform MBeans. * as are other platform MBeans.
* *
@ -116,108 +111,4 @@ public interface HotSpotDiagnosticMXBean extends PlatformManagedObject {
* ManagementPermission("control"). * ManagementPermission("control").
*/ */
public void setVMOption(String name, String value); public void setVMOption(String name, String value);
/**
* Returns the {@linkplain DiagnosticCommandInfo#getName() names}
* of all diagnostic commands.
* A diagnostic command is an action that can be invoked dynamically
* mainly for troubleshooting and diagnosis. The list of diagnostic
* commands may change at runtime. A diagnostic command may be
* {@linkplain DiagnosticCommandInfo#isEnabled disabled} but will
* not be removed from a previously returned list.
*
* @return the names of all diagnostic commands.
*
* @since 7u4
*/
public List<String> getDiagnosticCommands();
/**
* Returns a {@code DiagnosticCommandInfo} object describing the
* diagnostic command of the specified name {@code command}
*
* @param command a diagnostic command name
* @return a {@code DiagnosticCommandInfo} object
* @throws java.lang.IllegalArgumentException if the {@code command}
* doesn't match any diagnostic command registered in the
* targeted Java virtual machine.
*
* @since 7u4
*/
public DiagnosticCommandInfo getDiagnosticCommandInfo(String command);
/**
* Returns a list of {@code DiagnosticCommandInfo} object describing
* all diagnostic commands available on the targeted Java virtual machine
*
* @return a list of {@code DiagnosticCommandInfo} objects
*
* @since 7u4
*/
public List<DiagnosticCommandInfo> getDiagnosticCommandInfo();
/**
* Returns a list of {@code DiagnosticCommandInfo} object describing
* all diagnostic commands specified in the {@code commands} list.
*
* @param commands {@code List} of {@code String} containing diagnostic
* command names
* @return a {@code List} of {@code DiagnosticCommandInfo} objects
*
* @throws java.lang.IllegalArgumentException if at least one
* command specified in the {@code commands } list
* doesn't match any diagnostic command registered in the
* targeted Java virtual machine.
*
* @since 7u4
*/
public List<DiagnosticCommandInfo> getDiagnosticCommandInfo(List<String> commands);
/**
* Executes the command line {@code commandLine}. The command line must
* start with a diagnostic command name, optionally followed by parameters.
* Each command has its own syntax but the generic syntax for a diagnostic
* command line is:
* <blockquote>
* &lt;command name&gt; [&lt;option&gt;=&lt;value&gt;] [&lt;argument_value&gt;]
* </blockquote>
*
* @param commandLine command line to execute
* @return a {@code String} object containing the diagnostic command
* output.
*
* @throws java.lang.IllegalArgumentException if the command line doesn't
* match any diagnostic command registered in the virtual machine
* of if the parameters don't match the diagnostic command syntax.
* @throws java.lang.SecurityException
* if a security manager exists and the caller does not have
* ManagementPermission("control").
*
* @since 7u4
*/
public String execute(String commandLine);
/**
* Invokes the diagnostic command named {@code cmd} with the parameters
* specified in {@code args}. Each command has its own syntax but
* the generic syntax for parameters is:
* <blockquote>
* [&lt;option&gt;=&lt;value&gt;] [&lt;argument_value&gt;]
* </blockquote>
*
* @param cmd a diagnostic command name
* @param args the command parameters
* @return a {@code String} object containing the diagnostic command
* output.
*
* @throws java.lang.IllegalArgumentException if the command line doesn't
* match any diagnostic command registered in the virtual machine
* of if the parameters don't match the diagnostic command syntax.
* @throws java.lang.SecurityException
* if a security manager exists and the caller does not have
* ManagementPermission("control").
*
* @since 7u4
*/
public String execute(String cmd, String... args);
} }

View File

@ -94,7 +94,7 @@ public abstract class MessageInfo {
if (streamNumber < 0 || streamNumber > 65536) if (streamNumber < 0 || streamNumber > 65536)
throw new IllegalArgumentException("Invalid stream number"); throw new IllegalArgumentException("Invalid stream number");
return new sun.nio.ch.SctpMessageInfoImpl(null, address, streamNumber); return new sun.nio.ch.sctp.MessageInfoImpl(null, address, streamNumber);
} }
/** /**
* Creates a {@code MessageInfo} instance suitable for use when * Creates a {@code MessageInfo} instance suitable for use when
@ -133,8 +133,8 @@ public abstract class MessageInfo {
if (streamNumber < 0 || streamNumber > 65536) if (streamNumber < 0 || streamNumber > 65536)
throw new IllegalArgumentException("Invalid stream number"); throw new IllegalArgumentException("Invalid stream number");
return new sun.nio.ch.SctpMessageInfoImpl(association, address, return new sun.nio.ch.sctp.MessageInfoImpl(association,
streamNumber); address, streamNumber);
} }
/** /**

View File

@ -162,7 +162,7 @@ public abstract class SctpChannel
*/ */
public static SctpChannel open() throws public static SctpChannel open() throws
IOException { IOException {
return new sun.nio.ch.SctpChannelImpl((SelectorProvider)null); return new sun.nio.ch.sctp.SctpChannelImpl((SelectorProvider)null);
} }
/** /**

View File

@ -162,7 +162,7 @@ public abstract class SctpMultiChannel
*/ */
public static SctpMultiChannel open() throws public static SctpMultiChannel open() throws
IOException { IOException {
return new sun.nio.ch.SctpMultiChannelImpl((SelectorProvider)null); return new sun.nio.ch.sctp.SctpMultiChannelImpl((SelectorProvider)null);
} }
/** /**

View File

@ -98,7 +98,7 @@ public abstract class SctpServerChannel
*/ */
public static SctpServerChannel open() throws public static SctpServerChannel open() throws
IOException { IOException {
return new sun.nio.ch.SctpServerChannelImpl((SelectorProvider)null); return new sun.nio.ch.sctp.SctpServerChannelImpl((SelectorProvider)null);
} }
/** /**

View File

@ -25,7 +25,7 @@
package com.sun.nio.sctp; package com.sun.nio.sctp;
import java.net.SocketAddress; import java.net.SocketAddress;
import sun.nio.ch.SctpStdSocketOption; import sun.nio.ch.sctp.SctpStdSocketOption;
/** /**
* SCTP channels supports the socket options defined by this class * SCTP channels supports the socket options defined by this class
@ -50,7 +50,7 @@ public class SctpStandardSocketOptions {
*/ */
public static final SctpSocketOption<Boolean> SCTP_DISABLE_FRAGMENTS = new public static final SctpSocketOption<Boolean> SCTP_DISABLE_FRAGMENTS = new
SctpStdSocketOption<Boolean>("SCTP_DISABLE_FRAGMENTS", Boolean.class, SctpStdSocketOption<Boolean>("SCTP_DISABLE_FRAGMENTS", Boolean.class,
sun.nio.ch.SctpStdSocketOption.SCTP_DISABLE_FRAGMENTS); sun.nio.ch.sctp.SctpStdSocketOption.SCTP_DISABLE_FRAGMENTS);
/** /**
* Enables or disables explicit message completion. * Enables or disables explicit message completion.
@ -69,7 +69,7 @@ public class SctpStandardSocketOptions {
*/ */
public static final SctpSocketOption<Boolean> SCTP_EXPLICIT_COMPLETE = new public static final SctpSocketOption<Boolean> SCTP_EXPLICIT_COMPLETE = new
SctpStdSocketOption<Boolean>("SCTP_EXPLICIT_COMPLETE", Boolean.class, SctpStdSocketOption<Boolean>("SCTP_EXPLICIT_COMPLETE", Boolean.class,
sun.nio.ch.SctpStdSocketOption.SCTP_EXPLICIT_COMPLETE); sun.nio.ch.sctp.SctpStdSocketOption.SCTP_EXPLICIT_COMPLETE);
/** /**
* Fragmented interleave controls how the presentation of messages occur * Fragmented interleave controls how the presentation of messages occur
@ -120,7 +120,7 @@ public class SctpStandardSocketOptions {
public static final SctpSocketOption<Integer> SCTP_FRAGMENT_INTERLEAVE = public static final SctpSocketOption<Integer> SCTP_FRAGMENT_INTERLEAVE =
new SctpStdSocketOption<Integer>("SCTP_FRAGMENT_INTERLEAVE", new SctpStdSocketOption<Integer>("SCTP_FRAGMENT_INTERLEAVE",
Integer.class, Integer.class,
sun.nio.ch.SctpStdSocketOption.SCTP_FRAGMENT_INTERLEAVE); sun.nio.ch.sctp.SctpStdSocketOption.SCTP_FRAGMENT_INTERLEAVE);
/** /**
* The maximum number of streams requested by the local endpoint during * The maximum number of streams requested by the local endpoint during
@ -171,7 +171,7 @@ public class SctpStandardSocketOptions {
*/ */
public static final SctpSocketOption<Boolean> SCTP_NODELAY = public static final SctpSocketOption<Boolean> SCTP_NODELAY =
new SctpStdSocketOption<Boolean>("SCTP_NODELAY", Boolean.class, new SctpStdSocketOption<Boolean>("SCTP_NODELAY", Boolean.class,
sun.nio.ch.SctpStdSocketOption.SCTP_NODELAY); sun.nio.ch.sctp.SctpStdSocketOption.SCTP_NODELAY);
/** /**
* Requests that the local SCTP stack use the given peer address as * Requests that the local SCTP stack use the given peer address as
@ -246,7 +246,7 @@ public class SctpStandardSocketOptions {
*/ */
public static final SctpSocketOption<Integer> SO_SNDBUF = public static final SctpSocketOption<Integer> SO_SNDBUF =
new SctpStdSocketOption<Integer>("SO_SNDBUF", Integer.class, new SctpStdSocketOption<Integer>("SO_SNDBUF", Integer.class,
sun.nio.ch.SctpStdSocketOption.SO_SNDBUF); sun.nio.ch.sctp.SctpStdSocketOption.SO_SNDBUF);
/** /**
* The size of the socket receive buffer. * The size of the socket receive buffer.
@ -273,7 +273,7 @@ public class SctpStandardSocketOptions {
*/ */
public static final SctpSocketOption<Integer> SO_RCVBUF = public static final SctpSocketOption<Integer> SO_RCVBUF =
new SctpStdSocketOption<Integer>("SO_RCVBUF", Integer.class, new SctpStdSocketOption<Integer>("SO_RCVBUF", Integer.class,
sun.nio.ch.SctpStdSocketOption.SO_RCVBUF); sun.nio.ch.sctp.SctpStdSocketOption.SO_RCVBUF);
/** /**
* Linger on close if data is present. * Linger on close if data is present.
@ -304,7 +304,7 @@ public class SctpStandardSocketOptions {
*/ */
public static final SctpSocketOption<Integer> SO_LINGER = public static final SctpSocketOption<Integer> SO_LINGER =
new SctpStdSocketOption<Integer>("SO_LINGER", Integer.class, new SctpStdSocketOption<Integer>("SO_LINGER", Integer.class,
sun.nio.ch.SctpStdSocketOption.SO_LINGER); sun.nio.ch.sctp.SctpStdSocketOption.SO_LINGER);
/** /**
* This class is used to set the maximum number of inbound/outbound streams * This class is used to set the maximum number of inbound/outbound streams

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2011, 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
@ -46,12 +46,17 @@ at the permission allows, and associated risks">
* <tr> * <tr>
* <td>control</td> * <td>control</td>
* <td>Ability to control the runtime characteristics of the Java virtual * <td>Ability to control the runtime characteristics of the Java virtual
* machine, for example, setting the -verbose:gc and -verbose:class flag, * machine, for example, enabling and disabling the verbose output for
* setting the threshold of a memory pool, and enabling and disabling * the class loading or memory system, setting the threshold of a memory
* the thread contention monitoring support. * pool, and enabling and disabling the thread contention monitoring
* support. Some actions controlled by this permission can disclose
* information about the running application, like the -verbose:class
* flag.
* </td> * </td>
* <td>This allows an attacker to control the runtime characteristics * <td>This allows an attacker to control the runtime characteristics
* of the Java virtual machine and cause the system to misbehave. * of the Java virtual machine and cause the system to misbehave. An
* attacker can also access some information related to the running
* application.
* </td> * </td>
* </tr> * </tr>
* <tr> * <tr>

View File

@ -71,7 +71,7 @@ public class Attributes implements Map<Object,Object>, Cloneable {
* @param size the initial number of attributes * @param size the initial number of attributes
*/ */
public Attributes(int size) { public Attributes(int size) {
map = new HashMap(size); map = new HashMap<>(size);
} }
/** /**
@ -81,7 +81,7 @@ public class Attributes implements Map<Object,Object>, Cloneable {
* @param attr the specified Attributes * @param attr the specified Attributes
*/ */
public Attributes(Attributes attr) { public Attributes(Attributes attr) {
map = new HashMap(attr); map = new HashMap<>(attr);
} }
@ -296,9 +296,9 @@ public class Attributes implements Map<Object,Object>, Cloneable {
* XXX Need to handle UTF8 values and break up lines longer than 72 bytes * XXX Need to handle UTF8 values and break up lines longer than 72 bytes
*/ */
void write(DataOutputStream os) throws IOException { void write(DataOutputStream os) throws IOException {
Iterator it = entrySet().iterator(); Iterator<Map.Entry<Object, Object>> it = entrySet().iterator();
while (it.hasNext()) { while (it.hasNext()) {
Map.Entry e = (Map.Entry)it.next(); Map.Entry<Object, Object> e = it.next();
StringBuffer buffer = new StringBuffer( StringBuffer buffer = new StringBuffer(
((Name)e.getKey()).toString()); ((Name)e.getKey()).toString());
buffer.append(": "); buffer.append(": ");
@ -340,9 +340,9 @@ public class Attributes implements Map<Object,Object>, Cloneable {
// write out all attributes except for the version // write out all attributes except for the version
// we wrote out earlier // we wrote out earlier
Iterator it = entrySet().iterator(); Iterator<Map.Entry<Object, Object>> it = entrySet().iterator();
while (it.hasNext()) { while (it.hasNext()) {
Map.Entry e = (Map.Entry)it.next(); Map.Entry<Object, Object> e = it.next();
String name = ((Name)e.getKey()).toString(); String name = ((Name)e.getKey()).toString();
if ((version != null) && ! (name.equalsIgnoreCase(vername))) { if ((version != null) && ! (name.equalsIgnoreCase(vername))) {
@ -499,7 +499,7 @@ public class Attributes implements Map<Object,Object>, Cloneable {
*/ */
public boolean equals(Object o) { public boolean equals(Object o) {
if (o instanceof Name) { if (o instanceof Name) {
Comparator c = ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER; Comparator<String> c = ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER;
return c.compare(name, ((Name)o).name) == 0; return c.compare(name, ((Name)o).name) == 0;
} else { } else {
return false; return false;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2012, 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
@ -135,7 +135,7 @@ class JarOutputStream extends ZipOutputStream {
* The bytes are assumed to be in Intel (little-endian) byte order. * The bytes are assumed to be in Intel (little-endian) byte order.
*/ */
private static int get16(byte[] b, int off) { private static int get16(byte[] b, int off) {
return (b[off] & 0xff) | ((b[off+1] & 0xff) << 8); return Byte.toUnsignedInt(b[off]) | ( Byte.toUnsignedInt(b[off+1]) << 8);
} }
/* /*

View File

@ -48,21 +48,21 @@ class JarVerifier {
/* a table mapping names to code signers, for jar entries that have /* a table mapping names to code signers, for jar entries that have
had their actual hashes verified */ had their actual hashes verified */
private Hashtable verifiedSigners; private Hashtable<String, CodeSigner[]> verifiedSigners;
/* a table mapping names to code signers, for jar entries that have /* a table mapping names to code signers, for jar entries that have
passed the .SF/.DSA/.EC -> MANIFEST check */ passed the .SF/.DSA/.EC -> MANIFEST check */
private Hashtable sigFileSigners; private Hashtable<String, CodeSigner[]> sigFileSigners;
/* a hash table to hold .SF bytes */ /* a hash table to hold .SF bytes */
private Hashtable sigFileData; private Hashtable<String, byte[]> sigFileData;
/** "queue" of pending PKCS7 blocks that we couldn't parse /** "queue" of pending PKCS7 blocks that we couldn't parse
* until we parsed the .SF file */ * until we parsed the .SF file */
private ArrayList pendingBlocks; private ArrayList<SignatureFileVerifier> pendingBlocks;
/* cache of CodeSigner objects */ /* cache of CodeSigner objects */
private ArrayList signerCache; private ArrayList<CodeSigner[]> signerCache;
/* Are we parsing a block? */ /* Are we parsing a block? */
private boolean parsingBlockOrSF = false; private boolean parsingBlockOrSF = false;
@ -94,10 +94,10 @@ class JarVerifier {
public JarVerifier(byte rawBytes[]) { public JarVerifier(byte rawBytes[]) {
manifestRawBytes = rawBytes; manifestRawBytes = rawBytes;
sigFileSigners = new Hashtable(); sigFileSigners = new Hashtable<>();
verifiedSigners = new Hashtable(); verifiedSigners = new Hashtable<>();
sigFileData = new Hashtable(11); sigFileData = new Hashtable<>(11);
pendingBlocks = new ArrayList(); pendingBlocks = new ArrayList<>();
baos = new ByteArrayOutputStream(); baos = new ByteArrayOutputStream();
manifestDigests = new ArrayList<>(); manifestDigests = new ArrayList<>();
} }
@ -248,10 +248,9 @@ class JarVerifier {
sigFileData.put(key, bytes); sigFileData.put(key, bytes);
// check pending blocks, we can now process // check pending blocks, we can now process
// anyone waiting for this .SF file // anyone waiting for this .SF file
Iterator it = pendingBlocks.iterator(); Iterator<SignatureFileVerifier> it = pendingBlocks.iterator();
while (it.hasNext()) { while (it.hasNext()) {
SignatureFileVerifier sfv = SignatureFileVerifier sfv = it.next();
(SignatureFileVerifier) it.next();
if (sfv.needSignatureFile(key)) { if (sfv.needSignatureFile(key)) {
if (debug != null) { if (debug != null) {
debug.println( debug.println(
@ -270,7 +269,7 @@ class JarVerifier {
String key = uname.substring(0, uname.lastIndexOf(".")); String key = uname.substring(0, uname.lastIndexOf("."));
if (signerCache == null) if (signerCache == null)
signerCache = new ArrayList(); signerCache = new ArrayList<>();
if (manDig == null) { if (manDig == null) {
synchronized(manifestRawBytes) { synchronized(manifestRawBytes) {
@ -287,7 +286,7 @@ class JarVerifier {
if (sfv.needSignatureFileBytes()) { if (sfv.needSignatureFileBytes()) {
// see if we have already parsed an external .SF file // see if we have already parsed an external .SF file
byte[] bytes = (byte[]) sigFileData.get(key); byte[] bytes = sigFileData.get(key);
if (bytes == null) { if (bytes == null) {
// put this block on queue for later processing // put this block on queue for later processing
@ -343,7 +342,7 @@ class JarVerifier {
*/ */
public CodeSigner[] getCodeSigners(String name) public CodeSigner[] getCodeSigners(String name)
{ {
return (CodeSigner[])verifiedSigners.get(name); return verifiedSigners.get(name);
} }
public CodeSigner[] getCodeSigners(JarFile jar, JarEntry entry) public CodeSigner[] getCodeSigners(JarFile jar, JarEntry entry)
@ -376,15 +375,14 @@ class JarVerifier {
CodeSigner[] signers) { CodeSigner[] signers) {
if (signers != null) { if (signers != null) {
ArrayList certChains = new ArrayList(); ArrayList<java.security.cert.Certificate> certChains = new ArrayList<>();
for (int i = 0; i < signers.length; i++) { for (int i = 0; i < signers.length; i++) {
certChains.addAll( certChains.addAll(
signers[i].getSignerCertPath().getCertificates()); signers[i].getSignerCertPath().getCertificates());
} }
// Convert into a Certificate[] // Convert into a Certificate[]
return (java.security.cert.Certificate[]) return certChains.toArray(
certChains.toArray(
new java.security.cert.Certificate[certChains.size()]); new java.security.cert.Certificate[certChains.size()]);
} }
return null; return null;
@ -418,8 +416,8 @@ class JarVerifier {
// MANIFEST.MF is always treated as signed and verified, // MANIFEST.MF is always treated as signed and verified,
// move its signers from sigFileSigners to verifiedSigners. // move its signers from sigFileSigners to verifiedSigners.
if (sigFileSigners.containsKey(JarFile.MANIFEST_NAME)) { if (sigFileSigners.containsKey(JarFile.MANIFEST_NAME)) {
verifiedSigners.put(JarFile.MANIFEST_NAME, CodeSigner[] codeSigners = sigFileSigners.remove(JarFile.MANIFEST_NAME);
sigFileSigners.remove(JarFile.MANIFEST_NAME)); verifiedSigners.put(JarFile.MANIFEST_NAME, codeSigners);
} }
} }
@ -493,10 +491,10 @@ class JarVerifier {
// Extended JavaUtilJarAccess CodeSource API Support // Extended JavaUtilJarAccess CodeSource API Support
private Map urlToCodeSourceMap = new HashMap(); private Map<URL, Map<CodeSigner[], CodeSource>> urlToCodeSourceMap = new HashMap<>();
private Map signerToCodeSource = new HashMap(); private Map<CodeSigner[], CodeSource> signerToCodeSource = new HashMap<>();
private URL lastURL; private URL lastURL;
private Map lastURLMap; private Map<CodeSigner[], CodeSource> lastURLMap;
/* /*
* Create a unique mapping from codeSigner cache entries to CodeSource. * Create a unique mapping from codeSigner cache entries to CodeSource.
@ -504,19 +502,19 @@ class JarVerifier {
* and shared JAR file although in practice there will be a single URL in use. * and shared JAR file although in practice there will be a single URL in use.
*/ */
private synchronized CodeSource mapSignersToCodeSource(URL url, CodeSigner[] signers) { private synchronized CodeSource mapSignersToCodeSource(URL url, CodeSigner[] signers) {
Map map; Map<CodeSigner[], CodeSource> map;
if (url == lastURL) { if (url == lastURL) {
map = lastURLMap; map = lastURLMap;
} else { } else {
map = (Map) urlToCodeSourceMap.get(url); map = urlToCodeSourceMap.get(url);
if (map == null) { if (map == null) {
map = new HashMap(); map = new HashMap<>();
urlToCodeSourceMap.put(url, map); urlToCodeSourceMap.put(url, map);
} }
lastURLMap = map; lastURLMap = map;
lastURL = url; lastURL = url;
} }
CodeSource cs = (CodeSource) map.get(signers); CodeSource cs = map.get(signers);
if (cs == null) { if (cs == null) {
cs = new VerifierCodeSource(csdomain, url, signers); cs = new VerifierCodeSource(csdomain, url, signers);
signerToCodeSource.put(signers, cs); signerToCodeSource.put(signers, cs);
@ -524,16 +522,16 @@ class JarVerifier {
return cs; return cs;
} }
private CodeSource[] mapSignersToCodeSources(URL url, List signers, boolean unsigned) { private CodeSource[] mapSignersToCodeSources(URL url, List<CodeSigner[]> signers, boolean unsigned) {
List sources = new ArrayList(); List<CodeSource> sources = new ArrayList<>();
for (int i = 0; i < signers.size(); i++) { for (int i = 0; i < signers.size(); i++) {
sources.add(mapSignersToCodeSource(url, (CodeSigner[]) signers.get(i))); sources.add(mapSignersToCodeSource(url, signers.get(i)));
} }
if (unsigned) { if (unsigned) {
sources.add(mapSignersToCodeSource(url, null)); sources.add(mapSignersToCodeSource(url, null));
} }
return (CodeSource[]) sources.toArray(new CodeSource[sources.size()]); return sources.toArray(new CodeSource[sources.size()]);
} }
private CodeSigner[] emptySigner = new CodeSigner[0]; private CodeSigner[] emptySigner = new CodeSigner[0];
@ -553,7 +551,7 @@ class JarVerifier {
* but this handles a CodeSource of any type, just in case. * but this handles a CodeSource of any type, just in case.
*/ */
CodeSource[] sources = mapSignersToCodeSources(cs.getLocation(), getJarCodeSigners(), true); CodeSource[] sources = mapSignersToCodeSources(cs.getLocation(), getJarCodeSigners(), true);
List sourceList = new ArrayList(); List<CodeSource> sourceList = new ArrayList<>();
for (int i = 0; i < sources.length; i++) { for (int i = 0; i < sources.length; i++) {
sourceList.add(sources[i]); sourceList.add(sources[i]);
} }
@ -574,6 +572,7 @@ class JarVerifier {
* signing data that can be compared by object reference identity. * signing data that can be compared by object reference identity.
*/ */
private static class VerifierCodeSource extends CodeSource { private static class VerifierCodeSource extends CodeSource {
private static final long serialVersionUID = -9047366145967768825L;
URL vlocation; URL vlocation;
CodeSigner[] vsigners; CodeSigner[] vsigners;
@ -641,16 +640,16 @@ class JarVerifier {
return vcerts; return vcerts;
} }
} }
private Map signerMap; private Map<String, CodeSigner[]> signerMap;
private synchronized Map signerMap() { private synchronized Map<String, CodeSigner[]> signerMap() {
if (signerMap == null) { if (signerMap == null) {
/* /*
* Snapshot signer state so it doesn't change on us. We care * Snapshot signer state so it doesn't change on us. We care
* only about the asserted signatures. Verification of * only about the asserted signatures. Verification of
* signature validity happens via the JarEntry apis. * signature validity happens via the JarEntry apis.
*/ */
signerMap = new HashMap(verifiedSigners.size() + sigFileSigners.size()); signerMap = new HashMap<>(verifiedSigners.size() + sigFileSigners.size());
signerMap.putAll(verifiedSigners); signerMap.putAll(verifiedSigners);
signerMap.putAll(sigFileSigners); signerMap.putAll(sigFileSigners);
} }
@ -658,15 +657,15 @@ class JarVerifier {
} }
public synchronized Enumeration<String> entryNames(JarFile jar, final CodeSource[] cs) { public synchronized Enumeration<String> entryNames(JarFile jar, final CodeSource[] cs) {
final Map map = signerMap(); final Map<String, CodeSigner[]> map = signerMap();
final Iterator itor = map.entrySet().iterator(); final Iterator<Map.Entry<String, CodeSigner[]>> itor = map.entrySet().iterator();
boolean matchUnsigned = false; boolean matchUnsigned = false;
/* /*
* Grab a single copy of the CodeSigner arrays. Check * Grab a single copy of the CodeSigner arrays. Check
* to see if we can optimize CodeSigner equality test. * to see if we can optimize CodeSigner equality test.
*/ */
List req = new ArrayList(cs.length); List<CodeSigner[]> req = new ArrayList<>(cs.length);
for (int i = 0; i < cs.length; i++) { for (int i = 0; i < cs.length; i++) {
CodeSigner[] match = findMatchingSigners(cs[i]); CodeSigner[] match = findMatchingSigners(cs[i]);
if (match != null) { if (match != null) {
@ -678,8 +677,8 @@ class JarVerifier {
} }
} }
final List signersReq = req; final List<CodeSigner[]> signersReq = req;
final Enumeration enum2 = (matchUnsigned) ? unsignedEntryNames(jar) : emptyEnumeration; final Enumeration<String> enum2 = (matchUnsigned) ? unsignedEntryNames(jar) : emptyEnumeration;
return new Enumeration<String>() { return new Enumeration<String>() {
@ -691,14 +690,14 @@ class JarVerifier {
} }
while (itor.hasNext()) { while (itor.hasNext()) {
Map.Entry e = (Map.Entry) itor.next(); Map.Entry<String, CodeSigner[]> e = itor.next();
if (signersReq.contains((CodeSigner[]) e.getValue())) { if (signersReq.contains(e.getValue())) {
name = (String) e.getKey(); name = e.getKey();
return true; return true;
} }
} }
while (enum2.hasMoreElements()) { while (enum2.hasMoreElements()) {
name = (String) enum2.nextElement(); name = enum2.nextElement();
return true; return true;
} }
return false; return false;
@ -719,13 +718,13 @@ class JarVerifier {
* Like entries() but screens out internal JAR mechanism entries * Like entries() but screens out internal JAR mechanism entries
* and includes signed entries with no ZIP data. * and includes signed entries with no ZIP data.
*/ */
public Enumeration<JarEntry> entries2(final JarFile jar, Enumeration e) { public Enumeration<JarEntry> entries2(final JarFile jar, Enumeration<? extends ZipEntry> e) {
final Map map = new HashMap(); final Map<String, CodeSigner[]> map = new HashMap<>();
map.putAll(signerMap()); map.putAll(signerMap());
final Enumeration enum_ = e; final Enumeration<? extends ZipEntry> enum_ = e;
return new Enumeration<JarEntry>() { return new Enumeration<JarEntry>() {
Enumeration signers = null; Enumeration<String> signers = null;
JarEntry entry; JarEntry entry;
public boolean hasMoreElements() { public boolean hasMoreElements() {
@ -733,7 +732,7 @@ class JarVerifier {
return true; return true;
} }
while (enum_.hasMoreElements()) { while (enum_.hasMoreElements()) {
ZipEntry ze = (ZipEntry) enum_.nextElement(); ZipEntry ze = enum_.nextElement();
if (JarVerifier.isSigningRelated(ze.getName())) { if (JarVerifier.isSigningRelated(ze.getName())) {
continue; continue;
} }
@ -744,7 +743,7 @@ class JarVerifier {
signers = Collections.enumeration(map.keySet()); signers = Collections.enumeration(map.keySet());
} }
while (signers.hasMoreElements()) { while (signers.hasMoreElements()) {
String name = (String) signers.nextElement(); String name = signers.nextElement();
entry = jar.newEntry(new ZipEntry(name)); entry = jar.newEntry(new ZipEntry(name));
return true; return true;
} }
@ -764,7 +763,7 @@ class JarVerifier {
} }
}; };
} }
private Enumeration emptyEnumeration = new Enumeration<String>() { private Enumeration<String> emptyEnumeration = new Enumeration<String>() {
public boolean hasMoreElements() { public boolean hasMoreElements() {
return false; return false;
@ -797,8 +796,8 @@ class JarVerifier {
} }
private Enumeration<String> unsignedEntryNames(JarFile jar) { private Enumeration<String> unsignedEntryNames(JarFile jar) {
final Map map = signerMap(); final Map<String, CodeSigner[]> map = signerMap();
final Enumeration entries = jar.entries(); final Enumeration<JarEntry> entries = jar.entries();
return new Enumeration<String>() { return new Enumeration<String>() {
String name; String name;
@ -813,7 +812,7 @@ class JarVerifier {
} }
while (entries.hasMoreElements()) { while (entries.hasMoreElements()) {
String value; String value;
ZipEntry e = (ZipEntry) entries.nextElement(); ZipEntry e = entries.nextElement();
value = e.getName(); value = e.getName();
if (e.isDirectory() || isSigningRelated(value)) { if (e.isDirectory() || isSigningRelated(value)) {
continue; continue;
@ -836,14 +835,14 @@ class JarVerifier {
} }
}; };
} }
private List jarCodeSigners; private List<CodeSigner[]> jarCodeSigners;
private synchronized List getJarCodeSigners() { private synchronized List<CodeSigner[]> getJarCodeSigners() {
CodeSigner[] signers; CodeSigner[] signers;
if (jarCodeSigners == null) { if (jarCodeSigners == null) {
HashSet set = new HashSet(); HashSet<CodeSigner[]> set = new HashSet<>();
set.addAll(signerMap().values()); set.addAll(signerMap().values());
jarCodeSigners = new ArrayList(); jarCodeSigners = new ArrayList<>();
jarCodeSigners.addAll(set); jarCodeSigners.addAll(set);
} }
return jarCodeSigners; return jarCodeSigners;
@ -858,7 +857,7 @@ class JarVerifier {
public CodeSource getCodeSource(URL url, String name) { public CodeSource getCodeSource(URL url, String name) {
CodeSigner[] signers; CodeSigner[] signers;
signers = (CodeSigner[]) signerMap().get(name); signers = signerMap().get(name);
return mapSignersToCodeSource(url, signers); return mapSignersToCodeSource(url, signers);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2012, 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
@ -339,7 +339,7 @@ public class Manifest implements Cloneable {
return -1; return -1;
} }
} }
return buf[pos++] & 0xff; return Byte.toUnsignedInt(buf[pos++]);
} }
public int read(byte[] b, int off, int len) throws IOException { public int read(byte[] b, int off, int len) throws IOException {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2012, 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
@ -119,7 +119,7 @@ class InflaterInputStream extends FilterInputStream {
*/ */
public int read() throws IOException { public int read() throws IOException {
ensureOpen(); ensureOpen();
return read(singleByteBuf, 0, 1) == -1 ? -1 : singleByteBuf[0] & 0xff; return read(singleByteBuf, 0, 1) == -1 ? -1 : Byte.toUnsignedInt(singleByteBuf[0]);
} }
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2012, 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
@ -435,7 +435,7 @@ class ZipInputStream extends InflaterInputStream implements ZipConstants {
* The bytes are assumed to be in Intel (little-endian) byte order. * The bytes are assumed to be in Intel (little-endian) byte order.
*/ */
private static final int get16(byte b[], int off) { private static final int get16(byte b[], int off) {
return (b[off] & 0xff) | ((b[off+1] & 0xff) << 8); return Byte.toUnsignedInt(b[off]) | (Byte.toUnsignedInt(b[off+1]) << 8);
} }
/* /*

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2012, 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
@ -775,7 +775,7 @@ public abstract class CipherSpi {
int outOfs = output.arrayOffset() + outPos; int outOfs = output.arrayOffset() + outPos;
byte[] inArray = new byte[getTempArraySize(inLen)]; byte[] inArray = new byte[getTempArraySize(inLen)];
int total = 0; int total = 0;
while (inLen > 0) { do {
int chunk = Math.min(inLen, inArray.length); int chunk = Math.min(inLen, inArray.length);
input.get(inArray, 0, chunk); input.get(inArray, 0, chunk);
int n; int n;
@ -787,7 +787,7 @@ public abstract class CipherSpi {
total += n; total += n;
outOfs += n; outOfs += n;
inLen -= chunk; inLen -= chunk;
} } while (inLen > 0);
output.position(outPos + total); output.position(outPos + total);
return total; return total;
} else { // output is not backed by an accessible byte[] } else { // output is not backed by an accessible byte[]
@ -804,7 +804,7 @@ public abstract class CipherSpi {
int outSize = outArray.length; int outSize = outArray.length;
int total = 0; int total = 0;
boolean resized = false; boolean resized = false;
while (inLen > 0) { do {
int chunk = Math.min(inLen, outSize); int chunk = Math.min(inLen, outSize);
if ((a1 == false) && (resized == false)) { if ((a1 == false) && (resized == false)) {
input.get(inArray, 0, chunk); input.get(inArray, 0, chunk);
@ -834,7 +834,7 @@ public abstract class CipherSpi {
int newOut = engineGetOutputSize(chunk); int newOut = engineGetOutputSize(chunk);
outArray = new byte[newOut]; outArray = new byte[newOut];
} }
} } while (inLen > 0);
input.position(inLimit); input.position(inLimit);
return total; return total;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2010, 2012, 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
@ -43,7 +43,7 @@ public abstract class ExtendedSSLSession implements SSLSession {
* The signature algorithm name must be a standard Java Security * The signature algorithm name must be a standard Java Security
* name (such as "SHA1withRSA", "SHA256withECDSA", and so on). * name (such as "SHA1withRSA", "SHA256withECDSA", and so on).
* See Appendix A in the <a href= * See Appendix A in the <a href=
* "../../../technotes/guides/security/crypto/CryptoSpec.html#AppA"> * "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html#AppA">
* Java Cryptography Architecture API Specification &amp; Reference </a> * Java Cryptography Architecture API Specification &amp; Reference </a>
* for information about standard algorithm names. * for information about standard algorithm names.
* <p> * <p>
@ -71,7 +71,7 @@ public abstract class ExtendedSSLSession implements SSLSession {
* The signature algorithm name must be a standard Java Security * The signature algorithm name must be a standard Java Security
* name (such as "SHA1withRSA", "SHA256withECDSA", and so on). * name (such as "SHA1withRSA", "SHA256withECDSA", and so on).
* See Appendix A in the <a href= * See Appendix A in the <a href=
* "../../../technotes/guides/security/crypto/CryptoSpec.html#AppA"> * "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html#AppA">
* Java Cryptography Architecture API Specification &amp; Reference </a> * Java Cryptography Architecture API Specification &amp; Reference </a>
* for information about standard algorithm names. * for information about standard algorithm names.
* *

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2012, 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
@ -242,7 +242,7 @@ public class SSLParameters {
* *
* @param algorithm The standard string name of the endpoint * @param algorithm The standard string name of the endpoint
* identification algorithm (or null). See Appendix A in the <a href= * identification algorithm (or null). See Appendix A in the <a href=
* "../../../technotes/guides/security/crypto/CryptoSpec.html#AppA"> * "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html#AppA">
* Java Cryptography Architecture API Specification &amp; Reference </a> * Java Cryptography Architecture API Specification &amp; Reference </a>
* for information about standard algorithm names. * for information about standard algorithm names.
* *

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * 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
@ -107,10 +107,17 @@ public final class X500Principal implements Principal, java.io.Serializable {
* defined in RFC 1779 and RFC 2253 * defined in RFC 1779 and RFC 2253
* (and listed in {@link #getName(String format) getName(String format)}), * (and listed in {@link #getName(String format) getName(String format)}),
* as well as the T, DNQ or DNQUALIFIER, SURNAME, GIVENNAME, INITIALS, * as well as the T, DNQ or DNQUALIFIER, SURNAME, GIVENNAME, INITIALS,
* GENERATION, EMAILADDRESS, and SERIALNUMBER keywords whose OIDs are * GENERATION, EMAILADDRESS, and SERIALNUMBER keywords whose Object
* defined in RFC 3280 and its successor. * Identifiers (OIDs) are defined in RFC 3280 and its successor.
* Any other attribute type must be specified as an OID. * Any other attribute type must be specified as an OID.
* *
* <p>This implementation enforces a more restrictive OID syntax than
* defined in RFC 1779 and 2253. It uses the more correct syntax defined in
* <a href="http://www.ietf.org/rfc/rfc4512.txt">RFC 4512</a>, which
* specifies that OIDs contain at least 2 digits:
*
* <p>{@code numericoid = number 1*( DOT number ) }
*
* @param name an X.500 distinguished name in RFC 1779 or RFC 2253 format * @param name an X.500 distinguished name in RFC 1779 or RFC 2253 format
* @exception NullPointerException if the <code>name</code> * @exception NullPointerException if the <code>name</code>
* is <code>null</code> * is <code>null</code>
@ -135,10 +142,17 @@ public final class X500Principal implements Principal, java.io.Serializable {
* keywords recognized by <code>X500Principal(String)</code>. Keywords * keywords recognized by <code>X500Principal(String)</code>. Keywords
* MUST be specified in all upper-case, otherwise they will be ignored. * MUST be specified in all upper-case, otherwise they will be ignored.
* Improperly specified keywords are ignored; however if a keyword in the * Improperly specified keywords are ignored; however if a keyword in the
* name maps to an improperly specified OID, an * name maps to an improperly specified Object Identifier (OID), an
* <code>IllegalArgumentException</code> is thrown. It is permissible to * <code>IllegalArgumentException</code> is thrown. It is permissible to
* have 2 different keywords that map to the same OID. * have 2 different keywords that map to the same OID.
* *
* <p>This implementation enforces a more restrictive OID syntax than
* defined in RFC 1779 and 2253. It uses the more correct syntax defined in
* <a href="http://www.ietf.org/rfc/rfc4512.txt">RFC 4512</a>, which
* specifies that OIDs contain at least 2 digits:
*
* <p>{@code numericoid = number 1*( DOT number ) }
*
* @param name an X.500 distinguished name in RFC 1779 or RFC 2253 format * @param name an X.500 distinguished name in RFC 1779 or RFC 2253 format
* @param keywordMap an attribute type keyword map, where each key is a * @param keywordMap an attribute type keyword map, where each key is a
* keyword String that maps to a corresponding object identifier in String * keyword String that maps to a corresponding object identifier in String

View File

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<!-- <!--
Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 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
@ -30,17 +30,26 @@ questions.
<body bgcolor="white"> <body bgcolor="white">
This package contains the classes that should be used to store This package contains the classes that should be used to store
X500 Principal and X500 Private Crendentials in a X500 Principal and X500 Private Credentials in a
<i>Subject</i>. <i>Subject</i>.
<!--
<h2>Package Specification</h2> <h2>Package Specification</h2>
##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
<ul> <ul>
<li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a> <li><a href="http://www.ietf.org/rfc/rfc1779.txt">
RFC 1779: A String Representation of Distinguished Names</a></li>
<li><a href="http://www.ietf.org/rfc/rfc2253.txt">
RFC 2253: Lightweight Directory Access Protocol (v3):
UTF-8 String Representation of Distinguished Names</a></li>
<li><a href="http://www.ietf.org/rfc/rfc3280.txt">
RFC 3280: Internet X.509 Public Key Infrastructure
Certificate and Certificate Revocation List (CRL) Profile</a></li>
<li><a href="http://www.ietf.org/rfc/rfc4512.txt">
RFC 4512: Lightweight Directory Access Protocol (LDAP):
Directory Information Models</a></li>
</ul> </ul>
<!--
<h2>Related Documentation</h2> <h2>Related Documentation</h2>
For overviews, tutorials, examples, guides, and tool documentation, please see: For overviews, tutorials, examples, guides, and tool documentation, please see:

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2012, 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
@ -27,13 +27,9 @@ package sun.management;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List; import java.util.List;
import javax.management.ObjectName; import javax.management.ObjectName;
import com.sun.management.DiagnosticCommandInfo;
import com.sun.management.DiagnosticCommandArgumentInfo;
import com.sun.management.HotSpotDiagnosticMXBean; import com.sun.management.HotSpotDiagnosticMXBean;
import com.sun.management.VMOption; import com.sun.management.VMOption;
@ -120,54 +116,7 @@ public class HotSpotDiagnostic implements HotSpotDiagnosticMXBean {
} }
} }
public List<String> getDiagnosticCommands() {
String[] commands = getDiagnosticCommands0();
return commands == null ? Collections.<String>emptyList() :
Arrays.asList(commands);
}
public DiagnosticCommandInfo getDiagnosticCommandInfo(String command) {
String[] array = new String[] { command };
return getDiagnosticCommandInfo0(array)[0];
}
public List<DiagnosticCommandInfo> getDiagnosticCommandInfo() {
String[] commands = getDiagnosticCommands0();
return Arrays.asList(getDiagnosticCommandInfo0(commands));
}
public List<DiagnosticCommandInfo> getDiagnosticCommandInfo(
List<String> commands) {
return Arrays.asList(getDiagnosticCommandInfo0(
commands.toArray(new String[commands.size()])));
}
public String execute(String command) {
Util.checkControlAccess();
return executeDiagnosticCommand0(command);
}
public String execute(String cmd, String... arguments) {
if(cmd == null) {
throw new NullPointerException("Missing command name");
}
StringBuilder sb = new StringBuilder();
sb.append(cmd);
sb.append(" ");
for(String arg : arguments) {
sb.append(arg);
sb.append(" ");
}
return execute(sb.toString());
}
public ObjectName getObjectName() { public ObjectName getObjectName() {
return Util.newObjectName("com.sun.management:type=HotSpotDiagnostic"); return Util.newObjectName("com.sun.management:type=HotSpotDiagnostic");
} }
private native String[] getDiagnosticCommands0();
private native DiagnosticCommandInfo[] getDiagnosticCommandInfo0(
String[] commands) throws IllegalArgumentException;
private native String executeDiagnosticCommand0(String command)
throws IllegalArgumentException;
} }

View File

@ -270,7 +270,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
protected Proxy instProxy; protected Proxy instProxy;
private CookieHandler cookieHandler; private CookieHandler cookieHandler;
private ResponseCache cacheHandler; private final ResponseCache cacheHandler;
// the cached response, and cached response headers and body // the cached response, and cached response headers and body
protected CacheResponse cachedResponse; protected CacheResponse cachedResponse;
@ -1579,7 +1579,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
if (respCode == 200 || respCode == 203 || respCode == 206 || if (respCode == 200 || respCode == 203 || respCode == 206 ||
respCode == 300 || respCode == 301 || respCode == 410) { respCode == 300 || respCode == 301 || respCode == 410) {
if (cacheHandler != null) { if (cacheHandler != null && getUseCaches()) {
// give cache a chance to save response in cache // give cache a chance to save response in cache
URI uri = ParseUtil.toURI(url); URI uri = ParseUtil.toURI(url);
if (uri != null) { if (uri != null) {

View File

@ -35,15 +35,15 @@ import sun.misc.*;
* @since 1.4 * @since 1.4
*/ */
abstract class AbstractPollArrayWrapper { public abstract class AbstractPollArrayWrapper {
// Event masks // Event masks
static final short POLLIN = 0x0001; public static final short POLLIN = 0x0001;
static final short POLLOUT = 0x0004; public static final short POLLOUT = 0x0004;
static final short POLLERR = 0x0008; public static final short POLLERR = 0x0008;
static final short POLLHUP = 0x0010; public static final short POLLHUP = 0x0010;
static final short POLLNVAL = 0x0020; public static final short POLLNVAL = 0x0020;
static final short POLLREMOVE = 0x0800; public static final short POLLREMOVE = 0x0800;
// Miscellaneous constants // Miscellaneous constants
static final short SIZE_POLLFD = 8; static final short SIZE_POLLFD = 8;

View File

@ -67,7 +67,7 @@ abstract class AbstractPollSelectorImpl
this.channelOffset = offset; this.channelOffset = offset;
} }
void putEventOps(SelectionKeyImpl sk, int ops) { public void putEventOps(SelectionKeyImpl sk, int ops) {
synchronized (closeLock) { synchronized (closeLock) {
if (closed) if (closed)
throw new ClosedSelectorException(); throw new ClosedSelectorException();

View File

@ -28,16 +28,16 @@ package sun.nio.ch;
// Constants for reporting I/O status // Constants for reporting I/O status
final class IOStatus { public final class IOStatus {
private IOStatus() { } private IOStatus() { }
static final int EOF = -1; // End of file public static final int EOF = -1; // End of file
static final int UNAVAILABLE = -2; // Nothing available (non-blocking) public static final int UNAVAILABLE = -2; // Nothing available (non-blocking)
static final int INTERRUPTED = -3; // System call interrupted public static final int INTERRUPTED = -3; // System call interrupted
static final int UNSUPPORTED = -4; // Operation not supported public static final int UNSUPPORTED = -4; // Operation not supported
static final int THROWN = -5; // Exception thrown in JNI code public static final int THROWN = -5; // Exception thrown in JNI code
static final int UNSUPPORTED_CASE = -6; // This case not supported public static final int UNSUPPORTED_CASE = -6; // This case not supported
// The following two methods are for use in try/finally blocks where a // The following two methods are for use in try/finally blocks where a
// status value needs to be normalized before being returned to the invoker // status value needs to be normalized before being returned to the invoker
@ -55,28 +55,28 @@ final class IOStatus {
// } // }
// //
static int normalize(int n) { public static int normalize(int n) {
if (n == UNAVAILABLE) if (n == UNAVAILABLE)
return 0; return 0;
return n; return n;
} }
static boolean check(int n) { public static boolean check(int n) {
return (n >= UNAVAILABLE); return (n >= UNAVAILABLE);
} }
static long normalize(long n) { public static long normalize(long n) {
if (n == UNAVAILABLE) if (n == UNAVAILABLE)
return 0; return 0;
return n; return n;
} }
static boolean check(long n) { public static boolean check(long n) {
return (n >= UNAVAILABLE); return (n >= UNAVAILABLE);
} }
// Return true iff n is not one of the IOStatus values // Return true iff n is not one of the IOStatus values
static boolean checkAll(long n) { public static boolean checkAll(long n) {
return ((n > EOF) || (n < UNSUPPORTED_CASE)); return ((n > EOF) || (n < UNSUPPORTED_CASE));
} }

View File

@ -34,7 +34,7 @@ import java.nio.ByteBuffer;
* File-descriptor based I/O utilities that are shared by NIO classes. * File-descriptor based I/O utilities that are shared by NIO classes.
*/ */
class IOUtil { public class IOUtil {
private IOUtil() { } // No instantiation private IOUtil() { } // No instantiation
@ -309,7 +309,7 @@ class IOUtil {
} }
} }
static FileDescriptor newFD(int i) { public static FileDescriptor newFD(int i) {
FileDescriptor fd = new FileDescriptor(); FileDescriptor fd = new FileDescriptor();
setfdVal(fd, i); setfdVal(fd, i);
return fd; return fd;
@ -326,10 +326,11 @@ class IOUtil {
static native boolean drain(int fd) throws IOException; static native boolean drain(int fd) throws IOException;
static native void configureBlocking(FileDescriptor fd, boolean blocking) public static native void configureBlocking(FileDescriptor fd,
boolean blocking)
throws IOException; throws IOException;
static native int fdVal(FileDescriptor fd); public static native int fdVal(FileDescriptor fd);
static native void setfdVal(FileDescriptor fd, int value); static native void setfdVal(FileDescriptor fd, int value);

View File

@ -33,7 +33,7 @@ import java.security.AccessController;
import java.security.PrivilegedAction; import java.security.PrivilegedAction;
class Net { // package-private public class Net {
private Net() { } private Net() { }
@ -75,7 +75,7 @@ class Net { // package-private
return canJoin6WithIPv4Group0(); return canJoin6WithIPv4Group0();
} }
static InetSocketAddress checkAddress(SocketAddress sa) { public static InetSocketAddress checkAddress(SocketAddress sa) {
if (sa == null) if (sa == null)
throw new NullPointerException(); throw new NullPointerException();
if (!(sa instanceof InetSocketAddress)) if (!(sa instanceof InetSocketAddress))
@ -330,7 +330,7 @@ class Net { // package-private
// Due to oddities SO_REUSEADDR on windows reuse is ignored // Due to oddities SO_REUSEADDR on windows reuse is ignored
private static native int socket0(boolean preferIPv6, boolean stream, boolean reuse); private static native int socket0(boolean preferIPv6, boolean stream, boolean reuse);
static void bind(FileDescriptor fd, InetAddress addr, int port) public static void bind(FileDescriptor fd, InetAddress addr, int port)
throws IOException throws IOException
{ {
bind(UNSPEC, fd, addr, port); bind(UNSPEC, fd, addr, port);
@ -383,7 +383,7 @@ class Net { // package-private
private static native InetAddress localInetAddress(FileDescriptor fd) private static native InetAddress localInetAddress(FileDescriptor fd)
throws IOException; throws IOException;
static InetSocketAddress localAddress(FileDescriptor fd) public static InetSocketAddress localAddress(FileDescriptor fd)
throws IOException throws IOException
{ {
return new InetSocketAddress(localInetAddress(fd), localPort(fd)); return new InetSocketAddress(localInetAddress(fd), localPort(fd));

View File

@ -36,7 +36,7 @@ import java.io.IOException;
* @since 1.4 * @since 1.4
*/ */
interface SelChImpl extends Channel { public interface SelChImpl extends Channel {
FileDescriptor getFD(); FileDescriptor getFD();

View File

@ -34,12 +34,12 @@ import java.nio.channels.spi.*;
* An implementation of SelectionKey for Solaris. * An implementation of SelectionKey for Solaris.
*/ */
class SelectionKeyImpl public class SelectionKeyImpl
extends AbstractSelectionKey extends AbstractSelectionKey
{ {
final SelChImpl channel; // package-private final SelChImpl channel; // package-private
final SelectorImpl selector; // package-private public final SelectorImpl selector;
// Index for a pollfd array in Selector that this key is registered with // Index for a pollfd array in Selector that this key is registered with
private int index; private int index;
@ -91,15 +91,15 @@ class SelectionKeyImpl
// The nio versions of these operations do not care if a key // The nio versions of these operations do not care if a key
// has been invalidated. They are for internal use by nio code. // has been invalidated. They are for internal use by nio code.
void nioReadyOps(int ops) { // package-private public void nioReadyOps(int ops) {
readyOps = ops; readyOps = ops;
} }
int nioReadyOps() { // package-private public int nioReadyOps() {
return readyOps; return readyOps;
} }
SelectionKey nioInterestOps(int ops) { // package-private public SelectionKey nioInterestOps(int ops) {
if ((ops & ~channel().validOps()) != 0) if ((ops & ~channel().validOps()) != 0)
throw new IllegalArgumentException(); throw new IllegalArgumentException();
channel.translateAndSetInterestOps(ops, this); channel.translateAndSetInterestOps(ops, this);
@ -107,7 +107,7 @@ class SelectionKeyImpl
return this; return this;
} }
int nioInterestOps() { // package-private public int nioInterestOps() {
return interestOps; return interestOps;
} }

View File

@ -36,7 +36,7 @@ import java.util.*;
* Base Selector implementation class. * Base Selector implementation class.
*/ */
abstract class SelectorImpl public abstract class SelectorImpl
extends AbstractSelector extends AbstractSelector
{ {
@ -118,7 +118,7 @@ abstract class SelectorImpl
protected abstract void implClose() throws IOException; protected abstract void implClose() throws IOException;
void putEventOps(SelectionKeyImpl sk, int ops) { } public void putEventOps(SelectionKeyImpl sk, int ops) { }
protected final SelectionKey register(AbstractSelectableChannel ch, protected final SelectionKey register(AbstractSelectableChannel ch,
int ops, int ops,

View File

@ -40,7 +40,7 @@ import sun.misc.Cleaner;
import sun.security.action.GetPropertyAction; import sun.security.action.GetPropertyAction;
class Util { public class Util {
// -- Caches -- // -- Caches --
@ -158,7 +158,7 @@ class Util {
/** /**
* Returns a temporary buffer of at least the given size * Returns a temporary buffer of at least the given size
*/ */
static ByteBuffer getTemporaryDirectBuffer(int size) { public static ByteBuffer getTemporaryDirectBuffer(int size) {
BufferCache cache = bufferCache.get(); BufferCache cache = bufferCache.get();
ByteBuffer buf = cache.get(size); ByteBuffer buf = cache.get(size);
if (buf != null) { if (buf != null) {
@ -178,7 +178,7 @@ class Util {
/** /**
* Releases a temporary buffer by returning to the cache or freeing it. * Releases a temporary buffer by returning to the cache or freeing it.
*/ */
static void releaseTemporaryDirectBuffer(ByteBuffer buf) { public static void releaseTemporaryDirectBuffer(ByteBuffer buf) {
offerFirstTemporaryDirectBuffer(buf); offerFirstTemporaryDirectBuffer(buf);
} }
@ -467,7 +467,7 @@ class Util {
private static boolean loaded = false; private static boolean loaded = false;
static void load() { public static void load() {
synchronized (Util.class) { synchronized (Util.class) {
if (loaded) if (loaded)
return; return;

View File

@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
package sun.nio.ch; package sun.nio.ch.sctp;
import java.net.SocketAddress; import java.net.SocketAddress;
import com.sun.nio.sctp.MessageInfo; import com.sun.nio.sctp.MessageInfo;
@ -31,7 +31,7 @@ import com.sun.nio.sctp.Association;
/** /**
* An implementation of a MessageInfo. * An implementation of a MessageInfo.
*/ */
public class SctpMessageInfoImpl extends MessageInfo { public class MessageInfoImpl extends MessageInfo {
private final SocketAddress address; private final SocketAddress address;
private final int bytes; /* 0 */ private final int bytes; /* 0 */
@ -43,7 +43,7 @@ public class SctpMessageInfoImpl extends MessageInfo {
private long timeToLive; /* 0L */ private long timeToLive; /* 0L */
private int ppid; /* 0 */ private int ppid; /* 0 */
public SctpMessageInfoImpl(Association association, public MessageInfoImpl(Association association,
SocketAddress address, SocketAddress address,
int streamNumber) { int streamNumber) {
this.association = association; this.association = association;
@ -53,7 +53,7 @@ public class SctpMessageInfoImpl extends MessageInfo {
} }
/* Invoked from native */ /* Invoked from native */
private SctpMessageInfoImpl(int assocId, private MessageInfoImpl(int assocId,
SocketAddress address, SocketAddress address,
int bytes, int bytes,
int streamNumber, int streamNumber,
@ -75,7 +75,7 @@ public class SctpMessageInfoImpl extends MessageInfo {
} }
/** /**
* SctpMessageInfoImpl instances created from native will need to have their * MessageInfoImpl instances created from native will need to have their
* association set from the channel. * association set from the channel.
*/ */
void setAssociation(Association association) { void setAssociation(Association association) {

View File

@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
package sun.nio.ch; package sun.nio.ch.sctp;
import com.sun.nio.sctp.SctpSocketOption; import com.sun.nio.sctp.SctpSocketOption;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2012, 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
@ -72,8 +72,10 @@ public class PKCS7 {
/* /*
* Random number generator for creating nonce values * Random number generator for creating nonce values
* (Lazy initialization)
*/ */
private static final SecureRandom RANDOM; private static class SecureRandomHolder {
static final SecureRandom RANDOM;
static { static {
SecureRandom tmp = null; SecureRandom tmp = null;
try { try {
@ -83,6 +85,7 @@ public class PKCS7 {
} }
RANDOM = tmp; RANDOM = tmp;
} }
}
/* /*
* Object identifier for the timestamping key purpose. * Object identifier for the timestamping key purpose.
@ -862,8 +865,8 @@ public class PKCS7 {
// Generate a nonce // Generate a nonce
BigInteger nonce = null; BigInteger nonce = null;
if (RANDOM != null) { if (SecureRandomHolder.RANDOM != null) {
nonce = new BigInteger(64, RANDOM); nonce = new BigInteger(64, SecureRandomHolder.RANDOM);
tsQuery.setNonce(nonce); tsQuery.setNonce(nonce);
} }
tsQuery.requestCertificate(true); tsQuery.requestCertificate(true);

View File

@ -252,12 +252,26 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
throw uke; throw uke;
} }
try {
byte[] privateKeyInfo;
while (true) {
try { try {
// Use JCE // Use JCE
SecretKey skey = getPBEKey(password); SecretKey skey = getPBEKey(password);
Cipher cipher = Cipher.getInstance(algOid.toString()); Cipher cipher = Cipher.getInstance(algOid.toString());
cipher.init(Cipher.DECRYPT_MODE, skey, algParams); cipher.init(Cipher.DECRYPT_MODE, skey, algParams);
byte[] privateKeyInfo = cipher.doFinal(encryptedKey); privateKeyInfo = cipher.doFinal(encryptedKey);
break;
} catch (Exception e) {
if (password.length == 0) {
// Retry using an empty password
// without a NULL terminator.
password = new char[1];
continue;
}
throw e;
}
}
PKCS8EncodedKeySpec kspec = new PKCS8EncodedKeySpec(privateKeyInfo); PKCS8EncodedKeySpec kspec = new PKCS8EncodedKeySpec(privateKeyInfo);
@ -1251,16 +1265,24 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
ObjectIdentifier algOid = in.getOID(); ObjectIdentifier algOid = in.getOID();
AlgorithmParameters algParams = parseAlgParameters(in); AlgorithmParameters algParams = parseAlgParameters(in);
while (true) {
try { try {
// Use JCE // Use JCE
SecretKey skey = getPBEKey(password); SecretKey skey = getPBEKey(password);
Cipher cipher = Cipher.getInstance(algOid.toString()); Cipher cipher = Cipher.getInstance(algOid.toString());
cipher.init(Cipher.DECRYPT_MODE, skey, algParams); cipher.init(Cipher.DECRYPT_MODE, skey, algParams);
safeContentsData = cipher.doFinal(safeContentsData); safeContentsData = cipher.doFinal(safeContentsData);
break;
} catch (Exception e) { } catch (Exception e) {
throw new IOException("failed to decrypt safe" if (password.length == 0) {
+ " contents entry: " + e, e); // Retry using an empty password
// without a NULL terminator.
password = new char[1];
continue;
}
throw new IOException(
"failed to decrypt safe contents entry: " + e, e);
}
} }
} else { } else {
throw new IOException("public key protected PKCS12" + throw new IOException("public key protected PKCS12" +

View File

@ -55,7 +55,7 @@ public class CommandLine {
public static String[] parse(String[] args) public static String[] parse(String[] args)
throws IOException throws IOException
{ {
ArrayList newArgs = new ArrayList(args.length); List<String> newArgs = new ArrayList<>(args.length);
for (int i = 0; i < args.length; i++) { for (int i = 0; i < args.length; i++) {
String arg = args[i]; String arg = args[i];
if (arg.length() > 1 && arg.charAt(0) == '@') { if (arg.length() > 1 && arg.charAt(0) == '@') {
@ -69,10 +69,10 @@ public class CommandLine {
newArgs.add(arg); newArgs.add(arg);
} }
} }
return (String[])newArgs.toArray(new String[newArgs.size()]); return newArgs.toArray(new String[newArgs.size()]);
} }
private static void loadCmdFile(String name, List args) private static void loadCmdFile(String name, List<String> args)
throws IOException throws IOException
{ {
Reader r = new BufferedReader(new FileReader(name)); Reader r = new BufferedReader(new FileReader(name));
@ -83,7 +83,7 @@ public class CommandLine {
st.commentChar('#'); st.commentChar('#');
st.quoteChar('"'); st.quoteChar('"');
st.quoteChar('\''); st.quoteChar('\'');
while (st.nextToken() != st.TT_EOF) { while (st.nextToken() != StreamTokenizer.TT_EOF) {
args.add(st.sval); args.add(st.sval);
} }
r.close(); r.close();

View File

@ -47,10 +47,10 @@ public class Manifest {
/* list of headers that all pertain to a particular /* list of headers that all pertain to a particular
* file in the archive * file in the archive
*/ */
private Vector entries = new Vector(); private Vector<MessageHeader> entries = new Vector<>();
private byte[] tmpbuf = new byte[512]; private byte[] tmpbuf = new byte[512];
/* a hashtable of entries, for fast lookup */ /* a hashtable of entries, for fast lookup */
private Hashtable tableEntries = new Hashtable(); private Hashtable<String, MessageHeader> tableEntries = new Hashtable<>();
static final String[] hashes = {"SHA"}; static final String[] hashes = {"SHA"};
static final byte[] EOL = {(byte)'\r', (byte)'\n'}; static final byte[] EOL = {(byte)'\r', (byte)'\n'};
@ -115,14 +115,14 @@ public class Manifest {
} }
public MessageHeader getEntry(String name) { public MessageHeader getEntry(String name) {
return (MessageHeader) tableEntries.get(name); return tableEntries.get(name);
} }
public MessageHeader entryAt(int i) { public MessageHeader entryAt(int i) {
return (MessageHeader) entries.elementAt(i); return entries.elementAt(i);
} }
public Enumeration entries() { public Enumeration<MessageHeader> entries() {
return entries.elements(); return entries.elements();
} }
@ -214,7 +214,7 @@ public class Manifest {
/* the first header in the file should be the global one. /* the first header in the file should be the global one.
* It should say "Manifest-Version: x.x"; if not add it * It should say "Manifest-Version: x.x"; if not add it
*/ */
MessageHeader globals = (MessageHeader) entries.elementAt(0); MessageHeader globals = entries.elementAt(0);
if (globals.findValue("Manifest-Version") == null) { if (globals.findValue("Manifest-Version") == null) {
/* Assume this is a user-defined manifest. If it has a Name: <..> /* Assume this is a user-defined manifest. If it has a Name: <..>
@ -238,7 +238,7 @@ public class Manifest {
globals.print(ps); globals.print(ps);
for (int i = 1; i < entries.size(); ++i) { for (int i = 1; i < entries.size(); ++i) {
MessageHeader mh = (MessageHeader) entries.elementAt(i); MessageHeader mh = entries.elementAt(i);
mh.print(ps); mh.print(ps);
} }
} }

View File

@ -47,7 +47,7 @@ import sun.security.x509.AlgorithmId;
* *
* <p>Each entry section contains the name of an entry (which must * <p>Each entry section contains the name of an entry (which must
* have a counterpart in the manifest). Like the manifest it contains * have a counterpart in the manifest). Like the manifest it contains
* a hash, the hash of the manifest section correspondind to the * a hash, the hash of the manifest section corresponding to the
* name. Since the manifest entry contains the hash of the data, this * name. Since the manifest entry contains the hash of the data, this
* is equivalent to a signature of the data, plus the attributes of * is equivalent to a signature of the data, plus the attributes of
* the manifest entry. * the manifest entry.
@ -66,7 +66,7 @@ public class SignatureFile {
/* list of headers that all pertain to a particular file in the /* list of headers that all pertain to a particular file in the
* archive */ * archive */
private Vector entries = new Vector(); private Vector<MessageHeader> entries = new Vector<>();
/* Right now we only support SHA hashes */ /* Right now we only support SHA hashes */
static final String[] hashes = {"SHA"}; static final String[] hashes = {"SHA"};
@ -98,7 +98,7 @@ public class SignatureFile {
* character in length. */ * character in length. */
private SignatureFile(String name) throws JarException { private SignatureFile(String name) throws JarException {
entries = new Vector(); entries = new Vector<>();
if (name != null) { if (name != null) {
if (name.length() > 8 || name.indexOf('.') != -1) { if (name.length() > 8 || name.indexOf('.') != -1) {
@ -142,9 +142,9 @@ public class SignatureFile {
this(name, true); this(name, true);
this.manifest = manifest; this.manifest = manifest;
Enumeration enum_ = manifest.entries(); Enumeration<MessageHeader> enum_ = manifest.entries();
while (enum_.hasMoreElements()) { while (enum_.hasMoreElements()) {
MessageHeader mh = (MessageHeader)enum_.nextElement(); MessageHeader mh = enum_.nextElement();
String entryName = mh.findValue("Name"); String entryName = mh.findValue("Name");
if (entryName != null) { if (entryName != null) {
add(entryName); add(entryName);
@ -269,9 +269,9 @@ public class SignatureFile {
*the entry does not exist. *the entry does not exist.
*/ */
public MessageHeader getEntry(String name) { public MessageHeader getEntry(String name) {
Enumeration enum_ = entries(); Enumeration<MessageHeader> enum_ = entries();
while(enum_.hasMoreElements()) { while(enum_.hasMoreElements()) {
MessageHeader mh = (MessageHeader)enum_.nextElement(); MessageHeader mh = enum_.nextElement();
if (name.equals(mh.findValue("Name"))) { if (name.equals(mh.findValue("Name"))) {
return mh; return mh;
} }
@ -282,13 +282,13 @@ public class SignatureFile {
/** /**
* Returns the n-th entry. The global header is a entry 0. */ * Returns the n-th entry. The global header is a entry 0. */
public MessageHeader entryAt(int n) { public MessageHeader entryAt(int n) {
return (MessageHeader) entries.elementAt(n); return entries.elementAt(n);
} }
/** /**
* Returns an enumeration of the entries. * Returns an enumeration of the entries.
*/ */
public Enumeration entries() { public Enumeration<MessageHeader> entries() {
return entries.elements(); return entries.elements();
} }
@ -322,11 +322,11 @@ public class SignatureFile {
} }
} }
private Hashtable digests = new Hashtable(); private Hashtable<String, MessageDigest> digests = new Hashtable<>();
private MessageDigest getDigest(String algorithm) private MessageDigest getDigest(String algorithm)
throws NoSuchAlgorithmException { throws NoSuchAlgorithmException {
MessageDigest dig = (MessageDigest)digests.get(algorithm); MessageDigest dig = digests.get(algorithm);
if (dig == null) { if (dig == null) {
dig = MessageDigest.getInstance(algorithm); dig = MessageDigest.getInstance(algorithm);
digests.put(algorithm, dig); digests.put(algorithm, dig);
@ -344,7 +344,7 @@ public class SignatureFile {
/* the first header in the file should be the global one. /* the first header in the file should be the global one.
* It should say "SignatureFile-Version: x.x"; barf if not * It should say "SignatureFile-Version: x.x"; barf if not
*/ */
MessageHeader globals = (MessageHeader) entries.elementAt(0); MessageHeader globals = entries.elementAt(0);
if (globals.findValue("Signature-Version") == null) { if (globals.findValue("Signature-Version") == null) {
throw new JarException("Signature file requires " + throw new JarException("Signature file requires " +
"Signature-Version: 1.0 in 1st header"); "Signature-Version: 1.0 in 1st header");
@ -354,7 +354,7 @@ public class SignatureFile {
globals.print(ps); globals.print(ps);
for (int i = 1; i < entries.size(); ++i) { for (int i = 1; i < entries.size(); ++i) {
MessageHeader mh = (MessageHeader) entries.elementAt(i); MessageHeader mh = entries.elementAt(i);
mh.print(ps); mh.print(ps);
} }
} }

View File

@ -213,10 +213,10 @@ public class MemoryMonitor extends JPanel {
// Calculate remaining size // Calculate remaining size
float ssH = ascent + descent; float ssH = ascent + descent;
float remainingHeight = (float) (y2 - (ssH*2) - 0.5f); float remainingHeight = y2 - (ssH*2) - 0.5f;
float blockHeight = remainingHeight/10; float blockHeight = remainingHeight/10;
float blockWidth = 20.0f; float blockWidth = 20.0f;
float remainingWidth = (float) (x2 - blockWidth - 10); float remainingWidth = x2 - blockWidth - 10;
// .. Memory Free .. // .. Memory Free ..
big.setColor(mfColor); big.setColor(mfColor);
@ -224,7 +224,7 @@ public class MemoryMonitor extends JPanel {
int i = 0; int i = 0;
for ( ; i < MemUsage ; i++) { for ( ; i < MemUsage ; i++) {
mfRect.setRect(x1+5,(float) y1+ssH+i*blockHeight, mfRect.setRect(x1+5,(float) y1+ssH+i*blockHeight,
blockWidth,(float) blockHeight-1); blockWidth, blockHeight-1);
big.fill(mfRect); big.fill(mfRect);
} }
@ -232,13 +232,13 @@ public class MemoryMonitor extends JPanel {
big.setColor(Color.green); big.setColor(Color.green);
for ( ; i < 10; i++) { for ( ; i < 10; i++) {
muRect.setRect(x1+5,(float) y1 + ssH+i*blockHeight, muRect.setRect(x1+5,(float) y1 + ssH+i*blockHeight,
blockWidth,(float) blockHeight-1); blockWidth, blockHeight-1);
big.fill(muRect); big.fill(muRect);
} }
// .. Draw History Graph .. // .. Draw History Graph ..
if (remainingWidth <= 30) remainingWidth = (float)30; if (remainingWidth <= 30) remainingWidth = (float)30;
if (remainingHeight <= ssH) remainingHeight = (float)ssH; if (remainingHeight <= ssH) remainingHeight = ssH;
big.setColor(graphColor); big.setColor(graphColor);
int graphX = x1+30; int graphX = x1+30;
int graphY = y1 + (int) ssH; int graphY = y1 + (int) ssH;
@ -347,8 +347,8 @@ public class MemoryMonitor extends JPanel {
big = bimg.createGraphics(); big = bimg.createGraphics();
big.setFont(font); big.setFont(font);
FontMetrics fm = big.getFontMetrics(font); FontMetrics fm = big.getFontMetrics(font);
ascent = (int) fm.getAscent(); ascent = fm.getAscent();
descent = (int) fm.getDescent(); descent = fm.getDescent();
} }
repaint(); repaint();
try { try {

View File

@ -185,11 +185,11 @@ class ZipConstants {
*/ */
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
static final int CH(byte[] b, int n) { static final int CH(byte[] b, int n) {
return b[n] & 0xff; return Byte.toUnsignedInt(b[n]);
} }
static final int SH(byte[] b, int n) { static final int SH(byte[] b, int n) {
return (b[n] & 0xff) | ((b[n + 1] & 0xff) << 8); return Byte.toUnsignedInt(b[n]) | (Byte.toUnsignedInt(b[n + 1]) << 8);
} }
static final long LG(byte[] b, int n) { static final long LG(byte[] b, int n) {

View File

@ -61,7 +61,7 @@ public class ZipFileStore extends FileStore {
private final ZipFileSystem zfs; private final ZipFileSystem zfs;
ZipFileStore(ZipPath zpath) { ZipFileStore(ZipPath zpath) {
this.zfs = (ZipFileSystem)zpath.getFileSystem(); this.zfs = zpath.getFileSystem();
} }
@Override @Override

View File

@ -1609,7 +1609,7 @@ public class ZipFileSystem extends FileSystem {
synchronized (inflaters) { synchronized (inflaters) {
int size = inflaters.size(); int size = inflaters.size();
if (size > 0) { if (size > 0) {
Inflater inf = (Inflater)inflaters.remove(size - 1); Inflater inf = inflaters.remove(size - 1);
return inf; return inf;
} else { } else {
return new Inflater(true); return new Inflater(true);
@ -1638,7 +1638,7 @@ public class ZipFileSystem extends FileSystem {
synchronized (deflaters) { synchronized (deflaters) {
int size = deflaters.size(); int size = deflaters.size();
if (size > 0) { if (size > 0) {
Deflater def = (Deflater)deflaters.remove(size - 1); Deflater def = deflaters.remove(size - 1);
return def; return def;
} else { } else {
return new Deflater(Deflater.DEFAULT_COMPRESSION, true); return new Deflater(Deflater.DEFAULT_COMPRESSION, true);

View File

@ -211,7 +211,7 @@ public class ZipFileSystemProvider extends FileSystemProvider {
public <V extends FileAttributeView> V public <V extends FileAttributeView> V
getFileAttributeView(Path path, Class<V> type, LinkOption... options) getFileAttributeView(Path path, Class<V> type, LinkOption... options)
{ {
return (V)ZipFileAttributeView.get(toZipPath(path), type); return ZipFileAttributeView.get(toZipPath(path), type);
} }
@Override @Override

View File

@ -78,12 +78,12 @@ public class ZipInfo {
// twice // twice
long len = LOCHDR + CENNAM(cen, pos) + CENEXT(cen, pos) + CENHDR; long len = LOCHDR + CENNAM(cen, pos) + CENEXT(cen, pos) + CENHDR;
if (zfs.readFullyAt(buf, 0, len, locoff(cen, pos)) != len) if (zfs.readFullyAt(buf, 0, len, locoff(cen, pos)) != len)
zfs.zerror("read loc header failed"); ZipFileSystem.zerror("read loc header failed");
if (LOCEXT(buf) > CENEXT(cen, pos) + CENHDR) { if (LOCEXT(buf) > CENEXT(cen, pos) + CENHDR) {
// have to read the second time; // have to read the second time;
len = LOCHDR + LOCNAM(buf) + LOCEXT(buf); len = LOCHDR + LOCNAM(buf) + LOCEXT(buf);
if (zfs.readFullyAt(buf, 0, len, locoff(cen, pos)) != len) if (zfs.readFullyAt(buf, 0, len, locoff(cen, pos)) != len)
zfs.zerror("read loc header failed"); ZipFileSystem.zerror("read loc header failed");
} }
printLOC(buf); printLOC(buf);
pos += CENHDR + CENNAM(cen, pos) + CENEXT(cen, pos) + CENCOM(cen, pos); pos += CENHDR + CENNAM(cen, pos) + CENEXT(cen, pos) + CENCOM(cen, pos);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2012, 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
@ -34,141 +34,3 @@ Java_sun_management_HotSpotDiagnostic_dumpHeap
{ {
jmm_interface->DumpHeap0(env, outputfile, live); jmm_interface->DumpHeap0(env, outputfile, live);
} }
JNIEXPORT jobjectArray JNICALL
Java_sun_management_HotSpotDiagnostic_getDiagnosticCommands0
(JNIEnv *env, jobject dummy)
{
if ((jmm_version > JMM_VERSION_1_2_1)
|| (jmm_version == JMM_VERSION_1_2 && ((jmm_version&0xFF)>=2))) {
return jmm_interface->GetDiagnosticCommands(env);
}
JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
"Diagnostic commands are not supported by this VM");
}
jobject getDiagnosticCommandArgumentInfoArray(JNIEnv *env, jstring command,
int num_arg) {
int i;
jobject obj;
jobjectArray result;
dcmdArgInfo* dcmd_arg_info_array;
jclass dcmdArgInfoCls;
jclass arraysCls;
jmethodID mid;
jobject resultList;
dcmd_arg_info_array = (dcmdArgInfo*) malloc(num_arg * sizeof(dcmdArgInfo));
if (dcmd_arg_info_array == NULL) {
return NULL;
}
jmm_interface->GetDiagnosticCommandArgumentsInfo(env, command,
dcmd_arg_info_array);
dcmdArgInfoCls = (*env)->FindClass(env,
"com/sun/management/DiagnosticCommandArgumentInfo");
result = (*env)->NewObjectArray(env, num_arg, dcmdArgInfoCls, NULL);
if (result == NULL) {
free(dcmd_arg_info_array);
return NULL;
}
for (i=0; i<num_arg; i++) {
obj = JNU_NewObjectByName(env,
"com/sun/management/DiagnosticCommandArgumentInfo",
"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZI)V",
(*env)->NewStringUTF(env,dcmd_arg_info_array[i].name),
(*env)->NewStringUTF(env,dcmd_arg_info_array[i].description),
(*env)->NewStringUTF(env,dcmd_arg_info_array[i].type),
dcmd_arg_info_array[i].default_string == NULL ? NULL:
(*env)->NewStringUTF(env, dcmd_arg_info_array[i].default_string),
dcmd_arg_info_array[i].mandatory,
dcmd_arg_info_array[i].option,
dcmd_arg_info_array[i].position);
if (obj == NULL) {
free(dcmd_arg_info_array);
return NULL;
}
(*env)->SetObjectArrayElement(env, result, i, obj);
}
free(dcmd_arg_info_array);
arraysCls = (*env)->FindClass(env, "java/util/Arrays");
mid = (*env)->GetStaticMethodID(env, arraysCls,
"asList", "([Ljava/lang/Object;)Ljava/util/List;");
resultList = (*env)->CallStaticObjectMethod(env, arraysCls, mid, result);
return resultList;
}
/* Throws IllegalArgumentException if at least one the diagnostic command
* passed in argument is not supported by the JVM
*/
JNIEXPORT jobjectArray JNICALL
Java_sun_management_HotSpotDiagnostic_getDiagnosticCommandInfo0
(JNIEnv *env, jobject dummy, jobjectArray commands)
{
int i;
jclass dcmdInfoCls;
jobject result;
jobjectArray args;
jobject obj;
if (commands == NULL) {
JNU_ThrowNullPointerException(env, "Invalid String Array");
return NULL;
}
if ((jmm_version > JMM_VERSION_1_2_1)
|| (jmm_version == JMM_VERSION_1_2 && ((jmm_version&0xFF)>=2))) {
jsize num_commands = (*env)->GetArrayLength(env, commands);
dcmdInfo* dcmd_info_array = (dcmdInfo*) malloc(num_commands *
sizeof(dcmdInfo));
if (dcmd_info_array == NULL) {
JNU_ThrowOutOfMemoryError(env, NULL);
}
jmm_interface->GetDiagnosticCommandInfo(env, commands, dcmd_info_array);
dcmdInfoCls = (*env)->FindClass(env,
"com/sun/management/DiagnosticCommandInfo");
result = (*env)->NewObjectArray(env, num_commands, dcmdInfoCls, NULL);
if (result == NULL) {
free(dcmd_info_array);
JNU_ThrowOutOfMemoryError(env, 0);
}
for (i=0; i<num_commands; i++) {
args = getDiagnosticCommandArgumentInfoArray(env,
(*env)->GetObjectArrayElement(env,commands,i),
dcmd_info_array[i].num_arguments);
if (args == NULL) {
free(dcmd_info_array);
JNU_ThrowOutOfMemoryError(env, 0);
}
obj = JNU_NewObjectByName(env,
"com/sun/management/DiagnosticCommandInfo",
"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLjava/util/List;)V",
(*env)->NewStringUTF(env,dcmd_info_array[i].name),
(*env)->NewStringUTF(env,dcmd_info_array[i].description),
(*env)->NewStringUTF(env,dcmd_info_array[i].impact),
dcmd_info_array[i].enabled,
args);
if (obj == NULL) {
free(dcmd_info_array);
JNU_ThrowOutOfMemoryError(env, 0);
}
(*env)->SetObjectArrayElement(env, result, i, obj);
}
free(dcmd_info_array);
return result;
}
JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
"Diagnostic commands are not supported by this VM");
}
/* Throws IllegalArgumentException if the diagnostic command
* passed in argument is not supported by the JVM
*/
JNIEXPORT jstring JNICALL
Java_sun_management_HotSpotDiagnostic_executeDiagnosticCommand0
(JNIEnv *env, jobject dummy, jstring command) {
if((jmm_version > JMM_VERSION_1_2_1 )
|| (jmm_version == JMM_VERSION_1_2 && ((jmm_version&0xFF)>=2))) {
return jmm_interface->ExecuteDiagnosticCommand(env, command);
}
JNU_ThrowByName(env, "java/lang/UnsupportedOperationException",
"Diagnostic commands are not supported by this VM");
}

View File

@ -180,7 +180,7 @@ class DevPollSelectorImpl
((SelChImpl)selch).kill(); ((SelChImpl)selch).kill();
} }
void putEventOps(SelectionKeyImpl sk, int ops) { public void putEventOps(SelectionKeyImpl sk, int ops) {
if (closed) if (closed)
throw new ClosedSelectorException(); throw new ClosedSelectorException();
int fd = IOUtil.fdVal(sk.channel.getFD()); int fd = IOUtil.fdVal(sk.channel.getFD());

View File

@ -181,7 +181,7 @@ class EPollSelectorImpl
((SelChImpl)selch).kill(); ((SelChImpl)selch).kill();
} }
void putEventOps(SelectionKeyImpl sk, int ops) { public void putEventOps(SelectionKeyImpl sk, int ops) {
if (closed) if (closed)
throw new ClosedSelectorException(); throw new ClosedSelectorException();
pollWrapper.setInterest(sk.channel, ops); pollWrapper.setInterest(sk.channel, ops);

View File

@ -37,21 +37,21 @@ package sun.nio.ch;
// always returns -1 and the signal(long) method has no effect. // always returns -1 and the signal(long) method has no effect.
class NativeThread { public class NativeThread {
// Returns an opaque token representing the native thread underlying the // Returns an opaque token representing the native thread underlying the
// invoking Java thread. On systems that do not require signalling, this // invoking Java thread. On systems that do not require signalling, this
// method always returns -1. // method always returns -1.
// //
static native long current(); public static native long current();
// Signals the given native thread so as to release it from a blocking I/O // Signals the given native thread so as to release it from a blocking I/O
// operation. On systems that do not require signalling, this method has // operation. On systems that do not require signalling, this method has
// no effect. // no effect.
// //
static native void signal(long nt); public static native void signal(long nt);
static native void init(); private static native void init();
static { static {
Util.load(); Util.load();

View File

@ -41,9 +41,9 @@ import sun.misc.*;
* @since 1.4 * @since 1.4
*/ */
class PollArrayWrapper extends AbstractPollArrayWrapper { public class PollArrayWrapper extends AbstractPollArrayWrapper {
static final short POLLCONN = POLLOUT; public static final short POLLCONN = POLLOUT;
// File descriptor to write for interrupt // File descriptor to write for interrupt
int interruptFD; int interruptFD;

View File

@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
package sun.nio.ch; package sun.nio.ch.sctp;
import com.sun.nio.sctp.Association; import com.sun.nio.sctp.Association;
import com.sun.nio.sctp.AssociationChangeNotification; import com.sun.nio.sctp.AssociationChangeNotification;
@ -30,7 +30,7 @@ import com.sun.nio.sctp.AssociationChangeNotification;
/** /**
* An implementation of AssociationChangeNotification * An implementation of AssociationChangeNotification
*/ */
public class SctpAssocChange extends AssociationChangeNotification public class AssociationChange extends AssociationChangeNotification
implements SctpNotification implements SctpNotification
{ {
/* static final ints so that they can be referenced from native */ /* static final ints so that they can be referenced from native */
@ -50,7 +50,7 @@ public class SctpAssocChange extends AssociationChangeNotification
private int maxInStreams; private int maxInStreams;
/* Invoked from native */ /* Invoked from native */
private SctpAssocChange(int assocId, private AssociationChange(int assocId,
int intEvent, int intEvent,
int maxOutStreams, int maxOutStreams,
int maxInStreams) { int maxInStreams) {

View File

@ -22,15 +22,15 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
package sun.nio.ch; package sun.nio.ch.sctp;
import com.sun.nio.sctp.Association; import com.sun.nio.sctp.Association;
/** /**
* An implementation of Association * An implementation of Association
*/ */
public class SctpAssociationImpl extends Association { public class AssociationImpl extends Association {
public SctpAssociationImpl(int associationID, public AssociationImpl(int associationID,
int maxInStreams, int maxInStreams,
int maxOutStreams) { int maxOutStreams) {
super(associationID, maxInStreams, maxOutStreams); super(associationID, maxInStreams, maxOutStreams);

View File

@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
package sun.nio.ch; package sun.nio.ch.sctp;
import java.net.SocketAddress; import java.net.SocketAddress;
import com.sun.nio.sctp.Association; import com.sun.nio.sctp.Association;
@ -31,7 +31,7 @@ import com.sun.nio.sctp.PeerAddressChangeNotification;
/** /**
* An implementation of PeerAddressChangeNotification * An implementation of PeerAddressChangeNotification
*/ */
public class SctpPeerAddrChange extends PeerAddressChangeNotification public class PeerAddrChange extends PeerAddressChangeNotification
implements SctpNotification implements SctpNotification
{ {
/* static final ints so that they can be referenced from native */ /* static final ints so that they can be referenced from native */
@ -51,7 +51,7 @@ public class SctpPeerAddrChange extends PeerAddressChangeNotification
private AddressChangeEvent event; private AddressChangeEvent event;
/* Invoked from native */ /* Invoked from native */
private SctpPeerAddrChange(int assocId, SocketAddress address, int intEvent) { private PeerAddrChange(int assocId, SocketAddress address, int intEvent) {
switch (intEvent) { switch (intEvent) {
case SCTP_ADDR_AVAILABLE : case SCTP_ADDR_AVAILABLE :
this.event = AddressChangeEvent.ADDR_AVAILABLE; this.event = AddressChangeEvent.ADDR_AVAILABLE;

View File

@ -22,13 +22,13 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
package sun.nio.ch; package sun.nio.ch.sctp;
/** /**
* Wraps the actual message or notification so that it can be * Wraps the actual message or notification so that it can be
* set and returned from the native receive implementation. * set and returned from the native receive implementation.
*/ */
public class SctpResultContainer { public class ResultContainer {
/* static final ints so that they can be referenced from native */ /* static final ints so that they can be referenced from native */
static final int NOTHING = 0; static final int NOTHING = 0;
static final int MESSAGE = 1; static final int MESSAGE = 1;
@ -63,47 +63,47 @@ public class SctpResultContainer {
return (SctpNotification) value; return (SctpNotification) value;
} }
SctpMessageInfoImpl getMessageInfo() { MessageInfoImpl getMessageInfo() {
assert type() == MESSAGE; assert type() == MESSAGE;
if (value instanceof SctpMessageInfoImpl) if (value instanceof MessageInfoImpl)
return (SctpMessageInfoImpl) value; return (MessageInfoImpl) value;
return null; return null;
} }
SctpSendFailed getSendFailed() { SendFailed getSendFailed() {
assert type() == SEND_FAILED; assert type() == SEND_FAILED;
if (value instanceof SctpSendFailed) if (value instanceof SendFailed)
return (SctpSendFailed) value; return (SendFailed) value;
return null; return null;
} }
SctpAssocChange getAssociationChanged() { AssociationChange getAssociationChanged() {
assert type() == ASSOCIATION_CHANGED; assert type() == ASSOCIATION_CHANGED;
if (value instanceof SctpAssocChange) if (value instanceof AssociationChange)
return (SctpAssocChange) value; return (AssociationChange) value;
return null; return null;
} }
SctpPeerAddrChange getPeerAddressChanged() { PeerAddrChange getPeerAddressChanged() {
assert type() == PEER_ADDRESS_CHANGED; assert type() == PEER_ADDRESS_CHANGED;
if (value instanceof SctpPeerAddrChange) if (value instanceof PeerAddrChange)
return (SctpPeerAddrChange) value; return (PeerAddrChange) value;
return null; return null;
} }
SctpShutdown getShutdown() { Shutdown getShutdown() {
assert type() == SHUTDOWN; assert type() == SHUTDOWN;
if (value instanceof SctpShutdown) if (value instanceof Shutdown)
return (SctpShutdown) value; return (Shutdown) value;
return null; return null;
} }

View File

@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
package sun.nio.ch; package sun.nio.ch.sctp;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.SocketAddress; import java.net.SocketAddress;
@ -53,11 +53,20 @@ import com.sun.nio.sctp.MessageInfo;
import com.sun.nio.sctp.NotificationHandler; import com.sun.nio.sctp.NotificationHandler;
import com.sun.nio.sctp.SctpChannel; import com.sun.nio.sctp.SctpChannel;
import com.sun.nio.sctp.SctpSocketOption; import com.sun.nio.sctp.SctpSocketOption;
import sun.nio.ch.DirectBuffer;
import sun.nio.ch.IOStatus;
import sun.nio.ch.IOUtil;
import sun.nio.ch.NativeThread;
import sun.nio.ch.Net;
import sun.nio.ch.PollArrayWrapper;
import sun.nio.ch.SelChImpl;
import sun.nio.ch.SelectionKeyImpl;
import sun.nio.ch.Util;
import static com.sun.nio.sctp.SctpStandardSocketOptions.*; import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
import static sun.nio.ch.SctpResultContainer.SEND_FAILED; import static sun.nio.ch.sctp.ResultContainer.SEND_FAILED;
import static sun.nio.ch.SctpResultContainer.ASSOCIATION_CHANGED; import static sun.nio.ch.sctp.ResultContainer.ASSOCIATION_CHANGED;
import static sun.nio.ch.SctpResultContainer.PEER_ADDRESS_CHANGED; import static sun.nio.ch.sctp.ResultContainer.PEER_ADDRESS_CHANGED;
import static sun.nio.ch.SctpResultContainer.SHUTDOWN; import static sun.nio.ch.sctp.ResultContainer.SHUTDOWN;
/** /**
* An implementation of an SctpChannel * An implementation of an SctpChannel
@ -745,7 +754,7 @@ public class SctpChannelImpl extends SctpChannel
receiveInvoked.set(Boolean.TRUE); receiveInvoked.set(Boolean.TRUE);
try { try {
SctpResultContainer resultContainer = new SctpResultContainer(); ResultContainer resultContainer = new ResultContainer();
do { do {
resultContainer.clear(); resultContainer.clear();
synchronized (receiveLock) { synchronized (receiveLock) {
@ -775,7 +784,7 @@ public class SctpChannelImpl extends SctpChannel
/* message or nothing */ /* message or nothing */
if (resultContainer.hasSomething()) { if (resultContainer.hasSomething()) {
/* Set the association before returning */ /* Set the association before returning */
SctpMessageInfoImpl info = MessageInfoImpl info =
resultContainer.getMessageInfo(); resultContainer.getMessageInfo();
synchronized (stateLock) { synchronized (stateLock) {
assert association != null; assert association != null;
@ -812,7 +821,7 @@ public class SctpChannelImpl extends SctpChannel
private int receive(int fd, private int receive(int fd,
ByteBuffer dst, ByteBuffer dst,
SctpResultContainer resultContainer, ResultContainer resultContainer,
boolean peek) boolean peek)
throws IOException { throws IOException {
int pos = dst.position(); int pos = dst.position();
@ -837,7 +846,7 @@ public class SctpChannelImpl extends SctpChannel
} }
private int receiveIntoNativeBuffer(int fd, private int receiveIntoNativeBuffer(int fd,
SctpResultContainer resultContainer, ResultContainer resultContainer,
ByteBuffer bb, ByteBuffer bb,
int rem, int rem,
int pos, int pos,
@ -854,7 +863,7 @@ public class SctpChannelImpl extends SctpChannel
private InternalNotificationHandler internalNotificationHandler = private InternalNotificationHandler internalNotificationHandler =
new InternalNotificationHandler(); new InternalNotificationHandler();
private void handleNotificationInternal(SctpResultContainer resultContainer) private void handleNotificationInternal(ResultContainer resultContainer)
{ {
invokeNotificationHandler(resultContainer, invokeNotificationHandler(resultContainer,
internalNotificationHandler, null); internalNotificationHandler, null);
@ -869,8 +878,8 @@ public class SctpChannelImpl extends SctpChannel
if (not.event().equals( if (not.event().equals(
AssociationChangeNotification.AssocChangeEvent.COMM_UP) && AssociationChangeNotification.AssocChangeEvent.COMM_UP) &&
association == null) { association == null) {
SctpAssocChange sac = (SctpAssocChange) not; AssociationChange sac = (AssociationChange) not;
association = new SctpAssociationImpl association = new AssociationImpl
(sac.assocId(), sac.maxInStreams(), sac.maxOutStreams()); (sac.assocId(), sac.maxInStreams(), sac.maxOutStreams());
} }
return HandlerResult.CONTINUE; return HandlerResult.CONTINUE;
@ -878,7 +887,7 @@ public class SctpChannelImpl extends SctpChannel
} }
private <T> HandlerResult invokeNotificationHandler private <T> HandlerResult invokeNotificationHandler
(SctpResultContainer resultContainer, (ResultContainer resultContainer,
NotificationHandler<T> handler, NotificationHandler<T> handler,
T attachment) { T attachment) {
SctpNotification notification = resultContainer.notification(); SctpNotification notification = resultContainer.notification();
@ -1078,7 +1087,7 @@ public class SctpChannelImpl extends SctpChannel
/* Native */ /* Native */
private static native void initIDs(); private static native void initIDs();
static native int receive0(int fd, SctpResultContainer resultContainer, static native int receive0(int fd, ResultContainer resultContainer,
long address, int length, boolean peek) throws IOException; long address, int length, boolean peek) throws IOException;
static native int send0(int fd, long address, int length, static native int send0(int fd, long address, int length,

View File

@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
package sun.nio.ch; package sun.nio.ch.sctp;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.SocketAddress; import java.net.SocketAddress;
@ -53,8 +53,17 @@ import com.sun.nio.sctp.MessageInfo;
import com.sun.nio.sctp.SctpChannel; import com.sun.nio.sctp.SctpChannel;
import com.sun.nio.sctp.SctpMultiChannel; import com.sun.nio.sctp.SctpMultiChannel;
import com.sun.nio.sctp.SctpSocketOption; import com.sun.nio.sctp.SctpSocketOption;
import sun.nio.ch.DirectBuffer;
import sun.nio.ch.NativeThread;
import sun.nio.ch.IOStatus;
import sun.nio.ch.IOUtil;
import sun.nio.ch.Net;
import sun.nio.ch.PollArrayWrapper;
import sun.nio.ch.SelChImpl;
import sun.nio.ch.SelectionKeyImpl;
import sun.nio.ch.Util;
import static com.sun.nio.sctp.SctpStandardSocketOptions.*; import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
import static sun.nio.ch.SctpResultContainer.*; import static sun.nio.ch.sctp.ResultContainer.*;
/** /**
* An implementation of SctpMultiChannel * An implementation of SctpMultiChannel
@ -466,7 +475,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel
receiveInvoked.set(Boolean.TRUE); receiveInvoked.set(Boolean.TRUE);
try { try {
SctpResultContainer resultContainer = new SctpResultContainer(); ResultContainer resultContainer = new ResultContainer();
do { do {
resultContainer.clear(); resultContainer.clear();
synchronized (receiveLock) { synchronized (receiveLock) {
@ -498,7 +507,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel
/* message or nothing */ /* message or nothing */
if (resultContainer.hasSomething()) { if (resultContainer.hasSomething()) {
/* Set the association before returning */ /* Set the association before returning */
SctpMessageInfoImpl info = MessageInfoImpl info =
resultContainer.getMessageInfo(); resultContainer.getMessageInfo();
info.setAssociation(lookupAssociation(info. info.setAssociation(lookupAssociation(info.
associationID())); associationID()));
@ -542,7 +551,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel
private int receive(int fd, private int receive(int fd,
ByteBuffer dst, ByteBuffer dst,
SctpResultContainer resultContainer) ResultContainer resultContainer)
throws IOException { throws IOException {
int pos = dst.position(); int pos = dst.position();
int lim = dst.limit(); int lim = dst.limit();
@ -566,7 +575,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel
} }
private int receiveIntoNativeBuffer(int fd, private int receiveIntoNativeBuffer(int fd,
SctpResultContainer resultContainer, ResultContainer resultContainer,
ByteBuffer bb, ByteBuffer bb,
int rem, int rem,
int pos) int pos)
@ -580,7 +589,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel
private InternalNotificationHandler internalNotificationHandler = private InternalNotificationHandler internalNotificationHandler =
new InternalNotificationHandler(); new InternalNotificationHandler();
private void handleNotificationInternal(SctpResultContainer resultContainer) private void handleNotificationInternal(ResultContainer resultContainer)
{ {
invokeNotificationHandler(resultContainer, invokeNotificationHandler(resultContainer,
internalNotificationHandler, null); internalNotificationHandler, null);
@ -592,12 +601,12 @@ public class SctpMultiChannelImpl extends SctpMultiChannel
@Override @Override
public HandlerResult handleNotification( public HandlerResult handleNotification(
AssociationChangeNotification not, Object unused) { AssociationChangeNotification not, Object unused) {
SctpAssocChange sac = (SctpAssocChange) not; AssociationChange sac = (AssociationChange) not;
/* Update map to reflect change in association */ /* Update map to reflect change in association */
switch (not.event()) { switch (not.event()) {
case COMM_UP : case COMM_UP :
Association newAssociation = new SctpAssociationImpl Association newAssociation = new AssociationImpl
(sac.assocId(), sac.maxInStreams(), sac.maxOutStreams()); (sac.assocId(), sac.maxInStreams(), sac.maxOutStreams());
addAssociation(newAssociation); addAssociation(newAssociation);
break; break;
@ -612,7 +621,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel
} }
private <T> HandlerResult invokeNotificationHandler( private <T> HandlerResult invokeNotificationHandler(
SctpResultContainer resultContainer, ResultContainer resultContainer,
NotificationHandler<T> handler, NotificationHandler<T> handler,
T attachment) { T attachment) {
HandlerResult result; HandlerResult result;
@ -956,7 +965,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel
/* Use common native implementation shared between /* Use common native implementation shared between
* one-to-one and one-to-many */ * one-to-one and one-to-many */
private static int receive0(int fd, private static int receive0(int fd,
SctpResultContainer resultContainer, ResultContainer resultContainer,
long address, long address,
int length) int length)
throws IOException{ throws IOException{

View File

@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
package sun.nio.ch; package sun.nio.ch.sctp;
import java.io.FileDescriptor; import java.io.FileDescriptor;
import java.io.IOException; import java.io.IOException;
@ -34,6 +34,8 @@ import java.util.Set;
import java.util.HashSet; import java.util.HashSet;
import java.security.AccessController; import java.security.AccessController;
import sun.security.action.GetPropertyAction; import sun.security.action.GetPropertyAction;
import sun.nio.ch.IOUtil;
import sun.nio.ch.Net;
import com.sun.nio.sctp.SctpSocketOption; import com.sun.nio.sctp.SctpSocketOption;
import static com.sun.nio.sctp.SctpStandardSocketOptions.*; import static com.sun.nio.sctp.SctpStandardSocketOptions.*;

View File

@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
package sun.nio.ch; package sun.nio.ch.sctp;
import com.sun.nio.sctp.Association; import com.sun.nio.sctp.Association;
import com.sun.nio.sctp.Notification; import com.sun.nio.sctp.Notification;

View File

@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
package sun.nio.ch; package sun.nio.ch.sctp;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
@ -41,6 +41,15 @@ import com.sun.nio.sctp.SctpChannel;
import com.sun.nio.sctp.SctpServerChannel; import com.sun.nio.sctp.SctpServerChannel;
import com.sun.nio.sctp.SctpSocketOption; import com.sun.nio.sctp.SctpSocketOption;
import com.sun.nio.sctp.SctpStandardSocketOptions; import com.sun.nio.sctp.SctpStandardSocketOptions;
import sun.nio.ch.DirectBuffer;
import sun.nio.ch.NativeThread;
import sun.nio.ch.IOStatus;
import sun.nio.ch.IOUtil;
import sun.nio.ch.Net;
import sun.nio.ch.PollArrayWrapper;
import sun.nio.ch.SelChImpl;
import sun.nio.ch.SelectionKeyImpl;
import sun.nio.ch.Util;
/** /**
* An implementation of SctpServerChannel * An implementation of SctpServerChannel

View File

@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
package sun.nio.ch; package sun.nio.ch.sctp;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.net.SocketAddress; import java.net.SocketAddress;
@ -32,7 +32,7 @@ import com.sun.nio.sctp.SendFailedNotification;
/** /**
* An implementation of SendFailedNotification * An implementation of SendFailedNotification
*/ */
public class SctpSendFailed extends SendFailedNotification public class SendFailed extends SendFailedNotification
implements SctpNotification implements SctpNotification
{ {
private Association association; private Association association;
@ -45,7 +45,7 @@ public class SctpSendFailed extends SendFailedNotification
private int streamNumber; private int streamNumber;
/* Invoked from native */ /* Invoked from native */
private SctpSendFailed(int assocId, private SendFailed(int assocId,
SocketAddress address, SocketAddress address,
ByteBuffer buffer, ByteBuffer buffer,
int errorCode, int errorCode,

View File

@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
package sun.nio.ch; package sun.nio.ch.sctp;
import com.sun.nio.sctp.Association; import com.sun.nio.sctp.Association;
import com.sun.nio.sctp.ShutdownNotification; import com.sun.nio.sctp.ShutdownNotification;
@ -30,7 +30,7 @@ import com.sun.nio.sctp.ShutdownNotification;
/** /**
* An implementation of ShutdownNotification * An implementation of ShutdownNotification
*/ */
public class SctpShutdown extends ShutdownNotification public class Shutdown extends ShutdownNotification
implements SctpNotification implements SctpNotification
{ {
private Association association; private Association association;
@ -39,7 +39,7 @@ public class SctpShutdown extends ShutdownNotification
private int assocId; private int assocId;
/* Invoked from native */ /* Invoked from native */
private SctpShutdown(int assocId) { private Shutdown(int assocId) {
this.assocId = assocId; this.assocId = assocId;
} }

View File

@ -1,153 +0,0 @@
." Copyright (c) 2004, 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.
."
." 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.
."
.TH apt 1 "10 May 2011"
.LP
.SH "NAME"
.LP
.LP
\f2apt\fP \- annotation processing tool
.LP
.SH "SYNOPSIS"
.LP
.LP
\f2apt [\-classpath \fP\f2classpath\fP] [\-sourcepath \f2sourcepath\fP] [\-d \f2directory\fP] [\-s \f2directory\fP] [\-factorypath \f2path\fP] [\-factory \f2class\fP] [\-print] [\-nocompile] [\-A\f2key\fP[\f2=val\fP] ...] [\f2javac option\fP] sourcefiles [@files]
.LP
.SH "PARAMETERS"
.LP
.LP
Options may be in any order. For a discussion of parameters which apply to a specific option, see OPTIONS below.
.LP
.RS 3
.TP 3
sourcefiles
Zero or more source files to be processed.
.TP 3
@files
One or more files that list source files or other options
.RE
.LP
.SH "DESCRIPTION"
.LP
.LP
\f3Note\fP: The \f2apt\fP tool and its associated API contained in the package \f2com.sun.mirror\fP have been deprecated since JDK 7 and are planned to be removed in the next major JDK release. Use the options available in the \f2javac(1)\fP tool and the APIs contained in the packages \f2javax.annotation.processing\fP and \f2javax.lang.model\fP to process annotations.
.LP
.LP
The tool \f2apt\fP, annotation processing tool, includes reflective APIs and supporting infrastructure to process program annotations. The \f2apt\fP reflective APIs provide a build\-time, source\-based, read\-only view of program structure. These reflective APIs are designed to cleanly model the Java(TM) programming language's type system after the addition of generics. First, \f2apt\fP runs annotation processors that can produce new source code and other files. Next, \f2apt\fP can cause compilation of both original and generated source files, easing development. The reflective APIs and other APIs used to interact with the tool are subpackages of \f2com.sun.mirror\fP.
.LP
.LP
A fuller discussion of how the tool operates as well as instructions for developing with \f2apt\fP are in
.na
\f4Getting Started with \fP\f4apt\fP. @
.fi
http://download.oracle.com/javase/7/docs/technotes/guides/apt/GettingStarted.html
.LP
.SH "OPTIONS"
.LP
.SS
apt specific options
.LP
.RS 3
.TP 3
\-s dir
Specify the directory root under which processor\-generated source files will be placed; files are placed in subdirectories based on package namespace.
.TP 3
\-nocompile
Do not compile source files to class files.
.TP 3
\-print
Print out textual representation of specified types; perform no annotation processing or compilation.
.TP 3
\-A[key[=val]]
Options to pass to annotation processors \-\- these are not interpreted by \f2apt\fP directly, but are made available for use by individual processors
.TP 3
\-factorypath path
Specify where to find annotation processor factories; if this option is used, the classpath is \f2not\fP searched for factories.
.TP 3
\-factory classname
Name of annotation processor factory to use; bypasses default discovery process
.TP 3
\-version
Print version information.
.TP 3
\-X
Display information about non\-standard options.
.RE
.LP
.SS
Options shared with javac
.LP
.RS 3
.TP 3
\-d dir
Specify where to place processor and javac generated class files
.TP 3
\-cp path or \-classpath path
Specify where to find user class files and annotation processor factories. If \f2\-factorypath\fP is given, the classpath is not searched for factories.
.RE
.LP
.LP
Consult the javac(1) man page for information on \f2javac\fP options.
.LP
.SS
Non\-Standard Options
.LP
.RS 3
.TP 3
\-XListAnnotationTypes
List found annotation types.
.TP 3
\-XListDeclarations
List specified and included declarations.
.TP 3
\-XPrintAptRounds
Print information about initial and recursive \f2apt\fP rounds.
.TP 3
\-XPrintFactoryInfo
Print information about which annotations a factory is asked to process.
.TP 3
\-XclassesAsDecls
Treat both class and source files as declarations to process.
.RE
.LP
.LP
\f3Note\fP: Because these options are non\-standard, they are subject to change without notice.
.LP
.SH "NOTES"
.LP
.LP
The \f2apt\fP tool and its associated API contained in the package \f2com.sun.mirror\fP have been deprecated since JDK 7 and are planned to be removed in the next major JDK release. Use the options available in the \f2javac(1)\fP tool and the APIs contained in the packages \f2javax.annotation.processing\fP and \f2javax.lang.model\fP to process annotations.
.LP
.SH "SEE ALSO"
.LP
.RS 3
.TP 2
o
javac(1), java(1)
.RE
.LP

View File

@ -1,153 +0,0 @@
." Copyright (c) 2004, 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.
."
." 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.
."
.TH apt 1 "07 May 2011"
.LP
.SH "NAME"
.LP
.LP
\f2apt\fP \- 注釈処理ツール
.LP
.SH "形式"
.LP
.LP
\f2apt [\-classpath \fP\f2classpath\fP] [\-sourcepath \f2sourcepath\fP] [\-d \f2directory\fP] [\-s \f2directory\fP] [\-factorypath \f2path\fP] [\-factory \f2class\fP] [\-print] [\-nocompile] [\-A\f2key\fP[\f2=val\fP] ...] [\f2javac option\fP] sourcefiles [@files]
.LP
.SH "パラメータ"
.LP
.LP
オプションの指定順序に決まりはありません。特定のオプションに適用されるパラメータについては、下記の「オプション」を参照してください。
.LP
.RS 3
.TP 3
sourcefiles
ゼロ、1 つ、または複数の処理対象のソースファイル
.TP 3
@files
ソースファイルまたは他のオプションを一覧表示する 1 つまたは複数のファイル
.RE
.LP
.SH "説明"
.LP
.LP
\f3\fP: \f2apt\fP ツールと、パッケージ \f2com.sun.mirror\fP に含まれているそれに関連した API は、JDK 7 以降非推奨になっており、JDK の次のメジャーリリースで削除される予定です。\f2javac(1)\fP ツールで利用可能なオプションと、パッケージ \f2javax.annotation.processing\fP および \f2javax.lang.model\fP に含まれている API を使用して、注釈を処理してください。
.LP
.LP
注釈処理ツール \f2apt\fP は、リフレクト API とサポートインフラストラクチャーから構成され、プログラム注釈を処理します。\f2apt\fP リフレクト API は、 構築時のソースベースで、プログラム構造に関する読み取り専用ビューを提供します。これらのリフレクト API は、総称を追加した後に、Java(TM) プログラミング言語の型システムを正しくモデル化するように設計されています。最初に、\f2apt\fP は、新しいソースコードと他のファイルを作成する注釈プロセッサを実行します。次に、\f2apt\fP は、元のソースファイルと生成したソースファイルの両方をコンパイルするため、開発が楽になります。ツールとのインタフェースに使用されるリフレクト API などの API は、\f2com.sun.mirror\fP のサブパッケージです。
.LP
.LP
ツールの機能に関する詳細と、\f2apt\fP を使用した開発方法については、
.na
\f4「apt 入門」\fP @
.fi
http://java.sun.com/javase/6/docs/technotes/guides/apt/GettingStarted.htmlを参照してください。
.LP
.SH "オプション"
.LP
.SS
apt 固有のオプション
.LP
.RS 3
.TP 3
\-s dir
プロセッサの生成するソースファイルを置くディレクトリルートを指定します。 ファイルは、パッケージの名前空間に基づいてサブディレクトリに置かれます。
.TP 3
\-nocompile
ソースファイルをクラスファイルにコンパイルしません。
.TP 3
\-print
指定したタイプのテキスト表現を出力します。 注釈処理またはコンパイルは行いません。
.TP 3
\-A[key[=val]]
注釈プロセッサへ渡すオプションです。 このオプションは、\f2apt\fP が直接解釈するのではなく、それぞれのプロセッサによって使用できるように変えられます。
.TP 3
\-factorypath path
注釈プロセッサファクトリを検索する場所を指定します。 このオプションを使用する場合、クラスパスのファクトリは検索されません。
.TP 3
\-factory classname
使用する注釈プロセッサファクトリの名前です。 デフォルトの検出プロセスを省略します。
.TP 3
\-version
バージョン情報を出力します。
.TP 3
\-X
非標準オプションに関する情報を表示します。
.RE
.LP
.SS
javac と共用するオプション
.LP
.RS 3
.TP 3
\-d dir
プロセッサと javac 生成のクラスファイルを置く場所を指定します。
.TP 3
\-cp path または \-classpath path
ユーザークラスファイルと注釈プロセッサファクトリを検索する場所を指定します。\f2\-factorypath\fP が指定されている場合、クラスパスのファクトリは検索されません。
.RE
.LP
.LP
\f2javac\fP オプションの詳細については、javac(1) のマニュアルページを参照してください。
.LP
.SS
非標準オプション
.LP
.RS 3
.TP 3
\-XListAnnotationTypes
注釈の型に検出されるリスト.
.TP 3
\-XListDeclarations
指定および宣言がインクルードされるリスト.
.TP 3
\-XPrintAptRounds
初期および再帰的な \f2apt\fP ラウンドに関する情報を出力する.
.TP 3
\-XPrintFactoryInfo
処理を要求するファクトリの注釈に関する情報を出力する.
.TP 3
\-XclassesAsDecls
クラスファイルとソースファイルの両方を、処理対象の宣言として処理します。
.RE
.LP
.LP
\f3\fP: これらは非標準オプションなので、予告なく変更される可能性があります。
.LP
.SH "注"
.LP
.LP
\f2apt\fP ツールと、パッケージ \f2com.sun.mirror\fP に含まれているそれに関連した API は、JDK 7 以降非推奨になっており、JDK の次のメジャーリリースで削除される予定です。\f2javac(1)\fP ツールで利用可能なオプションと、パッケージ \f2javax.annotation.processing\fP および \f2javax.lang.model\fP に含まれている API を使用して、注釈を処理してください。
.LP
.SH "関連項目"
.LP
.RS 3
.TP 2
o
javac(1), java(1)
.RE
.LP

View File

@ -32,21 +32,21 @@
#include "nio.h" #include "nio.h"
#include "net_util.h" #include "net_util.h"
#include "net_util_md.h" #include "net_util_md.h"
#include "sun_nio_ch_SctpNet.h" #include "sun_nio_ch_sctp_SctpNet.h"
#include "sun_nio_ch_SctpChannelImpl.h" #include "sun_nio_ch_sctp_SctpChannelImpl.h"
#include "sun_nio_ch_SctpAssocChange.h" #include "sun_nio_ch_sctp_AssociationChange.h"
#include "sun_nio_ch_SctpResultContainer.h" #include "sun_nio_ch_sctp_ResultContainer.h"
#include "sun_nio_ch_SctpPeerAddrChange.h" #include "sun_nio_ch_sctp_PeerAddrChange.h"
/* sizeof(union sctp_notification */ /* sizeof(union sctp_notification */
#define NOTIFICATION_BUFFER_SIZE 280 #define NOTIFICATION_BUFFER_SIZE 280
#define MESSAGE_IMPL_CLASS "sun/nio/ch/SctpMessageInfoImpl" #define MESSAGE_IMPL_CLASS "sun/nio/ch/sctp/MessageInfoImpl"
#define RESULT_CONTAINER_CLASS "sun/nio/ch/SctpResultContainer" #define RESULT_CONTAINER_CLASS "sun/nio/ch/sctp/ResultContainer"
#define SEND_FAILED_CLASS "sun/nio/ch/SctpSendFailed" #define SEND_FAILED_CLASS "sun/nio/ch/sctp/SendFailed"
#define ASSOC_CHANGE_CLASS "sun/nio/ch/SctpAssocChange" #define ASSOC_CHANGE_CLASS "sun/nio/ch/sctp/AssociationChange"
#define PEER_CHANGE_CLASS "sun/nio/ch/SctpPeerAddrChange" #define PEER_CHANGE_CLASS "sun/nio/ch/sctp/PeerAddrChange"
#define SHUTDOWN_CLASS "sun/nio/ch/SctpShutdown" #define SHUTDOWN_CLASS "sun/nio/ch/sctp/Shutdown"
struct controlData { struct controlData {
int assocId; int assocId;
@ -55,38 +55,40 @@ struct controlData {
unsigned int ppid; unsigned int ppid;
}; };
static jclass smi_class; /* sun.nio.ch.SctpMessageInfoImpl */ static jclass smi_class; /* sun.nio.ch.sctp.MessageInfoImpl */
static jmethodID smi_ctrID; /* sun.nio.ch.SctpMessageInfoImpl.<init> */ static jmethodID smi_ctrID; /* sun.nio.ch.sctp.MessageInfoImpl.<init> */
static jfieldID src_valueID; /* sun.nio.ch.SctpResultContainer.value */ static jfieldID src_valueID; /* sun.nio.ch.sctp.ResultContainer.value */
static jfieldID src_typeID; /* sun.nio.ch.SctpResultContainer.type */ static jfieldID src_typeID; /* sun.nio.ch.sctp.ResultContainer.type */
static jclass ssf_class; /* sun.nio.ch.SctpSendFailed */ static jclass ssf_class; /* sun.nio.ch.sctp.SendFailed */
static jmethodID ssf_ctrID; /* sun.nio.ch.SctpSendFailed.<init> */ static jmethodID ssf_ctrID; /* sun.nio.ch.sctp.SendFailed.<init> */
static jclass sac_class; /* sun.nio.ch.SctpAssociationChanged */ static jclass sac_class; /* sun.nio.ch.sctp.AssociationChange */
static jmethodID sac_ctrID; /* sun.nio.ch.SctpAssociationChanged.<init> */ static jmethodID sac_ctrID; /* sun.nio.ch.sctp.AssociationChange.<init> */
static jclass spc_class; /* sun.nio.ch.SctpPeerAddressChanged */ static jclass spc_class; /* sun.nio.ch.sctp.PeerAddressChanged */
static jmethodID spc_ctrID; /* sun.nio.ch.SctpPeerAddressChanged.<init> */ static jmethodID spc_ctrID; /* sun.nio.ch.sctp.PeerAddressChanged.<init> */
static jclass ss_class; /* sun.nio.ch.SctpShutdown */ static jclass ss_class; /* sun.nio.ch.sctp.Shutdown */
static jmethodID ss_ctrID; /* sun.nio.ch.SctpShutdown.<init> */ static jmethodID ss_ctrID; /* sun.nio.ch.sctp.Shutdown.<init> */
static jfieldID isa_addrID; /* java.net.InetSocketAddress.addr */ static jfieldID isa_addrID; /* java.net.InetSocketAddress.addr */
static jfieldID isa_portID; /* java.net.InetSocketAddress.port */ static jfieldID isa_portID; /* java.net.InetSocketAddress.port */
/* defined in SctpNet.c */ /* defined in SctpNet.c */
jobject SockAddrToInetSocketAddress(JNIEnv* env, struct sockaddr* addr); jobject SockAddrToInetSocketAddress(JNIEnv* env, struct sockaddr* addr);
jint handleSocketError(JNIEnv *env, jint errorValue);
/* use SocketChannelImpl's checkConnect implementation */ /* use SocketChannelImpl's checkConnect implementation */
extern jint Java_sun_nio_ch_SocketChannelImpl_checkConnect(JNIEnv* env, extern jint Java_sun_nio_ch_SocketChannelImpl_checkConnect(JNIEnv* env,
jobject this, jobject fdo, jboolean block, jboolean ready); jobject this, jobject fdo, jboolean block, jboolean ready);
/* /*
* Class: sun_nio_ch_SctpChannelImpl * Class: sun_nio_ch_sctp_SctpChannelImpl
* Method: initIDs * Method: initIDs
* Signature: ()V * Signature: ()V
*/ */
JNIEXPORT void JNICALL Java_sun_nio_ch_SctpChannelImpl_initIDs JNIEXPORT void JNICALL Java_sun_nio_ch_sctp_SctpChannelImpl_initIDs
(JNIEnv *env, jclass klass) { (JNIEnv *env, jclass klass) {
jclass cls; jclass cls;
/* SctpMessageInfoImpl */ /* MessageInfoImpl */
cls = (*env)->FindClass(env, MESSAGE_IMPL_CLASS); cls = (*env)->FindClass(env, MESSAGE_IMPL_CLASS);
CHECK_NULL(cls); CHECK_NULL(cls);
smi_class = (*env)->NewGlobalRef(env, cls); smi_class = (*env)->NewGlobalRef(env, cls);
@ -95,7 +97,7 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpChannelImpl_initIDs
"(ILjava/net/SocketAddress;IIZZI)V"); "(ILjava/net/SocketAddress;IIZZI)V");
CHECK_NULL(smi_ctrID); CHECK_NULL(smi_ctrID);
/* SctpResultContainer */ /* ResultContainer */
cls = (*env)->FindClass(env, RESULT_CONTAINER_CLASS); cls = (*env)->FindClass(env, RESULT_CONTAINER_CLASS);
CHECK_NULL(cls); CHECK_NULL(cls);
src_valueID = (*env)->GetFieldID(env, cls, "value", "Ljava/lang/Object;"); src_valueID = (*env)->GetFieldID(env, cls, "value", "Ljava/lang/Object;");
@ -103,7 +105,7 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpChannelImpl_initIDs
src_typeID = (*env)->GetFieldID(env, cls, "type", "I"); src_typeID = (*env)->GetFieldID(env, cls, "type", "I");
CHECK_NULL(src_typeID); CHECK_NULL(src_typeID);
/* SctpSendFailed */ /* SendFailed */
cls = (*env)->FindClass(env, SEND_FAILED_CLASS); cls = (*env)->FindClass(env, SEND_FAILED_CLASS);
CHECK_NULL(cls); CHECK_NULL(cls);
ssf_class = (*env)->NewGlobalRef(env, cls); ssf_class = (*env)->NewGlobalRef(env, cls);
@ -112,7 +114,7 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpChannelImpl_initIDs
"(ILjava/net/SocketAddress;Ljava/nio/ByteBuffer;II)V"); "(ILjava/net/SocketAddress;Ljava/nio/ByteBuffer;II)V");
CHECK_NULL(ssf_ctrID); CHECK_NULL(ssf_ctrID);
/* SctpAssocChange */ /* AssociationChange */
cls = (*env)->FindClass(env, ASSOC_CHANGE_CLASS); cls = (*env)->FindClass(env, ASSOC_CHANGE_CLASS);
CHECK_NULL(cls); CHECK_NULL(cls);
sac_class = (*env)->NewGlobalRef(env, cls); sac_class = (*env)->NewGlobalRef(env, cls);
@ -120,7 +122,7 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpChannelImpl_initIDs
sac_ctrID = (*env)->GetMethodID(env, cls, "<init>", "(IIII)V"); sac_ctrID = (*env)->GetMethodID(env, cls, "<init>", "(IIII)V");
CHECK_NULL(sac_ctrID); CHECK_NULL(sac_ctrID);
/* SctpPeerAddrChange */ /* PeerAddrChange */
cls = (*env)->FindClass(env, PEER_CHANGE_CLASS); cls = (*env)->FindClass(env, PEER_CHANGE_CLASS);
CHECK_NULL(cls); CHECK_NULL(cls);
spc_class = (*env)->NewGlobalRef(env, cls); spc_class = (*env)->NewGlobalRef(env, cls);
@ -129,7 +131,7 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpChannelImpl_initIDs
"(ILjava/net/SocketAddress;I)V"); "(ILjava/net/SocketAddress;I)V");
CHECK_NULL(spc_ctrID); CHECK_NULL(spc_ctrID);
/* sun.nio.ch.SctpShutdown */ /* Shutdown */
cls = (*env)->FindClass(env, SHUTDOWN_CLASS); cls = (*env)->FindClass(env, SHUTDOWN_CLASS);
CHECK_NULL(cls); CHECK_NULL(cls);
ss_class = (*env)->NewGlobalRef(env, cls); ss_class = (*env)->NewGlobalRef(env, cls);
@ -266,13 +268,13 @@ void handleSendFailed
} }
} }
/* create SctpSendFailed */ /* create SendFailed */
resultObj = (*env)->NewObject(env, ssf_class, ssf_ctrID, ssf->ssf_assoc_id, resultObj = (*env)->NewObject(env, ssf_class, ssf_ctrID, ssf->ssf_assoc_id,
isaObj, bufferObj, ssf->ssf_error, sri->sinfo_stream); isaObj, bufferObj, ssf->ssf_error, sri->sinfo_stream);
CHECK_NULL(resultObj); CHECK_NULL(resultObj);
(*env)->SetObjectField(env, resultContainerObj, src_valueID, resultObj); (*env)->SetObjectField(env, resultContainerObj, src_valueID, resultObj);
(*env)->SetIntField(env, resultContainerObj, src_typeID, (*env)->SetIntField(env, resultContainerObj, src_typeID,
sun_nio_ch_SctpResultContainer_SEND_FAILED); sun_nio_ch_sctp_ResultContainer_SEND_FAILED);
} }
void handleAssocChange void handleAssocChange
@ -282,38 +284,38 @@ void handleAssocChange
switch (sac->sac_state) { switch (sac->sac_state) {
case SCTP_COMM_UP : case SCTP_COMM_UP :
state = sun_nio_ch_SctpAssocChange_SCTP_COMM_UP; state = sun_nio_ch_sctp_AssociationChange_SCTP_COMM_UP;
break; break;
case SCTP_COMM_LOST : case SCTP_COMM_LOST :
state = sun_nio_ch_SctpAssocChange_SCTP_COMM_LOST; state = sun_nio_ch_sctp_AssociationChange_SCTP_COMM_LOST;
break; break;
case SCTP_RESTART : case SCTP_RESTART :
state = sun_nio_ch_SctpAssocChange_SCTP_RESTART; state = sun_nio_ch_sctp_AssociationChange_SCTP_RESTART;
break; break;
case SCTP_SHUTDOWN_COMP : case SCTP_SHUTDOWN_COMP :
state = sun_nio_ch_SctpAssocChange_SCTP_SHUTDOWN; state = sun_nio_ch_sctp_AssociationChange_SCTP_SHUTDOWN;
break; break;
case SCTP_CANT_STR_ASSOC : case SCTP_CANT_STR_ASSOC :
state = sun_nio_ch_SctpAssocChange_SCTP_CANT_START; state = sun_nio_ch_sctp_AssociationChange_SCTP_CANT_START;
} }
/* create SctpAssociationChanged */ /* create AssociationChange */
resultObj = (*env)->NewObject(env, sac_class, sac_ctrID, sac->sac_assoc_id, resultObj = (*env)->NewObject(env, sac_class, sac_ctrID, sac->sac_assoc_id,
state, sac->sac_outbound_streams, sac->sac_inbound_streams); state, sac->sac_outbound_streams, sac->sac_inbound_streams);
CHECK_NULL(resultObj); CHECK_NULL(resultObj);
(*env)->SetObjectField(env, resultContainerObj, src_valueID, resultObj); (*env)->SetObjectField(env, resultContainerObj, src_valueID, resultObj);
(*env)->SetIntField(env, resultContainerObj, src_typeID, (*env)->SetIntField(env, resultContainerObj, src_typeID,
sun_nio_ch_SctpResultContainer_ASSOCIATION_CHANGED); sun_nio_ch_sctp_ResultContainer_ASSOCIATION_CHANGED);
} }
void handleShutdown void handleShutdown
(JNIEnv* env, jobject resultContainerObj, struct sctp_shutdown_event* sse) { (JNIEnv* env, jobject resultContainerObj, struct sctp_shutdown_event* sse) {
/* create SctpShutdown */ /* create Shutdown */
jobject resultObj = (*env)->NewObject(env, ss_class, ss_ctrID, sse->sse_assoc_id); jobject resultObj = (*env)->NewObject(env, ss_class, ss_ctrID, sse->sse_assoc_id);
CHECK_NULL(resultObj); CHECK_NULL(resultObj);
(*env)->SetObjectField(env, resultContainerObj, src_valueID, resultObj); (*env)->SetObjectField(env, resultContainerObj, src_valueID, resultObj);
(*env)->SetIntField(env, resultContainerObj, src_typeID, (*env)->SetIntField(env, resultContainerObj, src_typeID,
sun_nio_ch_SctpResultContainer_SHUTDOWN); sun_nio_ch_sctp_ResultContainer_SHUTDOWN);
} }
void handlePeerAddrChange void handlePeerAddrChange
@ -324,35 +326,35 @@ void handlePeerAddrChange
switch (state) { switch (state) {
case SCTP_ADDR_AVAILABLE : case SCTP_ADDR_AVAILABLE :
event = sun_nio_ch_SctpPeerAddrChange_SCTP_ADDR_AVAILABLE; event = sun_nio_ch_sctp_PeerAddrChange_SCTP_ADDR_AVAILABLE;
break; break;
case SCTP_ADDR_UNREACHABLE : case SCTP_ADDR_UNREACHABLE :
event = sun_nio_ch_SctpPeerAddrChange_SCTP_ADDR_UNREACHABLE; event = sun_nio_ch_sctp_PeerAddrChange_SCTP_ADDR_UNREACHABLE;
break; break;
case SCTP_ADDR_REMOVED : case SCTP_ADDR_REMOVED :
event = sun_nio_ch_SctpPeerAddrChange_SCTP_ADDR_REMOVED; event = sun_nio_ch_sctp_PeerAddrChange_SCTP_ADDR_REMOVED;
break; break;
case SCTP_ADDR_ADDED : case SCTP_ADDR_ADDED :
event = sun_nio_ch_SctpPeerAddrChange_SCTP_ADDR_ADDED; event = sun_nio_ch_sctp_PeerAddrChange_SCTP_ADDR_ADDED;
break; break;
case SCTP_ADDR_MADE_PRIM : case SCTP_ADDR_MADE_PRIM :
event = sun_nio_ch_SctpPeerAddrChange_SCTP_ADDR_MADE_PRIM; event = sun_nio_ch_sctp_PeerAddrChange_SCTP_ADDR_MADE_PRIM;
#ifdef __linux__ /* Solaris currently doesn't support SCTP_ADDR_CONFIRMED */ #ifdef __linux__ /* Solaris currently doesn't support SCTP_ADDR_CONFIRMED */
break; break;
case SCTP_ADDR_CONFIRMED : case SCTP_ADDR_CONFIRMED :
event = sun_nio_ch_SctpPeerAddrChange_SCTP_ADDR_CONFIRMED; event = sun_nio_ch_sctp_PeerAddrChange_SCTP_ADDR_CONFIRMED;
#endif /* __linux__ */ #endif /* __linux__ */
} }
addressObj = SockAddrToInetSocketAddress(env, (struct sockaddr*)&spc->spc_aaddr); addressObj = SockAddrToInetSocketAddress(env, (struct sockaddr*)&spc->spc_aaddr);
/* create SctpPeerAddressChanged */ /* create PeerAddressChanged */
resultObj = (*env)->NewObject(env, spc_class, spc_ctrID, spc->spc_assoc_id, resultObj = (*env)->NewObject(env, spc_class, spc_ctrID, spc->spc_assoc_id,
addressObj, event); addressObj, event);
CHECK_NULL(resultObj); CHECK_NULL(resultObj);
(*env)->SetObjectField(env, resultContainerObj, src_valueID, resultObj); (*env)->SetObjectField(env, resultContainerObj, src_valueID, resultObj);
(*env)->SetIntField(env, resultContainerObj, src_typeID, (*env)->SetIntField(env, resultContainerObj, src_typeID,
sun_nio_ch_SctpResultContainer_PEER_ADDRESS_CHANGED); sun_nio_ch_sctp_ResultContainer_PEER_ADDRESS_CHANGED);
} }
void handleUninteresting void handleUninteresting
@ -403,7 +405,7 @@ void handleMessage
isa = SockAddrToInetSocketAddress(env, sap); isa = SockAddrToInetSocketAddress(env, sap);
getControlData(msg, cdata); getControlData(msg, cdata);
/* create SctpMessageInfoImpl */ /* create MessageInfoImpl */
resultObj = (*env)->NewObject(env, smi_class, smi_ctrID, cdata->assocId, resultObj = (*env)->NewObject(env, smi_class, smi_ctrID, cdata->assocId,
isa, read, cdata->streamNumber, isa, read, cdata->streamNumber,
isEOR ? JNI_TRUE : JNI_FALSE, isEOR ? JNI_TRUE : JNI_FALSE,
@ -411,15 +413,15 @@ void handleMessage
CHECK_NULL(resultObj); CHECK_NULL(resultObj);
(*env)->SetObjectField(env, resultContainerObj, src_valueID, resultObj); (*env)->SetObjectField(env, resultContainerObj, src_valueID, resultObj);
(*env)->SetIntField(env, resultContainerObj, src_typeID, (*env)->SetIntField(env, resultContainerObj, src_typeID,
sun_nio_ch_SctpResultContainer_MESSAGE); sun_nio_ch_sctp_ResultContainer_MESSAGE);
} }
/* /*
* Class: sun_nio_ch_SctpChannelImpl * Class: sun_nio_ch_sctp_SctpChannelImpl
* Method: receive0 * Method: receive0
* Signature: (ILsun/nio/ch/SctpResultContainer;JIZ)I * Signature: (ILsun/nio/ch/sctp/ResultContainer;JIZ)I
*/ */
JNIEXPORT jint JNICALL Java_sun_nio_ch_SctpChannelImpl_receive0 JNIEXPORT jint JNICALL Java_sun_nio_ch_sctp_SctpChannelImpl_receive0
(JNIEnv *env, jclass klass, jint fd, jobject resultContainerObj, (JNIEnv *env, jclass klass, jint fd, jobject resultContainerObj,
jlong address, jint length, jboolean peek) { jlong address, jint length, jboolean peek) {
SOCKADDR sa; SOCKADDR sa;
@ -505,11 +507,11 @@ JNIEXPORT jint JNICALL Java_sun_nio_ch_SctpChannelImpl_receive0
} }
/* /*
* Class: sun_nio_ch_SctpChannelImpl * Class: sun_nio_ch_sctp_SctpChannelImpl
* Method: send0 * Method: send0
* Signature: (IJILjava/net/SocketAddress;IIZI)I * Signature: (IJILjava/net/SocketAddress;IIZI)I
*/ */
JNIEXPORT jint JNICALL Java_sun_nio_ch_SctpChannelImpl_send0 JNIEXPORT jint JNICALL Java_sun_nio_ch_sctp_SctpChannelImpl_send0
(JNIEnv *env, jclass klass, jint fd, jlong address, jint length, (JNIEnv *env, jclass klass, jint fd, jlong address, jint length,
jobject saTarget, jint assocId, jint streamNumber, jboolean unordered, jobject saTarget, jint assocId, jint streamNumber, jboolean unordered,
jint ppid) { jint ppid) {
@ -582,11 +584,11 @@ JNIEXPORT jint JNICALL Java_sun_nio_ch_SctpChannelImpl_send0
} }
/* /*
* Class: sun_nio_ch_SctpChannelImpl * Class: sun_nio_ch_sctp_SctpChannelImpl
* Method: checkConnect * Method: checkConnect
* Signature: (Ljava/io/FileDescriptor;ZZ)I * Signature: (Ljava/io/FileDescriptor;ZZ)I
*/ */
JNIEXPORT jint JNICALL Java_sun_nio_ch_SctpChannelImpl_checkConnect JNIEXPORT jint JNICALL Java_sun_nio_ch_sctp_SctpChannelImpl_checkConnect
(JNIEnv* env, jobject this, jobject fdo, jboolean block, jboolean ready) { (JNIEnv* env, jobject this, jobject fdo, jboolean block, jboolean ready) {
return Java_sun_nio_ch_SocketChannelImpl_checkConnect(env, this, return Java_sun_nio_ch_SocketChannelImpl_checkConnect(env, this,
fdo, block, ready); fdo, block, ready);

View File

@ -34,8 +34,8 @@
#include "nio.h" #include "nio.h"
#include "net_util.h" #include "net_util.h"
#include "net_util_md.h" #include "net_util_md.h"
#include "sun_nio_ch_SctpNet.h" #include "sun_nio_ch_sctp_SctpNet.h"
#include "sun_nio_ch_SctpStdSocketOption.h" #include "sun_nio_ch_sctp_SctpStdSocketOption.h"
static jclass isaCls = 0; static jclass isaCls = 0;
static jmethodID isaCtrID = 0; static jmethodID isaCtrID = 0;
@ -143,12 +143,12 @@ handleSocketError(JNIEnv *env, jint errorValue)
} }
/* /*
* Class: sun_nio_ch_SctpNet * Class: sun_nio_ch_sctp_SctpNet
* Method: init * Method: init
* Signature: ()V * Signature: ()V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_sun_nio_ch_SctpNet_init Java_sun_nio_ch_sctp_SctpNet_init
(JNIEnv *env, jclass cl) { (JNIEnv *env, jclass cl) {
int sp[2]; int sp[2];
if (socketpair(PF_UNIX, SOCK_STREAM, 0, sp) < 0) { if (socketpair(PF_UNIX, SOCK_STREAM, 0, sp) < 0) {
@ -160,11 +160,11 @@ Java_sun_nio_ch_SctpNet_init
} }
/* /*
* Class: sun_nio_ch_SctpNet * Class: sun_nio_ch_sctp_SctpNet
* Method: socket0 * Method: socket0
* Signature: (Z)I * Signature: (Z)I
*/ */
JNIEXPORT jint JNICALL Java_sun_nio_ch_SctpNet_socket0 JNIEXPORT jint JNICALL Java_sun_nio_ch_sctp_SctpNet_socket0
(JNIEnv *env, jclass klass, jboolean oneToOne) { (JNIEnv *env, jclass klass, jboolean oneToOne) {
int fd; int fd;
struct sctp_event_subscribe event; struct sctp_event_subscribe event;
@ -202,11 +202,11 @@ JNIEXPORT jint JNICALL Java_sun_nio_ch_SctpNet_socket0
} }
/* /*
* Class: sun_nio_ch_SctpNet * Class: sun_nio_ch_sctp_SctpNet
* Method: bindx * Method: bindx
* Signature: (I[Ljava/net/InetAddress;IIZ)V * Signature: (I[Ljava/net/InetAddress;IIZ)V
*/ */
JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_bindx JNIEXPORT void JNICALL Java_sun_nio_ch_sctp_SctpNet_bindx
(JNIEnv *env, jclass klass, jint fd, jobjectArray addrs, jint port, (JNIEnv *env, jclass klass, jint fd, jobjectArray addrs, jint port,
jint addrsLength, jboolean add, jboolean preferIPv6) { jint addrsLength, jboolean add, jboolean preferIPv6) {
SOCKADDR *sap, *tmpSap; SOCKADDR *sap, *tmpSap;
@ -241,24 +241,24 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_bindx
} }
/* /*
* Class: sun_nio_ch_SctpNet * Class: sun_nio_ch_sctp_SctpNet
* Method: listen0 * Method: listen0
* Signature: (II)V * Signature: (II)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_sun_nio_ch_SctpNet_listen0 Java_sun_nio_ch_sctp_SctpNet_listen0
(JNIEnv *env, jclass cl, jint fd, jint backlog) { (JNIEnv *env, jclass cl, jint fd, jint backlog) {
if (listen(fd, backlog) < 0) if (listen(fd, backlog) < 0)
handleSocketError(env, errno); handleSocketError(env, errno);
} }
/* /*
* Class: sun_nio_ch_SctpNet * Class: sun_nio_ch_sctp_SctpNet
* Method: connect0 * Method: connect0
* Signature: (ILjava/net/InetAddress;I)I * Signature: (ILjava/net/InetAddress;I)I
*/ */
JNIEXPORT jint JNICALL JNIEXPORT jint JNICALL
Java_sun_nio_ch_SctpNet_connect0 Java_sun_nio_ch_sctp_SctpNet_connect0
(JNIEnv *env, jclass clazz, int fd, jobject iao, jint port) { (JNIEnv *env, jclass clazz, int fd, jobject iao, jint port) {
SOCKADDR sa; SOCKADDR sa;
int sa_len = SOCKADDR_LEN; int sa_len = SOCKADDR_LEN;
@ -282,12 +282,12 @@ Java_sun_nio_ch_SctpNet_connect0
} }
/* /*
* Class: sun_nio_ch_SctpNet * Class: sun_nio_ch_sctp_SctpNet
* Method: close0 * Method: close0
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_sun_nio_ch_SctpNet_close0 Java_sun_nio_ch_sctp_SctpNet_close0
(JNIEnv *env, jclass clazz, jint fd) { (JNIEnv *env, jclass clazz, jint fd) {
if (fd != -1) { if (fd != -1) {
int rv = close(fd); int rv = close(fd);
@ -297,12 +297,12 @@ Java_sun_nio_ch_SctpNet_close0
} }
/* /*
* Class: sun_nio_ch_SctpNet * Class: sun_nio_ch_sctp_SctpNet
* Method: preClose0 * Method: preClose0
* Signature: (I)V * Signature: (I)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_sun_nio_ch_SctpNet_preClose0 Java_sun_nio_ch_sctp_SctpNet_preClose0
(JNIEnv *env, jclass clazz, jint fd) { (JNIEnv *env, jclass clazz, jint fd) {
if (preCloseFD >= 0) { if (preCloseFD >= 0) {
if (dup2(preCloseFD, fd) < 0) if (dup2(preCloseFD, fd) < 0)
@ -340,11 +340,11 @@ jobject SockAddrToInetSocketAddress
} }
/* /*
* Class: sun_nio_ch_SctpNet * Class: sun_nio_ch_sctp_SctpNet
* Method: getLocalAddresses0 * Method: getLocalAddresses0
* Signature: (I)[Ljava/net/SocketAddress; * Signature: (I)[Ljava/net/SocketAddress;
*/ */
JNIEXPORT jobjectArray JNICALL Java_sun_nio_ch_SctpNet_getLocalAddresses0 JNIEXPORT jobjectArray JNICALL Java_sun_nio_ch_sctp_SctpNet_getLocalAddresses0
(JNIEnv *env, jclass klass, jint fd) { (JNIEnv *env, jclass klass, jint fd) {
void *addr_buf, *laddr; void *addr_buf, *laddr;
struct sockaddr* sap; struct sockaddr* sap;
@ -448,11 +448,11 @@ jobjectArray getRemoteAddresses
} }
/* /*
* Class: sun_nio_ch_SctpNet * Class: sun_nio_ch_sctp_SctpNet
* Method: getRemoteAddresses0 * Method: getRemoteAddresses0
* Signature: (II)[Ljava/net/SocketAddress; * Signature: (II)[Ljava/net/SocketAddress;
*/ */
JNIEXPORT jobjectArray JNICALL Java_sun_nio_ch_SctpNet_getRemoteAddresses0 JNIEXPORT jobjectArray JNICALL Java_sun_nio_ch_sctp_SctpNet_getRemoteAddresses0
(JNIEnv *env, jclass klass, jint fd, jint assocId) { (JNIEnv *env, jclass klass, jint fd, jint assocId) {
return getRemoteAddresses(env, fd, assocId); return getRemoteAddresses(env, fd, assocId);
} }
@ -465,13 +465,13 @@ int mapSocketOption
int level; int level;
int optname; int optname;
} const opts[] = { } const opts[] = {
{ sun_nio_ch_SctpStdSocketOption_SCTP_DISABLE_FRAGMENTS, IPPROTO_SCTP, SCTP_DISABLE_FRAGMENTS }, { sun_nio_ch_sctp_SctpStdSocketOption_SCTP_DISABLE_FRAGMENTS, IPPROTO_SCTP, SCTP_DISABLE_FRAGMENTS },
{ sun_nio_ch_SctpStdSocketOption_SCTP_EXPLICIT_COMPLETE, IPPROTO_SCTP, SCTP_EXPLICIT_EOR }, { sun_nio_ch_sctp_SctpStdSocketOption_SCTP_EXPLICIT_COMPLETE, IPPROTO_SCTP, SCTP_EXPLICIT_EOR },
{ sun_nio_ch_SctpStdSocketOption_SCTP_FRAGMENT_INTERLEAVE, IPPROTO_SCTP, SCTP_FRAGMENT_INTERLEAVE }, { sun_nio_ch_sctp_SctpStdSocketOption_SCTP_FRAGMENT_INTERLEAVE, IPPROTO_SCTP, SCTP_FRAGMENT_INTERLEAVE },
{ sun_nio_ch_SctpStdSocketOption_SCTP_NODELAY, IPPROTO_SCTP, SCTP_NODELAY }, { sun_nio_ch_sctp_SctpStdSocketOption_SCTP_NODELAY, IPPROTO_SCTP, SCTP_NODELAY },
{ sun_nio_ch_SctpStdSocketOption_SO_SNDBUF, SOL_SOCKET, SO_SNDBUF }, { sun_nio_ch_sctp_SctpStdSocketOption_SO_SNDBUF, SOL_SOCKET, SO_SNDBUF },
{ sun_nio_ch_SctpStdSocketOption_SO_RCVBUF, SOL_SOCKET, SO_RCVBUF }, { sun_nio_ch_sctp_SctpStdSocketOption_SO_RCVBUF, SOL_SOCKET, SO_RCVBUF },
{ sun_nio_ch_SctpStdSocketOption_SO_LINGER, SOL_SOCKET, SO_LINGER } }; { sun_nio_ch_sctp_SctpStdSocketOption_SO_LINGER, SOL_SOCKET, SO_LINGER } };
int i; int i;
for (i=0; i<(int)(sizeof(opts) / sizeof(opts[0])); i++) { for (i=0; i<(int)(sizeof(opts) / sizeof(opts[0])); i++) {
@ -487,11 +487,11 @@ int mapSocketOption
} }
/* /*
* Class: sun_nio_ch_SctpNet * Class: sun_nio_ch_sctp_SctpNet
* Method: setIntOption0 * Method: setIntOption0
* Signature: (III)V * Signature: (III)V
*/ */
JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_setIntOption0 JNIEXPORT void JNICALL Java_sun_nio_ch_sctp_SctpNet_setIntOption0
(JNIEnv *env, jclass klass, jint fd, jint opt, int arg) { (JNIEnv *env, jclass klass, jint fd, jint opt, int arg) {
int klevel, kopt; int klevel, kopt;
int result; int result;
@ -505,7 +505,7 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_setIntOption0
return; return;
} }
if (opt == sun_nio_ch_SctpStdSocketOption_SO_LINGER) { if (opt == sun_nio_ch_sctp_SctpStdSocketOption_SO_LINGER) {
parg = (void *)&linger; parg = (void *)&linger;
arglen = sizeof(linger); arglen = sizeof(linger);
if (arg >= 0) { if (arg >= 0) {
@ -522,16 +522,16 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_setIntOption0
if (NET_SetSockOpt(fd, klevel, kopt, parg, arglen) < 0) { if (NET_SetSockOpt(fd, klevel, kopt, parg, arglen) < 0) {
JNU_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", JNU_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
"sun_nio_ch_SctpNet.setIntOption0"); "sun_nio_ch_sctp_SctpNet.setIntOption0");
} }
} }
/* /*
* Class: sun_nio_ch_SctpNet * Class: sun_nio_ch_sctp_SctpNet
* Method: getIntOption0 * Method: getIntOption0
* Signature: (II)I * Signature: (II)I
*/ */
JNIEXPORT int JNICALL Java_sun_nio_ch_SctpNet_getIntOption0 JNIEXPORT int JNICALL Java_sun_nio_ch_sctp_SctpNet_getIntOption0
(JNIEnv *env, jclass klass, jint fd, jint opt) { (JNIEnv *env, jclass klass, jint fd, jint opt) {
int klevel, kopt; int klevel, kopt;
int result; int result;
@ -545,7 +545,7 @@ JNIEXPORT int JNICALL Java_sun_nio_ch_SctpNet_getIntOption0
return -1; return -1;
} }
if (opt == sun_nio_ch_SctpStdSocketOption_SO_LINGER) { if (opt == sun_nio_ch_sctp_SctpStdSocketOption_SO_LINGER) {
arg = (void *)&linger; arg = (void *)&linger;
arglen = sizeof(linger); arglen = sizeof(linger);
} else { } else {
@ -559,18 +559,18 @@ JNIEXPORT int JNICALL Java_sun_nio_ch_SctpNet_getIntOption0
return -1; return -1;
} }
if (opt == sun_nio_ch_SctpStdSocketOption_SO_LINGER) if (opt == sun_nio_ch_sctp_SctpStdSocketOption_SO_LINGER)
return linger.l_onoff ? linger.l_linger : -1; return linger.l_onoff ? linger.l_linger : -1;
else else
return result; return result;
} }
/* /*
* Class: sun_nio_ch_SctpNet * Class: sun_nio_ch_sctp_SctpNet
* Method: getPrimAddrOption0 * Method: getPrimAddrOption0
* Signature: (II)Ljava/net/SocketAddress; * Signature: (II)Ljava/net/SocketAddress;
*/ */
JNIEXPORT jobject JNICALL Java_sun_nio_ch_SctpNet_getPrimAddrOption0 JNIEXPORT jobject JNICALL Java_sun_nio_ch_sctp_SctpNet_getPrimAddrOption0
(JNIEnv *env, jclass klass, jint fd, jint assocId) { (JNIEnv *env, jclass klass, jint fd, jint assocId) {
struct sctp_setprim prim; struct sctp_setprim prim;
unsigned int prim_len = sizeof(prim); unsigned int prim_len = sizeof(prim);
@ -588,11 +588,11 @@ JNIEXPORT jobject JNICALL Java_sun_nio_ch_SctpNet_getPrimAddrOption0
} }
/* /*
* Class: sun_nio_ch_SctpNet * Class: sun_nio_ch_sctp_SctpNet
* Method: setPrimAddrOption0 * Method: setPrimAddrOption0
* Signature: (IILjava/net/InetAddress;I)V * Signature: (IILjava/net/InetAddress;I)V
*/ */
JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_setPrimAddrOption0 JNIEXPORT void JNICALL Java_sun_nio_ch_sctp_SctpNet_setPrimAddrOption0
(JNIEnv *env, jclass klass, jint fd, jint assocId, jobject iaObj, jint port) { (JNIEnv *env, jclass klass, jint fd, jint assocId, jobject iaObj, jint port) {
struct sctp_setprim prim; struct sctp_setprim prim;
struct sockaddr* sap = (struct sockaddr*)&prim.ssp_addr; struct sockaddr* sap = (struct sockaddr*)&prim.ssp_addr;
@ -612,11 +612,11 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_setPrimAddrOption0
} }
/* /*
* Class: sun_nio_ch_SctpNet * Class: sun_nio_ch_sctp_SctpNet
* Method: setPeerPrimAddrOption0 * Method: setPeerPrimAddrOption0
* Signature: (IILjava/net/InetAddress;I)V * Signature: (IILjava/net/InetAddress;I)V
*/ */
JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_setPeerPrimAddrOption0 JNIEXPORT void JNICALL Java_sun_nio_ch_sctp_SctpNet_setPeerPrimAddrOption0
(JNIEnv *env, jclass klass, jint fd, jint assocId, (JNIEnv *env, jclass klass, jint fd, jint assocId,
jobject iaObj, jint port, jboolean preferIPv6) { jobject iaObj, jint port, jboolean preferIPv6) {
struct sctp_setpeerprim prim; struct sctp_setpeerprim prim;
@ -638,11 +638,11 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_setPeerPrimAddrOption0
} }
/* /*
* Class: sun_nio_ch_SctpNet * Class: sun_nio_ch_sctp_SctpNet
* Method: getInitMsgOption0 * Method: getInitMsgOption0
* Signature: (I[I)V * Signature: (I[I)V
*/ */
JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_getInitMsgOption0 JNIEXPORT void JNICALL Java_sun_nio_ch_sctp_SctpNet_getInitMsgOption0
(JNIEnv *env, jclass klass, jint fd, jintArray retVal) { (JNIEnv *env, jclass klass, jint fd, jintArray retVal) {
struct sctp_initmsg sctp_initmsg; struct sctp_initmsg sctp_initmsg;
unsigned int sim_len = sizeof(sctp_initmsg); unsigned int sim_len = sizeof(sctp_initmsg);
@ -661,11 +661,11 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_getInitMsgOption0
} }
/* /*
* Class: sun_nio_ch_SctpNet * Class: sun_nio_ch_sctp_SctpNet
* Method: setInitMsgOption0 * Method: setInitMsgOption0
* Signature: (III)V * Signature: (III)V
*/ */
JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_setInitMsgOption0 JNIEXPORT void JNICALL Java_sun_nio_ch_sctp_SctpNet_setInitMsgOption0
(JNIEnv *env, jclass klass, jint fd, jint inArg, jint outArg) { (JNIEnv *env, jclass klass, jint fd, jint inArg, jint outArg) {
struct sctp_initmsg sctp_initmsg; struct sctp_initmsg sctp_initmsg;
@ -682,11 +682,11 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_setInitMsgOption0
} }
/* /*
* Class: sun_nio_ch_SctpNet * Class: sun_nio_ch_sctp_SctpNet
* Method: shutdown0 * Method: shutdown0
* Signature: (II)V * Signature: (II)V
*/ */
JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_shutdown0 JNIEXPORT void JNICALL Java_sun_nio_ch_sctp_SctpNet_shutdown0
(JNIEnv *env, jclass klass, jint fd, jint assocId) { (JNIEnv *env, jclass klass, jint fd, jint assocId) {
int rv; int rv;
struct msghdr msg[1]; struct msghdr msg[1];
@ -738,11 +738,11 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_shutdown0
} }
/* /*
* Class: sun_nio_ch_SctpNet * Class: sun_nio_ch_sctp_SctpNet
* Method: branch * Method: branch
* Signature: (II)I * Signature: (II)I
*/ */
JNIEXPORT int JNICALL Java_sun_nio_ch_SctpNet_branch0 JNIEXPORT int JNICALL Java_sun_nio_ch_sctp_SctpNet_branch0
(JNIEnv *env, jclass klass, jint fd, jint assocId) { (JNIEnv *env, jclass klass, jint fd, jint assocId) {
int newfd = 0; int newfd = 0;
if ((newfd = nio_sctp_peeloff(fd, assocId)) < 0) { if ((newfd = nio_sctp_peeloff(fd, assocId)) < 0) {

View File

@ -23,7 +23,7 @@
* questions. * questions.
*/ */
#include "sun_nio_ch_SctpServerChannelImpl.h" #include "sun_nio_ch_sctp_SctpServerChannelImpl.h"
extern void Java_sun_nio_ch_ServerSocketChannelImpl_initIDs(JNIEnv* env, extern void Java_sun_nio_ch_ServerSocketChannelImpl_initIDs(JNIEnv* env,
jclass c); jclass c);
@ -32,21 +32,21 @@ extern jint Java_sun_nio_ch_ServerSocketChannelImpl_accept0(JNIEnv* env,
jobject this, jobject ssfdo, jobject newfdo, jobjectArray isaa); jobject this, jobject ssfdo, jobject newfdo, jobjectArray isaa);
/* /*
* Class: sun_nio_ch_SctpServerChannelImpl * Class: sun_nio_ch_sctp_SctpServerChannelImpl
* Method: initIDs * Method: initIDs
* Signature: ()V * Signature: ()V
*/ */
JNIEXPORT void JNICALL Java_sun_nio_ch_SctpServerChannelImpl_initIDs JNIEXPORT void JNICALL Java_sun_nio_ch_sctp_SctpServerChannelImpl_initIDs
(JNIEnv* env, jclass c) { (JNIEnv* env, jclass c) {
Java_sun_nio_ch_ServerSocketChannelImpl_initIDs(env, c); Java_sun_nio_ch_ServerSocketChannelImpl_initIDs(env, c);
} }
/* /*
* Class: sun_nio_ch_SctpServerChannelImpl * Class: sun_nio_ch_sctp_SctpServerChannelImpl
* Method: accept0 * Method: accept0
* Signature: (Ljava/io/FileDescriptor;Ljava/io/FileDescriptor;[Ljava/net/InetSocketAddress;)I * Signature: (Ljava/io/FileDescriptor;Ljava/io/FileDescriptor;[Ljava/net/InetSocketAddress;)I
*/ */
JNIEXPORT jint JNICALL Java_sun_nio_ch_SctpServerChannelImpl_accept0 JNIEXPORT jint JNICALL Java_sun_nio_ch_sctp_SctpServerChannelImpl_accept0
(JNIEnv* env, jobject this, jobject ssfdo, jobject newfdo, jobjectArray isaa) { (JNIEnv* env, jobject this, jobject ssfdo, jobject newfdo, jobjectArray isaa) {
return Java_sun_nio_ch_ServerSocketChannelImpl_accept0(env, this, return Java_sun_nio_ch_ServerSocketChannelImpl_accept0(env, this,
ssfdo, newfdo, isaa); ssfdo, newfdo, isaa);

View File

@ -605,9 +605,12 @@ Java_sun_nio_fs_UnixNativeDispatcher_closedir(JNIEnv* env, jclass this, jlong di
JNIEXPORT jbyteArray JNICALL JNIEXPORT jbyteArray JNICALL
Java_sun_nio_fs_UnixNativeDispatcher_readdir(JNIEnv* env, jclass this, jlong value) { Java_sun_nio_fs_UnixNativeDispatcher_readdir(JNIEnv* env, jclass this, jlong value) {
char entry[sizeof(struct dirent64) + PATH_MAX + 1];
struct dirent64* ptr = (struct dirent64*)&entry;
struct dirent64* result; struct dirent64* result;
struct {
struct dirent64 buf;
char name_extra[PATH_MAX + 1 - sizeof result->d_name];
} entry;
struct dirent64* ptr = &entry.buf;
int res; int res;
DIR* dirp = jlong_to_ptr(value); DIR* dirp = jlong_to_ptr(value);

View File

@ -585,7 +585,7 @@ final class WindowsSelectorImpl extends SelectorImpl {
((SelChImpl)selch).kill(); ((SelChImpl)selch).kill();
} }
void putEventOps(SelectionKeyImpl sk, int ops) { public void putEventOps(SelectionKeyImpl sk, int ops) {
synchronized (closeLock) { synchronized (closeLock) {
if (pollWrapper == null) if (pollWrapper == null)
throw new ClosedSelectorException(); throw new ClosedSelectorException();

View File

@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
package sun.nio.ch; package sun.nio.ch.sctp;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.net.InetAddress; import java.net.InetAddress;

View File

@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
package sun.nio.ch; package sun.nio.ch.sctp;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.net.InetAddress; import java.net.InetAddress;

View File

@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
package sun.nio.ch; package sun.nio.ch.sctp;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.net.InetAddress; import java.net.InetAddress;

View File

@ -517,14 +517,14 @@ jdk_nio1: $(call TestDirs, java/nio/file)
JDK_ALL_TARGETS += jdk_nio2 JDK_ALL_TARGETS += jdk_nio2
JDK_DEFAULT_TARGETS += jdk_nio2 JDK_DEFAULT_TARGETS += jdk_nio2
jdk_nio2: $(call TestDirs, java/nio/Buffer java/nio/ByteOrder \ jdk_nio2: $(call TestDirs, java/nio/Buffer java/nio/ByteOrder \
java/nio/channels java/nio/MappedByteBuffer) java/nio/channels java/nio/MappedByteBuffer sun/nio/ch)
$(call SharedLibraryPermissions,java/nio/channels) $(call SharedLibraryPermissions,java/nio/channels)
$(call RunAgentvmBatch) $(call RunAgentvmBatch)
# Stable agentvm testruns (minus items from PROBLEM_LIST) # Stable agentvm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_nio3 JDK_ALL_TARGETS += jdk_nio3
JDK_DEFAULT_TARGETS += jdk_nio3 JDK_DEFAULT_TARGETS += jdk_nio3
jdk_nio3: $(call TestDirs, sun/nio) jdk_nio3: $(call TestDirs, java/nio/charset sun/nio/cs)
$(call RunAgentvmBatch) $(call RunAgentvmBatch)
# All nio tests # All nio tests

View File

@ -211,78 +211,9 @@ java/lang/management/MemoryMXBean/CollectionUsageThreshold.java generic-all
# jdk_management # jdk_management
# Failing, bug was filed: 6959636 # 7073626
javax/management/loading/LibraryLoader/LibraryLoaderTest.java generic-all sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh windows-all
sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh windows-all
# Access denied messages on windows/mks, filed 6954450
sun/management/jmxremote/bootstrap/RmiSslNoKeyStoreTest.sh windows-all
# Fails on linux: KO: StringMonitor notification missed or not emitted
javax/management/monitor/NonComparableAttributeValueTest.java generic-all
# Port conflict? Fails with communication error
sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.sh generic-all
# Fails on Windows 2000, Test failed for iiop java.lang.NullPointerException
# at org.omg.stub.javax.management.remote.rmi._RMIConnectionImpl_Tie._invoke(Unknown Source)
# at com.sun.corba.se.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:653)
javax/management/remote/mandatory/connection/ReconnectTest.java generic-all
# Solaris 10 sparc, NPE from org.omg.stub.javax.management.remote.rmi._RMIConnectionImpl_Tie._invoke
javax/management/remote/mandatory/threads/ExecutorTest.java generic-all
# Linux 32bit Fedora 9, IllegalStateException
javax/management/monitor/RuntimeExceptionTest.java generic-all
# Problems with rmi connection, othervm
javax/management/remote/mandatory/subjectDelegation/SubjectDelegation2Test.java generic-all
# Fails with port already in use
sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.sh generic-all
# Fails with port already in use
sun/management/jmxremote/bootstrap/RmiRegistrySslTest.sh generic-all
# Windows, connection can't last that long
javax/management/eventService/LeaseTest.java generic-all
# Linux othervm, X64, java.lang.Exception: Failed: ratio=102.4027795593753
javax/management/remote/mandatory/notif/ListenerScaleTest.java generic-all
# Windows run seems to have triggered a hotspot gc error (see 6801625)
com/sun/management/HotSpotDiagnosticMXBean/DumpHeap.sh generic-all
# rmi problem? othervm, java.lang.reflect.UndeclaredThrowableException
javax/management/remote/mandatory/subjectDelegation/SubjectDelegation3Test.java generic-all
# Linux Fedora 9 32bit NPE in rmi server somehere??? othervm
javax/management/remote/mandatory/notif/NotificationBufferDeadlockTest.java generic-all
# Times out on solaris sparc, with othervm
javax/management/eventService/AddRemoveListenerTest.java generic-all
# Linux i586 and x64 -server, timed out waiting for threads to expire? othervm
javax/management/eventService/EventClientThreadTest.java generic-all
# Linux i586 -server, Expected to receive 20, but got 21, othervm
# Fails on Linux X64 -server 20!=21
javax/management/eventService/FetchingTest.java generic-all
# NPE on windows 2000 i586 -client and -server
javax/management/eventService/CustomForwarderTest.java windows-all
# Windows i586 failure, callback did not complete
javax/management/eventService/LeaseManagerDeadlockTest.java windows-all
# Port already in use
sun/management/jmxremote/bootstrap/LocalManagementTest.sh generic-all
# Failed to initialize connector (also overflowing jtreg io buffers)
sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh generic-all
sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh generic-all
# Windows X64, java.lang.IllegalStateException
javax/management/monitor/AttributeArbitraryDataTypeTest.java generic-all
############################################################################ ############################################################################
@ -410,71 +341,11 @@ java/nio/channels/FileChannel/ReleaseOnCloseDeadlock.java windows-all
# jdk_rmi # jdk_rmi
# Port already in use, fails on sparc, othervm # 7140992
java/rmi/reliability/benchmark/runRmiBench.sh generic-all
# Already in use port issues? othervm solaris
java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java generic-all
java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java generic-all
java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java generic-all
java/rmi/transport/dgcDeadLock/TestImpl_Stub.java generic-all
# Address already in use, othervm mode, solaris
java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java generic-all
java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java generic-all
# Registry already running on port, solaris
java/rmi/Naming/legalRegistryNames/LegalRegistryNames.java generic-all
# Fails on Linux 32 and 64bit -server?, impl not garbage collected???
java/rmi/transport/pinLastArguments/PinLastArguments.java generic-all
# Times out on solaris sparc
java/rmi/server/RemoteServer/AddrInUse.java generic-all
# Connection error on Windows i586 -server
# Also connection errors in othervm on Solaris 10 sparc, same port???
sun/rmi/transport/tcp/DeadCachedConnection.java generic-all
# Connection errors in othervm on Solaris 10 sparc, same port???
java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java generic-all
java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java generic-all
java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java generic-all
java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java generic-all
java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java generic-all
java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java generic-all
java/rmi/activation/Activatable/extLoadedImpl/ext.sh generic-all
java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java generic-all
java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java generic-all
java/rmi/activation/Activatable/nestedActivate/NestedActivate.java generic-all
java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java generic-all
java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java generic-all
java/rmi/activation/Activatable/shutdownGracefully/ShutdownGracefully.java generic-all
java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java generic-all
java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java generic-all
java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java generic-all
java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java generic-all
java/rmi/reliability/juicer/AppleUserImpl.java generic-all
java/rmi/server/RMISocketFactory/useSocketFactory/unicast/UseCustomSocketFactory.java generic-all
java/rmi/server/UnicastRemoteObject/keepAliveDuringCall/KeepAliveDuringCall.java generic-all
java/rmi/transport/handshakeTimeout/HandshakeTimeout.java generic-all
java/rmi/activation/Activatable/restartService/RestartService.java generic-all
java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java generic-all
java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java generic-all
java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java generic-all
java/rmi/activation/CommandEnvironment/SetChildEnv.java generic-all
java/rmi/registry/classPathCodebase/ClassPathCodebase.java generic-all
java/rmi/registry/reexport/Reexport.java generic-all
java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java generic-all java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java generic-all
java/rmi/server/Unreferenced/leaseCheckInterval/LeaseCheckInterval.java generic-all
java/rmi/server/Unreferenced/unreferencedContext/UnreferencedContext.java generic-all # 6948101
java/rmi/server/useCustomRef/UseCustomRef.java generic-all java/rmi/transport/pinLastArguments/PinLastArguments.java generic-all
java/rmi/transport/checkFQDN/CheckFQDN.java generic-all
java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java generic-all
java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java generic-all
java/rmi/server/RMISocketFactory/useSocketFactory/registry/UseCustomSocketFactory.java generic-all
java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java generic-all
# 7132247 # 7132247
java/rmi/registry/readTest/readTest.sh windows-all java/rmi/registry/readTest/readTest.sh windows-all
@ -557,6 +428,9 @@ java/text/Bidi/Bug6665028.java linux-x64
# jdk_tools # jdk_tools
# 6461635
com/sun/tools/attach/BasicTests.sh generic-all
# Filed 6952105 # Filed 6952105
com/sun/jdi/SuspendThreadTest.java generic-all com/sun/jdi/SuspendThreadTest.java generic-all
@ -572,15 +446,16 @@ com/sun/jdi/FieldWatchpoints.java generic-all
# Filed 6402201 # Filed 6402201
com/sun/jdi/ProcessAttachTest.sh generic-all com/sun/jdi/ProcessAttachTest.sh generic-all
# Filed 6986875
sun/tools/jps/jps-Vvml.sh generic-all
# Filed 6979016 # Filed 6979016
sun/tools/jconsole/ResourceCheckTest.sh generic-all sun/tools/jconsole/ResourceCheckTest.sh generic-all
# 7132203 # 7132203
sun/jvmstat/monitor/MonitoredVm/CR6672135.java generic-all sun/jvmstat/monitor/MonitoredVm/CR6672135.java generic-all
# Tests take too long
tools/pack200/CommandLineTests.java generic-all
tools/pack200/Pack200Test.java generic-all
############################################################################ ############################################################################
# jdk_util # jdk_util
@ -588,11 +463,6 @@ sun/jvmstat/monitor/MonitoredVm/CR6672135.java generic-all
# Filed 6933803 # Filed 6933803
java/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java generic-all java/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java generic-all
# Filed 7022325
# Fails with assertion error on windows
# 11 separate stacktraces created... file reuse problem?
java/util/zip/ZipFile/ReadLongZipFileName.java generic-all
# Filed 6772009 # Filed 6772009
java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java generic-all java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java generic-all

View File

@ -4,3 +4,9 @@
# The list of keywords supported in the entire test suite # The list of keywords supported in the entire test suite
keys=2d dnd i18n keys=2d dnd i18n
# Tests that must run in othervm mode
othervm.dirs=java/rmi sun/rmi javax/management
# Tests that cannot run concurrently
exclusiveAccess.dirs=java/rmi sun/rmi sun/management/jmxremote sun/tools/jstatd

View File

@ -1,64 +0,0 @@
/*
* Copyright (c) 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.
*
* 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.
*/
/*
* @test
* @bug 7104647
* @summary Basic Test for HotSpotDiagnosticMXBean.execute()
* @author Frederic Parain
*
* @run main ExecuteDiagnosticCommand
*/
import com.sun.management.HotSpotDiagnosticMXBean;
import com.sun.management.VMOption;
import java.lang.management.ManagementFactory;
import java.util.List;
import javax.management.MBeanServer;
public class ExecuteDiagnosticCommand {
private static String HOTSPOT_DIAGNOSTIC_MXBEAN_NAME =
"com.sun.management:type=HotSpotDiagnostic";
public static void main(String[] args) throws Exception {
HotSpotDiagnosticMXBean mbean =
ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
executeDiagnosticCommand(mbean);
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
mbean = ManagementFactory.newPlatformMXBeanProxy(mbs,
HOTSPOT_DIAGNOSTIC_MXBEAN_NAME,
HotSpotDiagnosticMXBean.class);
executeDiagnosticCommand(mbean);
}
private static void executeDiagnosticCommand(HotSpotDiagnosticMXBean mbean) {
String s = mbean.execute("help help");
System.out.println(s);
s = mbean.execute("help", "help");
System.out.println(s);
String tab[] = { "help"};
s = mbean.execute("help", tab);
System.out.println(s);
}
}

View File

@ -1,117 +0,0 @@
/*
* Copyright (c) 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.
*
* 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.
*/
/*
* @test
* @bug 7104647
* @summary Basic Test for HotSpotDiagnosticMXBean.getDiagnosticCommandInfo()
* @author Frederic Parain
*
* @run main GetDiagnosticCommandInfo
*/
import com.sun.management.HotSpotDiagnosticMXBean;
import com.sun.management.DiagnosticCommandInfo;
import com.sun.management.DiagnosticCommandArgumentInfo;
import com.sun.management.VMOption;
import java.lang.management.ManagementFactory;
import java.util.List;
import javax.management.MBeanServer;
public class GetDiagnosticCommandInfo {
private static String HOTSPOT_DIAGNOSTIC_MXBEAN_NAME =
"com.sun.management:type=HotSpotDiagnostic";
public static void main(String[] args) throws Exception {
HotSpotDiagnosticMXBean mbean =
ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
checkDiagnosticCommandArguments(mbean);
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
mbean = ManagementFactory.newPlatformMXBeanProxy(mbs,
HOTSPOT_DIAGNOSTIC_MXBEAN_NAME,
HotSpotDiagnosticMXBean.class);
checkDiagnosticCommandArguments(mbean);
}
private static void checkDiagnosticCommandArguments(HotSpotDiagnosticMXBean mbean) {
// check getDiagnosticCommandInfo()
StringBuilder sb = new StringBuilder();
List<DiagnosticCommandInfo> infoList = mbean.getDiagnosticCommandInfo();
for(DiagnosticCommandInfo info : infoList) {
printCommandInfo(info,sb);
}
// check getDiagnosticCommandInfo(List<String>)
List<String> commands = mbean.getDiagnosticCommands();
List<DiagnosticCommandInfo> list2 =
mbean.getDiagnosticCommandInfo(commands);
for(DiagnosticCommandInfo info : list2) {
printCommandInfo(info,sb);
}
// check getDiagnosticCommandInfo(String)
for(String cmd : commands) {
DiagnosticCommandInfo info2 = mbean.getDiagnosticCommandInfo(cmd);
printCommandInfo(info2,sb);
}
System.out.println(sb.toString());
}
private static void printCommandInfo(DiagnosticCommandInfo info,
StringBuilder sb) {
sb.append("\t").append(info.getName()).append(":\n");
sb.append("\t\tDescription=").append(info.getDescription()).append("\n");
sb.append("\t\tImpact=").append(info.getImpact()).append("\n");
sb.append("\t\tStatus=");
if (info.isEnabled()) {
sb.append("Enabled\n");
} else {
sb.append("Disbled\n");
}
sb.append("\t\tArguments=");
for(DiagnosticCommandArgumentInfo arg : info.getArgumentsInfo()) {
printArgumentInfo(arg,sb);
}
}
private static void printArgumentInfo(DiagnosticCommandArgumentInfo info,
StringBuilder sb) {
sb.append("\t\t\t").append(info.getName()).append(":\n");
sb.append("\t\t\t\tType=").append(info.getType()).append("\n");
sb.append("\t\t\t\tDescription=").append(info.getDescription()).append("\n");
if(info.getDefault() != null) {
sb.append("\t\t\t\tDefault=").append(info.getDefault()).append("\n");
}
if(info.isMandatory()) {
sb.append("\t\t\t\tMandatory\n");
} else {
sb.append("\t\t\t\tOptional\n");
}
if(info.isOption()) {
sb.append("\t\t\t\tIs an option\n");
} else {
sb.append("\t\t\t\tIs an argument expected at position");
sb.append(info.getPosition());
sb.append("\n");
}
}
}

View File

@ -1,62 +0,0 @@
/*
* Copyright (c) 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.
*
* 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.
*/
/*
* @test
* @bug 7104647
* @summary Basic Test for HotSpotDiagnosticMXBean.getDiagnosticCommands()
* @author Frederic Parain
*
* @run main GetDiagnosticCommands
*/
import com.sun.management.HotSpotDiagnosticMXBean;
import com.sun.management.VMOption;
import java.lang.management.ManagementFactory;
import java.util.List;
import javax.management.MBeanServer;
public class GetDiagnosticCommands {
private static String HOTSPOT_DIAGNOSTIC_MXBEAN_NAME =
"com.sun.management:type=HotSpotDiagnostic";
public static void main(String[] args) throws Exception {
HotSpotDiagnosticMXBean mbean =
ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
checkDiagnosticCommands(mbean);
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
mbean = ManagementFactory.newPlatformMXBeanProxy(mbs,
HOTSPOT_DIAGNOSTIC_MXBEAN_NAME,
HotSpotDiagnosticMXBean.class);
checkDiagnosticCommands(mbean);
}
private static void checkDiagnosticCommands(HotSpotDiagnosticMXBean mbean) {
List<String> commands = mbean.getDiagnosticCommands();
System.out.println("Commands:");
for (String cmd : commands) {
System.out.println(cmd);
}
}
}

View File

@ -25,7 +25,7 @@
* @bug 4313887 6838333 7017446 * @bug 4313887 6838333 7017446
* @summary Unit test for java.nio.file.WatchService * @summary Unit test for java.nio.file.WatchService
* @library .. * @library ..
* @run main/timeout=120 Basic * @run main Basic
*/ */
import java.nio.file.*; import java.nio.file.*;
@ -281,11 +281,11 @@ public class Basic {
System.out.println("poll with timeout..."); System.out.println("poll with timeout...");
try { try {
long start = System.currentTimeMillis(); long start = System.nanoTime();
key = watcher.poll(3000, TimeUnit.MILLISECONDS); key = watcher.poll(3000, TimeUnit.MILLISECONDS);
if (key != null) if (key != null)
throw new RuntimeException("no keys registered"); throw new RuntimeException("no keys registered");
long waited = System.currentTimeMillis() - start; long waited = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
if (waited < 2900) if (waited < 2900)
throw new RuntimeException("poll was too short"); throw new RuntimeException("poll was too short");
} catch (InterruptedException x) { } catch (InterruptedException x) {
@ -358,14 +358,14 @@ public class Basic {
} }
// assume that poll throws exception immediately // assume that poll throws exception immediately
long start = System.currentTimeMillis(); long start = System.nanoTime();
try { try {
watcher.poll(10000, TimeUnit.MILLISECONDS); watcher.poll(10000, TimeUnit.MILLISECONDS);
throw new RuntimeException("ClosedWatchServiceException not thrown"); throw new RuntimeException("ClosedWatchServiceException not thrown");
} catch (InterruptedException x) { } catch (InterruptedException x) {
throw new RuntimeException(x); throw new RuntimeException(x);
} catch (ClosedWatchServiceException x) { } catch (ClosedWatchServiceException x) {
long waited = System.currentTimeMillis() - start; long waited = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
if (waited > 5000) if (waited > 5000)
throw new RuntimeException("poll was too long"); throw new RuntimeException("poll was too long");
} }

View File

@ -23,9 +23,9 @@
/* @test /* @test
* @bug 4313887 * @bug 4313887
* @summary Sanity test for Sun-specific sensitivyt level watch event modifier * @summary Sanity test for Sun-specific sensitivity level watch event modifier
* @library .. * @library ..
* @run main/timeout=330 Basic * @run main/timeout=240 SensitivityModifier
*/ */
import java.nio.file.*; import java.nio.file.*;
@ -96,6 +96,7 @@ public class SensitivityModifier {
// drain events (to avoid interference) // drain events (to avoid interference)
do { do {
key.pollEvents();
key.reset(); key.reset();
key = watcher.poll(1, TimeUnit.SECONDS); key = watcher.poll(1, TimeUnit.SECONDS);
} while (key != null); } while (key != null);

View File

@ -75,10 +75,10 @@ public class BlockingTaskExecutor {
throw new Error("Executor stuck"); throw new Error("Executor stuck");
// Wait for the invocation thread to complete. // Wait for the invocation thread to complete.
thread.join(1000); thread.join(5000);
if (thread.isAlive()) { if (thread.isAlive()) {
thread.interrupt(); thread.interrupt();
thread.join(1000); thread.join(5000);
throw new Error("invokeAll stuck"); throw new Error("invokeAll stuck");
} }
} }

View File

@ -100,8 +100,8 @@ public class Custom {
equal(countExecutorThreads(), threadCount); equal(countExecutorThreads(), threadCount);
equal(CustomTask.births.get(), threadCount); equal(CustomTask.births.get(), threadCount);
tpe.shutdown(); tpe.shutdown();
tpe.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS); tpe.awaitTermination(120, TimeUnit.SECONDS);
Thread.sleep(10); Thread.sleep(1000);
equal(countExecutorThreads(), 0); equal(countExecutorThreads(), 0);
CustomSTPE stpe = new CustomSTPE(); CustomSTPE stpe = new CustomSTPE();
@ -110,8 +110,8 @@ public class Custom {
equal(CustomSTPE.decorations.get(), threadCount); equal(CustomSTPE.decorations.get(), threadCount);
equal(countExecutorThreads(), threadCount); equal(countExecutorThreads(), threadCount);
stpe.shutdown(); stpe.shutdown();
stpe.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS); stpe.awaitTermination(120, TimeUnit.SECONDS);
Thread.sleep(10); Thread.sleep(1000);
equal(countExecutorThreads(), 0); equal(countExecutorThreads(), 0);
System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);

View File

@ -86,7 +86,7 @@ public class FlakyMutex implements Lock {
} catch (Throwable t) { unexpected(t); }}});} } catch (Throwable t) { unexpected(t); }}});}
barrier.await(); barrier.await();
es.shutdown(); es.shutdown();
check(es.awaitTermination(10, TimeUnit.SECONDS)); check(es.awaitTermination(30, TimeUnit.SECONDS));
} }
private static class FlakySync extends AbstractQueuedLongSynchronizer { private static class FlakySync extends AbstractQueuedLongSynchronizer {

View File

@ -0,0 +1,181 @@
/*
* Copyright (c) 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.
*
* 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.
*/
/**
* @test
* @bug 7142509
* @summary Cipher.doFinal(ByteBuffer,ByteBuffer) fails to
* process when in.remaining() == 0
*/
import java.nio.ByteBuffer;
import java.security.SecureRandom;
import java.util.Arrays;
import java.util.Random;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
/*
* Simple test case to show that Cipher.doFinal(ByteBuffer, ByteBuffer) fails to
* process the data internally buffered inBB the cipher when input.remaining()
* == 0 and at least one buffer is a direct buffer.
*/
public class DirectBBRemaining {
private static Random random = new SecureRandom();
private static int testSizes = 40;
private static int outputFrequency = 5;
public static void main(String args[]) throws Exception {
boolean failedOnce = false;
Exception failedReason = null;
byte[] keyBytes = new byte[8];
random.nextBytes(keyBytes);
SecretKey key = new SecretKeySpec(keyBytes, "DES");
Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding", "SunJCE");
cipher.init(Cipher.ENCRYPT_MODE, key);
/*
* Iterate through various sizes to make sure that the code does empty
* blocks, single partial blocks, 1 full block, full + partial blocks,
* multiple full blocks, etc. 5 blocks (using DES) is probably overkill
* but will feel more confident the fix isn't breaking anything.
*/
System.out.println("Output test results for every "
+ outputFrequency + " tests...");
for (int size = 0; size <= testSizes; size++) {
boolean output = (size % outputFrequency) == 0;
if (output) {
System.out.print("\nTesting buffer size: " + size + ":");
}
int outSize = cipher.getOutputSize(size);
try {
encrypt(cipher, size,
ByteBuffer.allocate(size),
ByteBuffer.allocate(outSize),
ByteBuffer.allocateDirect(size),
ByteBuffer.allocateDirect(outSize),
output);
} catch (Exception e) {
System.out.print("\n Failed with size " + size);
failedOnce = true;
failedReason = e;
// If we got an exception, let's be safe for future
// testing and reset the cipher to a known good state.
cipher.init(Cipher.ENCRYPT_MODE, key);
}
}
if (failedOnce) {
throw failedReason;
}
System.out.println("\nTest Passed...");
}
private enum TestVariant {
HEAP_HEAP, HEAP_DIRECT, DIRECT_HEAP, DIRECT_DIRECT
};
private static void encrypt(Cipher cipher, int size,
ByteBuffer heapIn, ByteBuffer heapOut,
ByteBuffer directIn, ByteBuffer directOut,
boolean output) throws Exception {
ByteBuffer inBB = null;
ByteBuffer outBB = null;
// Set up data and encrypt to known/expected values.
byte[] testdata = new byte[size];
random.nextBytes(testdata);
byte[] expected = cipher.doFinal(testdata);
for (TestVariant tv : TestVariant.values()) {
if (output) {
System.out.print(" " + tv);
}
switch (tv) {
case HEAP_HEAP:
inBB = heapIn;
outBB = heapOut;
break;
case HEAP_DIRECT:
inBB = heapIn;
outBB = directOut;
break;
case DIRECT_HEAP:
inBB = directIn;
outBB = heapOut;
break;
case DIRECT_DIRECT:
inBB = directIn;
outBB = directOut;
break;
}
inBB.clear();
outBB.clear();
inBB.put(testdata);
inBB.flip();
// Process all data in one shot, but don't call doFinal() yet.
// May store up to n-1 bytes (w/block size n) internally.
cipher.update(inBB, outBB);
if (inBB.hasRemaining()) {
throw new Exception("buffer not empty");
}
// finish encryption and process all data buffered
cipher.doFinal(inBB, outBB);
outBB.flip();
// validate output size
if (outBB.remaining() != expected.length) {
throw new Exception(
"incomplete encryption output, expected "
+ expected.length + " bytes but was only "
+ outBB.remaining() + " bytes");
}
// validate output data
byte[] encrypted = new byte[outBB.remaining()];
outBB.get(encrypted);
if (!Arrays.equals(expected, encrypted)) {
throw new Exception("bad encryption output");
}
if (!Arrays.equals(cipher.doFinal(), cipher.doFinal())) {
throw new Exception("Internal buffers still held data!");
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More