This commit is contained in:
J. Duke 2017-07-05 20:14:02 +02:00
commit 7a7fbd12e9
98 changed files with 6264 additions and 818 deletions

View File

@ -287,3 +287,4 @@ cf136458ee747e151a27aa9ea0c1492ea55ef3e7 jdk9-b40
f7c11da0b0481d49cc7a65a453336c108191e821 jdk9-b42
02ee8c65622e8bd97496d584e22fc7dcf0edc4ae jdk9-b43
8994f5d87b3bb5e8d317d4e8ccb326da1a73684a jdk9-b44
3dd628fde2086218d548841022ee8436b6b88185 jdk9-b45

View File

@ -54,8 +54,11 @@ ifneq ($(findstring qp,$(MAKEFLAGS)),)
# Duplication of global targets, needed before ParseConfAndSpec in case we have
# no configurations.
help:
# If CONF is not set, look for all available configurations
CONF?=
# If both CONF and SPEC are unset, look for all available configurations by
# setting CONF to the empty string.
ifeq ($(SPEC), )
CONF?=
endif
endif
# ... and then we can include our helper functions

View File

@ -4329,7 +4329,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++"
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
DATE_WHEN_GENERATED=1418395009
DATE_WHEN_GENERATED=1420811523
###############################################################################
#
@ -27408,8 +27408,8 @@ $as_echo "$as_me: Trying to extract Visual Studio environment variables" >&6;}
# The trailing space for everyone except PATH is no typo, but is needed due
# to trailing \ in the Windows paths. These will be stripped later.
$ECHO "$WINPATH_BASH -c 'echo VS_PATH="'\"$PATH\" > set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
$ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
$ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
$ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE\;$include \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
$ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB\;$lib \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
$ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
$ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
$ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE

View File

@ -690,10 +690,15 @@ OS_VERSION_MICRO:=@OS_VERSION_MICRO@
# Images directory definitions
JDK_IMAGE_SUBDIR:=jdk
JRE_IMAGE_SUBDIR:=jre
# Colon left out to be able to override output dir for bootcycle-images
JDK_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JDK_IMAGE_SUBDIR)
JRE_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_IMAGE_SUBDIR)
# Test image, as above
TEST_IMAGE_SUBDIR:=test
TEST_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(TEST_IMAGE_SUBDIR)
# Macosx bundles directory definitions
JDK_BUNDLE_SUBDIR=jdk-bundle/jdk$(JDK_VERSION).jdk/Contents
JRE_BUNDLE_SUBDIR=jre-bundle/jre$(JDK_VERSION).jre/Contents

View File

@ -173,8 +173,8 @@ AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
# The trailing space for everyone except PATH is no typo, but is needed due
# to trailing \ in the Windows paths. These will be stripped later.
$ECHO "$WINPATH_BASH -c 'echo VS_PATH="'\"$PATH\" > set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
$ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
$ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
$ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE\;$include \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
$ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB\;$lib \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
$ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
$ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
$ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE

View File

@ -26,10 +26,8 @@ corba/src/java.corba/share/classes/com/sun/org/omg : corba/src/share/classes/com
corba/src/java.corba/share/classes/com/sun/tools/corba/se/idl : corba/src/share/classes/com/sun/tools/corba/se/idl
corba/src/java.corba/share/classes/javax/activity : corba/src/share/classes/javax/activity
corba/src/java.corba/share/classes/javax/rmi : corba/src/share/classes/javax/rmi
corba/src/java.corba/share/classes/javax/transaction : corba/src/share/classes/javax/transaction
corba/src/java.corba/share/classes/org/omg : corba/src/share/classes/org/omg
corba/src/java.corba/share/classes/sun/corba : corba/src/share/classes/sun/corba
corba/src/java.sql/share/classes/javax/transaction/xa : corba/src/share/classes/javax/transaction/xa
corba/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop : corba/src/share/classes/sun/rmi/rmic/iiop
jaxp/src/java.xml/share/classes/com/sun/java_cup/internal/runtime : jaxp/src/com/sun/java_cup/internal/runtime
jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal : jaxp/src/com/sun/org/apache/bcel/internal
@ -66,8 +64,8 @@ jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset : jaxws/s
jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/org : jaxws/src/share/jaxws_classes/com/sun/xml/internal/org
jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2 : jaxws/src/share/jaxws_classes/com/sun/xml/internal/txw2
jaxws/src/java.xml.bind/share/classes/javax/xml/bind : jaxws/src/share/jaxws_classes/javax/xml/bind
jaxws/src/java.xml.soap/share/classes/com/sun/xml/internal/messaging : jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging
jaxws/src/java.xml.soap/share/classes/javax/xml/soap : jaxws/src/share/jaxws_classes/javax/xml/soap
jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging : jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging
jaxws/src/java.xml.ws/share/classes/javax/xml/soap : jaxws/src/share/jaxws_classes/javax/xml/soap
jaxws/src/java.xml.ws/share/classes/com/oracle/webservices/internal : jaxws/src/share/jaxws_classes/com/oracle/webservices/internal
jaxws/src/java.xml.ws/share/classes/com/oracle/xmlns/internal : jaxws/src/share/jaxws_classes/com/oracle/xmlns/internal
jaxws/src/java.xml.ws/share/classes/com/sun/org/glassfish : jaxws/src/share/jaxws_classes/com/sun/org/glassfish
@ -1245,6 +1243,8 @@ jdk/src/java.sql.rowset/share/classes/com/sun/rowset : jdk/src/share/classes/com
jdk/src/java.sql.rowset/share/classes/javax/sql/rowset : jdk/src/share/classes/javax/sql/rowset
jdk/src/java.sql/share/classes/java/sql : jdk/src/share/classes/java/sql
jdk/src/java.sql/share/classes/javax/sql : jdk/src/share/classes/javax/sql
jdk/src/java.sql/share/classes/javax/transaction/xa : corba/src/share/classes/javax/transaction/xa
jdk/src/java.transaction/share/classes/javax/transaction : corba/src/share/classes/javax/transaction
jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security : jdk/src/share/classes/com/sun/org/apache/xml/internal/security
jdk/src/java.xml.crypto/share/classes/javax/xml/crypto : jdk/src/share/classes/javax/xml/crypto
jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal : jdk/src/share/classes/org/jcp/xml/dsig/internal

View File

@ -287,3 +287,4 @@ e27c725d6c9d155667b35255f442d4ceb8c3c084 jdk9-b40
078bb11af876fe528d4b516f33ad4dd9bb60549e jdk9-b42
9645e35616b60c5c07b4fdf11a132afc8081dfa8 jdk9-b43
1f57bd728c9e6865ccb9d43ccd80a1c11230a32f jdk9-b44
9e3f2bed80c0e5a84a256ce41f1d10c5ade48466 jdk9-b45

View File

@ -1,314 +0,0 @@
/*
* Copyright (c) 2000, 2001, 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 javax.transaction.xa;
/** <p>The XAResource interface is a Java mapping of the industry standard
* XA interface based on the X/Open CAE Specification (Distributed
* Transaction Processing: The XA Specification).
*
* <p>The XA interface defines the contract between a Resource Manager
* and a Transaction Manager in a distributed transaction processing
* (DTP) environment. A JDBC driver or a JMS provider implements
* this interface to support the association between a global transaction
* and a database or message service connection.
*
* <p>The XAResource interface can be supported by any transactional
* resource that is intended to be used by application programs in an
* environment where transactions are controlled by an external
* transaction manager. An example of such a resource is a database
* management system. An application may access data through multiple
* database connections. Each database connection is enlisted with
* the transaction manager as a transactional resource. The transaction
* manager obtains an XAResource for each connection participating
* in a global transaction. The transaction manager uses the
* <code>start</code> method
* to associate the global transaction with the resource, and it uses the
* <code>end</code> method to disassociate the transaction from
* the resource. The resource
* manager is responsible for associating the global transaction to all
* work performed on its data between the start and end method invocations.
*
* <p>At transaction commit time, the resource managers are informed by
* the transaction manager to prepare, commit, or rollback a transaction
* according to the two-phase commit protocol.</p>
*
*/
public interface XAResource
{
/** Commits the global transaction specified by xid.
*
* @param xid A global transaction identifier
*
* @param onePhase If true, the resource manager should use a one-phase
* commit protocol to commit the work done on behalf of xid.
*
* @exception XAException An error has occurred. Possible XAExceptions
* are XA_HEURHAZ, XA_HEURCOM, XA_HEURRB, XA_HEURMIX, XAER_RMERR,
* XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO.
*
* <P>If the resource manager did not commit the transaction and the
* paramether onePhase is set to true, the resource manager may throw
* one of the XA_RB* exceptions. Upon return, the resource manager has
* rolled back the branch's work and has released all held resources.
*/
void commit(Xid xid, boolean onePhase) throws XAException;
/** Ends the work performed on behalf of a transaction branch.
* The resource manager disassociates the XA resource from the
* transaction branch specified and lets the transaction
* complete.
*
* <p>If TMSUSPEND is specified in the flags, the transaction branch
* is temporarily suspended in an incomplete state. The transaction
* context is in a suspended state and must be resumed via the
* <code>start</code> method with TMRESUME specified.</p>
*
* <p>If TMFAIL is specified, the portion of work has failed.
* The resource manager may mark the transaction as rollback-only</p>
*
* <p>If TMSUCCESS is specified, the portion of work has completed
* successfully.</p>
*
* @param xid A global transaction identifier that is the same as
* the identifier used previously in the <code>start</code> method.
*
* @param flags One of TMSUCCESS, TMFAIL, or TMSUSPEND.
*
* @exception XAException An error has occurred. Possible XAException
* values are XAER_RMERR, XAER_RMFAILED, XAER_NOTA, XAER_INVAL,
* XAER_PROTO, or XA_RB*.
*/
void end(Xid xid, int flags) throws XAException;
/** Tells the resource manager to forget about a heuristically
* completed transaction branch.
*
* @param xid A global transaction identifier.
*
* @exception XAException An error has occurred. Possible exception
* values are XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or
* XAER_PROTO.
*/
void forget(Xid xid) throws XAException;
/** Obtains the current transaction timeout value set for this
* XAResource instance. If <CODE>XAResource.setTransactionTimeout</CODE>
* was not used prior to invoking this method, the return value
* is the default timeout set for the resource manager; otherwise,
* the value used in the previous <CODE>setTransactionTimeout</CODE>
* call is returned.
*
* @return the transaction timeout value in seconds.
*
* @exception XAException An error has occurred. Possible exception
* values are XAER_RMERR and XAER_RMFAIL.
*/
int getTransactionTimeout() throws XAException;
/** This method is called to determine if the resource manager
* instance represented by the target object is the same as the
* resouce manager instance represented by the parameter <i>xares</i>.
*
* @param xares An XAResource object whose resource manager instance
* is to be compared with the resource manager instance of the
* target object.
*
* @return <i>true</i> if it's the same RM instance; otherwise
* <i>false</i>.
*
* @exception XAException An error has occurred. Possible exception
* values are XAER_RMERR and XAER_RMFAIL.
*
*/
boolean isSameRM(XAResource xares) throws XAException;
/** Ask the resource manager to prepare for a transaction commit
* of the transaction specified in xid.
*
* @param xid A global transaction identifier.
*
* @exception XAException An error has occurred. Possible exception
* values are: XA_RB*, XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL,
* or XAER_PROTO.
*
* @return A value indicating the resource manager's vote on the
* outcome of the transaction. The possible values are: XA_RDONLY
* or XA_OK. If the resource manager wants to roll back the
* transaction, it should do so by raising an appropriate XAException
* in the prepare method.
*/
int prepare(Xid xid) throws XAException;
/** Obtains a list of prepared transaction branches from a resource
* manager. The transaction manager calls this method during recovery
* to obtain the list of transaction branches that are currently in
* prepared or heuristically completed states.
*
* @param flag One of TMSTARTRSCAN, TMENDRSCAN, TMNOFLAGS. TMNOFLAGS
* must be used when no other flags are set in the parameter.
*
* @exception XAException An error has occurred. Possible values are
* XAER_RMERR, XAER_RMFAIL, XAER_INVAL, and XAER_PROTO.
*
* @return The resource manager returns zero or more XIDs of the
* transaction branches that are currently in a prepared or
* heuristically completed state. If an error occurs during the
* operation, the resource manager should throw the appropriate
* XAException.
*
*/
Xid[] recover(int flag) throws XAException;
/** Informs the resource manager to roll back work done on behalf
* of a transaction branch.
*
* @param xid A global transaction identifier.
*
* @exception XAException An error has occurred.
*/
void rollback(Xid xid) throws XAException;
/** <P>Sets the current transaction timeout value for this <CODE>XAResource</CODE>
* instance. Once set, this timeout value is effective until
* <code>setTransactionTimeout</code> is invoked again with a different
* value. To reset the timeout value to the default value used by the resource
* manager, set the value to zero.
*
* If the timeout operation is performed successfully, the method returns
* <i>true</i>; otherwise <i>false</i>. If a resource manager does not
* support explicitly setting the transaction timeout value, this method
* returns <i>false</i>.
*
* @param seconds The transaction timeout value in seconds.
*
* @return <i>true</i> if the transaction timeout value is set successfully;
* otherwise <i>false</i>.
*
* @exception XAException An error has occurred. Possible exception values
* are XAER_RMERR, XAER_RMFAIL, or XAER_INVAL.
*/
boolean setTransactionTimeout(int seconds) throws XAException;
/** Starts work on behalf of a transaction branch specified in
* <code>xid</code>.
*
* If TMJOIN is specified, the start applies to joining a transaction
* previously seen by the resource manager. If TMRESUME is specified,
* the start applies to resuming a suspended transaction specified in the
* parameter <code>xid</code>.
*
* If neither TMJOIN nor TMRESUME is specified and the transaction
* specified by <code>xid</code> has previously been seen by the resource
* manager, the resource manager throws the XAException exception with
* XAER_DUPID error code.
*
* @param xid A global transaction identifier to be associated
* with the resource.
*
* @param flags One of TMNOFLAGS, TMJOIN, or TMRESUME.
*
* @exception XAException An error has occurred. Possible exceptions
* are XA_RB*, XAER_RMERR, XAER_RMFAIL, XAER_DUPID, XAER_OUTSIDE,
* XAER_NOTA, XAER_INVAL, or XAER_PROTO.
*
*/
void start(Xid xid, int flags) throws XAException;
/**
* Ends a recovery scan.
*/
public final static int TMENDRSCAN = 0x00800000;
/**
* Disassociates the caller and marks the transaction branch
* rollback-only.
*/
public final static int TMFAIL = 0x20000000;
/**
* Caller is joining existing transaction branch.
*/
public final static int TMJOIN = 0x00200000;
/**
* Use TMNOFLAGS to indicate no flags value is selected.
*/
public final static int TMNOFLAGS = 0x00000000;
/**
* Caller is using one-phase optimization.
*/
public final static int TMONEPHASE = 0x40000000;
/**
* Caller is resuming association with a suspended
* transaction branch.
*/
public final static int TMRESUME = 0x08000000;
/**
* Starts a recovery scan.
*/
public final static int TMSTARTRSCAN = 0x01000000;
/**
* Disassociates caller from a transaction branch.
*/
public final static int TMSUCCESS = 0x04000000;
/**
* Caller is suspending (not ending) its association with
* a transaction branch.
*/
public final static int TMSUSPEND = 0x02000000;
/**
* The transaction branch has been read-only and has been committed.
*/
public final static int XA_RDONLY = 0x00000003;
/**
* The transaction work has been prepared normally.
*/
public final static int XA_OK = 0;
}

View File

@ -447,3 +447,4 @@ c363a8b87e477ee45d6d3cb2a36cb365141bc596 jdk9-b38
38cb4fbd47e3472bd1b5ebac83bda96fe4869c4f jdk9-b42
65a9747147b8090037541040ba67156ec914db6a jdk9-b43
43a44b56dca61a4d766a20f0528fdd8b5ceff873 jdk9-b44
5dc8184af1e2bb30b0103113d1f1a58a21a80c37 jdk9-b45

View File

@ -287,3 +287,4 @@ a12d347f84176200593999f4da91ae2bb86865b2 jdk9-b39
47b0d3fa4118b9d56870cf4004987438c501f5c0 jdk9-b42
40b242363040229a05224fbc5dc203a3f46a8f8f jdk9-b43
0cb0844b58924d6086d2850c22087d06679d5eef jdk9-b44
0dab3e848229127c7aca4c58b98e2d90ba70372f jdk9-b45

View File

@ -287,3 +287,4 @@ e336cbd8b15e959e70ed02f0f5e93fa76ebd4c07 jdk9-b41
6b2314173433467245261364a52fb8e347fe6342 jdk9-b42
8c6ad41974f9ab6c33d544b088648314963f2a50 jdk9-b43
8cc4dc300041eb70a7a40e4b2431a8f4d4965ea4 jdk9-b44
9acaa4f57b0b9e3757a7b4576ca9418a75ea8287 jdk9-b45

View File

@ -53,24 +53,21 @@ endif
# Find the default set of src dirs for a native library.
# Param 1 - module name
# Param 2 - library name
define FindSrcDirsForLib
FindSrcDirsForLib = \
$(call uniq, $(wildcard \
$(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/lib$(strip $2) \
$(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/lib$(strip $2) \
$(JDK_TOPDIR)/src/$(strip $1)/share/native/lib$(strip $2)))
endef
################################################################################
# Find lib dir for module
# Param 1 - module name
ifeq ($(OPENJDK_TARGET_OS_TYPE), unix)
define FindLibDirForModule
$(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)$(OPENJDK_TARGET_CPU_LIBDIR)
endef
FindLibDirForModule = \
$(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)$(OPENJDK_TARGET_CPU_LIBDIR)
else
define FindLibDirForModule
$(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
endef
FindLibDirForModule = \
$(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
endif
################################################################################
@ -78,11 +75,10 @@ endif
# Param 1 - module name
# Param 2 - library name
# Param 3 - subdir for library
define FindLib
$(strip \
$(call FindLibDirForModule, $(strip $1))$(strip $3)/$(LIBRARY_PREFIX)$(strip $2)$(SHARED_LIBRARY_SUFFIX) \
)
endef
FindLib = \
$(call FindLibDirForModule, \
$(strip $1))$(strip $3)/$(LIBRARY_PREFIX)$(strip $2)$(SHARED_LIBRARY_SUFFIX)
################################################################################
# Define the header include flags needed to compile against it.

View File

@ -17,10 +17,10 @@ java.security.sasl
java.smartcardio
java.sql
java.sql.rowset
java.transaction
java.xml
java.xml.bind
java.xml.crypto
java.xml.soap
java.xml.ws
jdk.charsets
jdk.deploy

View File

@ -48,6 +48,8 @@ class FilterOutputStream extends OutputStream {
*/
protected OutputStream out;
private boolean closed;
/**
* Creates an output stream filter built on top of the specified
* underlying output stream.
@ -144,9 +146,9 @@ class FilterOutputStream extends OutputStream {
* Closes this output stream and releases any system resources
* associated with the stream.
* <p>
* The <code>close</code> method of <code>FilterOutputStream</code>
* calls its <code>flush</code> method, and then calls the
* <code>close</code> method of its underlying output stream.
* When not already closed, the {@code close} method of {@code
* FilterOutputStream} calls its {@code flush} method, and then
* calls the {@code close} method of its underlying output stream.
*
* @exception IOException if an I/O error occurs.
* @see java.io.FilterOutputStream#flush()
@ -154,6 +156,9 @@ class FilterOutputStream extends OutputStream {
*/
@SuppressWarnings("try")
public void close() throws IOException {
if (closed)
return;
closed = true;
try (OutputStream ostream = out) {
flush();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, 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
@ -34,9 +34,13 @@ import static java.lang.annotation.ElementType.*;
* or because a better alternative exists. Compilers warn when a
* deprecated program element is used or overridden in non-deprecated code.
*
* <p>Use of the &#64;Deprecated annotation on a local variable
* declaration or on a parameter declaration or a package declaration
* has no effect.
*
* @author Neal Gafter
* @since 1.5
* @jls 9.6.3.6 @Deprecated
* @jls 9.6.4.6 @Deprecated
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)

View File

@ -265,24 +265,41 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
// Constructors
/**
* Translates a byte array containing the two's-complement binary
* representation of a BigInteger into a BigInteger. The input array is
* Translates a byte sub-array containing the two's-complement binary
* representation of a BigInteger into a BigInteger. The sub-array is
* specified via an offset into the array and a length. The sub-array is
* assumed to be in <i>big-endian</i> byte-order: the most significant
* byte is in the zeroth element.
* byte is the element at index {@code off}. The {@code val} array is
* assumed to be unchanged for the duration of the constructor call.
*
* @param val big-endian two's-complement binary representation of
* BigInteger.
* An {@code IndexOutOfBoundsException} is thrown if the length of the array
* {@code val} is non-zero and either {@code off} is negative, {@code len}
* is negative, or {@code off+len} is greater than the length of
* {@code val}.
*
* @param val byte array containing a sub-array which is the big-endian
* two's-complement binary representation of a BigInteger.
* @param off the start offset of the binary representation.
* @param len the number of bytes to use.
* @throws NumberFormatException {@code val} is zero bytes long.
* @throws IndexOutOfBoundsException if the provided array offset and
* length would cause an index into the byte array to be
* negative or greater than or equal to the array length.
* @since 1.9
*/
public BigInteger(byte[] val) {
if (val.length == 0)
public BigInteger(byte[] val, int off, int len) {
if (val.length == 0) {
throw new NumberFormatException("Zero length BigInteger");
} else if ((off < 0) || (off >= val.length) || (len < 0) ||
(len > val.length - off)) { // 0 <= off < val.length
throw new IndexOutOfBoundsException();
}
if (val[0] < 0) {
mag = makePositive(val);
if (val[off] < 0) {
mag = makePositive(val, off, len);
signum = -1;
} else {
mag = stripLeadingZeroBytes(val);
mag = stripLeadingZeroBytes(val, off, len);
signum = (mag.length == 0 ? 0 : 1);
}
if (mag.length >= MAX_MAG_LENGTH) {
@ -290,11 +307,28 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
}
}
/**
* Translates a byte array containing the two's-complement binary
* representation of a BigInteger into a BigInteger. The input array is
* assumed to be in <i>big-endian</i> byte-order: the most significant
* byte is in the zeroth element. The {@code val} array is assumed to be
* unchanged for the duration of the constructor call.
*
* @param val big-endian two's-complement binary representation of a
* BigInteger.
* @throws NumberFormatException {@code val} is zero bytes long.
*/
public BigInteger(byte[] val) {
this(val, 0, val.length);
}
/**
* This private constructor translates an int array containing the
* two's-complement binary representation of a BigInteger into a
* BigInteger. The input array is assumed to be in <i>big-endian</i>
* int-order: the most significant int is in the zeroth element.
* int-order: the most significant int is in the zeroth element. The
* {@code val} array is assumed to be unchanged for the duration of
* the constructor call.
*/
private BigInteger(int[] val) {
if (val.length == 0)
@ -315,24 +349,44 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
/**
* Translates the sign-magnitude representation of a BigInteger into a
* BigInteger. The sign is represented as an integer signum value: -1 for
* negative, 0 for zero, or 1 for positive. The magnitude is a byte array
* in <i>big-endian</i> byte-order: the most significant byte is in the
* zeroth element. A zero-length magnitude array is permissible, and will
* result in a BigInteger value of 0, whether signum is -1, 0 or 1.
* negative, 0 for zero, or 1 for positive. The magnitude is a sub-array of
* a byte array in <i>big-endian</i> byte-order: the most significant byte
* is the element at index {@code off}. A zero value of the length
* {@code len} is permissible, and will result in a BigInteger value of 0,
* whether signum is -1, 0 or 1. The {@code magnitude} array is assumed to
* be unchanged for the duration of the constructor call.
*
* An {@code IndexOutOfBoundsException} is thrown if the length of the array
* {@code magnitude} is non-zero and either {@code off} is negative,
* {@code len} is negative, or {@code off+len} is greater than the length of
* {@code magnitude}.
*
* @param signum signum of the number (-1 for negative, 0 for zero, 1
* for positive).
* @param magnitude big-endian binary representation of the magnitude of
* the number.
* @param off the start offset of the binary representation.
* @param len the number of bytes to use.
* @throws NumberFormatException {@code signum} is not one of the three
* legal values (-1, 0, and 1), or {@code signum} is 0 and
* {@code magnitude} contains one or more non-zero bytes.
* @throws IndexOutOfBoundsException if the provided array offset and
* length would cause an index into the byte array to be
* negative or greater than or equal to the array length.
* @since 1.9
*/
public BigInteger(int signum, byte[] magnitude) {
this.mag = stripLeadingZeroBytes(magnitude);
if (signum < -1 || signum > 1)
public BigInteger(int signum, byte[] magnitude, int off, int len) {
if (signum < -1 || signum > 1) {
throw(new NumberFormatException("Invalid signum value"));
} else if ((off < 0) || (len < 0) ||
(len > 0 &&
((off >= magnitude.length) ||
(len > magnitude.length - off)))) { // 0 <= off < magnitude.length
throw new IndexOutOfBoundsException();
}
// stripLeadingZeroBytes() returns a zero length array if len == 0
this.mag = stripLeadingZeroBytes(magnitude, off, len);
if (this.mag.length == 0) {
this.signum = 0;
@ -346,11 +400,34 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
}
}
/**
* Translates the sign-magnitude representation of a BigInteger into a
* BigInteger. The sign is represented as an integer signum value: -1 for
* negative, 0 for zero, or 1 for positive. The magnitude is a byte array
* in <i>big-endian</i> byte-order: the most significant byte is the
* zeroth element. A zero-length magnitude array is permissible, and will
* result in a BigInteger value of 0, whether signum is -1, 0 or 1. The
* {@code magnitude} array is assumed to be unchanged for the duration of
* the constructor call.
*
* @param signum signum of the number (-1 for negative, 0 for zero, 1
* for positive).
* @param magnitude big-endian binary representation of the magnitude of
* the number.
* @throws NumberFormatException {@code signum} is not one of the three
* legal values (-1, 0, and 1), or {@code signum} is 0 and
* {@code magnitude} contains one or more non-zero bytes.
*/
public BigInteger(int signum, byte[] magnitude) {
this(signum, magnitude, 0, magnitude.length);
}
/**
* A constructor for internal use that translates the sign-magnitude
* representation of a BigInteger into a BigInteger. It checks the
* arguments and copies the magnitude so this constructor would be
* safe for external use.
* safe for external use. The {@code magnitude} array is assumed to be
* unchanged for the duration of the constructor call.
*/
private BigInteger(int signum, int[] magnitude) {
this.mag = stripLeadingZeroInts(magnitude);
@ -467,7 +544,9 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
/*
* Constructs a new BigInteger using a char array with radix=10.
* Sign is precalculated outside and not allowed in the val.
* Sign is precalculated outside and not allowed in the val. The {@code val}
* array is assumed to be unchanged for the duration of the constructor
* call.
*/
BigInteger(char[] val, int sign, int len) {
int cursor = 0, numDigits;
@ -1035,11 +1114,12 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
/**
* This private constructor is for internal use and assumes that its
* arguments are correct.
* arguments are correct. The {@code magnitude} array is assumed to be
* unchanged for the duration of the constructor call.
*/
private BigInteger(byte[] magnitude, int signum) {
this.signum = (magnitude.length == 0 ? 0 : signum);
this.mag = stripLeadingZeroBytes(magnitude);
this.mag = stripLeadingZeroBytes(magnitude, 0, magnitude.length);
if (mag.length >= MAX_MAG_LENGTH) {
checkRange();
}
@ -3977,18 +4057,18 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
/**
* Returns a copy of the input array stripped of any leading zero bytes.
*/
private static int[] stripLeadingZeroBytes(byte a[]) {
int byteLength = a.length;
private static int[] stripLeadingZeroBytes(byte a[], int off, int len) {
int indexBound = off + len;
int keep;
// Find first nonzero byte
for (keep = 0; keep < byteLength && a[keep] == 0; keep++)
for (keep = off; keep < indexBound && a[keep] == 0; keep++)
;
// Allocate new array and copy relevant part of input array
int intLength = ((byteLength - keep) + 3) >>> 2;
int intLength = ((indexBound - keep) + 3) >>> 2;
int[] result = new int[intLength];
int b = byteLength - 1;
int b = indexBound - 1;
for (int i = intLength-1; i >= 0; i--) {
result[i] = a[b--] & 0xff;
int bytesRemaining = b - keep + 1;
@ -4003,27 +4083,27 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
* Takes an array a representing a negative 2's-complement number and
* returns the minimal (no leading zero bytes) unsigned whose value is -a.
*/
private static int[] makePositive(byte a[]) {
private static int[] makePositive(byte a[], int off, int len) {
int keep, k;
int byteLength = a.length;
int indexBound = off + len;
// Find first non-sign (0xff) byte of input
for (keep=0; keep < byteLength && a[keep] == -1; keep++)
for (keep=off; keep < indexBound && a[keep] == -1; keep++)
;
/* Allocate output array. If all non-sign bytes are 0x00, we must
* allocate space for one extra output byte. */
for (k=keep; k < byteLength && a[k] == 0; k++)
for (k=keep; k < indexBound && a[k] == 0; k++)
;
int extraByte = (k == byteLength) ? 1 : 0;
int intLength = ((byteLength - keep + extraByte) + 3) >>> 2;
int extraByte = (k == indexBound) ? 1 : 0;
int intLength = ((indexBound - keep + extraByte) + 3) >>> 2;
int result[] = new int[intLength];
/* Copy one's complement of input into output, leaving extra
* byte (if it exists) == 0x00 */
int b = byteLength - 1;
int b = indexBound - 1;
for (int i = intLength-1; i >= 0; i--) {
result[i] = a[b--] & 0xff;
int numBytesToTransfer = Math.min(3, b-keep+1);
@ -4248,7 +4328,7 @@ public class BigInteger extends Number implements Comparable<BigInteger> {
message = "BigInteger: Signum not present in stream";
throw new java.io.StreamCorruptedException(message);
}
int[] mag = stripLeadingZeroBytes(magnitude);
int[] mag = stripLeadingZeroBytes(magnitude, 0, magnitude.length);
if ((mag.length == 0) != (sign == 0)) {
String message = "BigInteger: signum-magnitude mismatch";
if (fields.defaulted("magnitude"))

View File

@ -3727,29 +3727,29 @@ public final class Formatter implements Closeable, Flushable {
exp = new StringBuilder("+00");
}
}
return;
}
long adjusted = -(long) scale + (len - 1);
if (form == BigDecimalLayoutForm.DECIMAL_FLOAT) {
} else if (form == BigDecimalLayoutForm.DECIMAL_FLOAT) {
// count of padding zeros
int pad = scale - len;
if (pad >= 0) {
if (scale >= len) {
// 0.xxx form
mant.append("0.");
dot = true;
trailingZeros(mant, pad);
trailingZeros(mant, scale - len);
mant.append(coeff);
} else {
if (-pad < len) {
if (scale > 0) {
// xx.xx form
mant.append(coeff, 0, -pad);
int pad = len - scale;
mant.append(coeff, 0, pad);
mant.append('.');
dot = true;
mant.append(coeff, -pad, -pad + scale);
} else {
mant.append(coeff, pad, len);
} else { // scale < 0
// xx form
mant.append(coeff, 0, len);
trailingZeros(mant, -scale);
if (intVal.signum() != 0) {
trailingZeros(mant, -scale);
}
this.scale = 0;
}
}
@ -3762,6 +3762,7 @@ public final class Formatter implements Closeable, Flushable {
mant.append(coeff, 1, len);
}
exp = new StringBuilder();
long adjusted = -(long) scale + (len - 1);
if (adjusted != 0) {
long abs = Math.abs(adjusted);
// require sign

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, 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
@ -29,7 +29,7 @@ import java.security.spec.AlgorithmParameterSpec;
/**
* This class specifies the parameters used with the
* <a href="http://www.ietf.org/rfc/rfc2040.txt"><i>RC5</i></a>
* <a href="http://tools.ietf.org/html/rfc2040"><i>RC5</i></a>
* algorithm.
*
* <p> The parameters consist of a version number, a rounds count, a word
@ -37,7 +37,7 @@ import java.security.spec.AlgorithmParameterSpec;
*
* <p> This class can be used to initialize a <code>Cipher</code> object that
* implements the <i>RC5</i> algorithm as supplied by
* <a href="http://www.rsasecurity.com">RSA Security Inc.</a>,
* <a href="http://www.rsa.com">RSA Security LLC</a>,
* or any parties authorized by RSA Security.
*
* @author Jan Luehe

View File

@ -123,7 +123,7 @@ class FileDispatcherImpl extends FileDispatcher {
new PrivilegedAction<String>() {
@Override
public String run() {
return System.getProperty("jdk.net.enableFastFileTransfer");
return System.getProperty("jdk.nio.enableFastFileTransfer");
}
});
boolean enable;

View File

@ -81,9 +81,17 @@ static int getAdapters (JNIEnv *env, IP_ADAPTER_ADDRESSES **adapters) {
DWORD ret, flags;
IP_ADAPTER_ADDRESSES *adapterInfo;
ULONG len;
char *error_msg_buf = NULL;
size_t error_msg_buf_size =
strlen("IP Helper Library GetAdaptersAddresses function failed"
" with error == ") + 10;
int _ret = 0;
adapterInfo = (IP_ADAPTER_ADDRESSES *)malloc (bufsize);
if (adapterInfo == NULL) {
JNU_ThrowByName(env, "java/lang/OutOfMemoryError", "Native heap allocation failure");
JNU_ThrowByName(env, "java/lang/OutOfMemoryError",
"Native heap allocation failure");
return -1;
}
@ -94,10 +102,12 @@ static int getAdapters (JNIEnv *env, IP_ADAPTER_ADDRESSES **adapters) {
ret = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
if (ret == ERROR_BUFFER_OVERFLOW) {
IP_ADAPTER_ADDRESSES * newAdapterInfo = (IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len);
IP_ADAPTER_ADDRESSES * newAdapterInfo =
(IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len);
if (newAdapterInfo == NULL) {
free(adapterInfo);
JNU_ThrowByName(env, "java/lang/OutOfMemoryError", "Native heap allocation failure");
JNU_ThrowByName(env, "java/lang/OutOfMemoryError",
"Native heap allocation failure");
return -1;
}
@ -109,8 +119,32 @@ static int getAdapters (JNIEnv *env, IP_ADAPTER_ADDRESSES **adapters) {
if (ret != ERROR_SUCCESS) {
free (adapterInfo);
JNU_ThrowByName(env, "java/lang/Error",
"IP Helper Library GetAdaptersAddresses function failed");
if (ret == ERROR_INSUFFICIENT_BUFFER) {
JNU_ThrowByName(env, "java/lang/Error",
"IP Helper Library GetAdaptersAddresses function failed "
"with ERROR_INSUFFICIENT_BUFFER");
} else if (ret == ERROR_ADDRESS_NOT_ASSOCIATED ) {
JNU_ThrowByName(env, "java/lang/Error",
"IP Helper Library GetAdaptersAddresses function failed "
"with ERROR_ADDRESS_NOT_ASSOCIATED");
} else {
error_msg_buf = (char *)malloc(error_msg_buf_size);
if (error_msg_buf != NULL) {
memset(error_msg_buf, 0, error_msg_buf_size);
_ret = _snprintf_s(error_msg_buf, error_msg_buf_size,
_TRUNCATE, "IP Helper Library GetAdaptersAddresses "
"function failed with error == %d", ret);
if (_ret != -1) {
JNU_ThrowByName(env, "java/lang/Error", error_msg_buf);
} else {
JNU_ThrowByName(env, "java/lang/Error",
"IP Helper Library GetAdaptersAddresses function failure");
}
} else {
JNU_ThrowByName(env, "java/lang/Error",
"IP Helper Library GetAdaptersAddresses function failed");
}
}
return -1;
}
*adapters = adapterInfo;
@ -126,9 +160,14 @@ IP_ADAPTER_ADDRESSES *getAdapter (JNIEnv *env, jint index) {
DWORD flags, val;
IP_ADAPTER_ADDRESSES *adapterInfo, *ptr, *ret;
ULONG len;
char *error_msg_buf = NULL;
size_t error_msg_buf_size =
strlen("IP Helper Library GetAdaptersAddresses function failed with error == ") + 10;
int _ret = 0;
adapterInfo = (IP_ADAPTER_ADDRESSES *)malloc (bufsize);
if (adapterInfo == NULL) {
JNU_ThrowByName(env, "java/lang/OutOfMemoryError", "Native heap allocation failure");
JNU_ThrowByName(env, "java/lang/OutOfMemoryError",
"Native heap allocation failure");
return NULL;
}
len = bufsize;
@ -137,10 +176,12 @@ IP_ADAPTER_ADDRESSES *getAdapter (JNIEnv *env, jint index) {
flags |= GAA_FLAG_INCLUDE_PREFIX;
val = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapterInfo, &len);
if (val == ERROR_BUFFER_OVERFLOW) {
IP_ADAPTER_ADDRESSES * newAdapterInfo = (IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len);
IP_ADAPTER_ADDRESSES * newAdapterInfo =
(IP_ADAPTER_ADDRESSES *) realloc (adapterInfo, len);
if (newAdapterInfo == NULL) {
free(adapterInfo);
JNU_ThrowByName(env, "java/lang/OutOfMemoryError", "Native heap allocation failure");
JNU_ThrowByName(env, "java/lang/OutOfMemoryError",
"Native heap allocation failure");
return NULL;
}
@ -152,10 +193,35 @@ IP_ADAPTER_ADDRESSES *getAdapter (JNIEnv *env, jint index) {
if (val != ERROR_SUCCESS) {
free (adapterInfo);
JNU_ThrowByName(env, "java/lang/Error",
"IP Helper Library GetAdaptersAddresses function failed");
if (val == ERROR_INSUFFICIENT_BUFFER) {
JNU_ThrowByName(env, "java/lang/Error",
"IP Helper Library GetAdaptersAddresses function failed "
"with ERROR_INSUFFICIENT_BUFFER");
} else if (val == ERROR_ADDRESS_NOT_ASSOCIATED ) {
JNU_ThrowByName(env, "java/lang/Error",
"IP Helper Library GetAdaptersAddresses function failed "
"with ERROR_ADDRESS_NOT_ASSOCIATED");
} else {
error_msg_buf = (char *)malloc(error_msg_buf_size);
if (error_msg_buf != NULL) {
memset(error_msg_buf, 0, error_msg_buf_size);
_ret = _snprintf_s(error_msg_buf, error_msg_buf_size,
_TRUNCATE, "IP Helper Library GetAdaptersAddresses function failed "
"with error == %d", val);
if (_ret != -1) {
JNU_ThrowByName(env, "java/lang/Error", error_msg_buf);
} else {
JNU_ThrowByName(env, "java/lang/Error",
"IP Helper Library GetAdaptersAddresses function failure");
}
} else {
JNU_ThrowByName(env, "java/lang/Error",
"IP Helper Library GetAdaptersAddresses function failed");
}
}
return NULL;
}
ptr = adapterInfo;
ret = NULL;
while (ptr != NULL) {
@ -168,7 +234,8 @@ IP_ADAPTER_ADDRESSES *getAdapter (JNIEnv *env, jint index) {
ret = (IP_ADAPTER_ADDRESSES *) malloc(sizeof(IP_ADAPTER_ADDRESSES));
if (ret == NULL) {
free(adapterInfo);
JNU_ThrowByName(env, "java/lang/OutOfMemoryError", "Native heap allocation failure");
JNU_ThrowByName(env, "java/lang/OutOfMemoryError",
"Native heap allocation failure");
return NULL;
}

View File

@ -85,7 +85,7 @@ public interface ScriptEngineFactory {
public List<String> getNames();
/**
* Returns the name of the scripting langauge supported by this
* Returns the name of the scripting language supported by this
* <code>ScriptEngine</code>.
* @return The name of the supported language.
*/
@ -104,14 +104,15 @@ public interface ScriptEngineFactory {
* <ul>
* <li>ScriptEngine.ENGINE</li>
* <li>ScriptEngine.ENGINE_VERSION</li>
* <li>ScriptEngine.NAME</li>
* <li>ScriptEngine.LANGUAGE</li>
* <li>ScriptEngine.LANGUAGE_VERSION</li>
* <li>ScriptEngine.NAME</li>
* </ul>
* <p>
* The values for these keys are the Strings returned by <code>getEngineName</code>,
* <code>getEngineVersion</code>, <code>getName</code>, <code>getLanguageName</code> and
* <code>getLanguageVersion</code> respectively.<br><br>
* <code>getEngineVersion</code>, <code>getLanguageName</code>,
* <code>getLanguageVersion</code> for the first four keys respectively. For NAME, one of the Strings
* returned by <code>getNames</code> is returned.<br><br>
* A reserved key, <code><b>THREADING</b></code>, whose value describes the behavior of the engine
* with respect to concurrent execution of scripts and maintenance of state is also defined.
* These values for the <code><b>THREADING</b></code> key are:<br><br>

View File

@ -30,21 +30,20 @@ package javax.transaction.xa;
* Transaction Manager of an error encountered by the involved transaction.
*
*/
public class XAException extends java.lang.Exception {
public class XAException extends Exception {
//private static final long serialVersionUID = -8249683284832867751L;
/**
* The error code with which to create the SystemException.
*
* @serial The error code for the exception
* The error code with which to create the SystemException.
*
* @serial The error code for the exception
*/
public int errorCode;
/**
* Create an XAException.
*/
public XAException()
{
public XAException() {
super();
}
@ -54,8 +53,7 @@ public class XAException extends java.lang.Exception {
* @param s The <code>String</code> object containing the exception
* message.
*/
public XAException(String s)
{
public XAException(String s) {
super(s);
}
@ -64,8 +62,7 @@ public class XAException extends java.lang.Exception {
*
* @param errcode The error code identifying the exception.
*/
public XAException(int errcode)
{
public XAException(int errcode) {
super();
errorCode = errcode;
}
@ -196,6 +193,4 @@ public class XAException extends java.lang.Exception {
* The resource manager is doing work outside a global transaction.
*/
public final static int XAER_OUTSIDE = -9;
}

View File

@ -0,0 +1,305 @@
/*
* Copyright (c) 2000, 2001, 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 javax.transaction.xa;
/**
* The XAResource interface is a Java mapping of the industry standard
* XA interface based on the X/Open CAE Specification (Distributed
* Transaction Processing: The XA Specification).
*
* <p>The XA interface defines the contract between a Resource Manager
* and a Transaction Manager in a distributed transaction processing
* (DTP) environment. A JDBC driver or a JMS provider implements
* this interface to support the association between a global transaction
* and a database or message service connection.
*
* <p>The XAResource interface can be supported by any transactional
* resource that is intended to be used by application programs in an
* environment where transactions are controlled by an external
* transaction manager. An example of such a resource is a database
* management system. An application may access data through multiple
* database connections. Each database connection is enlisted with
* the transaction manager as a transactional resource. The transaction
* manager obtains an XAResource for each connection participating
* in a global transaction. The transaction manager uses the
* <code>start</code> method
* to associate the global transaction with the resource, and it uses the
* <code>end</code> method to disassociate the transaction from
* the resource. The resource
* manager is responsible for associating the global transaction to all
* work performed on its data between the start and end method invocations.
*
* <p>At transaction commit time, the resource managers are informed by
* the transaction manager to prepare, commit, or rollback a transaction
* according to the two-phase commit protocol.</p>
*
*/
public interface XAResource {
/**
* Commits the global transaction specified by xid.
*
* @param xid A global transaction identifier
*
* @param onePhase If true, the resource manager should use a one-phase
* commit protocol to commit the work done on behalf of xid.
*
* @exception XAException An error has occurred. Possible XAExceptions
* are XA_HEURHAZ, XA_HEURCOM, XA_HEURRB, XA_HEURMIX, XAER_RMERR,
* XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO.
*
* <P>If the resource manager did not commit the transaction and the
* paramether onePhase is set to true, the resource manager may throw
* one of the XA_RB* exceptions. Upon return, the resource manager has
* rolled back the branch's work and has released all held resources.
*/
void commit(Xid xid, boolean onePhase) throws XAException;
/**
* Ends the work performed on behalf of a transaction branch.
* The resource manager disassociates the XA resource from the
* transaction branch specified and lets the transaction
* complete.
*
* <p>If TMSUSPEND is specified in the flags, the transaction branch
* is temporarily suspended in an incomplete state. The transaction
* context is in a suspended state and must be resumed via the
* <code>start</code> method with TMRESUME specified.</p>
*
* <p>If TMFAIL is specified, the portion of work has failed.
* The resource manager may mark the transaction as rollback-only</p>
*
* <p>If TMSUCCESS is specified, the portion of work has completed
* successfully.</p>
*
* @param xid A global transaction identifier that is the same as
* the identifier used previously in the <code>start</code> method.
*
* @param flags One of TMSUCCESS, TMFAIL, or TMSUSPEND.
*
* @exception XAException An error has occurred. Possible XAException
* values are XAER_RMERR, XAER_RMFAILED, XAER_NOTA, XAER_INVAL,
* XAER_PROTO, or XA_RB*.
*/
void end(Xid xid, int flags) throws XAException;
/**
* Tells the resource manager to forget about a heuristically
* completed transaction branch.
*
* @param xid A global transaction identifier.
*
* @exception XAException An error has occurred. Possible exception
* values are XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or
* XAER_PROTO.
*/
void forget(Xid xid) throws XAException;
/**
* Obtains the current transaction timeout value set for this
* XAResource instance. If <CODE>XAResource.setTransactionTimeout</CODE>
* was not used prior to invoking this method, the return value
* is the default timeout set for the resource manager; otherwise,
* the value used in the previous <CODE>setTransactionTimeout</CODE>
* call is returned.
*
* @return the transaction timeout value in seconds.
*
* @exception XAException An error has occurred. Possible exception
* values are XAER_RMERR and XAER_RMFAIL.
*/
int getTransactionTimeout() throws XAException;
/**
* This method is called to determine if the resource manager
* instance represented by the target object is the same as the
* resouce manager instance represented by the parameter <i>xares</i>.
*
* @param xares An XAResource object whose resource manager instance
* is to be compared with the resource manager instance of the
* target object.
*
* @return <i>true</i> if it's the same RM instance; otherwise
* <i>false</i>.
*
* @exception XAException An error has occurred. Possible exception
* values are XAER_RMERR and XAER_RMFAIL.
*/
boolean isSameRM(XAResource xares) throws XAException;
/**
* Ask the resource manager to prepare for a transaction commit
* of the transaction specified in xid.
*
* @param xid A global transaction identifier.
*
* @exception XAException An error has occurred. Possible exception
* values are: XA_RB*, XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL,
* or XAER_PROTO.
*
* @return A value indicating the resource manager's vote on the
* outcome of the transaction. The possible values are: XA_RDONLY
* or XA_OK. If the resource manager wants to roll back the
* transaction, it should do so by raising an appropriate XAException
* in the prepare method.
*/
int prepare(Xid xid) throws XAException;
/**
* Obtains a list of prepared transaction branches from a resource
* manager. The transaction manager calls this method during recovery
* to obtain the list of transaction branches that are currently in
* prepared or heuristically completed states.
*
* @param flag One of TMSTARTRSCAN, TMENDRSCAN, TMNOFLAGS. TMNOFLAGS
* must be used when no other flags are set in the parameter.
*
* @exception XAException An error has occurred. Possible values are
* XAER_RMERR, XAER_RMFAIL, XAER_INVAL, and XAER_PROTO.
*
* @return The resource manager returns zero or more XIDs of the
* transaction branches that are currently in a prepared or
* heuristically completed state. If an error occurs during the
* operation, the resource manager should throw the appropriate
* XAException.
*/
Xid[] recover(int flag) throws XAException;
/**
* Informs the resource manager to roll back work done on behalf
* of a transaction branch.
*
* @param xid A global transaction identifier.
*
* @exception XAException An error has occurred.
*/
void rollback(Xid xid) throws XAException;
/**
* Sets the current transaction timeout value for this <CODE>XAResource</CODE>
* instance. Once set, this timeout value is effective until
* <code>setTransactionTimeout</code> is invoked again with a different
* value. To reset the timeout value to the default value used by the resource
* manager, set the value to zero.
*
* If the timeout operation is performed successfully, the method returns
* <i>true</i>; otherwise <i>false</i>. If a resource manager does not
* support explicitly setting the transaction timeout value, this method
* returns <i>false</i>.
*
* @param seconds The transaction timeout value in seconds.
*
* @return <i>true</i> if the transaction timeout value is set successfully;
* otherwise <i>false</i>.
*
* @exception XAException An error has occurred. Possible exception values
* are XAER_RMERR, XAER_RMFAIL, or XAER_INVAL.
*/
boolean setTransactionTimeout(int seconds) throws XAException;
/**
* Starts work on behalf of a transaction branch specified in
* <code>xid</code>.
*
* If TMJOIN is specified, the start applies to joining a transaction
* previously seen by the resource manager. If TMRESUME is specified,
* the start applies to resuming a suspended transaction specified in the
* parameter <code>xid</code>.
*
* If neither TMJOIN nor TMRESUME is specified and the transaction
* specified by <code>xid</code> has previously been seen by the resource
* manager, the resource manager throws the XAException exception with
* XAER_DUPID error code.
*
* @param xid A global transaction identifier to be associated
* with the resource.
*
* @param flags One of TMNOFLAGS, TMJOIN, or TMRESUME.
*
* @exception XAException An error has occurred. Possible exceptions
* are XA_RB*, XAER_RMERR, XAER_RMFAIL, XAER_DUPID, XAER_OUTSIDE,
* XAER_NOTA, XAER_INVAL, or XAER_PROTO.
*/
void start(Xid xid, int flags) throws XAException;
/**
* Ends a recovery scan.
*/
public final static int TMENDRSCAN = 0x00800000;
/**
* Disassociates the caller and marks the transaction branch
* rollback-only.
*/
public final static int TMFAIL = 0x20000000;
/**
* Caller is joining existing transaction branch.
*/
public final static int TMJOIN = 0x00200000;
/**
* Use TMNOFLAGS to indicate no flags value is selected.
*/
public final static int TMNOFLAGS = 0x00000000;
/**
* Caller is using one-phase optimization.
*/
public final static int TMONEPHASE = 0x40000000;
/**
* Caller is resuming association with a suspended
* transaction branch.
*/
public final static int TMRESUME = 0x08000000;
/**
* Starts a recovery scan.
*/
public final static int TMSTARTRSCAN = 0x01000000;
/**
* Disassociates caller from a transaction branch.
*/
public final static int TMSUCCESS = 0x04000000;
/**
* Caller is suspending (not ending) its association with
* a transaction branch.
*/
public final static int TMSUSPEND = 0x02000000;
/**
* The transaction branch has been read-only and has been committed.
*/
public final static int XA_RDONLY = 0x00000003;
/**
* The transaction work has been prepared normally.
*/
public final static int XA_OK = 0;
}

View File

@ -36,15 +36,14 @@ package javax.transaction;
* context. For example, this exception could be raised if an error
* occured when trying to register a resource.
*/
public class InvalidTransactionException extends java.rmi.RemoteException
{
public InvalidTransactionException()
{
@SuppressWarnings("serial") // serialVersionUID intentionally omitted
public class InvalidTransactionException extends java.rmi.RemoteException {
public InvalidTransactionException() {
super();
}
public InvalidTransactionException(String msg)
{
public InvalidTransactionException(String msg) {
super(msg);
}
}

View File

@ -35,15 +35,14 @@ package javax.transaction;
* This exception indicates that a request carried a null transaction context,
* but the target object requires an activate transaction.
*/
public class TransactionRequiredException extends java.rmi.RemoteException
{
public TransactionRequiredException()
{
@SuppressWarnings("serial") // serialVersionUID intentionally omitted
public class TransactionRequiredException extends java.rmi.RemoteException {
public TransactionRequiredException() {
super();
}
public TransactionRequiredException(String msg)
{
public TransactionRequiredException(String msg) {
super(msg);
}
}

View File

@ -38,15 +38,14 @@ package javax.transaction;
* because further computation on behalf of the transaction would be
* fruitless
*/
public class TransactionRolledbackException extends java.rmi.RemoteException
{
public TransactionRolledbackException()
{
@SuppressWarnings("serial") // serialVersionUID intentionally omitted
public class TransactionRolledbackException extends java.rmi.RemoteException {
public TransactionRolledbackException() {
super();
}
public TransactionRolledbackException(String msg)
{
public TransactionRolledbackException(String msg) {
super(msg);
}
}

View File

@ -21,7 +21,7 @@
* under the License.
*/
/*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
*/
/*
* $Id: DOMKeyValue.java 1333415 2012-05-03 12:03:51Z coheigea $
@ -33,20 +33,19 @@ import javax.xml.crypto.dom.DOMCryptoContext;
import javax.xml.crypto.dsig.*;
import javax.xml.crypto.dsig.keyinfo.KeyValue;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.io.IOException;
import java.math.BigInteger;
import java.security.KeyException;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.security.PublicKey;
import java.security.interfaces.DSAParams;
import java.security.interfaces.DSAPublicKey;
import java.security.interfaces.ECPublicKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.DSAPublicKeySpec;
import java.security.spec.ECField;
import java.security.spec.ECFieldFp;
import java.security.spec.ECParameterSpec;
import java.security.spec.ECPoint;
import java.security.spec.ECPublicKeySpec;
@ -54,6 +53,7 @@ import java.security.spec.EllipticCurve;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.KeySpec;
import java.security.spec.RSAPublicKeySpec;
import java.util.Arrays;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@ -325,55 +325,112 @@ public abstract class DOMKeyValue extends DOMStructure implements KeyValue {
private byte[] ecPublicKey;
private KeyFactory eckf;
private ECParameterSpec ecParams;
private Method encodePoint, decodePoint, getCurveName,
getECParameterSpec;
// The supported curve, secp256r1
private static final Curve SECP256R1;
static {
final String name, oid, sfield, a, b, x, y, n;
name = "secp256r1 [NIST P-256, X9.62 prime256v1]";
oid = "1.2.840.10045.3.1.7";
sfield =
"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF";
a =
"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC";
b =
"5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B";
x =
"6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296";
y =
"4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5";
n =
"FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551";
final int h = 1;
BigInteger p = bigInt(sfield);
ECField field = new ECFieldFp(p);
EllipticCurve curve = new EllipticCurve(field, bigInt(a),
bigInt(b));
ECPoint g = new ECPoint(bigInt(x), bigInt(y));
SECP256R1 = new Curve(name, oid, curve, g, bigInt(n), h);
}
EC(PublicKey key) throws KeyException {
super(key);
ECPublicKey ecKey = (ECPublicKey)key;
ECPoint ecPoint = ecKey.getW();
ecParams = ecKey.getParams();
try {
AccessController.doPrivileged(
new PrivilegedExceptionAction<Void>() {
public Void run() throws
ClassNotFoundException, NoSuchMethodException
{
getMethods();
return null;
}
}
);
} catch (PrivilegedActionException pae) {
throw new KeyException("ECKeyValue not supported",
pae.getException());
}
Object[] args = new Object[] { ecPoint, ecParams.getCurve() };
try {
ecPublicKey = (byte[])encodePoint.invoke(null, args);
} catch (IllegalAccessException iae) {
throw new KeyException(iae);
} catch (InvocationTargetException ite) {
throw new KeyException(ite);
}
ecPublicKey = encodePoint(ecPoint, ecParams.getCurve());
}
EC(Element dmElem) throws MarshalException {
super(dmElem);
}
void getMethods() throws ClassNotFoundException, NoSuchMethodException {
Class<?> c = Class.forName("sun.security.util.ECParameters");
Class<?>[] params = new Class<?>[] { ECPoint.class,
EllipticCurve.class };
encodePoint = c.getMethod("encodePoint", params);
params = new Class<?>[] { ECParameterSpec.class };
getCurveName = c.getMethod("getCurveName", params);
params = new Class<?>[] { byte[].class, EllipticCurve.class };
decodePoint = c.getMethod("decodePoint", params);
c = Class.forName("sun.security.util.NamedCurve");
params = new Class<?>[] { String.class };
getECParameterSpec = c.getMethod("getECParameterSpec", params);
private static ECPoint decodePoint(byte[] data, EllipticCurve curve)
throws IOException {
if ((data.length == 0) || (data[0] != 4)) {
throw new IOException("Only uncompressed point format " +
"supported");
}
// Per ANSI X9.62, an encoded point is a 1 byte type followed by
// ceiling(log base 2 field-size / 8) bytes of x and the same of y.
int n = (data.length - 1) / 2;
if (n != ((curve.getField().getFieldSize() + 7) >> 3)) {
throw new IOException("Point does not match field size");
}
byte[] xb = Arrays.copyOfRange(data, 1, 1 + n);
byte[] yb = Arrays.copyOfRange(data, n + 1, n + 1 + n);
return new ECPoint(new BigInteger(1, xb), new BigInteger(1, yb));
}
private static byte[] encodePoint(ECPoint point, EllipticCurve curve) {
// get field size in bytes (rounding up)
int n = (curve.getField().getFieldSize() + 7) >> 3;
byte[] xb = trimZeroes(point.getAffineX().toByteArray());
byte[] yb = trimZeroes(point.getAffineY().toByteArray());
if ((xb.length > n) || (yb.length > n)) {
throw new RuntimeException("Point coordinates do not " +
"match field size");
}
byte[] b = new byte[1 + (n << 1)];
b[0] = 4; // uncompressed
System.arraycopy(xb, 0, b, n - xb.length + 1, xb.length);
System.arraycopy(yb, 0, b, b.length - yb.length, yb.length);
return b;
}
private static byte[] trimZeroes(byte[] b) {
int i = 0;
while ((i < b.length - 1) && (b[i] == 0)) {
i++;
}
if (i == 0) {
return b;
}
return Arrays.copyOfRange(b, i, b.length);
}
private static String getCurveOid(ECParameterSpec params) {
// Check that the params represent the secp256r1 curve
// If so, return the object identifier of the curve
int fieldSize = params.getCurve().getField().getFieldSize();
if (SECP256R1.getCurve().getField().getFieldSize() == fieldSize
&& SECP256R1.getCurve().equals(params.getCurve())
&& SECP256R1.getGenerator().equals(params.getGenerator())
&& SECP256R1.getOrder().equals(params.getOrder())
&& SECP256R1.getCofactor() == params.getCofactor()) {
return SECP256R1.getObjectId();
}
return null;
}
private static ECParameterSpec getECParameterSpec(String oid) {
if (oid.equals(SECP256R1.getObjectId())) {
return SECP256R1;
}
return null;
}
void marshalPublicKey(Node parent, Document doc, String dsPrefix,
@ -391,14 +448,11 @@ public abstract class DOMKeyValue extends DOMStructure implements KeyValue {
XMLDSIG_11_XMLNS,
prefix);
Object[] args = new Object[] { ecParams };
try {
String oid = (String) getCurveName.invoke(null, args);
DOMUtils.setAttribute(namedCurveElem, "URI", "urn:oid:" + oid);
} catch (IllegalAccessException iae) {
throw new MarshalException(iae);
} catch (InvocationTargetException ite) {
throw new MarshalException(ite);
String oid = getCurveOid(ecParams);
if (oid == null) {
throw new MarshalException("Invalid ECParameterSpec");
}
DOMUtils.setAttribute(namedCurveElem, "URI", "urn:oid:" + oid);
String qname = (prefix == null || prefix.length() == 0)
? "xmlns" : "xmlns:" + prefix;
namedCurveElem.setAttributeNS("http://www.w3.org/2000/xmlns/",
@ -422,21 +476,6 @@ public abstract class DOMKeyValue extends DOMStructure implements KeyValue {
("unable to create EC KeyFactory: " + e.getMessage());
}
}
try {
AccessController.doPrivileged(
new PrivilegedExceptionAction<Void>() {
public Void run() throws
ClassNotFoundException, NoSuchMethodException
{
getMethods();
return null;
}
}
);
} catch (PrivilegedActionException pae) {
throw new MarshalException("ECKeyValue not supported",
pae.getException());
}
ECParameterSpec ecParams = null;
Element curElem = DOMUtils.getFirstChildElement(kvtElem);
if (curElem.getLocalName().equals("ECParameters")) {
@ -447,14 +486,9 @@ public abstract class DOMKeyValue extends DOMStructure implements KeyValue {
// strip off "urn:oid"
if (uri.startsWith("urn:oid:")) {
String oid = uri.substring(8);
try {
Object[] args = new Object[] { oid };
ecParams = (ECParameterSpec)
getECParameterSpec.invoke(null, args);
} catch (IllegalAccessException iae) {
throw new MarshalException(iae);
} catch (InvocationTargetException ite) {
throw new MarshalException(ite);
ecParams = getECParameterSpec(oid);
if (ecParams == null) {
throw new MarshalException("Invalid curve OID");
}
} else {
throw new MarshalException("Invalid NamedCurve URI");
@ -464,24 +498,43 @@ public abstract class DOMKeyValue extends DOMStructure implements KeyValue {
}
curElem = DOMUtils.getNextSiblingElement(curElem, "PublicKey");
ECPoint ecPoint = null;
try {
Object[] args = new Object[] { Base64.decode(curElem),
ecParams.getCurve() };
ecPoint = (ECPoint)decodePoint.invoke(null, args);
ecPoint = decodePoint(Base64.decode(curElem),
ecParams.getCurve());
} catch (Base64DecodingException bde) {
throw new MarshalException("Invalid EC PublicKey", bde);
} catch (IllegalAccessException iae) {
throw new MarshalException(iae);
} catch (InvocationTargetException ite) {
throw new MarshalException(ite);
} catch (IOException ioe) {
throw new MarshalException("Invalid EC Point", ioe);
}
/*
ecPoint = sun.security.util.ECParameters.decodePoint(
Base64.decode(curElem), ecParams.getCurve());
*/
ECPublicKeySpec spec = new ECPublicKeySpec(ecPoint, ecParams);
return generatePublicKey(eckf, spec);
}
static final class Curve extends ECParameterSpec {
private final String name;
private final String oid;
Curve(String name, String oid, EllipticCurve curve,
ECPoint g, BigInteger n, int h) {
super(curve, g, n, h);
this.name = name;
this.oid = oid;
}
private String getName() {
return name;
}
private String getObjectId() {
return oid;
}
}
}
private static BigInteger bigInt(String s) {
return new BigInteger(s, 16);
}
static final class Unknown extends DOMKeyValue {

View File

@ -154,6 +154,9 @@ com/sun/management/OperatingSystemMXBean/GetProcessCpuLoad.java aix-all
com/sun/management/OperatingSystemMXBean/GetSystemCpuLoad.java aix-all
javax/management/MBeanServer/OldMBeanServerTest.java aix-all
# 8042215
javax/management/remote/mandatory/notif/NotifReconnectDeadlockTest.java generic-all
############################################################################
# jdk_math

View File

@ -75,13 +75,13 @@ ${TESTJAVA}${FS}bin${FS}java -version
mkdir bug
cp ${TESTSRC}${FS}bug.idl .
${TESTJAVA}${FS}bin${FS}idlj bug.idl
${COMPILEJAVA}${FS}bin${FS}idlj bug.idl
cp ${TESTSRC}${FS}JavaBug.java bug
chmod -fR 777 bug
${TESTJAVA}${FS}bin${FS}javac -d . bug${FS}*.java
${COMPILEJAVA}${FS}bin${FS}javac -d . bug${FS}*.java
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp . bug/JavaBug > test.out 2>&1

View File

@ -55,8 +55,8 @@ PORT=1052
cp -r ${TESTSRC}${FS}*.java ${TESTSRC}${FS}Hello.idl .
echo "Testing...please wait"
${TESTJAVA}${FS}bin${FS}idlj -fall Hello.idl
${TESTJAVA}${FS}bin${FS}javac *.java HelloApp/*.java
${COMPILEJAVA}${FS}bin${FS}idlj -fall Hello.idl
${COMPILEJAVA}${FS}bin${FS}javac *.java HelloApp/*.java
echo "starting orbd"
${TESTJAVA}${FS}bin${FS}orbd -ORBInitialPort $PORT -ORBInitialHost localhost &

View File

@ -27,39 +27,52 @@
public class TestUtility {
private static final String digits = "0123456789abcdef";
private static final String DIGITS = "0123456789abcdef";
public TestUtility() {
private TestUtility() {
}
public static String hexDump(byte[] bytes) {
StringBuffer buf = new StringBuffer (bytes.length * 2);
int i;
StringBuilder buf = new StringBuilder(bytes.length * 2);
int i;
buf.append (" "); // four spaces
buf.append(" "); // four spaces
for (i = 0; i < bytes.length; i++) {
buf.append (digits.charAt ((bytes[i] >> 4) & 0x0f));
buf.append (digits.charAt (bytes[i] & 0x0f));
if (((i + 1) % 32) == 0) {
if ((i + 1) != bytes.length)
buf.append ("\n "); // line after four words
} else if (((i + 1) % 4) == 0)
buf.append (' '); // space between words
buf.append(DIGITS.charAt(bytes[i] >> 4 & 0x0f));
buf.append(DIGITS.charAt(bytes[i] & 0x0f));
if ((i + 1) % 32 == 0) {
if (i + 1 != bytes.length) {
buf.append("\n "); // line after four words
}
} else if ((i + 1) % 4 == 0) {
buf.append(' '); // space between words
}
}
return buf.toString ();
return buf.toString();
}
public static String hexDump(byte[] bytes, int index) {
StringBuilder buf = new StringBuilder(bytes.length * 2);
int i;
buf.append(" "); // four spaces
buf.append(DIGITS.charAt(bytes[index] >> 4 & 0x0f));
buf.append(DIGITS.charAt(bytes[index] & 0x0f));
return buf.toString();
}
public static boolean equalsBlock(byte[] b1, byte[] b2) {
if (b1.length != b2.length)
if (b1.length != b2.length) {
return false;
}
for (int i=0; i<b1.length; i++) {
if (b1[i] != b2[i])
for (int i = 0; i < b1.length; i++) {
if (b1[i] != b2[i]) {
return false;
}
}
return true;
@ -67,9 +80,10 @@ public class TestUtility {
public static boolean equalsBlock(byte[] b1, byte[] b2, int len) {
for (int i=0; i<len; i++) {
if (b1[i] != b2[i])
for (int i = 0; i < len; i++) {
if (b1[i] != b2[i]) {
return false;
}
}
return true;

View File

@ -25,7 +25,7 @@ import java.io.*;
/**
* @test
* @bug 7015589
* @bug 7015589 8054565
* @summary Test that buffering streams are considered closed even when the
* close or flush from the underlying stream fails.
*/
@ -165,7 +165,7 @@ public class FailingFlushAndClose {
}
}
static void testFailingClose(InputStream in) throws IOException {
static InputStream testFailingClose(InputStream in) throws IOException {
System.out.println(in.getClass());
in.read(new byte[100]);
try {
@ -176,9 +176,10 @@ public class FailingFlushAndClose {
in.read(new byte[100]);
fail("read did not fail");
} catch (IOException expected) { }
return in;
}
static void testFailingClose(OutputStream out) throws IOException {
static OutputStream testFailingClose(OutputStream out) throws IOException {
System.out.println(out.getClass());
out.write(1);
try {
@ -190,9 +191,10 @@ public class FailingFlushAndClose {
if (!(out instanceof BufferedOutputStream))
fail("write did not fail");
} catch (IOException expected) { }
return out;
}
static void testFailingFlush(OutputStream out) throws IOException {
static OutputStream testFailingFlush(OutputStream out) throws IOException {
System.out.println(out.getClass());
out.write(1);
try {
@ -206,9 +208,27 @@ public class FailingFlushAndClose {
fail("close did not fail");
} catch (IOException expected) { }
}
return out;
}
static void testFailingClose(Reader r) throws IOException {
static void closeAgain(InputStream in) throws IOException {
// assert the given stream should already be closed.
try {
in.close();
} catch (IOException expected) {
fail("unexpected IOException from subsequent close");
}
}
static void closeAgain(OutputStream out) throws IOException {
// assert the given stream should already be closed.
try {
out.close();
} catch (IOException expected) {
fail("unexpected IOException from subsequent close");
}
}
static Reader testFailingClose(Reader r) throws IOException {
System.out.println(r.getClass());
r.read(new char[100]);
try {
@ -219,9 +239,10 @@ public class FailingFlushAndClose {
r.read(new char[100]);
fail("read did not fail");
} catch (IOException expected) { }
return r;
}
static void testFailingClose(Writer w) throws IOException {
static Writer testFailingClose(Writer w) throws IOException {
System.out.println(w.getClass());
w.write("message");
try {
@ -232,9 +253,10 @@ public class FailingFlushAndClose {
w.write("another message");
fail("write did not fail");
} catch (IOException expected) { }
return w;
}
static void testFailingFlush(Writer w) throws IOException {
static Writer testFailingFlush(Writer w) throws IOException {
System.out.println(w.getClass());
w.write("message");
try {
@ -249,18 +271,38 @@ public class FailingFlushAndClose {
fail("close did not fail");
} catch (IOException expected) { }
}
return w;
}
static Reader closeAgain(Reader r) throws IOException {
// assert the given stream should already be closed.
try {
r.close();
} catch (IOException expected) {
fail("unexpected IOException from subsequent close");
}
return r;
}
static Writer closeAgain(Writer w) throws IOException {
// assert the given stream should already be closed.
try {
w.close();
} catch (IOException expected) {
fail("unexpected IOException from subsequent close");
}
return w;
}
public static void main(String[] args) throws IOException {
testFailingClose(new BufferedInputStream(new FailingCloseInputStream()));
testFailingClose(new BufferedOutputStream(new FailingCloseOutputStream()));
closeAgain(testFailingClose(new BufferedInputStream(new FailingCloseInputStream())));
closeAgain(testFailingClose(new BufferedOutputStream(new FailingCloseOutputStream())));
testFailingClose(new BufferedReader(new FailingCloseReader()));
testFailingClose(new BufferedWriter(new FailingCloseWriter()));
closeAgain(testFailingClose(new BufferedReader(new FailingCloseReader())));
closeAgain(testFailingClose(new BufferedWriter(new FailingCloseWriter())));
testFailingFlush(new BufferedOutputStream(new FailingFlushOutputStream()));
testFailingFlush(new BufferedWriter(new FailingFlushWriter()));
closeAgain(testFailingFlush(new BufferedOutputStream(new FailingFlushOutputStream())));
closeAgain(testFailingFlush(new BufferedWriter(new FailingFlushWriter())));
if (failed > 0)
throw new RuntimeException(failed + " test(s) failed - see log for details");

View File

@ -23,7 +23,7 @@
/*
* @test
* @bug 4181191 4161971 4227146 4194389 4823171 4624738 4812225 4837946
* @bug 4181191 4161971 4227146 4194389 4823171 4624738 4812225 4837946 4026465
* @summary tests methods in BigInteger
* @run main/timeout=400 BigIntegerTest
* @author madbot
@ -89,6 +89,120 @@ public class BigIntegerTest {
static Random rnd = new Random();
static boolean failure = false;
public static void constructor() {
int failCount = 0;
// --- guard condition tests for array indexing ---
int arrayLength = 23;
int halfLength = arrayLength/2;
byte[] array = new byte[arrayLength];
rnd.nextBytes(array);
int[][] offLen = new int[][] { // offset, length, num exceptions
{-1, arrayLength, 1}, // negative offset
{0, arrayLength, 0}, // OK
{1, arrayLength, 1}, // length overflow
{arrayLength - 1, 1, 0}, // OK
{arrayLength, 1, 1}, // offset overflow
{0, -1, 1}, // negative length
{halfLength, arrayLength - halfLength + 1, 1} // length overflow
};
// two's complement
for (int[] ol : offLen) {
int numExceptions = 0;
try {
BigInteger bi = new BigInteger(array, ol[0], ol[1]);
} catch (IndexOutOfBoundsException e) {
numExceptions++;
}
if (numExceptions != ol[2]) {
System.err.println("IndexOutOfBoundsException did not occur for "
+ " two's complement constructor with parameters offset "
+ ol[0] + " and length " + ol[1]);
failCount++;
}
}
// sign-magnitude
for (int[] ol : offLen) {
int numExceptions = 0;
try {
BigInteger bi = new BigInteger(1, array, ol[0], ol[1]);
} catch (IndexOutOfBoundsException e) {
numExceptions++;
}
if (numExceptions != ol[2]) {
System.err.println("IndexOutOfBoundsException did not occur for "
+ " sign-magnitude constructor with parameters offset "
+ ol[0] + " and length " + ol[1]);
failCount++;
}
}
// --- tests for creation of zero-valued BigIntegers ---
byte[] magZeroLength = new byte[0];
for (int signum = -1; signum <= 1; signum++) {
BigInteger bi = new BigInteger(signum, magZeroLength);
if (bi.compareTo(BigInteger.ZERO) != 0) {
System.err.println("A: Zero length BigInteger != 0 for signum " + signum);
failCount++;
}
}
for (int signum = -1; signum <= 1; signum++) {
BigInteger bi = new BigInteger(signum, magZeroLength, 0, 0);
if (bi.compareTo(BigInteger.ZERO) != 0) {
System.err.println("B: Zero length BigInteger != 0 for signum " + signum);
failCount++;
}
}
byte[] magNonZeroLength = new byte[42];
rnd.nextBytes(magNonZeroLength);
for (int signum = -1; signum <= 1; signum++) {
BigInteger bi = new BigInteger(signum, magNonZeroLength, 0, 0);
if (bi.compareTo(BigInteger.ZERO) != 0) {
System.err.println("C: Zero length BigInteger != 0 for signum " + signum);
failCount++;
}
}
// --- tests for accurate creation of non-zero BigIntegers ---
for (int i = 0; i < SIZE; i++) {
// create reference value via a different code path from those tested
BigInteger reference = new BigInteger(2 + rnd.nextInt(336), 4, rnd);
byte[] refArray = reference.toByteArray();
int refLen = refArray.length;
int factor = rnd.nextInt(5);
int objLen = refArray.length + factor*rnd.nextInt(refArray.length) + 1;
int offset = rnd.nextInt(objLen - refLen);
byte[] objArray = new byte[objLen];
System.arraycopy(refArray, 0, objArray, offset, refLen);
BigInteger twosComp = new BigInteger(objArray, offset, refLen);
if (twosComp.compareTo(reference) != 0) {
System.err.println("Two's-complement BigInteger not equal for offset " +
offset + " and length " + refLen);
failCount++;
}
boolean isNegative = rnd.nextBoolean();
BigInteger signMag = new BigInteger(isNegative ? -1 : 1, objArray, offset, refLen);
if (signMag.compareTo(isNegative ? reference.negate() : reference) != 0) {
System.err.println("Sign-magnitude BigInteger not equal for offset " +
offset + " and length " + refLen);
failCount++;
}
}
report("Constructor", failCount);
}
public static void pow(int order) {
int failCount1 = 0;
@ -961,6 +1075,8 @@ public class BigIntegerTest {
if (args.length >3)
order4 = (int)((Integer.parseInt(args[3]))* 3.333);
constructor();
prime();
nextProbablePrime();

View File

@ -25,7 +25,7 @@
* @bug 4652496
* @summary Test transferTo with different target channels
* @run main TransferToChannel
* @run main/othervm -Djdk.net.enableFastFileTransfer TransferToChannel
* @run main/othervm -Djdk.nio.enableFastFileTransfer TransferToChannel
*/
import java.nio.channels.FileChannel;

View File

@ -4,8 +4,8 @@
grant {
permission java.io.FilePermission "..${/}..${/}test.props", "read";
// test needs to communicate with the activation system
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
permission java.util.PropertyPermission "test.*", "read";
permission java.lang.RuntimePermission "getClassLoader";
};

View File

@ -1,10 +1,9 @@
/*
* security policy used by activation groups.
* security policy used by activation groups
*/
grant {
permission java.io.FilePermission "..${/}..${/}test.props", "read";
// test needs to communicate with the activation system
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
permission java.util.PropertyPermission "test.*", "read";
};

View File

@ -4,10 +4,6 @@
grant {
permission java.io.FilePermission "..${/}..${/}test.props", "read";
// allow remote objects to be exported on arbitrary ports.
permission java.net.SocketPermission "*:1024-", "connect,accept";
// allow exporting object with non-public remote interface
permission java.rmi.RMIPermission "exportRemoteInterface.ActivateMe";
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
permission java.util.PropertyPermission "test.*", "read";
};

View File

@ -1,13 +1,9 @@
/*
* security policy used activation groups
* security policy used by activation groups
*/
grant {
permission java.io.FilePermission "..${/}..${/}test.props", "read";
// test needs to communicate with the activation system
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
// allow exporting object with non-public remote interface
permission java.rmi.RMIPermission "exportRemoteInterface.ActivateMe";
permission java.util.PropertyPermission "test.*", "read";
};

View File

@ -1,14 +1,15 @@
/*
* security policy used exec'ed activation groups
* security policy used by activation groups
*/
grant {
permission java.io.FilePermission "..${/}..${/}test.props", "read";
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
permission java.util.PropertyPermission "test.*", "read";
// need to load custom security manager and activation group from a new codebase
permission java.io.FilePermission ".${/}codebase1", "read,write,delete";
permission java.io.FilePermission ".${/}codebase1${/}-", "read,write";
permission java.io.FilePermission ".${/}codebase2", "read,write,delete";
permission java.io.FilePermission ".${/}codebase2${/}-", "read,write,delete";
// allow remote objects to be exported on arbitrary ports.
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
};

View File

@ -1,12 +1,13 @@
/*
* security policy used activation groups
* security policy used by activation groups
*/
grant {
permission java.io.FilePermission "..${/}..${/}test.props", "read";
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
permission java.util.PropertyPermission "test.*", "read";
// Needed because of bug#: 4182104
permission java.lang.RuntimePermission "modifyThreadGroup";
permission java.lang.RuntimePermission "modifyThread";
// allow remote objects to be exported on arbitrary ports.
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
};

View File

@ -1,8 +1,9 @@
/*
* security policy used exec'ed activation groups
* security policy used by activation groups
*/
grant {
// allow remote objects to be exported on arbitrary ports.
permission java.io.FilePermission "..${/}..${/}test.props", "read";
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
permission java.util.PropertyPermission "test.*", "read";
};

View File

@ -3,9 +3,7 @@
*/
grant {
// allow remote objects to be exported on arbitrary ports.
permission java.io.FilePermission "..${/}..${/}test.props", "read";
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
// allow exporting object with non-public remote interface
permission java.rmi.RMIPermission "exportRemoteInterface.ActivateMe";
permission java.util.PropertyPermission "test.*", "read";
};

View File

@ -4,10 +4,6 @@
grant {
permission java.io.FilePermission "..${/}..${/}test.props", "read";
// allow remote objects to be exported on arbitrary ports.
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
// allow exporting object with non-public remote interface
permission java.rmi.RMIPermission "exportRemoteInterface.ActivateMe";
permission java.util.PropertyPermission "test.*", "read";
};

View File

@ -1,13 +1,9 @@
/*
* security policy used by test activation groups
* security policy used by activation groups
*/
grant {
permission java.io.FilePermission "..${/}..${/}test.props", "read";
// allow remote objects to be exported on arbitrary ports.
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
// allow exporting of non-public remote interface
permission java.rmi.RMIPermission "exportRemoteInterface.ActivateMe";
permission java.util.PropertyPermission "test.*", "read";
};

View File

@ -4,7 +4,6 @@
grant {
permission java.io.FilePermission "..${/}..${/}test.props", "read";
// allow remote objects to be exported on arbitrary ports.
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
permission java.util.PropertyPermission "test.*", "read";
};

View File

@ -1,8 +1,9 @@
/*
* security policy used by test activation groups
* security policy used by activation groups
*/
grant {
// test needs to communicate with the activation system
permission java.io.FilePermission "..${/}..${/}test.props", "read";
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
permission java.util.PropertyPermission "test.*", "read";
};

View File

@ -3,6 +3,7 @@
*/
grant {
// allow remote objects to be exported on arbitrary ports.
permission java.io.FilePermission "..${/}..${/}test.props", "read";
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
permission java.util.PropertyPermission "test.*", "read";
};

View File

@ -3,6 +3,7 @@
*/
grant {
// allow remote objects to be exported on arbitrary ports.
permission java.io.FilePermission "..${/}..${/}test.props", "read";
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
permission java.util.PropertyPermission "test.*", "read";
};

View File

@ -1,10 +1,9 @@
/*
* security policy used activation groups
* security policy used by activation groups
*/
grant {
permission java.io.FilePermission "..${/}..${/}test.props", "read";
// test needs to communicate with the activation system
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
permission java.util.PropertyPermission "test.*", "read";
};

View File

@ -4,7 +4,6 @@
grant {
permission java.io.FilePermission "..${/}..${/}test.props", "read";
// allow remote objects to be exported on arbitrary ports.
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
permission java.util.PropertyPermission "test.*", "read";
};

View File

@ -1,8 +1,9 @@
/*
* security policy used activation groups
* security policy used by activation groups
*/
grant {
// test needs to communicate with the activation system
permission java.io.FilePermission "..${/}..${/}test.props", "read";
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
permission java.util.PropertyPermission "test.*", "read";
};

View File

@ -1,10 +1,11 @@
/*
* security policy used by downloaded activation group
* security policy used by activation groups
*/
grant {
permission java.io.FilePermission "..${/}..${/}test.props", "read";
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
permission java.util.PropertyPermission "test.*", "read";
permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.server";
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
};

View File

@ -4,10 +4,6 @@
grant {
permission java.io.FilePermission "..${/}..${/}test.props", "read";
// accomodate property used by this test.
permission java.util.PropertyPermission "test.message", "read";
// test needs to communicate with the activation system
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
permission java.util.PropertyPermission "test.*", "read";
};

View File

@ -1,13 +1,11 @@
/*
* security policy used by activation groups.
* security policy used by activation groups
*/
grant {
permission java.io.FilePermission "..${/}..${/}test.props", "read";
// give the group permission to create a class that the main test process can not create
permission java.lang.RuntimePermission "accessClassInPackage.sun.security.provider";
// test needs to communicate with the activation system
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
permission java.util.PropertyPermission "test.*", "read";
permission java.lang.RuntimePermission "accessClassInPackage.sun.security.provider";
};

View File

@ -4,8 +4,6 @@
grant {
permission java.io.FilePermission "..${/}..${/}test.props", "read";
// test needs to communicate with the activation system
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
permission java.util.PropertyPermission "unregisterGroup.port", "read";
permission java.util.PropertyPermission "test.*", "read";
};

View File

@ -1,8 +1,9 @@
/*
* security policy used by activation groups.
* security policy used by activation groups
*/
grant {
// test needs to communicate with the activation system
permission java.io.FilePermission "..${/}..${/}test.props", "read";
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
permission java.util.PropertyPermission "test.*", "read";
};

View File

@ -1,11 +1,9 @@
/*
* security policy used by the rmid process exec'ed by a running
* instance of the test.
* security policy used by activation groups
*/
grant {
permission java.io.FilePermission "..${/}..${/}test.props", "read";
// test needs to communicate with the activation system
permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
permission java.util.PropertyPermission "test.*", "read";
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2015, 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
@ -27,7 +27,7 @@
* The RemoteServer.setLog method requires
* java.util.log.LoggingPermission("control").
* @author Ann Wollrath
* @run main/othervm/policy=java.policy SetLogPermission
* @run main/othervm/policy=security.policy SetLogPermission
*/
import java.rmi.server.RemoteServer;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, 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
@ -40,20 +40,6 @@ import java.rmi.registry.LocateRegistry;
* objects.
*/
public class ActivationLibrary {
/** time safeDestroy should wait before failing on shutdown rmid */
private static final int SAFE_WAIT_TIME;
static {
int slopFactor = 1;
try {
slopFactor = Integer.valueOf(
TestLibrary.getExtraProperty("jcov.sleep.multiplier","1"));
} catch (NumberFormatException ignore) {}
SAFE_WAIT_TIME = 60000 * slopFactor;
}
private static final String SYSTEM_NAME =
ActivationSystem.class.getName();
private static void mesg(Object mesg) {
System.err.println("ACTIVATION_LIBRARY: " + mesg.toString());
}
@ -63,20 +49,19 @@ public class ActivationLibrary {
*/
public static void deactivate(Remote remote,
ActivationID id) {
// We do as much as 50 deactivation trials, each separated by
// at least 100 milliseconds sleep time (max sleep time of 5 secs).
final long deactivateSleepTime = 100;
long stopTime = System.currentTimeMillis() + deactivateSleepTime * 50;
while (System.currentTimeMillis() < stopTime) {
final long POLLTIME_MS = 100L;
final long DEACTIVATE_TIME_MS = 30_000L;
long startTime = System.currentTimeMillis();
long deadline = TestLibrary.computeDeadline(startTime, DEACTIVATE_TIME_MS);
while (System.currentTimeMillis() < deadline) {
try {
if (Activatable.inactive(id) == true) {
mesg("inactive successful");
return;
} else {
mesg("inactive trial failed. Sleeping " +
deactivateSleepTime +
" milliseconds before next trial");
Thread.sleep(deactivateSleepTime);
Thread.sleep(POLLTIME_MS);
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
@ -95,7 +80,8 @@ public class ActivationLibrary {
}
}
mesg("unable to inactivate after several attempts");
mesg("unable to inactivate after " +
(System.currentTimeMillis() - startTime) + "ms.");
mesg("unexporting object forcibly instead");
try {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, 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
@ -194,7 +194,7 @@ public class JavaVM {
throws InterruptedException, TimeoutException {
if (vm == null)
throw new IllegalStateException("can't wait for JavaVM that isn't running");
long deadline = computeDeadline(System.currentTimeMillis(), timeout);
long deadline = TestLibrary.computeDeadline(System.currentTimeMillis(), timeout);
while (true) {
try {
@ -218,21 +218,4 @@ public class JavaVM {
start();
return waitFor();
}
/**
* Computes a deadline from a timestamp and a timeout value.
* Maximum timeout (before multipliers are applied) is one hour.
*/
public static long computeDeadline(long timestamp, long timeout) {
final long MAX_TIMEOUT_MS = 3_600_000L;
if (timeout < 0L || timeout > MAX_TIMEOUT_MS) {
throw new IllegalArgumentException("timeout " + timeout + "ms out of range");
}
// TODO apply test.timeout.factor (and possibly jcov.sleep.multiplier)
// here instead of upstream
return timestamp + timeout;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, 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
@ -249,15 +249,15 @@ public class RMID extends JavaVM {
mesg("Starting rmid on port " + port + ".");
super.start();
int slopFactor = 1;
try {
slopFactor = Integer.valueOf(
TestLibrary.getExtraProperty("jcov.sleep.multiplier","1"));
} catch (NumberFormatException ignore) {}
waitTime = waitTime * slopFactor;
// int slopFactor = 1;
// try {
// slopFactor = Integer.valueOf(
// TestLibrary.getExtraProperty("jcov.sleep.multiplier","1"));
// } catch (NumberFormatException ignore) {}
// waitTime = waitTime * slopFactor;
long startTime = System.currentTimeMillis();
long deadline = computeDeadline(startTime, waitTime);
long deadline = TestLibrary.computeDeadline(startTime, waitTime);
while (true) {
try {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, 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
@ -135,7 +135,8 @@ public class TestLibrary {
*/
public static boolean checkIfRegistryRunning(int port, int msTimeout) {
long stopTime = System.currentTimeMillis() + msTimeout;
final long POLLTIME_MS = 100L;
long stopTime = computeDeadline(System.currentTimeMillis(), msTimeout);
do {
try {
Registry r = LocateRegistry.getRegistry(port);
@ -145,12 +146,12 @@ public class TestLibrary {
} catch (RemoteException e) {
// problem - not ready ? Try again
try {
Thread.sleep(500);
Thread.sleep(POLLTIME_MS);
} catch (InterruptedException ie) {
// not expected
}
}
} while (stopTime > System.currentTimeMillis());
} while (System.currentTimeMillis() < stopTime);
return false;
}
@ -169,6 +170,31 @@ public class TestLibrary {
}
}
public static double getTimeoutFactor() {
String prop = getProperty("test.timeout.factor", "1.0");
double timeoutFactor = 1.0;
try {
timeoutFactor = Double.parseDouble(prop);
} catch (NumberFormatException ignore) { }
return timeoutFactor;
}
/**
* Computes a deadline from a timestamp and a timeout value.
* Maximum timeout (before multipliers are applied) is one hour.
*/
public static long computeDeadline(long timestamp, long timeout) {
final long MAX_TIMEOUT_MS = 3_600_000L;
if (timeout < 0L || timeout > MAX_TIMEOUT_MS) {
throw new IllegalArgumentException("timeout " + timeout + "ms out of range");
}
return timestamp + (long)(timeout * getTimeoutFactor());
}
/**
* Property mutators
*/

View File

@ -1154,6 +1154,10 @@ public class Basic$Type$ extends Basic {
test("%.5f", "0.99960", val);
test("%.6f", "0.999600", val);
val = new BigDecimal(BigInteger.ZERO, 6);
test("%.4f", "0.0000", val);
val = new BigDecimal(BigInteger.ZERO, -6);
test("%.4f", "0.0000", val);
#end[BigDecimal]
#if[float]

View File

@ -26,6 +26,7 @@
* @bug 4906370 4962433 4973103 4989961 5005818 5031150 4970931 4989491 5002937
* 5005104 5007745 5061412 5055180 5066788 5088703 6317248 6318369 6320122
* 6344623 6369500 6534606 6282094 6286592 6476425 5063507 6469160 6476168
* 8059175
*
* @run shell/timeout=240 Basic.sh
*/

View File

@ -1154,6 +1154,11 @@ public class BasicBigDecimal extends Basic {
test("%.5f", "0.99960", val);
test("%.6f", "0.999600", val);
val = new BigDecimal(BigInteger.ZERO, 6);
test("%.4f", "0.0000", val);
val = new BigDecimal(BigInteger.ZERO, -6);
test("%.4f", "0.0000", val);

View File

@ -0,0 +1,121 @@
/*
* Copyright (c) 2015, 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.
*/
import java.io.PrintStream;
import java.lang.String;
import java.lang.System;
import java.security.Provider;
import java.security.SecureRandom;
import java.security.Security;
import javax.crypto.KeyGenerator;
import static java.lang.System.out;
/*
* @test
* @bug 8048607
* @compile ../../../com/sun/crypto/provider/Cipher/DES/TestUtility.java
* @summary Test key generation of DES and DESEDE
*/
public class TestKGParity {
private static final String[] ALGORITHM_ARR = {
"deS", "DesEDE"
};
public static void main(String argv[]) throws Exception {
TestKGParity test = new TestKGParity();
test.run();
}
private void run() throws Exception {
Provider[] providers = Security.getProviders();
for (Provider p : providers) {
String prvName = p.getName();
if (prvName.startsWith("SunJCE")
|| prvName.startsWith("SunPKCS11-")) {
for (String algorithm : ALGORITHM_ARR) {
if (!runTest(p, algorithm)) {
throw new RuntimeException(
"Test failed with provider/algorithm:"
+ p.getName() + "/" + algorithm);
} else {
out.println("Test passed with provider/algorithm:"
+ p.getName() + "/" + algorithm);
}
}
}
}
}
public boolean runTest(Provider p, String algo) throws Exception {
byte[] keyValue = null;
try {
// Initialization
SecureRandom sRdm = new SecureRandom();
KeyGenerator kg = KeyGenerator.getInstance(algo, p);
kg.init(sRdm);
// Generate a SecretKey and retrieve its value
keyValue = kg.generateKey().getEncoded();
// Verify its parity in the unit of byte
for (int i = 0; i < keyValue.length; i++) {
if (!checkParity(keyValue[i])) {
out.println("Testing: "
+ p.getName()
+ "/"
+ algo
+ " failed when verify its parity in the unit of byte:"
+ TestUtility.hexDump(keyValue, i));
return false;
}
}
return true;
} catch (Exception ex) {
out.println("Testing: " + p.getName() + "/" + algo
+ " failed with unexpected exception");
ex.printStackTrace();
throw ex;
}
}
private boolean checkParity(byte keyByte) {
boolean even = false;
byte[] PARITY_BIT_MASK = {
(byte) 0x40, (byte) 0x20, (byte) 0x10, (byte) 0x08,
(byte) 0x04, (byte) 0x02, (byte) 0x01
};
for (int i = 0; i < 7; i++) {
if ((keyByte & PARITY_BIT_MASK[i]) > 0) {
even = !even;
}
}
if (keyByte < 0) {
even = !even;
}
return even;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2015, 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
@ -24,7 +24,8 @@
/*
* @test
* @bug 6239400
* @summary Tests NotificationBuffer doesn't hold locks when adding listeners.
* @summary Tests NotificationBuffer doesn't hold locks when adding listeners,
* if test times out then deadlock is suspected.
* @author Eamonn McManus
* @run clean NotificationBufferDeadlockTest
* @run build NotificationBufferDeadlockTest
@ -38,6 +39,7 @@ import java.net.MalformedURLException;
import java.util.List;
import java.util.Set;
import java.util.Vector;
import java.util.concurrent.CountDownLatch;
import javax.management.*;
import javax.management.remote.*;
@ -173,9 +175,7 @@ public class NotificationBufferDeadlockTest {
for (ObjectName name : names)
mbsc.invoke(name, "send", null, null);
if (!countListener.waiting(MAX_WAITING_TIME)) {
return "did not get " + names.size() + " notifs as expected\n";
}
countListener.waiting();
if (!sources.containsAll(names))
return "missing names: " + sources;
@ -202,13 +202,13 @@ public class NotificationBufferDeadlockTest {
}
};
t.start();
System.out.println("DeadlockTest-addNotificationListener waiting for the sending thread to die...");
try {
t.join(5000L);
t.join(); //if times out here then deadlock is suspected
System.out.println("DeadlockTest-addNotificationListener OK.");
} catch (Exception e) {
thisFailure = "Join exception: " + e;
}
if (t.isAlive())
thisFailure = "Deadlock detected";
}
public void send() {
@ -244,9 +244,9 @@ public class NotificationBufferDeadlockTest {
}
};
t.start();
t.join(5000);
if (t.isAlive())
failure = "Query deadlock detected";
System.out.println("CreateDuringQueryInvocationHandler-createMBeanIfQuery waiting for the creating thread to die...");
t.join(); // if times out here then deadlock is suspected
System.out.println("CreateDuringQueryInvocationHandler-createMBeanIfQuery OK");
}
}
@ -264,50 +264,30 @@ public class NotificationBufferDeadlockTest {
private static class MyListener implements NotificationListener {
public MyListener(int waitNB) {
this.waitNB= waitNB;
count = new CountDownLatch(waitNB);
}
public void handleNotification(Notification n, Object h) {
System.out.println("MyListener got: "+n.getSource()+" "+n.getType());
System.out.println("MyListener got: " + n.getSource() + " " + n.getType());
synchronized(this) {
if (TESTING_TYPE.equals(n.getType())) {
sources.add((ObjectName) n.getSource());
if (sources.size() == waitNB) {
this.notifyAll();
}
}
if (TESTING_TYPE.equals(n.getType())) {
sources.add((ObjectName) n.getSource());
count.countDown();
}
}
public boolean waiting(long timeout) {
final long startTime = System.currentTimeMillis();
long toWait = timeout;
synchronized(this) {
while(sources.size() < waitNB && toWait > 0) {
try {
this.wait(toWait);
} catch (InterruptedException ire) {
break;
}
toWait = timeout -
(System.currentTimeMillis() - startTime);
}
}
return sources.size() == waitNB;
public void waiting() throws InterruptedException {
System.out.println("MyListener-waiting ...");
count.await(); // if times out here then deadlock is suspected
System.out.println("MyListener-waiting done!");
}
private final int waitNB;
private final CountDownLatch count;
}
static String thisFailure;
static String failure;
static int nextNameIndex;
static final long MAX_WAITING_TIME = 10000;
private static MyListener countListener;
private static final List<ObjectName> sources = new Vector();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2015, 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
@ -24,6 +24,7 @@
/**
* @test
* @bug 4635230 6283345 6303830 6824440 6867348 7094155 8038184 8038349 8046949
* 8046724
* @summary Basic unit tests for generating XML Signatures with JSR 105
* @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java
* X509KeySelector.java GenerationTests.java
@ -45,6 +46,13 @@ import java.security.cert.X509CRL;
import java.security.spec.KeySpec;
import java.security.spec.DSAPrivateKeySpec;
import java.security.spec.DSAPublicKeySpec;
import java.security.spec.ECField;
import java.security.spec.ECFieldFp;
import java.security.spec.ECParameterSpec;
import java.security.spec.ECPoint;
import java.security.spec.ECPrivateKeySpec;
import java.security.spec.ECPublicKeySpec;
import java.security.spec.EllipticCurve;
import java.security.spec.RSAPrivateKeySpec;
import java.security.spec.RSAPublicKeySpec;
import java.util.*;
@ -81,9 +89,10 @@ public class GenerationTests {
private static DocumentBuilder db;
private static CanonicalizationMethod withoutComments;
private static SignatureMethod dsaSha1, dsaSha256, rsaSha1,
rsaSha256, rsaSha384, rsaSha512;
rsaSha256, rsaSha384, rsaSha512,
ecdsaSha1;
private static DigestMethod sha1, sha256, sha384, sha512;
private static KeyInfo dsa1024, dsa2048, rsa, rsa1024;
private static KeyInfo dsa1024, dsa2048, rsa, rsa1024, p256ki;
private static KeySelector kvks = new KeySelectors.KeyValueKeySelector();
private static KeySelector sks;
private static Key signingKey;
@ -121,6 +130,7 @@ public class GenerationTests {
test_create_signature_enveloping_hmac_sha384();
test_create_signature_enveloping_hmac_sha512();
test_create_signature_enveloping_rsa();
test_create_signature_enveloping_p256_sha1();
test_create_signature_external_b64_dsa();
test_create_signature_external_dsa();
test_create_signature_keyname();
@ -175,6 +185,8 @@ public class GenerationTests {
(kifac.newKeyValue(getPublicKey("RSA", 512))));
rsa1024 = kifac.newKeyInfo(Collections.singletonList
(kifac.newKeyValue(getPublicKey("RSA", 1024))));
p256ki = kifac.newKeyInfo(Collections.singletonList
(kifac.newKeyValue(getECPublicKey())));
rsaSha1 = fac.newSignatureMethod(SignatureMethod.RSA_SHA1, null);
rsaSha256 = fac.newSignatureMethod
("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", null);
@ -182,6 +194,8 @@ public class GenerationTests {
("http://www.w3.org/2001/04/xmldsig-more#rsa-sha384", null);
rsaSha512 = fac.newSignatureMethod
("http://www.w3.org/2001/04/xmldsig-more#rsa-sha512", null);
ecdsaSha1 = fac.newSignatureMethod
("http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1", null);
sks = new KeySelectors.SecretKeySelector("secret".getBytes("ASCII"));
httpUd = new HttpURIDereferencer();
@ -342,6 +356,13 @@ public class GenerationTests {
System.out.println();
}
static void test_create_signature_enveloping_p256_sha1() throws Exception {
System.out.println("* Generating signature-enveloping-p256-sha1.xml");
test_create_signature_enveloping(sha1, ecdsaSha1, p256ki,
getECPrivateKey(), kvks, false);
System.out.println();
}
static void test_create_signature_external_b64_dsa() throws Exception {
System.out.println("* Generating signature-external-b64-dsa.xml");
test_create_signature_external(dsaSha1, dsa1024, signingKey, kvks, true);
@ -1168,7 +1189,42 @@ public class GenerationTests {
"237008997971129772408397621801631622129297063463868593083106979716" +
"204903524890556839550490384015324575598723478554854070823335021842" +
"210112348400928769";
private static final String EC_X =
"335863644451761614592446380116804721648611739647823420286081723541" +
"6166183710";
private static final String EC_Y =
"951559601159729477487064127150143688502130342917782252098602422796" +
"95457910701";
private static final String EC_S =
"425976209773168452211813225517384419928639977904006759709292218082" +
"7440083936";
private static final ECParameterSpec EC_PARAMS;
static {
final String ec_sfield, ec_a, ec_b, ec_gx, ec_gy, ec_n;
ec_sfield =
"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF";
ec_a =
"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC";
ec_b =
"5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B";
ec_gx =
"6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296";
ec_gy =
"4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5";
ec_n =
"FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551";
final int ec_h = 1;
final ECField ec_field = new ECFieldFp(bigInt(ec_sfield));
final EllipticCurve ec_curve = new EllipticCurve(ec_field,
bigInt(ec_a), bigInt(ec_b));
final ECPoint ec_g = new ECPoint(bigInt(ec_gx), bigInt(ec_gy));
EC_PARAMS = new ECParameterSpec(ec_curve, ec_g, bigInt(ec_n), ec_h);
}
private static BigInteger bigInt(String s) {
return new BigInteger(s, 16);
}
private static PublicKey getPublicKey(String algo, int keysize)
throws Exception {
KeyFactory kf = KeyFactory.getInstance(algo);
@ -1197,6 +1253,14 @@ public class GenerationTests {
return kf.generatePublic(kspec);
}
private static PublicKey getECPublicKey() throws Exception {
KeyFactory kf = KeyFactory.getInstance("EC");
KeySpec kspec = new ECPublicKeySpec(new ECPoint(new BigInteger(EC_X),
new BigInteger(EC_Y)),
EC_PARAMS);
return kf.generatePublic(kspec);
}
private static PrivateKey getPrivateKey(String algo, int keysize)
throws Exception {
KeyFactory kf = KeyFactory.getInstance(algo);
@ -1223,6 +1287,12 @@ public class GenerationTests {
return kf.generatePrivate(kspec);
}
private static PrivateKey getECPrivateKey() throws Exception {
KeyFactory kf = KeyFactory.getInstance("EC");
KeySpec kspec = new ECPrivateKeySpec(new BigInteger(EC_S), EC_PARAMS);
return kf.generatePrivate(kspec);
}
private static SecretKey getSecretKey(final byte[] secret) {
return new SecretKey() {
public String getFormat() { return "RAW"; }

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2015, 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
@ -166,7 +166,6 @@ class KeySelectors {
throw new KeySelectorException("No KeyValue element found!");
}
//@@@FIXME: this should also work for key types other than DSA/RSA
static boolean algEquals(String algURI, String algName) {
if (algName.equalsIgnoreCase("DSA") &&
algURI.equals(SignatureMethod.DSA_SHA1) ||
@ -181,6 +180,10 @@ class KeySelectors {
algURI.equals
("http://www.w3.org/2001/04/xmldsig-more#rsa-sha512"))) {
return true;
} else if (algName.equalsIgnoreCase("EC") &&
(algURI.equals
("http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1"))) {
return true;
} else {
return false;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2015, 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
@ -23,7 +23,7 @@
/**
* @test
* @bug 4635230 6365103 6366054 6824440 7131084
* @bug 4635230 6365103 6366054 6824440 7131084 8046724
* @summary Basic unit tests for validating XML Signatures with JSR 105
* @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java
* X509KeySelector.java ValidationTests.java
@ -90,6 +90,7 @@ public class ValidationTests {
new Test("signature-enveloping-b64-dsa.xml", KVKS),
new Test("signature-enveloping-dsa.xml", KVKS),
new Test("signature-enveloping-rsa.xml", KVKS),
new Test("signature-enveloping-p256-sha1.xml", KVKS),
new Test("signature-enveloping-hmac-sha1.xml", SKKS),
new Test("signature-external-dsa.xml", KVKS),
new Test("signature-external-b64-dsa.xml", KVKS),

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/><SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1"/><Reference URI="#object"><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><DigestValue>7/XTsHaBSOnJ/jXD5v0zL6VKYsk=</DigestValue></Reference></SignedInfo><SignatureValue>WiF/Hd0s7BiH36Ds/1iJcbKiXOUVBSGFteuTjXwBbezR43NAwpMmMX5c1su0A9hG9rVVzE/1DOlO
vuDVLBBblg==</SignatureValue><KeyInfo><KeyValue><ECKeyValue xmlns="http://www.w3.org/2009/xmldsig11#"><NamedCurve URI="urn:oid:1.2.840.10045.3.1.7"/><PublicKey>BAds672US3sCYunM2k2bEQLbuRxdQlNTvq+5fitOpDMe0mBdZV4J3yZaG0taziYIuAT9GJGfds+q
xtXOCNWe/60=</PublicKey></ECKeyValue></KeyValue></KeyInfo><Object Id="object">some text</Object></Signature>

View File

@ -35,6 +35,9 @@ ifneq ($(CYGPATH), )
ifdef JPRT_ARCHIVE_INSTALL_BUNDLE
override JPRT_ARCHIVE_INSTALL_BUNDLE := $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_INSTALL_BUNDLE))
endif
ifdef JPRT_ARCHIVE_TEST_BUNDLE
override JPRT_ARCHIVE_TEST_BUNDLE := $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_TEST_BUNDLE))
endif
endif
# When running in JPRT these will be provided. Need defaults so that this makefile
@ -45,13 +48,16 @@ endif
ifndef JPRT_ARCHIVE_INSTALL_BUNDLE
JPRT_ARCHIVE_INSTALL_BUNDLE=/tmp/jprt_bundles/product-install.zip
endif
ifndef JPRT_ARCHIVE_TEST_BUNDLE
JPRT_ARCHIVE_TEST_BUNDLE=/tmp/jprt_bundles/test-image.zip
endif
ifeq ($(SKIP_BOOT_CYCLE), false)
jprt_bundle: bootcycle-images
endif
# This target must be called in the context of a SPEC file
jprt_bundle: $(JPRT_ARCHIVE_BUNDLE)
jprt_bundle: $(JPRT_ARCHIVE_BUNDLE) $(JPRT_ARCHIVE_TEST_BUNDLE)
# This target must be called in the context of a SPEC file
$(JPRT_ARCHIVE_BUNDLE): bundles
@ -59,8 +65,14 @@ $(JPRT_ARCHIVE_BUNDLE): bundles
$(RM) $@
$(CP) $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip $@
$(JPRT_ARCHIVE_TEST_BUNDLE): bundles
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $(BUILD_OUTPUT)/bundles/$(TEST_IMAGE_SUBDIR).zip $@
SRC_JDK_IMAGE_DIR := $(JDK_IMAGE_DIR)
SRC_JRE_IMAGE_DIR := $(JRE_IMAGE_DIR)
SRC_TEST_IMAGE_DIR := $(TEST_IMAGE_DIR)
SRC_JDK_BUNDLE_DIR := $(JDK_BUNDLE_DIR)
SRC_JRE_BUNDLE_DIR := $(JRE_BUNDLE_DIR)
@ -70,6 +82,7 @@ bundles: all
$(MKDIR) -p $(BUILD_OUTPUT)/bundles
$(CD) $(SRC_JDK_IMAGE_DIR) && $(ZIP) -y -q -r $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip .
$(CD) $(SRC_JRE_IMAGE_DIR) && $(ZIP) -y -q -r $(BUILD_OUTPUT)/bundles/$(JRE_IMAGE_SUBDIR).zip .
$(CD) $(SRC_TEST_IMAGE_DIR) && $(ZIP) -y -q -r $(BUILD_OUTPUT)/bundles/$(TEST_IMAGE_SUBDIR).zip .
if [ -d $(BUILD_OUTPUT)/install/bundles ] ; then \
$(CD) $(BUILD_OUTPUT)/install/bundles && $(ZIP) -y -q -r $(JPRT_ARCHIVE_INSTALL_BUNDLE) . ; \
fi

View File

@ -238,8 +238,12 @@ profiles:
mac-bundles:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk)
prepare-test-image:
$(MKDIR) -p $(TEST_IMAGE_DIR)
$(ECHO) > $(TEST_IMAGE_DIR)/Readme.txt 'JDK test image'
ALL_TARGETS += source-tips bootcycle-images zip-security zip-source strip-binaries \
jrtfs-jar jimages profiles mac-bundles
jrtfs-jar jimages profiles mac-bundles prepare-test-image
################################################################################
# Docs targets
@ -442,7 +446,7 @@ exploded-image: $(ALL_MODULE_TARGETS)
# alias for ease of use.
jdk: exploded-image
images: jimages demos samples zip-security
images: test-image jimages demos samples zip-security
ifeq ($(OPENJDK_TARGET_OS), macosx)
images: mac-bundles
@ -450,9 +454,11 @@ endif
docs: docs-javadoc docs-jvmtidoc
test-image: prepare-test-image
ALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers \
jdk.jdwp.agent-gensrc $(ALL_MODULE_TARGETS) exploded-image jdk images \
docs
docs test-image
################################################################################

View File

@ -482,6 +482,7 @@
<depend>java.logging</depend>
<depend>java.naming</depend>
<depend re-exports="true">java.rmi</depend>
<depend>java.transaction</depend>
<export>
<name>javax.activity</name>
</export>
@ -491,9 +492,6 @@
<export>
<name>javax.rmi.CORBA</name>
</export>
<export>
<name>javax.transaction</name>
</export>
<export>
<name>org.omg.CORBA</name>
</export>
@ -888,8 +886,8 @@
<depend re-exports="true">java.compact3</depend>
<depend re-exports="true">java.corba</depend>
<depend re-exports="true">java.desktop</depend>
<depend re-exports="true">java.transaction</depend>
<depend re-exports="true">java.xml.bind</depend>
<depend re-exports="true">java.xml.soap</depend>
<depend re-exports="true">java.xml.ws</depend>
</module>
<module>
@ -981,6 +979,14 @@
<name>javax.sql.rowset.spi</name>
</export>
</module>
<module>
<name>java.transaction</name>
<depend>java.base</depend>
<depend re-exports="true">java.rmi</depend>
<export>
<name>javax.transaction</name>
</export>
</module>
<module>
<name>java.xml</name>
<depend>java.base</depend>
@ -1056,17 +1062,17 @@
<export>
<name>org.xml.sax.helpers</name>
</export>
<export>
<name>com.sun.org.apache.xerces.internal.dom</name>
<to>java.xml.soap</to>
</export>
<export>
<name>com.sun.org.apache.xerces.internal.jaxp</name>
<to>java.xml.soap</to>
</export>
<export>
<name>com.sun.org.apache.xerces.internal.util</name>
<to>java.xml.soap</to>
<export>
<name>com.sun.org.apache.xerces.internal.dom</name>
<to>java.xml.ws</to>
</export>
<export>
<name>com.sun.org.apache.xerces.internal.jaxp</name>
<to>java.xml.ws</to>
</export>
<export>
<name>com.sun.org.apache.xerces.internal.util</name>
<to>java.xml.ws</to>
</export>
<export>
<name>com.sun.org.apache.xml.internal.dtm</name>
@ -1262,17 +1268,14 @@
</export>
<export>
<name>com.sun.xml.internal.org.jvnet.mimepull</name>
<to>java.xml.soap</to>
<to>java.xml.ws</to>
</export>
<export>
<name>com.sun.xml.internal.org.jvnet.staxex</name>
<to>java.xml.soap</to>
<to>java.xml.ws</to>
</export>
<export>
<name>com.sun.xml.internal.org.jvnet.staxex.util</name>
<to>java.xml.soap</to>
<to>java.xml.ws</to>
</export>
<export>
@ -1318,30 +1321,17 @@
<name>javax.xml.crypto.dsig.spec</name>
</export>
</module>
<module>
<name>java.xml.soap</name>
<depend re-exports="true">java.activation</depend>
<depend>java.base</depend>
<depend>java.desktop</depend>
<depend>java.logging</depend>
<depend re-exports="true">java.xml</depend>
<depend>java.xml.bind</depend>
<export>
<name>javax.xml.soap</name>
</export>
</module>
<module>
<name>java.xml.ws</name>
<depend>java.activation</depend>
<depend>java.annotations.common</depend>
<depend>java.base</depend>
<depend>java.desktop</depend>
<depend>java.logging</depend>
<depend>java.management</depend>
<depend>java.rmi</depend>
<depend re-exports="true">java.activation</depend>
<depend re-exports="true">java.xml</depend>
<depend re-exports="true">java.xml.bind</depend>
<depend re-exports="true">java.xml.soap</depend>
<depend>jdk.httpserver</depend>
<export>
<name>javax.jws</name>
@ -1349,6 +1339,9 @@
<export>
<name>javax.jws.soap</name>
</export>
<export>
<name>javax.xml.soap</name>
</export>
<export>
<name>javax.xml.ws</name>
</export>

View File

@ -278,3 +278,4 @@ dd7bbdf81a537106cfa9227d1a9a57849cb26b4d jdk9-b37
498d1d6c4219086143b764b3bf61afe65dcece47 jdk9-b42
8ae8dff2a28f3b8831cce97ae0c7a957c5dc650a jdk9-b43
50ee576062726e536d1bb9a5eadd8fd4470128fc jdk9-b44
3c2bbeda038aef7061455fec604db7d8a342fac5 jdk9-b45

94
nashorn/samples/jd.js Normal file
View File

@ -0,0 +1,94 @@
#// Usage: jjs -cp <asmtools.jar> jd.js -- <classname> [jdis|jdec]
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Oracle nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// javap-like disassembler/decoder tool that disassembles/decodes
// java classes but with OpenJDK AsmTools disassembler/decoder syntax.
// You need to build asmtool.jar from OpenJDK codetools project
// specify it with -cp option.
// See also https://wiki.openjdk.java.net/display/CodeTools/AsmTools
function usage() {
print("Usage: jjs -cp <asmtools.jar> jd.js -- <classname> [jdis|jdec]");
exit(1);
}
if (arguments.length == 0) {
usage();
}
// argument handling
// convert to internal class name
var className = arguments[0].replaceAll('\\.', '/');
var tool;
if (arguments.length > 1) {
tool = arguments[1];
switch (tool) {
case 'jdis':
case 'jdec':
break;
default:
usage();
}
} else {
tool = "jdis"; // default tool
}
// Java classes used
var AsmTools = Java.type("org.openjdk.asmtools.Main");
var Files = Java.type("java.nio.file.Files");
var StandardCopyOption = Java.type("java.nio.file.StandardCopyOption");
// retrive input stream for .class bytes
var cl = AsmTools.class.classLoader;
var res = cl.getResource(className + ".class");
if (res) {
var is = res.openStream();
var tmpPath;
try {
// copy the content of the .class to a temp file
tmpPath = Files.createTempFile("asmtools-", ".class");
// mark as delete-on-exit
tmpPath.toFile().deleteOnExit();
Files.copy(is, tmpPath, [ StandardCopyOption.REPLACE_EXISTING ]);
} finally {
is.close();
}
// invoke asmtools Main
AsmTools.main([ tool, tmpPath.toString() ]);
} else {
print("no such class: " + arguments[0]);
exit(1);
}

View File

@ -36,7 +36,10 @@ import java.util.Set;
* treat objects of such classes just like nashorn script objects. Usual nashorn
* operations like obj[i], obj.foo, obj.func(), delete obj.foo will be glued
* to appropriate method call of this class.
*
* @since 1.8u40
*/
@jdk.Exported
public abstract class AbstractJSObject implements JSObject {
/**
* Call this object as a JavaScript function. This is equivalent to

View File

@ -28,7 +28,10 @@ package jdk.nashorn.api.scripting;
* Class filter (optional) to be used by nashorn script engine.
* jsr-223 program embedding nashorn script can set ClassFilter instance
* to be used when an engine instance is created.
*
* @since 1.8u40
*/
@jdk.Exported
public interface ClassFilter {
/**
* Should the Java class of the specified name be exposed to scripts?

View File

@ -33,7 +33,10 @@ import java.util.Set;
* treat objects of such classes just like nashorn script objects. Usual nashorn
* operations like obj[i], obj.foo, obj.func(), delete obj.foo will be glued
* to appropriate method call of this interface.
*
* @since 1.8u40
*/
@jdk.Exported
public interface JSObject {
/**
* Call this object as a JavaScript function. This is equivalent to

View File

@ -41,7 +41,10 @@ import jdk.nashorn.internal.runtime.ScriptObject;
* script object or Java access to script object properties via java.util.Map
* interface. In these cases, user code will get an instance of this or
* implementation defined subclass.
*
* @since 1.8u40
*/
@jdk.Exported
@SuppressWarnings("serial")
public abstract class NashornException extends RuntimeException {
// script file name

View File

@ -65,8 +65,10 @@ import jdk.nashorn.internal.runtime.options.Options;
* {@link NashornScriptEngineFactory#getScriptEngine()}. Note that this engine implements the {@link Compilable} and
* {@link Invocable} interfaces, allowing for efficient precompilation and repeated execution of scripts.
* @see NashornScriptEngineFactory
*
* @since 1.8u40
*/
@jdk.Exported
public final class NashornScriptEngine extends AbstractScriptEngine implements Compilable, Invocable {
/**
* Key used to associate Nashorn global object mirror with arbitrary Bindings instance.

View File

@ -44,7 +44,10 @@ import jdk.nashorn.internal.runtime.Version;
* </ul>
* Programs executing in engines created using {@link #getScriptEngine(String[])} will have the passed arguments
* accessible as a global variable named {@code "arguments"}.
*
* @since 1.8u40
*/
@jdk.Exported
public final class NashornScriptEngineFactory implements ScriptEngineFactory {
@Override
public String getEngineName() {
@ -120,7 +123,7 @@ public final class NashornScriptEngineFactory implements ScriptEngineFactory {
// used to execute scripts concurrently on multiple threads.
return null;
default:
throw new IllegalArgumentException("Invalid key");
return null;
}
}

View File

@ -54,7 +54,10 @@ import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor;
/**
* Mirror object that wraps a given Nashorn Script object.
*
* @since 1.8u40
*/
@jdk.Exported
public final class ScriptObjectMirror extends AbstractJSObject implements Bindings {
private static AccessControlContext getContextAccCtxt() {
final Permissions perms = new Permissions();

View File

@ -36,7 +36,10 @@ import jdk.nashorn.internal.runtime.linker.Bootstrap;
/**
* Utilities that are to be called from script code.
*
* @since 1.8u40
*/
@jdk.Exported
public final class ScriptUtils {
private ScriptUtils() {}

View File

@ -35,7 +35,10 @@ import jdk.nashorn.internal.runtime.Source;
/**
* A Reader that reads from a URL. Used to make sure that the reader
* reads content from given URL and can be trusted to do so.
*
* @since 1.8u40
*/
@jdk.Exported
public final class URLReader extends Reader {
// underlying URL
private final URL url;

View File

@ -35,5 +35,8 @@
* interfaces, allowing for efficient pre-compilation and repeated execution of scripts. In addition,
* this package provides nashorn specific extension classes, interfaces and methods. See
* {@link jdk.nashorn.api.scripting.NashornScriptEngineFactory} for further details.
*
* @since 1.8u40
*/
@jdk.Exported
package jdk.nashorn.api.scripting;

View File

@ -38,7 +38,6 @@ import static jdk.nashorn.internal.codegen.CompilerConstants.SCOPE;
import static jdk.nashorn.internal.codegen.CompilerConstants.SPLIT_PREFIX;
import static jdk.nashorn.internal.codegen.CompilerConstants.THIS;
import static jdk.nashorn.internal.codegen.CompilerConstants.VARARGS;
import static jdk.nashorn.internal.codegen.CompilerConstants.constructorNoLookup;
import static jdk.nashorn.internal.codegen.CompilerConstants.interfaceCallNoLookup;
import static jdk.nashorn.internal.codegen.CompilerConstants.methodDescriptor;
import static jdk.nashorn.internal.codegen.CompilerConstants.staticCallNoLookup;
@ -186,9 +185,6 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
private static final String GLOBAL_OBJECT = Type.getInternalName(Global.class);
private static final String SCRIPTFUNCTION_IMPL_NAME = Type.getInternalName(ScriptFunctionImpl.class);
private static final Type SCRIPTFUNCTION_IMPL_TYPE = Type.typeFor(ScriptFunction.class);
private static final Call CREATE_REWRITE_EXCEPTION = CompilerConstants.staticCallNoLookup(RewriteException.class,
"create", RewriteException.class, UnwarrantedOptimismException.class, Object[].class, String[].class);
private static final Call CREATE_REWRITE_EXCEPTION_REST_OF = CompilerConstants.staticCallNoLookup(RewriteException.class,
@ -201,6 +197,11 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
private static final Call ENSURE_NUMBER = CompilerConstants.staticCallNoLookup(OptimisticReturnFilters.class,
"ensureNumber", double.class, Object.class, int.class);
private static final Call CREATE_FUNCTION_OBJECT = CompilerConstants.staticCallNoLookup(ScriptFunctionImpl.class,
"create", ScriptFunction.class, Object[].class, int.class, ScriptObject.class);
private static final Call CREATE_FUNCTION_OBJECT_NO_SCOPE = CompilerConstants.staticCallNoLookup(ScriptFunctionImpl.class,
"create", ScriptFunction.class, Object[].class, int.class);
private static final Class<?> ITERATOR_CLASS = Iterator.class;
static {
assert ITERATOR_CLASS == CompilerConstants.ITERATOR_PREFIX.type();
@ -2242,7 +2243,6 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
} else {
methodEmitter.loadConstants().load(index).arrayload();
if (object instanceof ArrayData) {
// avoid cast to non-public ArrayData subclass
methodEmitter.checkcast(ArrayData.class);
methodEmitter.invoke(virtualCallNoLookup(ArrayData.class, "copy", ArrayData.class));
} else if (cls != Object.class) {
@ -2251,6 +2251,10 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
}
}
private void loadConstantsAndIndex(final Object object, final MethodEmitter methodEmitter) {
methodEmitter.loadConstants().load(compiler.getConstantData().add(object));
}
// literal values
private void loadLiteral(final LiteralNode<?> node, final TypeBounds resultBounds) {
final Object value = node.getValue();
@ -4323,15 +4327,13 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
final RecompilableScriptFunctionData data = compiler.getScriptFunctionData(functionNode.getId());
if (functionNode.isProgram() && !compiler.isOnDemandCompilation()) {
final CompileUnit fnUnit = functionNode.getCompileUnit();
final MethodEmitter createFunction = fnUnit.getClassEmitter().method(
final MethodEmitter createFunction = functionNode.getCompileUnit().getClassEmitter().method(
EnumSet.of(Flag.PUBLIC, Flag.STATIC), CREATE_PROGRAM_FUNCTION.symbolName(),
ScriptFunction.class, ScriptObject.class);
createFunction.begin();
createFunction._new(SCRIPTFUNCTION_IMPL_NAME, SCRIPTFUNCTION_IMPL_TYPE).dup();
loadConstant(data, fnUnit, createFunction);
loadConstantsAndIndex(data, createFunction);
createFunction.load(SCOPE_TYPE, 0);
createFunction.invoke(constructorNoLookup(SCRIPTFUNCTION_IMPL_NAME, RecompilableScriptFunctionData.class, ScriptObject.class));
createFunction.invoke(CREATE_FUNCTION_OBJECT);
createFunction._return();
createFunction.end();
}
@ -4346,15 +4348,14 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
return;
}
method._new(SCRIPTFUNCTION_IMPL_NAME, SCRIPTFUNCTION_IMPL_TYPE).dup();
loadConstant(data);
loadConstantsAndIndex(data, method);
if (functionNode.needsParentScope()) {
method.loadCompilerConstant(SCOPE);
method.invoke(CREATE_FUNCTION_OBJECT);
} else {
method.loadNull();
method.invoke(CREATE_FUNCTION_OBJECT_NO_SCOPE);
}
method.invoke(constructorNoLookup(SCRIPTFUNCTION_IMPL_NAME, RecompilableScriptFunctionData.class, ScriptObject.class));
}
// calls on Global class.

View File

@ -118,13 +118,26 @@ public class ScriptFunctionImpl extends ScriptFunction {
}
/**
* Constructor called by (compiler) generated code for {@link ScriptObject}s.
* Factory method called by compiler generated code for functions that need parent scope.
*
* @param data static function data
* @param scope scope object
* @param constants the generated class' constant array
* @param index the index of the {@code RecompilableScriptFunctionData} object in the constants array.
* @param scope the parent scope object
* @return a newly created function object
*/
public ScriptFunctionImpl(final RecompilableScriptFunctionData data, final ScriptObject scope) {
this(data, scope, Global.instance());
public static ScriptFunction create(final Object[] constants, final int index, final ScriptObject scope) {
return new ScriptFunctionImpl((RecompilableScriptFunctionData)constants[index], scope, Global.instance());
}
/**
* Factory method called by compiler generated code for functions that don't need parent scope.
*
* @param constants the generated class' constant array
* @param index the index of the {@code RecompilableScriptFunctionData} object in the constants array.
* @return a newly created function object
*/
public static ScriptFunction create(final Object[] constants, final int index) {
return create(constants, index, null);
}
/**

View File

@ -48,28 +48,25 @@ final class AdaptationResult {
ERROR_NO_ACCESSIBLE_CONSTRUCTOR,
ERROR_MULTIPLE_SUPERCLASSES,
ERROR_NO_COMMON_LOADER,
ERROR_FINAL_FINALIZER
ERROR_FINAL_FINALIZER,
ERROR_OTHER
}
static final AdaptationResult SUCCESSFUL_RESULT = new AdaptationResult(Outcome.SUCCESS, "");
private final Outcome outcome;
private final String classList;
private final String[] messageArgs;
AdaptationResult(final Outcome outcome, final String classList) {
AdaptationResult(final Outcome outcome, final String... messageArgs) {
this.outcome = outcome;
this.classList = classList;
this.messageArgs = messageArgs;
}
Outcome getOutcome() {
return outcome;
}
String getClassList() {
return classList;
}
ECMAException typeError() {
return ECMAErrors.typeError("extend." + outcome, classList);
return ECMAErrors.typeError("extend." + outcome, messageArgs);
}
}

View File

@ -184,7 +184,7 @@ public final class JavaAdapterFactory {
final ClassAndLoader definingClassAndLoader = ClassAndLoader.getDefiningClassAndLoader(types);
final Map<List<Class<?>>, AdapterInfo> adapterInfoMap = ADAPTER_INFO_MAPS.get(definingClassAndLoader.getRepresentativeClass());
final List<Class<?>> typeList = types.length == 1 ? getSingletonClassList(types[0]) : Arrays.asList(types.clone());
final List<Class<?>> typeList = types.length == 1 ? Collections.<Class<?>>singletonList(types[0]) : Arrays.asList(types.clone());
AdapterInfo adapterInfo;
synchronized(adapterInfoMap) {
adapterInfo = adapterInfoMap.get(typeList);
@ -196,11 +196,6 @@ public final class JavaAdapterFactory {
return adapterInfo;
}
@SuppressWarnings({ "unchecked", "rawtypes" })
private static List<Class<?>> getSingletonClassList(final Class<?> clazz) {
return (List)Collections.singletonList(clazz);
}
/**
* For a given class, create its adapter class and associated info.
* @param type the class for which the adapter is created
@ -241,6 +236,8 @@ public final class JavaAdapterFactory {
return new AdapterInfo(effectiveSuperClass, interfaces, definingClassAndLoader);
} catch (final AdaptationException e) {
return new AdapterInfo(e.getAdaptationResult());
} catch (final RuntimeException e) {
return new AdapterInfo(new AdaptationResult(AdaptationResult.Outcome.ERROR_OTHER, Arrays.toString(types), e.toString()));
}
}
}, CREATE_ADAPTER_INFO_ACC_CTXT);

View File

@ -141,6 +141,7 @@ type.error.extend.ERROR_NO_ACCESSIBLE_CONSTRUCTOR=Can not extend class {0} as it
type.error.extend.ERROR_MULTIPLE_SUPERCLASSES=Can not extend multiple classes {0}. At most one of the specified types can be a class, the rest must all be interfaces.
type.error.extend.ERROR_NO_COMMON_LOADER=Can not find a common class loader for ScriptObject and {0}.
type.error.extend.ERROR_FINAL_FINALIZER=Can not extend class because {0} has a final finalize method.
type.error.extend.ERROR_OTHER=Can not extend/implement {0} because of {1}
type.error.no.constructor.matches.args=Can not construct {0} with the passed arguments; they do not match any of its constructor signatures.
type.error.no.method.matches.args=Can not invoke method {0} with the passed arguments; they do not match any of its method signatures.
type.error.method.not.constructor=Java method {0} cannot be used as a constructor.

View File

@ -0,0 +1,42 @@
/*
* Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* 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.
*/
/**
* JDK-8068580: make JavaAdapterFactory.isAutoConvertibleFromFunction more robust
*
* @test
* @run
*/
var BigAbstract = Java.type("jdk.nashorn.test.models.BigAbstract")
try {
new BigAbstract({});
} catch (e) {
Assert.assertTrue(e instanceof TypeError);
Assert.assertEquals(e.message, "Can not extend/implement [class jdk.nashorn.test.models.BigAbstract] because of java.lang.RuntimeException: Method code too large!");
}
try {
BigAbstract.accept(function() { });
} catch (e) {
Assert.assertSame(e.class, java.lang.ClassCastException.class);
}

View File

@ -27,6 +27,7 @@ package jdk.nashorn.api.scripting;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
import java.io.StringReader;
@ -668,6 +669,17 @@ public class ScriptEngineTest {
assertEquals("helloworld", inv.invokeMethod(ctx.get(), "join", ""));
}
// @bug 8068524: NashornScriptEngineFactory.getParameter() throws IAE
// for an unknown key, doesn't conform to the general spec
@Test
public void getParameterInvalidKeyTest() throws Exception {
final ScriptEngineManager manager = new ScriptEngineManager();
final ScriptEngine e = manager.getEngineByName("nashorn");
// no exception expected here!
Object value = e.getFactory().getParameter("no value assigned to this key");
assertNull(value);
}
private static void checkProperty(final ScriptEngine e, final String name)
throws ScriptException {
final String value = System.getProperty(name);

File diff suppressed because it is too large Load Diff