--- a/jdk/make/CompileJavaClasses.gmk Thu May 08 01:05:24 2014 -0700
+++ b/jdk/make/CompileJavaClasses.gmk Thu May 08 15:27:38 2014 -0700
@@ -84,8 +84,6 @@
SolarisUserDefinedFileAttributeView.java \
SolarisWatchService.java \
SolarisAclFileAttributeView.java \
- SolarisLoginModule.java \
- SolarisSystem.java \
sun/nio/ch/DevPollArrayWrapper.java \
sun/nio/ch/DevPollSelectorImpl.java \
sun/nio/ch/DevPollSelectorProvider.java \
@@ -100,15 +98,6 @@
EXCLUDES += com/oracle/security
endif
-ifneq ($(OPENJDK_TARGET_OS), windows)
- # Exclude Window security related files in src/share/classes
- EXFILES += NTLoginModule.java \
- NTSystem.java
-else
- EXFILES += UnixLoginModule.java \
- UnixSystem.java
-endif
-
ifeq ($(OPENJDK_TARGET_OS), windows)
# Don't build GTK L&F on Windows
EXCLUDES += com/sun/java/swing/plaf/gtk
--- a/jdk/make/mapfiles/libjava/mapfile-vers Thu May 08 01:05:24 2014 -0700
+++ b/jdk/make/mapfiles/libjava/mapfile-vers Thu May 08 15:27:38 2014 -0700
@@ -273,7 +273,8 @@
Java_sun_misc_VM_isSetUID;
Java_sun_misc_VM_initialize;
Java_sun_misc_VMSupport_initAgentProperties;
-
+ Java_sun_misc_VMSupport_getVMTemporaryDirectory;
+
# ZipFile.c needs this one
throwFileNotFoundException;
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/JCEMapper.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/JCEMapper.java Thu May 08 15:27:38 2014 -0700
@@ -87,6 +87,10 @@
new Algorithm("", "SHA1withDSA", "Signature")
);
algorithmsMap.put(
+ XMLSignature.ALGO_ID_SIGNATURE_DSA_SHA256,
+ new Algorithm("", "SHA256withDSA", "Signature")
+ );
+ algorithmsMap.put(
XMLSignature.ALGO_ID_SIGNATURE_NOT_RECOMMENDED_RSA_MD5,
new Algorithm("", "MD5withRSA", "Signature")
);
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java Thu May 08 15:27:38 2014 -0700
@@ -380,7 +380,12 @@
* This method registers the default algorithms.
*/
public static void registerDefaultAlgorithms() {
- algorithmHash.put(SignatureDSA.URI, SignatureDSA.class);
+ algorithmHash.put(
+ XMLSignature.ALGO_ID_SIGNATURE_DSA, SignatureDSA.class
+ );
+ algorithmHash.put(
+ XMLSignature.ALGO_ID_SIGNATURE_DSA_SHA256, SignatureDSA.SHA256.class
+ );
algorithmHash.put(
XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1, SignatureBaseRSA.SignatureRSASHA1.class
);
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureDSA.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureDSA.java Thu May 08 15:27:38 2014 -0700
@@ -31,13 +31,15 @@
import java.security.SecureRandom;
import java.security.Signature;
import java.security.SignatureException;
+import java.security.interfaces.DSAKey;
import java.security.spec.AlgorithmParameterSpec;
import com.sun.org.apache.xml.internal.security.algorithms.JCEMapper;
import com.sun.org.apache.xml.internal.security.algorithms.SignatureAlgorithmSpi;
+import com.sun.org.apache.xml.internal.security.signature.XMLSignature;
import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException;
import com.sun.org.apache.xml.internal.security.utils.Base64;
-import com.sun.org.apache.xml.internal.security.utils.Constants;
+import com.sun.org.apache.xml.internal.security.utils.JavaUtils;
public class SignatureDSA extends SignatureAlgorithmSpi {
@@ -45,19 +47,19 @@
private static java.util.logging.Logger log =
java.util.logging.Logger.getLogger(SignatureDSA.class.getName());
- /** Field URI */
- public static final String URI = Constants.SignatureSpecNS + "dsa-sha1";
-
/** Field algorithm */
private java.security.Signature signatureAlgorithm = null;
+ /** size of Q */
+ private int size;
+
/**
* Method engineGetURI
*
* @inheritDoc
*/
protected String engineGetURI() {
- return SignatureDSA.URI;
+ return XMLSignature.ALGO_ID_SIGNATURE_DSA;
}
/**
@@ -66,7 +68,7 @@
* @throws XMLSignatureException
*/
public SignatureDSA() throws XMLSignatureException {
- String algorithmID = JCEMapper.translateURItoJCEID(SignatureDSA.URI);
+ String algorithmID = JCEMapper.translateURItoJCEID(engineGetURI());
if (log.isLoggable(java.util.logging.Level.FINE)) {
log.log(java.util.logging.Level.FINE, "Created SignatureDSA using " + algorithmID);
}
@@ -110,7 +112,8 @@
log.log(java.util.logging.Level.FINE, "Called DSA.verify() on " + Base64.encode(signature));
}
- byte[] jcebytes = SignatureDSA.convertXMLDSIGtoASN1(signature);
+ byte[] jcebytes = JavaUtils.convertDsaXMLDSIGtoASN1(signature,
+ size/8);
return this.signatureAlgorithm.verify(jcebytes);
} catch (SignatureException ex) {
@@ -150,6 +153,7 @@
}
throw new XMLSignatureException("empty", ex);
}
+ size = ((DSAKey)publicKey).getParams().getQ().bitLength();
}
/**
@@ -159,7 +163,7 @@
try {
byte jcebytes[] = this.signatureAlgorithm.sign();
- return SignatureDSA.convertASN1toXMLDSIG(jcebytes);
+ return JavaUtils.convertDsaASN1toXMLDSIG(jcebytes, size/8);
} catch (IOException ex) {
throw new XMLSignatureException("empty", ex);
} catch (SignatureException ex) {
@@ -185,6 +189,7 @@
} catch (InvalidKeyException ex) {
throw new XMLSignatureException("empty", ex);
}
+ size = ((DSAKey)privateKey).getParams().getQ().bitLength();
}
/**
@@ -204,6 +209,7 @@
} catch (InvalidKeyException ex) {
throw new XMLSignatureException("empty", ex);
}
+ size = ((DSAKey)privateKey).getParams().getQ().bitLength();
}
/**
@@ -258,100 +264,6 @@
}
/**
- * Converts an ASN.1 DSA value to a XML Signature DSA Value.
- *
- * The JAVA JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
- * pairs; the XML Signature requires the core BigInteger values.
- *
- * @param asn1Bytes
- * @return the decode bytes
- *
- * @throws IOException
- * @see <A HREF="http://www.w3.org/TR/xmldsig-core/#dsa-sha1">6.4.1 DSA</A>
- */
- private static byte[] convertASN1toXMLDSIG(byte asn1Bytes[]) throws IOException {
-
- byte rLength = asn1Bytes[3];
- int i;
-
- for (i = rLength; (i > 0) && (asn1Bytes[(4 + rLength) - i] == 0); i--);
-
- byte sLength = asn1Bytes[5 + rLength];
- int j;
-
- for (j = sLength;
- (j > 0) && (asn1Bytes[(6 + rLength + sLength) - j] == 0); j--);
-
- if ((asn1Bytes[0] != 48) || (asn1Bytes[1] != asn1Bytes.length - 2)
- || (asn1Bytes[2] != 2) || (i > 20)
- || (asn1Bytes[4 + rLength] != 2) || (j > 20)) {
- throw new IOException("Invalid ASN.1 format of DSA signature");
- }
- byte xmldsigBytes[] = new byte[40];
-
- System.arraycopy(asn1Bytes, (4 + rLength) - i, xmldsigBytes, 20 - i, i);
- System.arraycopy(asn1Bytes, (6 + rLength + sLength) - j, xmldsigBytes,
- 40 - j, j);
-
- return xmldsigBytes;
- }
-
- /**
- * Converts a XML Signature DSA Value to an ASN.1 DSA value.
- *
- * The JAVA JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
- * pairs; the XML Signature requires the core BigInteger values.
- *
- * @param xmldsigBytes
- * @return the encoded ASN.1 bytes
- *
- * @throws IOException
- * @see <A HREF="http://www.w3.org/TR/xmldsig-core/#dsa-sha1">6.4.1 DSA</A>
- */
- private static byte[] convertXMLDSIGtoASN1(byte xmldsigBytes[]) throws IOException {
-
- if (xmldsigBytes.length != 40) {
- throw new IOException("Invalid XMLDSIG format of DSA signature");
- }
-
- int i;
-
- for (i = 20; (i > 0) && (xmldsigBytes[20 - i] == 0); i--);
-
- int j = i;
-
- if (xmldsigBytes[20 - i] < 0) {
- j += 1;
- }
-
- int k;
-
- for (k = 20; (k > 0) && (xmldsigBytes[40 - k] == 0); k--);
-
- int l = k;
-
- if (xmldsigBytes[40 - k] < 0) {
- l += 1;
- }
-
- byte asn1Bytes[] = new byte[6 + j + l];
-
- asn1Bytes[0] = 48;
- asn1Bytes[1] = (byte) (4 + j + l);
- asn1Bytes[2] = 2;
- asn1Bytes[3] = (byte) j;
-
- System.arraycopy(xmldsigBytes, 20 - i, asn1Bytes, (4 + j) - i, i);
-
- asn1Bytes[4 + j] = 2;
- asn1Bytes[5 + j] = (byte) l;
-
- System.arraycopy(xmldsigBytes, 40 - k, asn1Bytes, (6 + j + l) - k, k);
-
- return asn1Bytes;
- }
-
- /**
* Method engineSetHMACOutputLength
*
* @param HMACOutputLength
@@ -373,4 +285,15 @@
) throws XMLSignatureException {
throw new XMLSignatureException("algorithms.CannotUseAlgorithmParameterSpecOnDSA");
}
+
+ public static class SHA256 extends SignatureDSA {
+
+ public SHA256() throws XMLSignatureException {
+ super();
+ }
+
+ public String engineGetURI() {
+ return XMLSignature.ALGO_ID_SIGNATURE_DSA_SHA256;
+ }
+ }
}
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java Thu May 08 15:27:38 2014 -0700
@@ -85,6 +85,10 @@
public static final String ALGO_ID_SIGNATURE_DSA =
Constants.SignatureSpecNS + "dsa-sha1";
+ /** Signature - Optional DSAwithSHA256 */
+ public static final String ALGO_ID_SIGNATURE_DSA_SHA256 =
+ Constants.SignatureSpec11NS + "dsa-sha256";
+
/** Signature - Recommended RSAwithSHA1 */
public static final String ALGO_ID_SIGNATURE_RSA =
Constants.SignatureSpecNS + "rsa-sha1";
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/JavaUtils.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/JavaUtils.java Thu May 08 15:27:38 2014 -0700
@@ -145,4 +145,98 @@
return retBytes;
}
+
+ /**
+ * Converts an ASN.1 DSA value to a XML Signature DSA Value.
+ *
+ * The JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
+ * pairs (see section 2.2.2 of RFC 3279); the XML Signature requires the
+ * core BigInteger values.
+ *
+ * @param asn1Bytes the ASN.1 encoded bytes
+ * @param size size of r and s in bytes
+ * @return the XML Signature encoded bytes
+ * @throws IOException if the bytes are not encoded correctly
+ * @see <A HREF="http://www.w3.org/TR/xmldsig-core1/#sec-DSA">6.4.1 DSA</A>
+ */
+ public static byte[] convertDsaASN1toXMLDSIG(byte[] asn1Bytes, int size)
+ throws IOException
+ {
+ if (asn1Bytes[0] != 48 || asn1Bytes[1] != asn1Bytes.length - 2
+ || asn1Bytes[2] != 2) {
+ throw new IOException("Invalid ASN.1 format of DSA signature");
+ }
+
+ byte rLength = asn1Bytes[3];
+ int i;
+ for (i = rLength; i > 0 && asn1Bytes[4 + rLength - i] == 0; i--);
+
+ byte sLength = asn1Bytes[5 + rLength];
+ int j;
+ for (j = sLength;
+ j > 0 && asn1Bytes[6 + rLength + sLength - j] == 0; j--);
+
+ if (i > size || asn1Bytes[4 + rLength] != 2 || j > size) {
+ throw new IOException("Invalid ASN.1 format of DSA signature");
+ } else {
+ byte[] xmldsigBytes = new byte[size * 2];
+ System.arraycopy(asn1Bytes, 4 + rLength - i, xmldsigBytes,
+ size - i, i);
+ System.arraycopy(asn1Bytes, 6 + rLength + sLength - j,
+ xmldsigBytes, size * 2 - j, j);
+ return xmldsigBytes;
+ }
+ }
+
+ /**
+ * Converts an XML Signature DSA Value to a ASN.1 DSA value.
+ *
+ * The JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
+ * pairs (see section 2.2.2 of RFC 3279); the XML Signature requires the
+ * core BigInteger values.
+ *
+ * @param xmldsigBytes the XML Signature encoded bytes
+ * @param size size of r and s in bytes
+ * @return the ASN.1 encoded bytes
+ * @throws IOException if the bytes are not encoded correctly
+ * @see <A HREF="http://www.w3.org/TR/xmldsig-core1/#sec-DSA">6.4.1 DSA</A>
+ */
+ public static byte[] convertDsaXMLDSIGtoASN1(byte[] xmldsigBytes, int size)
+ throws IOException
+ {
+ int totalSize = size * 2;
+ if (xmldsigBytes.length != totalSize) {
+ throw new IOException("Invalid XMLDSIG format of DSA signature");
+ }
+
+ int i;
+ for (i = size; i > 0 && xmldsigBytes[size - i] == 0; i--);
+
+ int j = i;
+ if (xmldsigBytes[size - i] < 0) {
+ j++;
+ }
+
+ int k;
+ for (k = size; k > 0 && xmldsigBytes[totalSize - k] == 0; k--);
+
+ int l = k;
+ if (xmldsigBytes[totalSize - k] < 0) {
+ l++;
+ }
+
+ byte[] asn1Bytes = new byte[6 + j + l];
+ asn1Bytes[0] = 48;
+ asn1Bytes[1] = (byte)(4 + j + l);
+ asn1Bytes[2] = 2;
+ asn1Bytes[3] = (byte)j;
+ System.arraycopy(xmldsigBytes, size - i, asn1Bytes, 4 + j - i, i);
+
+ asn1Bytes[4 + j] = 2;
+ asn1Bytes[5 + j] = (byte) l;
+ System.arraycopy(xmldsigBytes, totalSize - k, asn1Bytes,
+ 6 + j + l - k, k);
+
+ return asn1Bytes;
+ }
}
--- a/jdk/src/share/classes/com/sun/security/auth/module/NTLoginModule.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/com/sun/security/auth/module/NTLoginModule.java Thu May 08 15:27:38 2014 -0700
@@ -139,15 +139,17 @@
succeeded = false; // Indicate not yet successful
- ntSystem = new NTSystem(debugNative);
- if (ntSystem == null) {
+ try {
+ ntSystem = new NTSystem(debugNative);
+ } catch (UnsatisfiedLinkError ule) {
if (debug) {
System.out.println("\t\t[NTLoginModule] " +
"Failed in NT login");
}
throw new FailedLoginException
("Failed in attempt to import the " +
- "underlying NT system identity information");
+ "underlying NT system identity information" +
+ " on " + System.getProperty("os.name"));
}
if (ntSystem.getName() == null) {
--- a/jdk/src/share/classes/com/sun/security/auth/module/SolarisLoginModule.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/com/sun/security/auth/module/SolarisLoginModule.java Thu May 08 15:27:38 2014 -0700
@@ -129,39 +129,39 @@
long[] solarisGroups = null;
- ss = new SolarisSystem();
-
- if (ss == null) {
+ try {
+ ss = new SolarisSystem();
+ } catch (UnsatisfiedLinkError ule) {
succeeded = false;
throw new FailedLoginException
("Failed in attempt to import " +
- "the underlying system identity information");
- } else {
- userPrincipal = new SolarisPrincipal(ss.getUsername());
- UIDPrincipal = new SolarisNumericUserPrincipal(ss.getUid());
- GIDPrincipal = new SolarisNumericGroupPrincipal(ss.getGid(), true);
- if (ss.getGroups() != null && ss.getGroups().length > 0)
- solarisGroups = ss.getGroups();
- for (int i = 0; i < solarisGroups.length; i++) {
- SolarisNumericGroupPrincipal ngp =
- new SolarisNumericGroupPrincipal
- (solarisGroups[i], false);
- if (!ngp.getName().equals(GIDPrincipal.getName()))
- supplementaryGroups.add(ngp);
- }
- if (debug) {
- System.out.println("\t\t[SolarisLoginModule]: " +
- "succeeded importing info: ");
- System.out.println("\t\t\tuid = " + ss.getUid());
- System.out.println("\t\t\tgid = " + ss.getGid());
- solarisGroups = ss.getGroups();
- for (int i = 0; i < solarisGroups.length; i++) {
- System.out.println("\t\t\tsupp gid = " + solarisGroups[i]);
- }
+ "the underlying system identity information" +
+ " on " + System.getProperty("os.name"));
+ }
+ userPrincipal = new SolarisPrincipal(ss.getUsername());
+ UIDPrincipal = new SolarisNumericUserPrincipal(ss.getUid());
+ GIDPrincipal = new SolarisNumericGroupPrincipal(ss.getGid(), true);
+ if (ss.getGroups() != null && ss.getGroups().length > 0)
+ solarisGroups = ss.getGroups();
+ for (int i = 0; i < solarisGroups.length; i++) {
+ SolarisNumericGroupPrincipal ngp =
+ new SolarisNumericGroupPrincipal
+ (solarisGroups[i], false);
+ if (!ngp.getName().equals(GIDPrincipal.getName()))
+ supplementaryGroups.add(ngp);
}
- succeeded = true;
- return true;
+ if (debug) {
+ System.out.println("\t\t[SolarisLoginModule]: " +
+ "succeeded importing info: ");
+ System.out.println("\t\t\tuid = " + ss.getUid());
+ System.out.println("\t\t\tgid = " + ss.getGid());
+ solarisGroups = ss.getGroups();
+ for (int i = 0; i < solarisGroups.length; i++) {
+ System.out.println("\t\t\tsupp gid = " + solarisGroups[i]);
+ }
}
+ succeeded = true;
+ return true;
}
/**
--- a/jdk/src/share/classes/com/sun/security/auth/module/SolarisSystem.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/com/sun/security/auth/module/SolarisSystem.java Thu May 08 15:27:38 2014 -0700
@@ -29,8 +29,10 @@
* <p> This class implementation retrieves and makes available Solaris
* UID/GID/groups information for the current user.
*
+ * @deprecated replaced by {@link UnixSystem}.
*/
-@jdk.Exported
+@jdk.Exported(false)
+@Deprecated
public class SolarisSystem {
private native void getSolarisInfo();
--- a/jdk/src/share/classes/com/sun/security/auth/module/UnixLoginModule.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/com/sun/security/auth/module/UnixLoginModule.java Thu May 08 15:27:38 2014 -0700
@@ -122,40 +122,40 @@
long[] unixGroups = null;
- ss = new UnixSystem();
-
- if (ss == null) {
+ try {
+ ss = new UnixSystem();
+ } catch (UnsatisfiedLinkError ule) {
succeeded = false;
throw new FailedLoginException
("Failed in attempt to import " +
- "the underlying system identity information");
- } else {
- userPrincipal = new UnixPrincipal(ss.getUsername());
- UIDPrincipal = new UnixNumericUserPrincipal(ss.getUid());
- GIDPrincipal = new UnixNumericGroupPrincipal(ss.getGid(), true);
- if (ss.getGroups() != null && ss.getGroups().length > 0) {
- unixGroups = ss.getGroups();
- for (int i = 0; i < unixGroups.length; i++) {
- UnixNumericGroupPrincipal ngp =
- new UnixNumericGroupPrincipal
- (unixGroups[i], false);
- if (!ngp.getName().equals(GIDPrincipal.getName()))
- supplementaryGroups.add(ngp);
- }
+ "the underlying system identity information" +
+ " on " + System.getProperty("os.name"));
+ }
+ userPrincipal = new UnixPrincipal(ss.getUsername());
+ UIDPrincipal = new UnixNumericUserPrincipal(ss.getUid());
+ GIDPrincipal = new UnixNumericGroupPrincipal(ss.getGid(), true);
+ if (ss.getGroups() != null && ss.getGroups().length > 0) {
+ unixGroups = ss.getGroups();
+ for (int i = 0; i < unixGroups.length; i++) {
+ UnixNumericGroupPrincipal ngp =
+ new UnixNumericGroupPrincipal
+ (unixGroups[i], false);
+ if (!ngp.getName().equals(GIDPrincipal.getName()))
+ supplementaryGroups.add(ngp);
}
- if (debug) {
- System.out.println("\t\t[UnixLoginModule]: " +
- "succeeded importing info: ");
- System.out.println("\t\t\tuid = " + ss.getUid());
- System.out.println("\t\t\tgid = " + ss.getGid());
- unixGroups = ss.getGroups();
- for (int i = 0; i < unixGroups.length; i++) {
- System.out.println("\t\t\tsupp gid = " + unixGroups[i]);
- }
+ }
+ if (debug) {
+ System.out.println("\t\t[UnixLoginModule]: " +
+ "succeeded importing info: ");
+ System.out.println("\t\t\tuid = " + ss.getUid());
+ System.out.println("\t\t\tgid = " + ss.getGid());
+ unixGroups = ss.getGroups();
+ for (int i = 0; i < unixGroups.length; i++) {
+ System.out.println("\t\t\tsupp gid = " + unixGroups[i]);
}
- succeeded = true;
- return true;
}
+ succeeded = true;
+ return true;
}
/**
--- a/jdk/src/share/classes/java/lang/Math.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/lang/Math.java Thu May 08 15:27:38 2014 -0700
@@ -1904,51 +1904,36 @@
* are naturally handled without any additional testing
*/
- // First check for NaN values
- if (Double.isNaN(start) || Double.isNaN(direction)) {
- // return a NaN derived from the input NaN(s)
- return start + direction;
- } else if (start == direction) {
- return direction;
- } else { // start > direction or start < direction
+ /*
+ * IEEE 754 floating-point numbers are lexicographically
+ * ordered if treated as signed-magnitude integers.
+ * Since Java's integers are two's complement,
+ * incrementing the two's complement representation of a
+ * logically negative floating-point value *decrements*
+ * the signed-magnitude representation. Therefore, when
+ * the integer representation of a floating-point value
+ * is negative, the adjustment to the representation is in
+ * the opposite direction from what would initially be expected.
+ */
+
+ // Branch to descending case first as it is more costly than ascending
+ // case due to start != 0.0d conditional.
+ if (start > direction) { // descending
+ if (start != 0.0d) {
+ final long transducer = Double.doubleToRawLongBits(start);
+ return Double.longBitsToDouble(transducer + ((transducer > 0L) ? -1L : 1L));
+ } else { // start == 0.0d && direction < 0.0d
+ return -Double.MIN_VALUE;
+ }
+ } else if (start < direction) { // ascending
// Add +0.0 to get rid of a -0.0 (+0.0 + -0.0 => +0.0)
// then bitwise convert start to integer.
- long transducer = Double.doubleToRawLongBits(start + 0.0d);
-
- /*
- * IEEE 754 floating-point numbers are lexicographically
- * ordered if treated as signed- magnitude integers .
- * Since Java's integers are two's complement,
- * incrementing" the two's complement representation of a
- * logically negative floating-point value *decrements*
- * the signed-magnitude representation. Therefore, when
- * the integer representation of a floating-point values
- * is less than zero, the adjustment to the representation
- * is in the opposite direction than would be expected at
- * first .
- */
- if (direction > start) { // Calculate next greater value
- transducer = transducer + (transducer >= 0L ? 1L:-1L);
- } else { // Calculate next lesser value
- assert direction < start;
- if (transducer > 0L)
- --transducer;
- else
- if (transducer < 0L )
- ++transducer;
- /*
- * transducer==0, the result is -MIN_VALUE
- *
- * The transition from zero (implicitly
- * positive) to the smallest negative
- * signed magnitude value must be done
- * explicitly.
- */
- else
- transducer = DoubleConsts.SIGN_BIT_MASK | 1L;
- }
-
- return Double.longBitsToDouble(transducer);
+ final long transducer = Double.doubleToRawLongBits(start + 0.0d);
+ return Double.longBitsToDouble(transducer + ((transducer >= 0L) ? 1L : -1L));
+ } else if (start == direction) {
+ return direction;
+ } else { // isNaN(start) || isNaN(direction)
+ return start + direction;
}
}
@@ -2003,51 +1988,36 @@
* are naturally handled without any additional testing
*/
- // First check for NaN values
- if (Float.isNaN(start) || Double.isNaN(direction)) {
- // return a NaN derived from the input NaN(s)
- return start + (float)direction;
- } else if (start == direction) {
- return (float)direction;
- } else { // start > direction or start < direction
+ /*
+ * IEEE 754 floating-point numbers are lexicographically
+ * ordered if treated as signed-magnitude integers.
+ * Since Java's integers are two's complement,
+ * incrementing the two's complement representation of a
+ * logically negative floating-point value *decrements*
+ * the signed-magnitude representation. Therefore, when
+ * the integer representation of a floating-point value
+ * is negative, the adjustment to the representation is in
+ * the opposite direction from what would initially be expected.
+ */
+
+ // Branch to descending case first as it is more costly than ascending
+ // case due to start != 0.0f conditional.
+ if (start > direction) { // descending
+ if (start != 0.0f) {
+ final int transducer = Float.floatToRawIntBits(start);
+ return Float.intBitsToFloat(transducer + ((transducer > 0) ? -1 : 1));
+ } else { // start == 0.0f && direction < 0.0f
+ return -Float.MIN_VALUE;
+ }
+ } else if (start < direction) { // ascending
// Add +0.0 to get rid of a -0.0 (+0.0 + -0.0 => +0.0)
// then bitwise convert start to integer.
- int transducer = Float.floatToRawIntBits(start + 0.0f);
-
- /*
- * IEEE 754 floating-point numbers are lexicographically
- * ordered if treated as signed- magnitude integers .
- * Since Java's integers are two's complement,
- * incrementing" the two's complement representation of a
- * logically negative floating-point value *decrements*
- * the signed-magnitude representation. Therefore, when
- * the integer representation of a floating-point values
- * is less than zero, the adjustment to the representation
- * is in the opposite direction than would be expected at
- * first.
- */
- if (direction > start) {// Calculate next greater value
- transducer = transducer + (transducer >= 0 ? 1:-1);
- } else { // Calculate next lesser value
- assert direction < start;
- if (transducer > 0)
- --transducer;
- else
- if (transducer < 0 )
- ++transducer;
- /*
- * transducer==0, the result is -MIN_VALUE
- *
- * The transition from zero (implicitly
- * positive) to the smallest negative
- * signed magnitude value must be done
- * explicitly.
- */
- else
- transducer = FloatConsts.SIGN_BIT_MASK | 1;
- }
-
- return Float.intBitsToFloat(transducer);
+ final int transducer = Float.floatToRawIntBits(start + 0.0f);
+ return Float.intBitsToFloat(transducer + ((transducer >= 0) ? 1 : -1));
+ } else if (start == direction) {
+ return (float)direction;
+ } else { // isNaN(start) || isNaN(direction)
+ return start + (float)direction;
}
}
@@ -2077,12 +2047,13 @@
* @since 1.6
*/
public static double nextUp(double d) {
- if( Double.isNaN(d) || d == Double.POSITIVE_INFINITY)
+ // Use a single conditional and handle the likely cases first.
+ if (d < Double.POSITIVE_INFINITY) {
+ // Add +0.0 to get rid of a -0.0 (+0.0 + -0.0 => +0.0).
+ final long transducer = Double.doubleToRawLongBits(d + 0.0D);
+ return Double.longBitsToDouble(transducer + ((transducer >= 0L) ? 1L : -1L));
+ } else { // d is NaN or +Infinity
return d;
- else {
- d += 0.0d;
- return Double.longBitsToDouble(Double.doubleToRawLongBits(d) +
- ((d >= 0.0d)?+1L:-1L));
}
}
@@ -2112,12 +2083,13 @@
* @since 1.6
*/
public static float nextUp(float f) {
- if( Float.isNaN(f) || f == FloatConsts.POSITIVE_INFINITY)
+ // Use a single conditional and handle the likely cases first.
+ if (f < Float.POSITIVE_INFINITY) {
+ // Add +0.0 to get rid of a -0.0 (+0.0 + -0.0 => +0.0).
+ final int transducer = Float.floatToRawIntBits(f + 0.0F);
+ return Float.intBitsToFloat(transducer + ((transducer >= 0) ? 1 : -1));
+ } else { // f is NaN or +Infinity
return f;
- else {
- f += 0.0f;
- return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
- ((f >= 0.0f)?+1:-1));
}
}
--- a/jdk/src/share/classes/java/net/ContentHandler.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/net/ContentHandler.java Thu May 08 15:27:38 2014 -0700
@@ -46,15 +46,28 @@
* <p>
* If no content handler could be found, URLConnection will
* look for a content handler in a user-defineable set of places.
- * By default it looks in sun.net.www.content, but users can define a
- * vertical-bar delimited set of class prefixes to search through in
- * addition by defining the java.content.handler.pkgs property.
- * The class name must be of the form:
- * <pre>
- * {package-prefix}.{major}.{minor}
- * e.g.
+ * Users can define a vertical-bar delimited set of class prefixes
+ * to search through by defining the <i>java.content.handler.pkgs</i>
+ * property. The class name must be of the form:
+ * <blockquote>
+ * <i>{package-prefix}.{major}.{minor}</i>
+ * <P>
+ * where <i>{major}.{minor}</i> is formed by taking the
+ * content-type string, replacing all slash characters with a
+ * {@code period} ('.'), and all other non-alphanumeric characters
+ * with the underscore character '{@code _}'. The alphanumeric
+ * characters are specifically the 26 uppercase ASCII letters
+ * '{@code A}' through '{@code Z}', the 26 lowercase ASCII
+ * letters '{@code a}' through '{@code z}', and the 10 ASCII
+ * digits '{@code 0}' through '{@code 9}'.
+ * <p>
+ * e.g.
* YoyoDyne.experimental.text.plain
- * </pre>
+ * </blockquote>
+ * If no user-defined content handler is found, then the system
+ * tries to load a specific <i>content-type</i> handler from one
+ * of the built-in handlers, if one exists.
+ * <p>
* If the loading of the content handler class would be performed by
* a classloader that is outside of the delegation chain of the caller,
* the JVM will need the RuntimePermission "getClassLoader".
--- a/jdk/src/share/classes/java/net/URL.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/net/URL.java Thu May 08 15:27:38 2014 -0700
@@ -266,10 +266,7 @@
* a subclass of {@code URLStreamHandler}, then the next package
* in the list is tried.
* <li>If the previous step fails to find a protocol handler, then the
- * constructor tries to load from a system default package.
- * <blockquote><pre>
- * <<i>system default package</i>>.<<i>protocol</i>>.Handler
- * </pre></blockquote>
+ * constructor tries to load a built-in protocol handler.
* If this class does not exist, or if the class exists but it is not a
* subclass of {@code URLStreamHandler}, then a
* {@code MalformedURLException} is thrown.
--- a/jdk/src/share/classes/java/net/URLConnection.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/net/URLConnection.java Thu May 08 15:27:38 2014 -0700
@@ -704,21 +704,10 @@
* handler for that content type.
* <li>If no content handler factory has yet been set up, or if the
* factory's {@code createContentHandler} method returns
- * {@code null}, then the application loads the class named:
- * <blockquote><pre>
- * sun.net.www.content.<<i>contentType</i>>
- * </pre></blockquote>
- * where <<i>contentType</i>> is formed by taking the
- * content-type string, replacing all slash characters with a
- * {@code period} ('.'), and all other non-alphanumeric characters
- * with the underscore character '{@code _}'. The alphanumeric
- * characters are specifically the 26 uppercase ASCII letters
- * '{@code A}' through '{@code Z}', the 26 lowercase ASCII
- * letters '{@code a}' through '{@code z}', and the 10 ASCII
- * digits '{@code 0}' through '{@code 9}'. If the specified
- * class does not exist, or is not a subclass of
- * {@code ContentHandler}, then an
- * {@code UnknownServiceException} is thrown.
+ * {@code null}, then this method tries to load a content handler
+ * class as defined by {@link java.net.ContentHandler ContentHandler}.
+ * If the class does not exist, or is not a subclass of {@code
+ * ContentHandler}, then an {@code UnknownServiceException} is thrown.
* </ol>
*
* @return the object fetched. The {@code instanceof} operator
--- a/jdk/src/share/classes/java/time/DayOfWeek.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/DayOfWeek.java Thu May 08 15:27:38 2014 -0700
@@ -201,7 +201,7 @@
* Gets the day-of-week {@code int} value.
* <p>
* The values are numbered following the ISO-8601 standard, from 1 (Monday) to 7 (Sunday).
- * See {@link WeekFields#dayOfWeek} for localized week-numbering.
+ * See {@link java.time.temporal.WeekFields#dayOfWeek()} for localized week-numbering.
*
* @return the day-of-week, from 1 (Monday) to 7 (Sunday)
*/
@@ -288,7 +288,7 @@
/**
* Gets the value of the specified field from this day-of-week as an {@code int}.
* <p>
- * This queries this day-of-week for the value for the specified field.
+ * This queries this day-of-week for the value of the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
@@ -321,7 +321,7 @@
/**
* Gets the value of the specified field from this day-of-week as a {@code long}.
* <p>
- * This queries this day-of-week for the value for the specified field.
+ * This queries this day-of-week for the value of the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
@@ -419,7 +419,7 @@
* The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)}
* passing {@link ChronoField#DAY_OF_WEEK} as the field.
* Note that this adjusts forwards or backwards within a Monday to Sunday week.
- * See {@link WeekFields#dayOfWeek} for localized week start days.
+ * See {@link java.time.temporal.WeekFields#dayOfWeek()} for localized week start days.
* See {@code TemporalAdjuster} for other adjusters with more control,
* such as {@code next(MONDAY)}.
* <p>
--- a/jdk/src/share/classes/java/time/Duration.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/Duration.java Thu May 08 15:27:38 2014 -0700
@@ -546,7 +546,7 @@
* They are returned in the order seconds, nanos.
* <p>
* This set can be used in conjunction with {@link #get(TemporalUnit)}
- * to access the entire state of the period.
+ * to access the entire state of the duration.
*
* @return a list containing the seconds and nanos units, not null
*/
@@ -686,8 +686,8 @@
* <p>
* This instance is immutable and unaffected by this method call.
*
- * @param amountToAdd the amount of the period, measured in terms of the unit, positive or negative
- * @param unit the unit that the period is measured in, must have an exact duration, not null
+ * @param amountToAdd the amount to add, measured in terms of the unit, positive or negative
+ * @param unit the unit that the amount is measured in, must have an exact duration, not null
* @return a {@code Duration} based on this duration with the specified duration added, not null
* @throws UnsupportedTemporalTypeException if the unit is not supported
* @throws ArithmeticException if numeric overflow occurs
@@ -848,8 +848,8 @@
* <p>
* This instance is immutable and unaffected by this method call.
*
- * @param amountToSubtract the amount of the period, measured in terms of the unit, positive or negative
- * @param unit the unit that the period is measured in, must have an exact duration, not null
+ * @param amountToSubtract the amount to subtract, measured in terms of the unit, positive or negative
+ * @param unit the unit that the amount is measured in, must have an exact duration, not null
* @return a {@code Duration} based on this duration with the specified duration subtracted, not null
* @throws ArithmeticException if numeric overflow occurs
*/
--- a/jdk/src/share/classes/java/time/Instant.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/Instant.java Thu May 08 15:27:38 2014 -0700
@@ -530,7 +530,7 @@
/**
* Gets the value of the specified field from this instant as an {@code int}.
* <p>
- * This queries this instant for the value for the specified field.
+ * This queries this instant for the value of the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
@@ -571,7 +571,7 @@
/**
* Gets the value of the specified field from this instant as a {@code long}.
* <p>
- * This queries this instant for the value for the specified field.
+ * This queries this instant for the value of the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
--- a/jdk/src/share/classes/java/time/LocalDate.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/LocalDate.java Thu May 08 15:27:38 2014 -0700
@@ -280,7 +280,7 @@
* @param dayOfYear the day-of-year to represent, from 1 to 366
* @return the local date, not null
* @throws DateTimeException if the value of any field is out of range,
- * or if the day-of-year is invalid for the month-year
+ * or if the day-of-year is invalid for the year
*/
public static LocalDate ofYearDay(int year, int dayOfYear) {
YEAR.checkValidValue(year);
@@ -308,7 +308,7 @@
*
* @param epochDay the Epoch Day to convert, based on the epoch 1970-01-01
* @return the local date, not null
- * @throws DateTimeException if the epoch days exceeds the supported date range
+ * @throws DateTimeException if the epoch day exceeds the supported date range
*/
public static LocalDate ofEpochDay(long epochDay) {
long zeroDay = epochDay + DAYS_0000_TO_1970;
@@ -515,7 +515,7 @@
/**
* Checks if the specified unit is supported.
* <p>
- * This checks if the specified unit can be added to, or subtracted from, this date-time.
+ * This checks if the specified unit can be added to, or subtracted from, this date.
* If false, then calling the {@link #plus(long, TemporalUnit)} and
* {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
* <p>
@@ -592,7 +592,7 @@
/**
* Gets the value of the specified field from this date as an {@code int}.
* <p>
- * This queries this date for the value for the specified field.
+ * This queries this date for the value of the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
@@ -600,7 +600,7 @@
* If the field is a {@link ChronoField} then the query is implemented here.
* The {@link #isSupported(TemporalField) supported fields} will return valid
* values based on this date, except {@code EPOCH_DAY} and {@code PROLEPTIC_MONTH}
- * which are too large to fit in an {@code int} and throw a {@code DateTimeException}.
+ * which are too large to fit in an {@code int} and throw an {@code UnsupportedTemporalTypeException}.
* All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
* <p>
* If the field is not a {@code ChronoField}, then the result of this method
@@ -627,7 +627,7 @@
/**
* Gets the value of the specified field from this date as a {@code long}.
* <p>
- * This queries this date for the value for the specified field.
+ * This queries this date for the value of the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
@@ -875,7 +875,9 @@
* <p>
* A simple adjuster might simply set the one of the fields, such as the year field.
* A more complex adjuster might set the date to the last day of the month.
- * A selection of common adjustments is provided in {@link TemporalAdjuster}.
+ * <p>
+ * A selection of common adjustments is provided in
+ * {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}.
* These include finding the "last day of the month" and "next Wednesday".
* Key date-time classes also implement the {@code TemporalAdjuster} interface,
* such as {@link Month} and {@link java.time.MonthDay MonthDay}.
@@ -885,7 +887,7 @@
* For example this code returns a date on the last day of July:
* <pre>
* import static java.time.Month.*;
- * import static java.time.temporal.Adjusters.*;
+ * import static java.time.temporal.TemporalAdjusters.*;
*
* result = localDate.with(JULY).with(lastDayOfMonth());
* </pre>
@@ -1041,7 +1043,8 @@
//-----------------------------------------------------------------------
/**
- * Returns a copy of this date with the year altered.
+ * Returns a copy of this {@code LocalDate} with the year altered.
+ * <p>
* If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
* <p>
* This instance is immutable and unaffected by this method call.
@@ -1059,7 +1062,8 @@
}
/**
- * Returns a copy of this date with the month-of-year altered.
+ * Returns a copy of this {@code LocalDate} with the month-of-year altered.
+ * <p>
* If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
* <p>
* This instance is immutable and unaffected by this method call.
@@ -1077,7 +1081,8 @@
}
/**
- * Returns a copy of this date with the day-of-month altered.
+ * Returns a copy of this {@code LocalDate} with the day-of-month altered.
+ * <p>
* If the resulting date is invalid, an exception is thrown.
* <p>
* This instance is immutable and unaffected by this method call.
@@ -1095,7 +1100,8 @@
}
/**
- * Returns a copy of this date with the day-of-year altered.
+ * Returns a copy of this {@code LocalDate} with the day-of-year altered.
+ * <p>
* If the resulting date is invalid, an exception is thrown.
* <p>
* This instance is immutable and unaffected by this method call.
@@ -1245,7 +1251,7 @@
//-----------------------------------------------------------------------
/**
- * Returns a copy of this {@code LocalDate} with the specified period in years added.
+ * Returns a copy of this {@code LocalDate} with the specified number of years added.
* <p>
* This method adds the specified amount to the years field in three steps:
* <ol>
@@ -1273,7 +1279,7 @@
}
/**
- * Returns a copy of this {@code LocalDate} with the specified period in months added.
+ * Returns a copy of this {@code LocalDate} with the specified number of months added.
* <p>
* This method adds the specified amount to the months field in three steps:
* <ol>
@@ -1304,7 +1310,7 @@
}
/**
- * Returns a copy of this {@code LocalDate} with the specified period in weeks added.
+ * Returns a copy of this {@code LocalDate} with the specified number of weeks added.
* <p>
* This method adds the specified amount in weeks to the days field incrementing
* the month and year fields as necessary to ensure the result remains valid.
@@ -1402,11 +1408,11 @@
//-----------------------------------------------------------------------
/**
- * Returns a copy of this {@code LocalDate} with the specified period in years subtracted.
+ * Returns a copy of this {@code LocalDate} with the specified number of years subtracted.
* <p>
* This method subtracts the specified amount from the years field in three steps:
* <ol>
- * <li>Subtract the input years to the year field</li>
+ * <li>Subtract the input years from the year field</li>
* <li>Check if the resulting date would be invalid</li>
* <li>Adjust the day-of-month to the last valid day if necessary</li>
* </ol>
@@ -1426,11 +1432,11 @@
}
/**
- * Returns a copy of this {@code LocalDate} with the specified period in months subtracted.
+ * Returns a copy of this {@code LocalDate} with the specified number of months subtracted.
* <p>
* This method subtracts the specified amount from the months field in three steps:
* <ol>
- * <li>Subtract the input months to the month-of-year field</li>
+ * <li>Subtract the input months from the month-of-year field</li>
* <li>Check if the resulting date would be invalid</li>
* <li>Adjust the day-of-month to the last valid day if necessary</li>
* </ol>
@@ -1450,7 +1456,7 @@
}
/**
- * Returns a copy of this {@code LocalDate} with the specified period in weeks subtracted.
+ * Returns a copy of this {@code LocalDate} with the specified number of weeks subtracted.
* <p>
* This method subtracts the specified amount in weeks from the days field decrementing
* the month and year fields as necessary to ensure the result remains valid.
--- a/jdk/src/share/classes/java/time/LocalDateTime.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/LocalDateTime.java Thu May 08 15:27:38 2014 -0700
@@ -428,7 +428,7 @@
/**
* Obtains an instance of {@code LocalDateTime} from a temporal object.
* <p>
- * This obtains an offset time based on the specified temporal.
+ * This obtains a local date-time based on the specified temporal.
* A {@code TemporalAccessor} represents an arbitrary set of date and time information,
* which this factory converts to an instance of {@code LocalDateTime}.
* <p>
@@ -656,7 +656,7 @@
/**
* Gets the value of the specified field from this date-time as an {@code int}.
* <p>
- * This queries this date-time for the value for the specified field.
+ * This queries this date-time for the value of the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
@@ -665,7 +665,7 @@
* The {@link #isSupported(TemporalField) supported fields} will return valid
* values based on this date-time, except {@code NANO_OF_DAY}, {@code MICRO_OF_DAY},
* {@code EPOCH_DAY} and {@code PROLEPTIC_MONTH} which are too large to fit in
- * an {@code int} and throw a {@code DateTimeException}.
+ * an {@code int} and throw a {@code UnsupportedTemporalTypeException}.
* All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
* <p>
* If the field is not a {@code ChronoField}, then the result of this method
@@ -693,7 +693,7 @@
/**
* Gets the value of the specified field from this date-time as a {@code long}.
* <p>
- * This queries this date-time for the value for the specified field.
+ * This queries this date-time for the value of the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
@@ -878,7 +878,9 @@
* <p>
* A simple adjuster might simply set the one of the fields, such as the year field.
* A more complex adjuster might set the date to the last day of the month.
- * A selection of common adjustments is provided in {@link TemporalAdjuster}.
+ * <p>
+ * A selection of common adjustments is provided in
+ * {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}.
* These include finding the "last day of the month" and "next Wednesday".
* Key date-time classes also implement the {@code TemporalAdjuster} interface,
* such as {@link Month} and {@link java.time.MonthDay MonthDay}.
@@ -888,7 +890,7 @@
* For example this code returns a date on the last day of July:
* <pre>
* import static java.time.Month.*;
- * import static java.time.temporal.Adjusters.*;
+ * import static java.time.temporal.TemporalAdjusters.*;
*
* result = localDateTime.with(JULY).with(lastDayOfMonth());
* </pre>
@@ -974,6 +976,7 @@
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code LocalDateTime} with the year altered.
+ * <p>
* The time does not affect the calculation and will be the same in the result.
* If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
* <p>
@@ -989,6 +992,7 @@
/**
* Returns a copy of this {@code LocalDateTime} with the month-of-year altered.
+ * <p>
* The time does not affect the calculation and will be the same in the result.
* If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
* <p>
@@ -1004,7 +1008,8 @@
/**
* Returns a copy of this {@code LocalDateTime} with the day-of-month altered.
- * If the resulting {@code LocalDateTime} is invalid, an exception is thrown.
+ * <p>
+ * If the resulting date-time is invalid, an exception is thrown.
* The time does not affect the calculation and will be the same in the result.
* <p>
* This instance is immutable and unaffected by this method call.
@@ -1020,7 +1025,8 @@
/**
* Returns a copy of this {@code LocalDateTime} with the day-of-year altered.
- * If the resulting {@code LocalDateTime} is invalid, an exception is thrown.
+ * <p>
+ * If the resulting date-time is invalid, an exception is thrown.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1035,7 +1041,7 @@
//-----------------------------------------------------------------------
/**
- * Returns a copy of this {@code LocalDateTime} with the hour-of-day value altered.
+ * Returns a copy of this {@code LocalDateTime} with the hour-of-day altered.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1049,7 +1055,7 @@
}
/**
- * Returns a copy of this {@code LocalDateTime} with the minute-of-hour value altered.
+ * Returns a copy of this {@code LocalDateTime} with the minute-of-hour altered.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1063,7 +1069,7 @@
}
/**
- * Returns a copy of this {@code LocalDateTime} with the second-of-minute value altered.
+ * Returns a copy of this {@code LocalDateTime} with the second-of-minute altered.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1077,7 +1083,7 @@
}
/**
- * Returns a copy of this {@code LocalDateTime} with the nano-of-second value altered.
+ * Returns a copy of this {@code LocalDateTime} with the nano-of-second altered.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1109,7 +1115,7 @@
* @param unit the unit to truncate to, not null
* @return a {@code LocalDateTime} based on this date-time with the time truncated, not null
* @throws DateTimeException if unable to truncate
- * @throws UnsupportedTemporalTypeException if the field is not supported
+ * @throws UnsupportedTemporalTypeException if the unit is not supported
*/
public LocalDateTime truncatedTo(TemporalUnit unit) {
return with(date, time.truncatedTo(unit));
@@ -1192,7 +1198,7 @@
//-----------------------------------------------------------------------
/**
- * Returns a copy of this {@code LocalDateTime} with the specified period in years added.
+ * Returns a copy of this {@code LocalDateTime} with the specified number of years added.
* <p>
* This method adds the specified amount to the years field in three steps:
* <ol>
@@ -1217,7 +1223,7 @@
}
/**
- * Returns a copy of this {@code LocalDateTime} with the specified period in months added.
+ * Returns a copy of this {@code LocalDateTime} with the specified number of months added.
* <p>
* This method adds the specified amount to the months field in three steps:
* <ol>
@@ -1242,7 +1248,7 @@
}
/**
- * Returns a copy of this {@code LocalDateTime} with the specified period in weeks added.
+ * Returns a copy of this {@code LocalDateTime} with the specified number of weeks added.
* <p>
* This method adds the specified amount in weeks to the days field incrementing
* the month and year fields as necessary to ensure the result remains valid.
@@ -1262,7 +1268,7 @@
}
/**
- * Returns a copy of this {@code LocalDateTime} with the specified period in days added.
+ * Returns a copy of this {@code LocalDateTime} with the specified number of days added.
* <p>
* This method adds the specified amount to the days field incrementing the
* month and year fields as necessary to ensure the result remains valid.
@@ -1283,7 +1289,7 @@
//-----------------------------------------------------------------------
/**
- * Returns a copy of this {@code LocalDateTime} with the specified period in hours added.
+ * Returns a copy of this {@code LocalDateTime} with the specified number of hours added.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1296,7 +1302,7 @@
}
/**
- * Returns a copy of this {@code LocalDateTime} with the specified period in minutes added.
+ * Returns a copy of this {@code LocalDateTime} with the specified number of minutes added.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1309,7 +1315,7 @@
}
/**
- * Returns a copy of this {@code LocalDateTime} with the specified period in seconds added.
+ * Returns a copy of this {@code LocalDateTime} with the specified number of seconds added.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1322,7 +1328,7 @@
}
/**
- * Returns a copy of this {@code LocalDateTime} with the specified period in nanoseconds added.
+ * Returns a copy of this {@code LocalDateTime} with the specified number of nanoseconds added.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1391,7 +1397,7 @@
//-----------------------------------------------------------------------
/**
- * Returns a copy of this {@code LocalDateTime} with the specified period in years subtracted.
+ * Returns a copy of this {@code LocalDateTime} with the specified number of years subtracted.
* <p>
* This method subtracts the specified amount from the years field in three steps:
* <ol>
@@ -1415,7 +1421,7 @@
}
/**
- * Returns a copy of this {@code LocalDateTime} with the specified period in months subtracted.
+ * Returns a copy of this {@code LocalDateTime} with the specified number of months subtracted.
* <p>
* This method subtracts the specified amount from the months field in three steps:
* <ol>
@@ -1439,7 +1445,7 @@
}
/**
- * Returns a copy of this {@code LocalDateTime} with the specified period in weeks subtracted.
+ * Returns a copy of this {@code LocalDateTime} with the specified number of weeks subtracted.
* <p>
* This method subtracts the specified amount in weeks from the days field decrementing
* the month and year fields as necessary to ensure the result remains valid.
@@ -1458,9 +1464,9 @@
}
/**
- * Returns a copy of this {@code LocalDateTime} with the specified period in days subtracted.
+ * Returns a copy of this {@code LocalDateTime} with the specified number of days subtracted.
* <p>
- * This method subtracts the specified amount from the days field incrementing the
+ * This method subtracts the specified amount from the days field decrementing the
* month and year fields as necessary to ensure the result remains valid.
* The result is only invalid if the maximum/minimum year is exceeded.
* <p>
@@ -1478,7 +1484,7 @@
//-----------------------------------------------------------------------
/**
- * Returns a copy of this {@code LocalDateTime} with the specified period in hours subtracted.
+ * Returns a copy of this {@code LocalDateTime} with the specified number of hours subtracted.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1491,7 +1497,7 @@
}
/**
- * Returns a copy of this {@code LocalDateTime} with the specified period in minutes subtracted.
+ * Returns a copy of this {@code LocalDateTime} with the specified number of minutes subtracted.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1504,7 +1510,7 @@
}
/**
- * Returns a copy of this {@code LocalDateTime} with the specified period in seconds subtracted.
+ * Returns a copy of this {@code LocalDateTime} with the specified number of seconds subtracted.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1517,7 +1523,7 @@
}
/**
- * Returns a copy of this {@code LocalDateTime} with the specified period in nanoseconds subtracted.
+ * Returns a copy of this {@code LocalDateTime} with the specified number of nanoseconds subtracted.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1575,7 +1581,7 @@
* what the result of this method will be.
* <p>
* The result of this method is obtained by invoking the
- * {@link java.time.temporal.TemporalQuery#queryFrom(TemporalAccessor)} method on the
+ * {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
* specified query passing {@code this} as the argument.
*
* @param <R> the type of the result
--- a/jdk/src/share/classes/java/time/LocalTime.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/LocalTime.java Thu May 08 15:27:38 2014 -0700
@@ -93,7 +93,7 @@
import java.util.Objects;
/**
- * A time without time-zone in the ISO-8601 calendar system,
+ * A time without a time-zone in the ISO-8601 calendar system,
* such as {@code 10:15:30}.
* <p>
* {@code LocalTime} is an immutable date-time object that represents a time,
@@ -101,7 +101,7 @@
* Time is represented to nanosecond precision.
* For example, the value "13:45.30.123456789" can be stored in a {@code LocalTime}.
* <p>
- * It does not store or represent a date or time-zone.
+ * This class does not store or represent a date or time-zone.
* Instead, it is a description of the local time as seen on a wall clock.
* It cannot represent an instant on the time-line without additional information
* such as an offset or time-zone.
@@ -280,7 +280,7 @@
return ofNanoOfDay(secsOfDay * NANOS_PER_SECOND + now.getNano());
}
- //------------------------get-----------------------------------------------
+ //-----------------------------------------------------------------------
/**
* Obtains an instance of {@code LocalTime} from an hour and minute.
* <p>
@@ -395,7 +395,7 @@
* on extracting the {@link ChronoField#NANO_OF_DAY NANO_OF_DAY} field.
* <p>
* This method matches the signature of the functional interface {@link TemporalQuery}
- * allowing it to be used in queries via method reference, {@code LocalTime::from}.
+ * allowing it to be used as a query via method reference, {@code LocalTime::from}.
*
* @param temporal the temporal object to convert, not null
* @return the local time, not null
@@ -418,7 +418,7 @@
* The string must represent a valid time and is parsed using
* {@link java.time.format.DateTimeFormatter#ISO_LOCAL_TIME}.
*
- * @param text the text to parse such as "10:15:30", not null
+ * @param text the text to parse such as "10:15:30", not null
* @return the parsed local time, not null
* @throws DateTimeParseException if the text cannot be parsed
*/
@@ -524,7 +524,7 @@
/**
* Checks if the specified unit is supported.
* <p>
- * This checks if the specified unit can be added to, or subtracted from, this date-time.
+ * This checks if the specified unit can be added to, or subtracted from, this time.
* If false, then calling the {@link #plus(long, TemporalUnit)} and
* {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
* <p>
@@ -589,7 +589,7 @@
/**
* Gets the value of the specified field from this time as an {@code int}.
* <p>
- * This queries this time for the value for the specified field.
+ * This queries this time for the value of the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
@@ -597,7 +597,7 @@
* If the field is a {@link ChronoField} then the query is implemented here.
* The {@link #isSupported(TemporalField) supported fields} will return valid
* values based on this time, except {@code NANO_OF_DAY} and {@code MICRO_OF_DAY}
- * which are too large to fit in an {@code int} and throw a {@code DateTimeException}.
+ * which are too large to fit in an {@code int} and throw a {@code UnsupportedTemporalTypeException}.
* All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
* <p>
* If the field is not a {@code ChronoField}, then the result of this method
@@ -624,7 +624,7 @@
/**
* Gets the value of the specified field from this time as a {@code long}.
* <p>
- * This queries this time for the value for the specified field.
+ * This queries this time for the value of the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
@@ -858,7 +858,7 @@
//-----------------------------------------------------------------------
/**
- * Returns a copy of this {@code LocalTime} with the hour-of-day value altered.
+ * Returns a copy of this {@code LocalTime} with the hour-of-day altered.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -875,7 +875,7 @@
}
/**
- * Returns a copy of this {@code LocalTime} with the minute-of-hour value altered.
+ * Returns a copy of this {@code LocalTime} with the minute-of-hour altered.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -892,7 +892,7 @@
}
/**
- * Returns a copy of this {@code LocalTime} with the second-of-minute value altered.
+ * Returns a copy of this {@code LocalTime} with the second-of-minute altered.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -909,7 +909,7 @@
}
/**
- * Returns a copy of this {@code LocalTime} with the nano-of-second value altered.
+ * Returns a copy of this {@code LocalTime} with the nano-of-second altered.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -929,7 +929,7 @@
/**
* Returns a copy of this {@code LocalTime} with the time truncated.
* <p>
- * Truncating the time returns a copy of the original time with fields
+ * Truncation returns a copy of the original time with fields
* smaller than the specified unit set to zero.
* For example, truncating with the {@link ChronoUnit#MINUTES minutes} unit
* will set the second-of-minute and nano-of-second field to zero.
@@ -1059,7 +1059,7 @@
//-----------------------------------------------------------------------
/**
- * Returns a copy of this {@code LocalTime} with the specified period in hours added.
+ * Returns a copy of this {@code LocalTime} with the specified number of hours added.
* <p>
* This adds the specified number of hours to this time, returning a new time.
* The calculation wraps around midnight.
@@ -1078,7 +1078,7 @@
}
/**
- * Returns a copy of this {@code LocalTime} with the specified period in minutes added.
+ * Returns a copy of this {@code LocalTime} with the specified number of minutes added.
* <p>
* This adds the specified number of minutes to this time, returning a new time.
* The calculation wraps around midnight.
@@ -1103,7 +1103,7 @@
}
/**
- * Returns a copy of this {@code LocalTime} with the specified period in seconds added.
+ * Returns a copy of this {@code LocalTime} with the specified number of seconds added.
* <p>
* This adds the specified number of seconds to this time, returning a new time.
* The calculation wraps around midnight.
@@ -1130,7 +1130,7 @@
}
/**
- * Returns a copy of this {@code LocalTime} with the specified period in nanoseconds added.
+ * Returns a copy of this {@code LocalTime} with the specified number of nanoseconds added.
* <p>
* This adds the specified number of nanoseconds to this time, returning a new time.
* The calculation wraps around midnight.
@@ -1208,7 +1208,7 @@
//-----------------------------------------------------------------------
/**
- * Returns a copy of this {@code LocalTime} with the specified period in hours subtracted.
+ * Returns a copy of this {@code LocalTime} with the specified number of hours subtracted.
* <p>
* This subtracts the specified number of hours from this time, returning a new time.
* The calculation wraps around midnight.
@@ -1223,7 +1223,7 @@
}
/**
- * Returns a copy of this {@code LocalTime} with the specified period in minutes subtracted.
+ * Returns a copy of this {@code LocalTime} with the specified number of minutes subtracted.
* <p>
* This subtracts the specified number of minutes from this time, returning a new time.
* The calculation wraps around midnight.
@@ -1238,7 +1238,7 @@
}
/**
- * Returns a copy of this {@code LocalTime} with the specified period in seconds subtracted.
+ * Returns a copy of this {@code LocalTime} with the specified number of seconds subtracted.
* <p>
* This subtracts the specified number of seconds from this time, returning a new time.
* The calculation wraps around midnight.
@@ -1253,7 +1253,7 @@
}
/**
- * Returns a copy of this {@code LocalTime} with the specified period in nanoseconds subtracted.
+ * Returns a copy of this {@code LocalTime} with the specified number of nanoseconds subtracted.
* <p>
* This subtracts the specified number of nanoseconds from this time, returning a new time.
* The calculation wraps around midnight.
@@ -1470,14 +1470,13 @@
//-----------------------------------------------------------------------
/**
- * Compares this {@code LocalTime} to another time.
+ * Compares this time to another time.
* <p>
* The comparison is based on the time-line position of the local times within a day.
* It is "consistent with equals", as defined by {@link Comparable}.
*
* @param other the other time to compare to, not null
* @return the comparator value, negative if less, positive if greater
- * @throws NullPointerException if {@code other} is null
*/
@Override
public int compareTo(LocalTime other) {
@@ -1495,26 +1494,24 @@
}
/**
- * Checks if this {@code LocalTime} is after the specified time.
+ * Checks if this time is after the specified time.
* <p>
* The comparison is based on the time-line position of the time within a day.
*
* @param other the other time to compare to, not null
* @return true if this is after the specified time
- * @throws NullPointerException if {@code other} is null
*/
public boolean isAfter(LocalTime other) {
return compareTo(other) > 0;
}
/**
- * Checks if this {@code LocalTime} is before the specified time.
+ * Checks if this time is before the specified time.
* <p>
* The comparison is based on the time-line position of the time within a day.
*
* @param other the other time to compare to, not null
* @return true if this point is before the specified time
- * @throws NullPointerException if {@code other} is null
*/
public boolean isBefore(LocalTime other) {
return compareTo(other) < 0;
--- a/jdk/src/share/classes/java/time/Month.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/Month.java Thu May 08 15:27:38 2014 -0700
@@ -202,7 +202,7 @@
* chronology, or can be converted to a {@code LocalDate}.
* <p>
* This method matches the signature of the functional interface {@link TemporalQuery}
- * allowing it to be used in queries via method reference, {@code Month::from}.
+ * allowing it to be used as a query via method reference, {@code Month::from}.
*
* @param temporal the temporal object to convert, not null
* @return the month-of-year, not null
@@ -315,7 +315,7 @@
/**
* Gets the value of the specified field from this month-of-year as an {@code int}.
* <p>
- * This queries this month for the value for the specified field.
+ * This queries this month for the value of the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
@@ -348,7 +348,7 @@
/**
* Gets the value of the specified field from this month-of-year as a {@code long}.
* <p>
- * This queries this month for the value for the specified field.
+ * This queries this month for the value of the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
--- a/jdk/src/share/classes/java/time/MonthDay.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/MonthDay.java Thu May 08 15:27:38 2014 -0700
@@ -90,8 +90,8 @@
* A month-day in the ISO-8601 calendar system, such as {@code --12-03}.
* <p>
* {@code MonthDay} is an immutable date-time object that represents the combination
- * of a year and month. Any field that can be derived from a month and day, such as
- * quarter-of-year, can be obtained.
+ * of a month and day-of-month. Any field that can be derived from a month and day,
+ * such as quarter-of-year, can be obtained.
* <p>
* This class does not store or represent a year, time or time-zone.
* For example, the value "December 3rd" can be stored in a {@code MonthDay}.
@@ -154,7 +154,7 @@
/**
* Obtains the current month-day from the system clock in the default time-zone.
* <p>
- * This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default
+ * This will query the {@link Clock#systemDefaultZone() system clock} in the default
* time-zone to obtain the current month-day.
* <p>
* Using this method will prevent the ability to use an alternate clock for testing
@@ -169,7 +169,7 @@
/**
* Obtains the current month-day from the system clock in the specified time-zone.
* <p>
- * This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current month-day.
+ * This will query the {@link Clock#system(ZoneId) system clock} to obtain the current month-day.
* Specifying the time-zone avoids dependence on the default time-zone.
* <p>
* Using this method will prevent the ability to use an alternate clock for testing
@@ -258,7 +258,7 @@
* chronology, or can be converted to a {@code LocalDate}.
* <p>
* This method matches the signature of the functional interface {@link TemporalQuery}
- * allowing it to be used in queries via method reference, {@code MonthDay::from}.
+ * allowing it to be used as a query via method reference, {@code MonthDay::from}.
*
* @param temporal the temporal object to convert, not null
* @return the month-day, not null
@@ -389,7 +389,7 @@
/**
* Gets the value of the specified field from this month-day as an {@code int}.
* <p>
- * This queries this month-day for the value for the specified field.
+ * This queries this month-day for the value of the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
@@ -420,7 +420,7 @@
/**
* Gets the value of the specified field from this month-day as a {@code long}.
* <p>
- * This queries this month-day for the value for the specified field.
+ * This queries this month-day for the value of the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
@@ -501,7 +501,7 @@
* This method checks whether this month and day and the input year form
* a valid date. This can only return false for February 29th.
*
- * @param year the year to validate, an out of range value returns false
+ * @param year the year to validate
* @return true if the year is valid for this month-day
* @see Year#isValidMonthDay(MonthDay)
*/
@@ -685,7 +685,7 @@
}
/**
- * Is this month-day after the specified month-day.
+ * Checks if this month-day is after the specified month-day.
*
* @param other the other month-day to compare to, not null
* @return true if this is after the specified month-day
@@ -695,7 +695,7 @@
}
/**
- * Is this month-day before the specified month-day.
+ * Checks if this month-day is before the specified month-day.
*
* @param other the other month-day to compare to, not null
* @return true if this point is before the specified month-day
--- a/jdk/src/share/classes/java/time/OffsetDateTime.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/OffsetDateTime.java Thu May 08 15:27:38 2014 -0700
@@ -199,7 +199,7 @@
/**
* Obtains the current date-time from the system clock in the default time-zone.
* <p>
- * This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default
+ * This will query the {@link Clock#systemDefaultZone() system clock} in the default
* time-zone to obtain the current date-time.
* The offset will be calculated from the time-zone in the clock.
* <p>
@@ -215,7 +215,7 @@
/**
* Obtains the current date-time from the system clock in the specified time-zone.
* <p>
- * This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current date-time.
+ * This will query the {@link Clock#system(ZoneId) system clock} to obtain the current date-time.
* Specifying the time-zone avoids dependence on the default time-zone.
* The offset will be calculated from the specified time-zone.
* <p>
@@ -345,7 +345,7 @@
* those fields that are equivalent to the relevant objects.
* <p>
* This method matches the signature of the functional interface {@link TemporalQuery}
- * allowing it to be used in queries via method reference, {@code OffsetDateTime::from}.
+ * allowing it to be used as a query via method reference, {@code OffsetDateTime::from}.
*
* @param temporal the temporal object to convert, not null
* @return the offset date-time, not null
@@ -566,7 +566,7 @@
/**
* Gets the value of the specified field from this date-time as an {@code int}.
* <p>
- * This queries this date-time for the value for the specified field.
+ * This queries this date-time for the value of the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
@@ -575,7 +575,7 @@
* The {@link #isSupported(TemporalField) supported fields} will return valid
* values based on this date-time, except {@code NANO_OF_DAY}, {@code MICRO_OF_DAY},
* {@code EPOCH_DAY}, {@code PROLEPTIC_MONTH} and {@code INSTANT_SECONDS} which are too
- * large to fit in an {@code int} and throw a {@code DateTimeException}.
+ * large to fit in an {@code int} and throw a {@code UnsupportedTemporalTypeException}.
* All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
* <p>
* If the field is not a {@code ChronoField}, then the result of this method
@@ -608,7 +608,7 @@
/**
* Gets the value of the specified field from this date-time as a {@code long}.
* <p>
- * This queries this date-time for the value for the specified field.
+ * This queries this date-time for the value of the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
@@ -703,7 +703,7 @@
//-----------------------------------------------------------------------
/**
- * Gets the {@code LocalDateTime} part of this offset date-time.
+ * Gets the {@code LocalDateTime} part of this date-time.
* <p>
* This returns a {@code LocalDateTime} with the same year, month, day and time
* as this date-time.
@@ -795,10 +795,10 @@
/**
* Gets the day-of-week field, which is an enum {@code DayOfWeek}.
* <p>
- * This method returns the enum {@link java.time.DayOfWeek} for the day-of-week.
+ * This method returns the enum {@link DayOfWeek} for the day-of-week.
* This avoids confusion as to what {@code int} values mean.
* If you need access to the primitive {@code int} value then the enum
- * provides the {@link java.time.DayOfWeek#getValue() int value}.
+ * provides the {@link DayOfWeek#getValue() int value}.
* <p>
* Additional information can be obtained from the {@code DayOfWeek}.
* This includes textual names of the values.
@@ -868,7 +868,8 @@
* <p>
* A simple adjuster might simply set the one of the fields, such as the year field.
* A more complex adjuster might set the date to the last day of the month.
- * A selection of common adjustments is provided in {@link TemporalAdjuster}.
+ * A selection of common adjustments is provided in
+ * {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}.
* These include finding the "last day of the month" and "next Wednesday".
* Key date-time classes also implement the {@code TemporalAdjuster} interface,
* such as {@link Month} and {@link java.time.MonthDay MonthDay}.
@@ -878,7 +879,7 @@
* For example this code returns a date on the last day of July:
* <pre>
* import static java.time.Month.*;
- * import static java.time.temporal.Adjusters.*;
+ * import static java.time.temporal.TemporalAdjusters.*;
*
* result = offsetDateTime.with(JULY).with(lastDayOfMonth());
* </pre>
@@ -920,7 +921,7 @@
/**
* Returns a copy of this date-time with the specified field set to a new value.
* <p>
- * TThis returns an {@code OffsetDateTime}, based on this one, with the value
+ * This returns an {@code OffsetDateTime}, based on this one, with the value
* for the specified field changed.
* This can be used to change any supported field, such as the year, month or day-of-month.
* If it is not possible to set the value, because the field is not supported or for
@@ -979,7 +980,8 @@
//-----------------------------------------------------------------------
/**
* Returns a copy of this {@code OffsetDateTime} with the year altered.
- * The offset does not affect the calculation and will be the same in the result.
+ * <p>
+ * The time and offset do not affect the calculation and will be the same in the result.
* If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
* <p>
* This instance is immutable and unaffected by this method call.
@@ -994,7 +996,8 @@
/**
* Returns a copy of this {@code OffsetDateTime} with the month-of-year altered.
- * The offset does not affect the calculation and will be the same in the result.
+ * <p>
+ * The time and offset do not affect the calculation and will be the same in the result.
* If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
* <p>
* This instance is immutable and unaffected by this method call.
@@ -1009,8 +1012,9 @@
/**
* Returns a copy of this {@code OffsetDateTime} with the day-of-month altered.
+ * <p>
* If the resulting {@code OffsetDateTime} is invalid, an exception is thrown.
- * The offset does not affect the calculation and will be the same in the result.
+ * The time and offset do not affect the calculation and will be the same in the result.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1025,6 +1029,8 @@
/**
* Returns a copy of this {@code OffsetDateTime} with the day-of-year altered.
+ * <p>
+ * The time and offset do not affect the calculation and will be the same in the result.
* If the resulting {@code OffsetDateTime} is invalid, an exception is thrown.
* <p>
* This instance is immutable and unaffected by this method call.
@@ -1040,9 +1046,9 @@
//-----------------------------------------------------------------------
/**
- * Returns a copy of this {@code OffsetDateTime} with the hour-of-day value altered.
+ * Returns a copy of this {@code OffsetDateTime} with the hour-of-day altered.
* <p>
- * The offset does not affect the calculation and will be the same in the result.
+ * The date and offset do not affect the calculation and will be the same in the result.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1055,9 +1061,9 @@
}
/**
- * Returns a copy of this {@code OffsetDateTime} with the minute-of-hour value altered.
+ * Returns a copy of this {@code OffsetDateTime} with the minute-of-hour altered.
* <p>
- * The offset does not affect the calculation and will be the same in the result.
+ * The date and offset do not affect the calculation and will be the same in the result.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1070,9 +1076,9 @@
}
/**
- * Returns a copy of this {@code OffsetDateTime} with the second-of-minute value altered.
+ * Returns a copy of this {@code OffsetDateTime} with the second-of-minute altered.
* <p>
- * The offset does not affect the calculation and will be the same in the result.
+ * The date and offset do not affect the calculation and will be the same in the result.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1085,15 +1091,15 @@
}
/**
- * Returns a copy of this {@code OffsetDateTime} with the nano-of-second value altered.
+ * Returns a copy of this {@code OffsetDateTime} with the nano-of-second altered.
* <p>
- * The offset does not affect the calculation and will be the same in the result.
+ * The date and offset do not affect the calculation and will be the same in the result.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @param nanoOfSecond the nano-of-second to set in the result, from 0 to 999,999,999
* @return an {@code OffsetDateTime} based on this date-time with the requested nanosecond, not null
- * @throws DateTimeException if the nanos value is invalid
+ * @throws DateTimeException if the nano value is invalid
*/
public OffsetDateTime withNano(int nanoOfSecond) {
return with(dateTime.withNano(nanoOfSecond), offset);
@@ -1187,7 +1193,7 @@
//-----------------------------------------------------------------------
/**
- * Returns a copy of this {@code OffsetDateTime} with the specified period in years added.
+ * Returns a copy of this {@code OffsetDateTime} with the specified number of years added.
* <p>
* This method adds the specified amount to the years field in three steps:
* <ol>
@@ -1211,7 +1217,7 @@
}
/**
- * Returns a copy of this {@code OffsetDateTime} with the specified period in months added.
+ * Returns a copy of this {@code OffsetDateTime} with the specified number of months added.
* <p>
* This method adds the specified amount to the months field in three steps:
* <ol>
@@ -1235,13 +1241,13 @@
}
/**
- * Returns a copy of this OffsetDateTime with the specified period in weeks added.
+ * Returns a copy of this OffsetDateTime with the specified number of weeks added.
* <p>
* This method adds the specified amount in weeks to the days field incrementing
* the month and year fields as necessary to ensure the result remains valid.
* The result is only invalid if the maximum/minimum year is exceeded.
* <p>
- * For example, 2008-12-31 plus one week would result in the 2009-01-07.
+ * For example, 2008-12-31 plus one week would result in 2009-01-07.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1254,13 +1260,13 @@
}
/**
- * Returns a copy of this OffsetDateTime with the specified period in days added.
+ * Returns a copy of this OffsetDateTime with the specified number of days added.
* <p>
* This method adds the specified amount to the days field incrementing the
* month and year fields as necessary to ensure the result remains valid.
* The result is only invalid if the maximum/minimum year is exceeded.
* <p>
- * For example, 2008-12-31 plus one day would result in the 2009-01-01.
+ * For example, 2008-12-31 plus one day would result in 2009-01-01.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1273,7 +1279,7 @@
}
/**
- * Returns a copy of this {@code OffsetDateTime} with the specified period in hours added.
+ * Returns a copy of this {@code OffsetDateTime} with the specified number of hours added.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1286,7 +1292,7 @@
}
/**
- * Returns a copy of this {@code OffsetDateTime} with the specified period in minutes added.
+ * Returns a copy of this {@code OffsetDateTime} with the specified number of minutes added.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1299,7 +1305,7 @@
}
/**
- * Returns a copy of this {@code OffsetDateTime} with the specified period in seconds added.
+ * Returns a copy of this {@code OffsetDateTime} with the specified number of seconds added.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1312,7 +1318,7 @@
}
/**
- * Returns a copy of this {@code OffsetDateTime} with the specified period in nanoseconds added.
+ * Returns a copy of this {@code OffsetDateTime} with the specified number of nanoseconds added.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1376,11 +1382,11 @@
//-----------------------------------------------------------------------
/**
- * Returns a copy of this {@code OffsetDateTime} with the specified period in years subtracted.
+ * Returns a copy of this {@code OffsetDateTime} with the specified number of years subtracted.
* <p>
* This method subtracts the specified amount from the years field in three steps:
* <ol>
- * <li>Subtract the input years to the year field</li>
+ * <li>Subtract the input years from the year field</li>
* <li>Check if the resulting date would be invalid</li>
* <li>Adjust the day-of-month to the last valid day if necessary</li>
* </ol>
@@ -1400,11 +1406,11 @@
}
/**
- * Returns a copy of this {@code OffsetDateTime} with the specified period in months subtracted.
+ * Returns a copy of this {@code OffsetDateTime} with the specified number of months subtracted.
* <p>
* This method subtracts the specified amount from the months field in three steps:
* <ol>
- * <li>Subtract the input months to the month-of-year field</li>
+ * <li>Subtract the input months from the month-of-year field</li>
* <li>Check if the resulting date would be invalid</li>
* <li>Adjust the day-of-month to the last valid day if necessary</li>
* </ol>
@@ -1424,13 +1430,13 @@
}
/**
- * Returns a copy of this {@code OffsetDateTime} with the specified period in weeks subtracted.
+ * Returns a copy of this {@code OffsetDateTime} with the specified number of weeks subtracted.
* <p>
* This method subtracts the specified amount in weeks from the days field decrementing
* the month and year fields as necessary to ensure the result remains valid.
* The result is only invalid if the maximum/minimum year is exceeded.
* <p>
- * For example, 2008-12-31 minus one week would result in the 2009-01-07.
+ * For example, 2008-12-31 minus one week would result in 2009-01-07.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1443,13 +1449,13 @@
}
/**
- * Returns a copy of this {@code OffsetDateTime} with the specified period in days subtracted.
+ * Returns a copy of this {@code OffsetDateTime} with the specified number of days subtracted.
* <p>
- * This method subtracts the specified amount from the days field incrementing the
+ * This method subtracts the specified amount from the days field decrementing the
* month and year fields as necessary to ensure the result remains valid.
* The result is only invalid if the maximum/minimum year is exceeded.
* <p>
- * For example, 2008-12-31 minus one day would result in the 2009-01-01.
+ * For example, 2008-12-31 minus one day would result in 2009-01-01.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1462,7 +1468,7 @@
}
/**
- * Returns a copy of this {@code OffsetDateTime} with the specified period in hours subtracted.
+ * Returns a copy of this {@code OffsetDateTime} with the specified number of hours subtracted.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1475,7 +1481,7 @@
}
/**
- * Returns a copy of this {@code OffsetDateTime} with the specified period in minutes subtracted.
+ * Returns a copy of this {@code OffsetDateTime} with the specified number of minutes subtracted.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1488,7 +1494,7 @@
}
/**
- * Returns a copy of this {@code OffsetDateTime} with the specified period in seconds subtracted.
+ * Returns a copy of this {@code OffsetDateTime} with the specified number of seconds subtracted.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1501,7 +1507,7 @@
}
/**
- * Returns a copy of this {@code OffsetDateTime} with the specified period in nanoseconds subtracted.
+ * Returns a copy of this {@code OffsetDateTime} with the specified number of nanoseconds subtracted.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1598,7 +1604,7 @@
* objects in terms of a single {@code TemporalUnit}.
* The start and end points are {@code this} and the specified date-time.
* The result will be negative if the end is before the start.
- * For example, the period in days between two date-times can be calculated
+ * For example, the amount in days between two date-times can be calculated
* using {@code startDateTime.until(endDateTime, DAYS)}.
* <p>
* The {@code Temporal} passed to this method is converted to a
@@ -1608,7 +1614,7 @@
* <p>
* The calculation returns a whole number, representing the number of
* complete units between the two date-times.
- * For example, the period in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z
+ * For example, the amount in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z
* will only be one month as it is one minute short of two months.
* <p>
* There are two equivalent ways of using this method.
@@ -1769,7 +1775,7 @@
//-----------------------------------------------------------------------
/**
- * Compares this {@code OffsetDateTime} to another date-time.
+ * Compares this date-time to another date-time.
* <p>
* The comparison is based on the instant then on the local date-time.
* It is "consistent with equals", as defined by {@link Comparable}.
--- a/jdk/src/share/classes/java/time/OffsetTime.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/OffsetTime.java Thu May 08 15:27:38 2014 -0700
@@ -153,14 +153,14 @@
/**
* Obtains the current time from the system clock in the default time-zone.
* <p>
- * This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default
+ * This will query the {@link Clock#systemDefaultZone() system clock} in the default
* time-zone to obtain the current time.
* The offset will be calculated from the time-zone in the clock.
* <p>
* Using this method will prevent the ability to use an alternate clock for testing
* because the clock is hard-coded.
*
- * @return the current time using the system clock, not null
+ * @return the current time using the system clock and default time-zone, not null
*/
public static OffsetTime now() {
return now(Clock.systemDefaultZone());
@@ -169,7 +169,7 @@
/**
* Obtains the current time from the system clock in the specified time-zone.
* <p>
- * This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current time.
+ * This will query the {@link Clock#system(ZoneId) system clock} to obtain the current time.
* Specifying the time-zone avoids dependence on the default time-zone.
* The offset will be calculated from the specified time-zone.
* <p>
@@ -277,7 +277,7 @@
* those fields that are equivalent to the relevant objects.
* <p>
* This method matches the signature of the functional interface {@link TemporalQuery}
- * allowing it to be used in queries via method reference, {@code OffsetTime::from}.
+ * allowing it to be used as a query via method reference, {@code OffsetTime::from}.
*
* @param temporal the temporal object to convert, not null
* @return the offset time, not null
@@ -402,7 +402,7 @@
/**
* Checks if the specified unit is supported.
* <p>
- * This checks if the specified unit can be added to, or subtracted from, this date-time.
+ * This checks if the specified unit can be added to, or subtracted from, this offset-time.
* If false, then calling the {@link #plus(long, TemporalUnit)} and
* {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
* <p>
@@ -473,7 +473,7 @@
/**
* Gets the value of the specified field from this time as an {@code int}.
* <p>
- * This queries this time for the value for the specified field.
+ * This queries this time for the value of the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
@@ -481,7 +481,7 @@
* If the field is a {@link ChronoField} then the query is implemented here.
* The {@link #isSupported(TemporalField) supported fields} will return valid
* values based on this time, except {@code NANO_OF_DAY} and {@code MICRO_OF_DAY}
- * which are too large to fit in an {@code int} and throw a {@code DateTimeException}.
+ * which are too large to fit in an {@code int} and throw a {@code UnsupportedTemporalTypeException}.
* All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
* <p>
* If the field is not a {@code ChronoField}, then the result of this method
@@ -505,7 +505,7 @@
/**
* Gets the value of the specified field from this time as a {@code long}.
* <p>
- * This queries this time for the value for the specified field.
+ * This queries this time for the value of the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
@@ -575,7 +575,7 @@
* <p>
* This method returns an object with the specified {@code ZoneOffset} and a {@code LocalTime}
* adjusted by the difference between the two offsets.
- * This will result in the old and new objects representing the same instant an an implied day.
+ * This will result in the old and new objects representing the same instant on an implied day.
* This is useful for finding the local time in a different offset.
* For example, if this time represents {@code 10:30+02:00} and the offset specified is
* {@code +03:00}, then this method will return {@code 11:30+03:00}.
@@ -737,7 +737,7 @@
//-----------------------------------------------------------------------
/**
- * Returns a copy of this {@code OffsetTime} with the hour-of-day value altered.
+ * Returns a copy of this {@code OffsetTime} with the hour-of-day altered.
* <p>
* The offset does not affect the calculation and will be the same in the result.
* <p>
@@ -752,7 +752,7 @@
}
/**
- * Returns a copy of this {@code OffsetTime} with the minute-of-hour value altered.
+ * Returns a copy of this {@code OffsetTime} with the minute-of-hour altered.
* <p>
* The offset does not affect the calculation and will be the same in the result.
* <p>
@@ -767,7 +767,7 @@
}
/**
- * Returns a copy of this {@code OffsetTime} with the second-of-minute value altered.
+ * Returns a copy of this {@code OffsetTime} with the second-of-minute altered.
* <p>
* The offset does not affect the calculation and will be the same in the result.
* <p>
@@ -782,7 +782,7 @@
}
/**
- * Returns a copy of this {@code OffsetTime} with the nano-of-second value altered.
+ * Returns a copy of this {@code OffsetTime} with the nano-of-second altered.
* <p>
* The offset does not affect the calculation and will be the same in the result.
* <p>
@@ -884,7 +884,7 @@
//-----------------------------------------------------------------------
/**
- * Returns a copy of this {@code OffsetTime} with the specified period in hours added.
+ * Returns a copy of this {@code OffsetTime} with the specified number of hours added.
* <p>
* This adds the specified number of hours to this time, returning a new time.
* The calculation wraps around midnight.
@@ -899,7 +899,7 @@
}
/**
- * Returns a copy of this {@code OffsetTime} with the specified period in minutes added.
+ * Returns a copy of this {@code OffsetTime} with the specified number of minutes added.
* <p>
* This adds the specified number of minutes to this time, returning a new time.
* The calculation wraps around midnight.
@@ -914,7 +914,7 @@
}
/**
- * Returns a copy of this {@code OffsetTime} with the specified period in seconds added.
+ * Returns a copy of this {@code OffsetTime} with the specified number of seconds added.
* <p>
* This adds the specified number of seconds to this time, returning a new time.
* The calculation wraps around midnight.
@@ -929,7 +929,7 @@
}
/**
- * Returns a copy of this {@code OffsetTime} with the specified period in nanoseconds added.
+ * Returns a copy of this {@code OffsetTime} with the specified number of nanoseconds added.
* <p>
* This adds the specified number of nanoseconds to this time, returning a new time.
* The calculation wraps around midnight.
@@ -995,7 +995,7 @@
//-----------------------------------------------------------------------
/**
- * Returns a copy of this {@code OffsetTime} with the specified period in hours subtracted.
+ * Returns a copy of this {@code OffsetTime} with the specified number of hours subtracted.
* <p>
* This subtracts the specified number of hours from this time, returning a new time.
* The calculation wraps around midnight.
@@ -1010,7 +1010,7 @@
}
/**
- * Returns a copy of this {@code OffsetTime} with the specified period in minutes subtracted.
+ * Returns a copy of this {@code OffsetTime} with the specified number of minutes subtracted.
* <p>
* This subtracts the specified number of minutes from this time, returning a new time.
* The calculation wraps around midnight.
@@ -1025,7 +1025,7 @@
}
/**
- * Returns a copy of this {@code OffsetTime} with the specified period in seconds subtracted.
+ * Returns a copy of this {@code OffsetTime} with the specified number of seconds subtracted.
* <p>
* This subtracts the specified number of seconds from this time, returning a new time.
* The calculation wraps around midnight.
@@ -1040,7 +1040,7 @@
}
/**
- * Returns a copy of this {@code OffsetTime} with the specified period in nanoseconds subtracted.
+ * Returns a copy of this {@code OffsetTime} with the specified number of nanoseconds subtracted.
* <p>
* This subtracts the specified number of nanoseconds from this time, returning a new time.
* The calculation wraps around midnight.
@@ -1130,7 +1130,7 @@
* objects in terms of a single {@code TemporalUnit}.
* The start and end points are {@code this} and the specified time.
* The result will be negative if the end is before the start.
- * For example, the period in hours between two times can be calculated
+ * For example, the amount in hours between two times can be calculated
* using {@code startTime.until(endTime, HOURS)}.
* <p>
* The {@code Temporal} passed to this method is converted to a
@@ -1140,7 +1140,7 @@
* <p>
* The calculation returns a whole number, representing the number of
* complete units between the two times.
- * For example, the period in hours between 11:30Z and 13:29Z will only
+ * For example, the amount in hours between 11:30Z and 13:29Z will only
* be one hour as it is one minute short of two hours.
* <p>
* There are two equivalent ways of using this method.
@@ -1165,7 +1165,7 @@
* <p>
* This instance is immutable and unaffected by this method call.
*
- * @param endExclusive the end date, exclusive, which is converted to an {@code OffsetTime}, not null
+ * @param endExclusive the end time, exclusive, which is converted to an {@code OffsetTime}, not null
* @param unit the unit to measure the amount in, not null
* @return the amount of time between this time and the end time
* @throws DateTimeException if the amount cannot be calculated, or the end
@@ -1258,7 +1258,6 @@
*
* @param other the other time to compare to, not null
* @return the comparator value, negative if less, positive if greater
- * @throws NullPointerException if {@code other} is null
*/
@Override
public int compareTo(OffsetTime other) {
--- a/jdk/src/share/classes/java/time/Period.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/Period.java Thu May 08 15:27:38 2014 -0700
@@ -616,7 +616,7 @@
* <p>
* This instance is immutable and unaffected by this method call.
*
- * @param amountToAdd the period to add, not null
+ * @param amountToAdd the amount to add, not null
* @return a {@code Period} based on this period with the requested period added, not null
* @throws DateTimeException if the specified amount has a non-ISO chronology or
* contains an invalid unit
@@ -705,7 +705,7 @@
* <p>
* This instance is immutable and unaffected by this method call.
*
- * @param amountToSubtract the period to subtract, not null
+ * @param amountToSubtract the amount to subtract, not null
* @return a {@code Period} based on this period with the requested period subtracted, not null
* @throws DateTimeException if the specified amount has a non-ISO chronology or
* contains an invalid unit
--- a/jdk/src/share/classes/java/time/Year.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/Year.java Thu May 08 15:27:38 2014 -0700
@@ -164,7 +164,7 @@
/**
* Obtains the current year from the system clock in the default time-zone.
* <p>
- * This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default
+ * This will query the {@link Clock#systemDefaultZone() system clock} in the default
* time-zone to obtain the current year.
* <p>
* Using this method will prevent the ability to use an alternate clock for testing
@@ -179,7 +179,7 @@
/**
* Obtains the current year from the system clock in the specified time-zone.
* <p>
- * This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current year.
+ * This will query the {@link Clock#system(ZoneId) system clock} to obtain the current year.
* Specifying the time-zone avoids dependence on the default time-zone.
* <p>
* Using this method will prevent the ability to use an alternate clock for testing
@@ -240,7 +240,7 @@
* chronology, or can be converted to a {@code LocalDate}.
* <p>
* This method matches the signature of the functional interface {@link TemporalQuery}
- * allowing it to be used in queries via method reference, {@code Year::from}.
+ * allowing it to be used as a query via method reference, {@code Year::from}.
*
* @param temporal the temporal object to convert, not null
* @return the year, not null
@@ -375,7 +375,7 @@
/**
* Checks if the specified unit is supported.
* <p>
- * This checks if the specified unit can be added to, or subtracted from, this date-time.
+ * This checks if the specified unit can be added to, or subtracted from, this year.
* If false, then calling the {@link #plus(long, TemporalUnit)} and
* {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
* <p>
@@ -441,7 +441,7 @@
/**
* Gets the value of the specified field from this year as an {@code int}.
* <p>
- * This queries this year for the value for the specified field.
+ * This queries this year for the value of the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
@@ -472,7 +472,7 @@
/**
* Gets the value of the specified field from this year as a {@code long}.
* <p>
- * This queries this year for the value for the specified field.
+ * This queries this year for the value of the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
@@ -720,13 +720,13 @@
}
/**
- * Returns a copy of this year with the specified number of years added.
+ * Returns a copy of this {@code Year} with the specified number of years added.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @param yearsToAdd the years to add, may be negative
- * @return a {@code Year} based on this year with the period added, not null
- * @throws DateTimeException if the result exceeds the supported year range
+ * @return a {@code Year} based on this year with the years added, not null
+ * @throws DateTimeException if the result exceeds the supported range
*/
public Year plusYears(long yearsToAdd) {
if (yearsToAdd == 0) {
@@ -786,13 +786,13 @@
}
/**
- * Returns a copy of this year with the specified number of years subtracted.
+ * Returns a copy of this {@code Year} with the specified number of years subtracted.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @param yearsToSubtract the years to subtract, may be negative
- * @return a {@code Year} based on this year with the period subtracted, not null
- * @throws DateTimeException if the result exceeds the supported year range
+ * @return a {@code Year} based on this year with the year subtracted, not null
+ * @throws DateTimeException if the result exceeds the supported range
*/
public Year minusYears(long yearsToSubtract) {
return (yearsToSubtract == Long.MIN_VALUE ? plusYears(Long.MAX_VALUE).plusYears(1) : plusYears(-yearsToSubtract));
@@ -871,12 +871,12 @@
* The result will be negative if the end is before the start.
* The {@code Temporal} passed to this method is converted to a
* {@code Year} using {@link #from(TemporalAccessor)}.
- * For example, the period in decades between two year can be calculated
+ * For example, the amount in decades between two year can be calculated
* using {@code startYear.until(endYear, DECADES)}.
* <p>
* The calculation returns a whole number, representing the number of
* complete units between the two years.
- * For example, the period in decades between 2012 and 2031
+ * For example, the amount in decades between 2012 and 2031
* will only be one decade as it is one year short of two decades.
* <p>
* There are two equivalent ways of using this method.
@@ -948,7 +948,7 @@
* <p>
* The day-of-year value 366 is only valid in a leap year.
*
- * @param dayOfYear the day-of-year to use, not null
+ * @param dayOfYear the day-of-year to use, from 1 to 365-366
* @return the local date formed from this year and the specified date of year, not null
* @throws DateTimeException if the day of year is zero or less, 366 or greater or equal
* to 366 and this is not a leap year
@@ -1025,7 +1025,7 @@
}
/**
- * Is this year after the specified year.
+ * Checks if this year is after the specified year.
*
* @param other the other year to compare to, not null
* @return true if this is after the specified year
@@ -1035,7 +1035,7 @@
}
/**
- * Is this year before the specified year.
+ * Checks if this year is before the specified year.
*
* @param other the other year to compare to, not null
* @return true if this point is before the specified year
--- a/jdk/src/share/classes/java/time/YearMonth.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/YearMonth.java Thu May 08 15:27:38 2014 -0700
@@ -157,9 +157,8 @@
/**
* Obtains the current year-month from the system clock in the default time-zone.
* <p>
- * This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default
+ * This will query the {@link Clock#systemDefaultZone() system clock} in the default
* time-zone to obtain the current year-month.
- * The zone and offset will be set based on the time-zone in the clock.
* <p>
* Using this method will prevent the ability to use an alternate clock for testing
* because the clock is hard-coded.
@@ -173,7 +172,7 @@
/**
* Obtains the current year-month from the system clock in the specified time-zone.
* <p>
- * This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current year-month.
+ * This will query the {@link Clock#system(ZoneId) system clock} to obtain the current year-month.
* Specifying the time-zone avoids dependence on the default time-zone.
* <p>
* Using this method will prevent the ability to use an alternate clock for testing
@@ -243,7 +242,7 @@
* chronology, or can be converted to a {@code LocalDate}.
* <p>
* This method matches the signature of the functional interface {@link TemporalQuery}
- * allowing it to be used in queries via method reference, {@code YearMonth::from}.
+ * allowing it to be used as a query via method reference, {@code YearMonth::from}.
*
* @param temporal the temporal object to convert, not null
* @return the year-month, not null
@@ -363,7 +362,7 @@
/**
* Checks if the specified unit is supported.
* <p>
- * This checks if the specified unit can be added to, or subtracted from, this date-time.
+ * This checks if the specified unit can be added to, or subtracted from, this year-month.
* If false, then calling the {@link #plus(long, TemporalUnit)} and
* {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
* <p>
@@ -430,7 +429,7 @@
/**
* Gets the value of the specified field from this year-month as an {@code int}.
* <p>
- * This queries this year-month for the value for the specified field.
+ * This queries this year-month for the value of the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
@@ -462,7 +461,7 @@
/**
* Gets the value of the specified field from this year-month as a {@code long}.
* <p>
- * This queries this year-month for the value for the specified field.
+ * This queries this year-month for the value of the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
@@ -819,7 +818,7 @@
}
/**
- * Returns a copy of this year-month with the specified period in years added.
+ * Returns a copy of this {@code YearMonth} with the specified number of years added.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -836,7 +835,7 @@
}
/**
- * Returns a copy of this year-month with the specified period in months added.
+ * Returns a copy of this {@code YearMonth} with the specified number of months added.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -906,7 +905,7 @@
}
/**
- * Returns a copy of this year-month with the specified period in years subtracted.
+ * Returns a copy of this {@code YearMonth} with the specified number of years subtracted.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -919,7 +918,7 @@
}
/**
- * Returns a copy of this year-month with the specified period in months subtracted.
+ * Returns a copy of this {@code YearMonth} with the specified number of months subtracted.
* <p>
* This instance is immutable and unaffected by this method call.
*
@@ -1004,12 +1003,12 @@
* The result will be negative if the end is before the start.
* The {@code Temporal} passed to this method is converted to a
* {@code YearMonth} using {@link #from(TemporalAccessor)}.
- * For example, the period in years between two year-months can be calculated
+ * For example, the amount in years between two year-months can be calculated
* using {@code startYearMonth.until(endYearMonth, YEARS)}.
* <p>
* The calculation returns a whole number, representing the number of
* complete units between the two year-months.
- * For example, the period in decades between 2012-06 and 2032-05
+ * For example, the amount in decades between 2012-06 and 2032-05
* will only be one decade as it is one month short of two decades.
* <p>
* There are two equivalent ways of using this method.
@@ -1134,7 +1133,7 @@
}
/**
- * Is this year-month after the specified year-month.
+ * Checks if this year-month is after the specified year-month.
*
* @param other the other year-month to compare to, not null
* @return true if this is after the specified year-month
@@ -1144,7 +1143,7 @@
}
/**
- * Is this year-month before the specified year-month.
+ * Checks if this year-month is before the specified year-month.
*
* @param other the other year-month to compare to, not null
* @return true if this point is before the specified year-month
--- a/jdk/src/share/classes/java/time/ZoneId.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/ZoneId.java Thu May 08 15:27:38 2014 -0700
@@ -453,7 +453,7 @@
* zones over offset-based zones using {@link TemporalQueries#zone()}.
* <p>
* This method matches the signature of the functional interface {@link TemporalQuery}
- * allowing it to be used in queries via method reference, {@code ZoneId::from}.
+ * allowing it to be used as a query via method reference, {@code ZoneId::from}.
*
* @param temporal the temporal object to convert, not null
* @return the zone ID, not null
--- a/jdk/src/share/classes/java/time/ZoneOffset.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/ZoneOffset.java Thu May 08 15:27:38 2014 -0700
@@ -89,7 +89,7 @@
/**
* A time-zone offset from Greenwich/UTC, such as {@code +02:00}.
* <p>
- * A time-zone offset is the period of time that a time-zone differs from Greenwich/UTC.
+ * A time-zone offset is the amount of time that a time-zone differs from Greenwich/UTC.
* This is usually a fixed number of hours and minutes.
* <p>
* Different parts of the world have different time-zone offsets.
@@ -334,7 +334,7 @@
* on extracting the {@link ChronoField#OFFSET_SECONDS OFFSET_SECONDS} field.
* <p>
* This method matches the signature of the functional interface {@link TemporalQuery}
- * allowing it to be used in queries via method reference, {@code ZoneOffset::from}.
+ * allowing it to be used as a query via method reference, {@code ZoneOffset::from}.
*
* @param temporal the temporal object to convert, not null
* @return the zone-offset, not null
@@ -564,7 +564,7 @@
/**
* Gets the value of the specified field from this offset as an {@code int}.
* <p>
- * This queries this offset for the value for the specified field.
+ * This queries this offset for the value of the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
@@ -599,7 +599,7 @@
/**
* Gets the value of the specified field from this offset as a {@code long}.
* <p>
- * This queries this offset for the value for the specified field.
+ * This queries this offset for the value of the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
--- a/jdk/src/share/classes/java/time/ZonedDateTime.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/ZonedDateTime.java Thu May 08 15:27:38 2014 -0700
@@ -418,7 +418,7 @@
* <p>
* Converting an instant to a zoned date-time is simple as there is only one valid
* offset for each instant. If the valid offset is different to the offset specified,
- * the the date-time and offset of the zoned date-time will differ from those specified.
+ * then the date-time and offset of the zoned date-time will differ from those specified.
* <p>
* If the {@code ZoneId} to be used is a {@code ZoneOffset}, this method is equivalent
* to {@link #of(LocalDateTime, ZoneId)}.
@@ -469,6 +469,7 @@
* @param offset the zone offset, not null
* @param zone the time-zone, not null
* @return the zoned date-time, not null
+ * @throws DateTimeException if the combination of arguments is invalid
*/
public static ZonedDateTime ofStrict(LocalDateTime localDateTime, ZoneOffset offset, ZoneId zone) {
Objects.requireNonNull(localDateTime, "localDateTime");
@@ -538,7 +539,7 @@
* those fields that are equivalent to the relevant objects.
* <p>
* This method matches the signature of the functional interface {@link TemporalQuery}
- * allowing it to be used in queries via method reference, {@code ZonedDateTime::from}.
+ * allowing it to be used as a query via method reference, {@code ZonedDateTime::from}.
*
* @param temporal the temporal object to convert, not null
* @return the zoned date-time, not null
@@ -782,7 +783,7 @@
/**
* Gets the value of the specified field from this date-time as an {@code int}.
* <p>
- * This queries this date-time for the value for the specified field.
+ * This queries this date-time for the value of the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
@@ -791,7 +792,7 @@
* The {@link #isSupported(TemporalField) supported fields} will return valid
* values based on this date-time, except {@code NANO_OF_DAY}, {@code MICRO_OF_DAY},
* {@code EPOCH_DAY}, {@code PROLEPTIC_MONTH} and {@code INSTANT_SECONDS} which are too
- * large to fit in an {@code int} and throw a {@code DateTimeException}.
+ * large to fit in an {@code int} and throw a {@code UnsupportedTemporalTypeException}.
* All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
* <p>
* If the field is not a {@code ChronoField}, then the result of this method
@@ -824,7 +825,7 @@
/**
* Gets the value of the specified field from this date-time as a {@code long}.
* <p>
- * This queries this date-time for the value for the specified field.
+ * This queries this date-time for the value of the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
@@ -1182,7 +1183,8 @@
* <p>
* A simple adjuster might simply set the one of the fields, such as the year field.
* A more complex adjuster might set the date to the last day of the month.
- * A selection of common adjustments is provided in {@link TemporalAdjuster}.
+ * A selection of common adjustments is provided in
+ * {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}.
* These include finding the "last day of the month" and "next Wednesday".
* Key date-time classes also implement the {@code TemporalAdjuster} interface,
* such as {@link Month} and {@link java.time.MonthDay MonthDay}.
@@ -1192,7 +1194,7 @@
* For example this code returns a date on the last day of July:
* <pre>
* import static java.time.Month.*;
- * import static java.time.temporal.Adjusters.*;
+ * import static java.time.temporal.TemporalAdjusters.*;
*
* result = zonedDateTime.with(JULY).with(lastDayOfMonth());
* </pre>
@@ -1313,7 +1315,7 @@
//-----------------------------------------------------------------------
/**
- * Returns a copy of this {@code ZonedDateTime} with the year value altered.
+ * Returns a copy of this {@code ZonedDateTime} with the year altered.
* <p>
* This operates on the local time-line,
* {@link LocalDateTime#withYear(int) changing the year} of the local date-time.
@@ -1335,7 +1337,7 @@
}
/**
- * Returns a copy of this {@code ZonedDateTime} with the month-of-year value altered.
+ * Returns a copy of this {@code ZonedDateTime} with the month-of-year altered.
* <p>
* This operates on the local time-line,
* {@link LocalDateTime#withMonth(int) changing the month} of the local date-time.
@@ -1357,7 +1359,7 @@
}
/**
- * Returns a copy of this {@code ZonedDateTime} with the day-of-month value altered.
+ * Returns a copy of this {@code ZonedDateTime} with the day-of-month altered.
* <p>
* This operates on the local time-line,
* {@link LocalDateTime#withDayOfMonth(int) changing the day-of-month} of the local date-time.
@@ -1404,7 +1406,7 @@
//-----------------------------------------------------------------------
/**
- * Returns a copy of this {@code ZonedDateTime} with the hour-of-day value altered.
+ * Returns a copy of this {@code ZonedDateTime} with the hour-of-day altered.
* <p>
* This operates on the local time-line,
* {@linkplain LocalDateTime#withHour(int) changing the time} of the local date-time.
@@ -1426,7 +1428,7 @@
}
/**
- * Returns a copy of this {@code ZonedDateTime} with the minute-of-hour value altered.
+ * Returns a copy of this {@code ZonedDateTime} with the minute-of-hour altered.
* <p>
* This operates on the local time-line,
* {@linkplain LocalDateTime#withMinute(int) changing the time} of the local date-time.
@@ -1448,7 +1450,7 @@
}
/**
- * Returns a copy of this {@code ZonedDateTime} with the second-of-minute value altered.
+ * Returns a copy of this {@code ZonedDateTime} with the second-of-minute altered.
* <p>
* This operates on the local time-line,
* {@linkplain LocalDateTime#withSecond(int) changing the time} of the local date-time.
@@ -1470,7 +1472,7 @@
}
/**
- * Returns a copy of this {@code ZonedDateTime} with the nano-of-second value altered.
+ * Returns a copy of this {@code ZonedDateTime} with the nano-of-second altered.
* <p>
* This operates on the local time-line,
* {@linkplain LocalDateTime#withNano(int) changing the time} of the local date-time.
@@ -1506,7 +1508,7 @@
* {@link ChronoUnit#DAYS DAYS}. Other units throw an exception.
* <p>
* This operates on the local time-line,
- * {@link LocalDateTime#truncatedTo(java.time.temporal.TemporalUnit) truncating}
+ * {@link LocalDateTime#truncatedTo(TemporalUnit) truncating}
* the underlying local date-time. This is then converted back to a
* {@code ZonedDateTime}, using the zone ID to obtain the offset.
* <p>
@@ -1607,7 +1609,7 @@
//-----------------------------------------------------------------------
/**
- * Returns a copy of this {@code ZonedDateTime} with the specified period in years added.
+ * Returns a copy of this {@code ZonedDateTime} with the specified number of years added.
* <p>
* This operates on the local time-line,
* {@link LocalDateTime#plusYears(long) adding years} to the local date-time.
@@ -1629,7 +1631,7 @@
}
/**
- * Returns a copy of this {@code ZonedDateTime} with the specified period in months added.
+ * Returns a copy of this {@code ZonedDateTime} with the specified number of months added.
* <p>
* This operates on the local time-line,
* {@link LocalDateTime#plusMonths(long) adding months} to the local date-time.
@@ -1651,7 +1653,7 @@
}
/**
- * Returns a copy of this {@code ZonedDateTime} with the specified period in weeks added.
+ * Returns a copy of this {@code ZonedDateTime} with the specified number of weeks added.
* <p>
* This operates on the local time-line,
* {@link LocalDateTime#plusWeeks(long) adding weeks} to the local date-time.
@@ -1673,7 +1675,7 @@
}
/**
- * Returns a copy of this {@code ZonedDateTime} with the specified period in days added.
+ * Returns a copy of this {@code ZonedDateTime} with the specified number of days added.
* <p>
* This operates on the local time-line,
* {@link LocalDateTime#plusDays(long) adding days} to the local date-time.
@@ -1696,7 +1698,7 @@
//-----------------------------------------------------------------------
/**
- * Returns a copy of this {@code ZonedDateTime} with the specified period in hours added.
+ * Returns a copy of this {@code ZonedDateTime} with the specified number of hours added.
* <p>
* This operates on the instant time-line, such that adding one hour will
* always be a duration of one hour later.
@@ -1724,7 +1726,7 @@
}
/**
- * Returns a copy of this {@code ZonedDateTime} with the specified period in minutes added.
+ * Returns a copy of this {@code ZonedDateTime} with the specified number of minutes added.
* <p>
* This operates on the instant time-line, such that adding one minute will
* always be a duration of one minute later.
@@ -1742,7 +1744,7 @@
}
/**
- * Returns a copy of this {@code ZonedDateTime} with the specified period in seconds added.
+ * Returns a copy of this {@code ZonedDateTime} with the specified number of seconds added.
* <p>
* This operates on the instant time-line, such that adding one second will
* always be a duration of one second later.
@@ -1760,7 +1762,7 @@
}
/**
- * Returns a copy of this {@code ZonedDateTime} with the specified period in nanoseconds added.
+ * Returns a copy of this {@code ZonedDateTime} with the specified number of nanoseconds added.
* <p>
* This operates on the instant time-line, such that adding one nano will
* always be a duration of one nano later.
@@ -1848,7 +1850,7 @@
//-----------------------------------------------------------------------
/**
- * Returns a copy of this {@code ZonedDateTime} with the specified period in years subtracted.
+ * Returns a copy of this {@code ZonedDateTime} with the specified number of years subtracted.
* <p>
* This operates on the local time-line,
* {@link LocalDateTime#minusYears(long) subtracting years} to the local date-time.
@@ -1870,7 +1872,7 @@
}
/**
- * Returns a copy of this {@code ZonedDateTime} with the specified period in months subtracted.
+ * Returns a copy of this {@code ZonedDateTime} with the specified number of months subtracted.
* <p>
* This operates on the local time-line,
* {@link LocalDateTime#minusMonths(long) subtracting months} to the local date-time.
@@ -1892,7 +1894,7 @@
}
/**
- * Returns a copy of this {@code ZonedDateTime} with the specified period in weeks subtracted.
+ * Returns a copy of this {@code ZonedDateTime} with the specified number of weeks subtracted.
* <p>
* This operates on the local time-line,
* {@link LocalDateTime#minusWeeks(long) subtracting weeks} to the local date-time.
@@ -1914,7 +1916,7 @@
}
/**
- * Returns a copy of this {@code ZonedDateTime} with the specified period in days subtracted.
+ * Returns a copy of this {@code ZonedDateTime} with the specified number of days subtracted.
* <p>
* This operates on the local time-line,
* {@link LocalDateTime#minusDays(long) subtracting days} to the local date-time.
@@ -1937,7 +1939,7 @@
//-----------------------------------------------------------------------
/**
- * Returns a copy of this {@code ZonedDateTime} with the specified period in hours subtracted.
+ * Returns a copy of this {@code ZonedDateTime} with the specified number of hours subtracted.
* <p>
* This operates on the instant time-line, such that subtracting one hour will
* always be a duration of one hour earlier.
@@ -1965,7 +1967,7 @@
}
/**
- * Returns a copy of this {@code ZonedDateTime} with the specified period in minutes subtracted.
+ * Returns a copy of this {@code ZonedDateTime} with the specified number of minutes subtracted.
* <p>
* This operates on the instant time-line, such that subtracting one minute will
* always be a duration of one minute earlier.
@@ -1983,7 +1985,7 @@
}
/**
- * Returns a copy of this {@code ZonedDateTime} with the specified period in seconds subtracted.
+ * Returns a copy of this {@code ZonedDateTime} with the specified number of seconds subtracted.
* <p>
* This operates on the instant time-line, such that subtracting one second will
* always be a duration of one second earlier.
@@ -2001,7 +2003,7 @@
}
/**
- * Returns a copy of this {@code ZonedDateTime} with the specified period in nanoseconds subtracted.
+ * Returns a copy of this {@code ZonedDateTime} with the specified number of nanoseconds subtracted.
* <p>
* This operates on the instant time-line, such that subtracting one nano will
* always be a duration of one nano earlier.
@@ -2028,7 +2030,7 @@
* what the result of this method will be.
* <p>
* The result of this method is obtained by invoking the
- * {@link java.time.temporal.TemporalQuery#queryFrom(TemporalAccessor)} method on the
+ * {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
* specified query passing {@code this} as the argument.
*
* @param <R> the type of the result
@@ -2049,7 +2051,7 @@
* objects in terms of a single {@code TemporalUnit}.
* The start and end points are {@code this} and the specified date-time.
* The result will be negative if the end is before the start.
- * For example, the period in days between two date-times can be calculated
+ * For example, the amount in days between two date-times can be calculated
* using {@code startDateTime.until(endDateTime, DAYS)}.
* <p>
* The {@code Temporal} passed to this method is converted to a
@@ -2059,7 +2061,7 @@
* <p>
* The calculation returns a whole number, representing the number of
* complete units between the two date-times.
- * For example, the period in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z
+ * For example, the amount in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z
* will only be one month as it is one minute short of two months.
* <p>
* There are two equivalent ways of using this method.
--- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java Thu May 08 15:27:38 2014 -0700
@@ -249,8 +249,8 @@
* This allows dates in different calendar systems to be compared based
* on the position of the date on the local time-line.
* The underlying comparison is equivalent to comparing the epoch-day.
+ *
* @return a comparator that compares in time-line order ignoring the chronology
- *
* @see #isAfter
* @see #isBefore
* @see #isEqual
--- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateImpl.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateImpl.java Thu May 08 15:27:38 2014 -0700
@@ -227,7 +227,7 @@
//-----------------------------------------------------------------------
/**
- * Returns a copy of this date with the specified period in years added.
+ * Returns a copy of this date with the specified number of years added.
* <p>
* This adds the specified period in years to the date.
* In some cases, adding years can cause the resulting date to become invalid.
@@ -243,7 +243,7 @@
abstract D plusYears(long yearsToAdd);
/**
- * Returns a copy of this date with the specified period in months added.
+ * Returns a copy of this date with the specified number of months added.
* <p>
* This adds the specified period in months to the date.
* In some cases, adding months can cause the resulting date to become invalid.
@@ -259,7 +259,7 @@
abstract D plusMonths(long monthsToAdd);
/**
- * Returns a copy of this date with the specified period in weeks added.
+ * Returns a copy of this date with the specified number of weeks added.
* <p>
* This adds the specified period in weeks to the date.
* In some cases, adding weeks can cause the resulting date to become invalid.
@@ -292,7 +292,7 @@
//-----------------------------------------------------------------------
/**
- * Returns a copy of this date with the specified period in years subtracted.
+ * Returns a copy of this date with the specified number of years subtracted.
* <p>
* This subtracts the specified period in years to the date.
* In some cases, subtracting years can cause the resulting date to become invalid.
@@ -313,7 +313,7 @@
}
/**
- * Returns a copy of this date with the specified period in months subtracted.
+ * Returns a copy of this date with the specified number of months subtracted.
* <p>
* This subtracts the specified period in months to the date.
* In some cases, subtracting months can cause the resulting date to become invalid.
@@ -334,7 +334,7 @@
}
/**
- * Returns a copy of this date with the specified period in weeks subtracted.
+ * Returns a copy of this date with the specified number of weeks subtracted.
* <p>
* This subtracts the specified period in weeks to the date.
* In some cases, subtracting weeks can cause the resulting date to become invalid.
--- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java Thu May 08 15:27:38 2014 -0700
@@ -131,7 +131,6 @@
* The underlying comparison is equivalent to comparing the epoch-day and nano-of-day.
*
* @return a comparator that compares in time-line order ignoring the chronology
- *
* @see #isAfter
* @see #isBefore
* @see #isEqual
@@ -323,7 +322,7 @@
* what the result of this method will be.
* <p>
* The result of this method is obtained by invoking the
- * {@link java.time.temporal.TemporalQuery#queryFrom(TemporalAccessor)} method on the
+ * {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
* specified query passing {@code this} as the argument.
*
* @param <R> the type of the result
--- a/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java Thu May 08 15:27:38 2014 -0700
@@ -132,7 +132,6 @@
* The underlying comparison is equivalent to comparing the epoch-second and nano-of-second.
*
* @return a comparator that compares in time-line order ignoring the chronology
- *
* @see #isAfter
* @see #isBefore
* @see #isEqual
@@ -292,7 +291,7 @@
* <p>
* This instance is immutable and unaffected by this method call.
*
- * @return a {@code ZoneChronoDateTime} based on this date-time with the earlier offset, not null
+ * @return a {@code ChronoZonedDateTime} based on this date-time with the earlier offset, not null
* @throws DateTimeException if no rules can be found for the zone
* @throws DateTimeException if no rules are valid for this date-time
*/
@@ -319,7 +318,7 @@
ChronoZonedDateTime<D> withLaterOffsetAtOverlap();
/**
- * Returns a copy of this ZonedDateTime with a different time-zone,
+ * Returns a copy of this date-time with a different time-zone,
* retaining the local date-time if possible.
* <p>
* This method changes the time-zone and retains the local date-time.
@@ -470,7 +469,7 @@
* what the result of this method will be.
* <p>
* The result of this method is obtained by invoking the
- * {@link java.time.temporal.TemporalQuery#queryFrom(TemporalAccessor)} method on the
+ * {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
* specified query passing {@code this} as the argument.
*
* @param <R> the type of the result
--- a/jdk/src/share/classes/java/time/chrono/Chronology.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/chrono/Chronology.java Thu May 08 15:27:38 2014 -0700
@@ -132,8 +132,9 @@
* The set of available chronologies can be extended by applications.
* Adding a new calendar system requires the writing of an implementation of
* {@code Chronology}, {@code ChronoLocalDate} and {@code Era}.
- * The majority of the logic specific to the calendar system will be in
- * {@code ChronoLocalDate}. The {@code Chronology} subclass acts as a factory.
+ * The majority of the logic specific to the calendar system will be in the
+ * {@code ChronoLocalDate} implementation.
+ * The {@code Chronology} implementation acts as a factory.
* <p>
* To permit the discovery of additional chronologies, the {@link java.util.ServiceLoader ServiceLoader}
* is used. A file must be added to the {@code META-INF/services} directory with the
@@ -167,7 +168,7 @@
* If the specified temporal object does not have a chronology, {@link IsoChronology} is returned.
* <p>
* This method matches the signature of the functional interface {@link TemporalQuery}
- * allowing it to be used in queries via method reference, {@code Chronology::from}.
+ * allowing it to be used as a query via method reference, {@code Chronology::from}.
*
* @param temporal the temporal to convert, not null
* @return the chronology, not null
@@ -413,7 +414,7 @@
* The alternate clock may be introduced using {@link Clock dependency injection}.
*
* @implSpec
- * The default implementation invokes {@link #date(TemporalAccessor)} )}.
+ * The default implementation invokes {@link #date(TemporalAccessor)}.
*
* @param clock the clock to use, not null
* @return the current local date, not null
@@ -622,7 +623,7 @@
* The parameters control the style of the returned text and the locale.
*
* @implSpec
- * The default implementation behaves as the the formatter was used to
+ * The default implementation behaves as though the formatter was used to
* format the chronology textual name.
*
* @param style the style of the text required, not null
--- a/jdk/src/share/classes/java/time/chrono/Era.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/chrono/Era.java Thu May 08 15:27:38 2014 -0700
@@ -182,7 +182,7 @@
/**
* Gets the value of the specified field from this era as an {@code int}.
* <p>
- * This queries this era for the value for the specified field.
+ * This queries this era for the value of the specified field.
* The returned value will always be within the valid range of values for the field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
@@ -215,7 +215,7 @@
/**
* Gets the value of the specified field from this era as a {@code long}.
* <p>
- * This queries this era for the value for the specified field.
+ * This queries this era for the value of the specified field.
* If it is not possible to return the value, because the field is not supported
* or for some other reason, an exception is thrown.
* <p>
--- a/jdk/src/share/classes/java/time/chrono/HijrahChronology.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/chrono/HijrahChronology.java Thu May 08 15:27:38 2014 -0700
@@ -394,7 +394,7 @@
* Gets the ID of the chronology.
* <p>
* The ID uniquely identifies the {@code Chronology}. It can be used to
- * lookup the {@code Chronology} using {@link #of(String)}.
+ * lookup the {@code Chronology} using {@link Chronology#of(String)}.
*
* @return the chronology ID, non-null
* @see #getCalendarType()
@@ -409,7 +409,7 @@
* <p>
* The calendar type is an identifier defined by the
* <em>Unicode Locale Data Markup Language (LDML)</em> specification.
- * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+ * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
*
* @return the calendar system type; non-null if the calendar has
* a standard type, otherwise null
--- a/jdk/src/share/classes/java/time/chrono/IsoChronology.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/chrono/IsoChronology.java Thu May 08 15:27:38 2014 -0700
@@ -143,7 +143,7 @@
* Gets the ID of the chronology - 'ISO'.
* <p>
* The ID uniquely identifies the {@code Chronology}.
- * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+ * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
*
* @return the chronology ID - 'ISO'
* @see #getCalendarType()
@@ -158,7 +158,7 @@
* <p>
* The calendar type is an identifier defined by the
* <em>Unicode Locale Data Markup Language (LDML)</em> specification.
- * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+ * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
* It can also be used as part of a locale, accessible via
* {@link Locale#getUnicodeLocaleType(String)} with the key 'ca'.
*
--- a/jdk/src/share/classes/java/time/chrono/JapaneseChronology.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/chrono/JapaneseChronology.java Thu May 08 15:27:38 2014 -0700
@@ -150,7 +150,7 @@
* Gets the ID of the chronology - 'Japanese'.
* <p>
* The ID uniquely identifies the {@code Chronology}.
- * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+ * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
*
* @return the chronology ID - 'Japanese'
* @see #getCalendarType()
@@ -165,7 +165,7 @@
* <p>
* The calendar type is an identifier defined by the
* <em>Unicode Locale Data Markup Language (LDML)</em> specification.
- * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+ * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
* It can also be used as part of a locale, accessible via
* {@link Locale#getUnicodeLocaleType(String)} with the key 'ca'.
*
--- a/jdk/src/share/classes/java/time/chrono/MinguoChronology.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/chrono/MinguoChronology.java Thu May 08 15:27:38 2014 -0700
@@ -132,7 +132,7 @@
* Gets the ID of the chronology - 'Minguo'.
* <p>
* The ID uniquely identifies the {@code Chronology}.
- * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+ * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
*
* @return the chronology ID - 'Minguo'
* @see #getCalendarType()
@@ -147,7 +147,7 @@
* <p>
* The calendar type is an identifier defined by the
* <em>Unicode Locale Data Markup Language (LDML)</em> specification.
- * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+ * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
* It can also be used as part of a locale, accessible via
* {@link Locale#getUnicodeLocaleType(String)} with the key 'ca'.
*
--- a/jdk/src/share/classes/java/time/chrono/ThaiBuddhistChronology.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/chrono/ThaiBuddhistChronology.java Thu May 08 15:27:38 2014 -0700
@@ -168,7 +168,7 @@
* Gets the ID of the chronology - 'ThaiBuddhist'.
* <p>
* The ID uniquely identifies the {@code Chronology}.
- * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+ * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
*
* @return the chronology ID - 'ThaiBuddhist'
* @see #getCalendarType()
@@ -183,7 +183,7 @@
* <p>
* The calendar type is an identifier defined by the
* <em>Unicode Locale Data Markup Language (LDML)</em> specification.
- * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+ * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
* It can also be used as part of a locale, accessible via
* {@link Locale#getUnicodeLocaleType(String)} with the key 'ca'.
*
--- a/jdk/src/share/classes/java/time/format/DateTimeFormatter.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/format/DateTimeFormatter.java Thu May 08 15:27:38 2014 -0700
@@ -117,7 +117,7 @@
* {@code parse(CharSequence text, DateTimeFormatter formatter)}.
* <p>For example:
* <blockquote><pre>
- * String text = date.toString(formatter);
+ * String text = date.format(formatter);
* LocalDate date = LocalDate.parse(text, formatter);
* </pre></blockquote>
* <p>
@@ -266,7 +266,7 @@
* For example:
* <blockquote><pre>
* DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy MM dd");
- * String text = date.toString(formatter);
+ * String text = date.format(formatter);
* LocalDate date = LocalDate.parse(text, formatter);
* </pre></blockquote>
* <p>
@@ -1976,7 +1976,7 @@
* Errors are returned using the error index field of the {@code ParsePosition}
* instead of {@code DateTimeParseException}.
* The returned error index will be set to an index indicative of the error.
- * Callers must check for errors before using the context.
+ * Callers must check for errors before using the result.
* <p>
* If the formatter parses the same field more than once with different values,
* the result will be an error.
--- a/jdk/src/share/classes/java/time/format/DateTimeFormatterBuilder.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/format/DateTimeFormatterBuilder.java Thu May 08 15:27:38 2014 -0700
@@ -137,7 +137,6 @@
* <li>ChronologyText - the name of the chronology</li>
* <li>Literal - a text literal</li>
* <li>Nested and Optional - formats can be nested or made optional</li>
- * <li>Other - the printer and parser interfaces can be used to add user supplied formatting</li>
* </ul>
* In addition, any of the elements may be decorated by padding, either with spaces or any other character.
* <p>
@@ -194,8 +193,8 @@
* The locale and chronology are used to lookup the locale specific format
* for the requested dateStyle and/or timeStyle.
*
- * @param dateStyle the FormatStyle for the date
- * @param timeStyle the FormatStyle for the time
+ * @param dateStyle the FormatStyle for the date, null for time-only pattern
+ * @param timeStyle the FormatStyle for the time, null for date-only pattern
* @param chrono the Chronology, non-null
* @param locale the locale, non-null
* @return the locale and Chronology specific formatting pattern
@@ -747,9 +746,9 @@
* defines the connection between each value and the text:
* <pre>
* Map<Long, String> map = new HashMap<>();
- * map.put(1, "JNY");
- * map.put(2, "FBY");
- * map.put(3, "MCH");
+ * map.put(1L, "JNY");
+ * map.put(2L, "FBY");
+ * map.put(3L, "MCH");
* ...
* builder.appendText(MONTH_OF_YEAR, map);
* </pre>
@@ -841,7 +840,7 @@
* <p>
* The {@linkplain ResolverStyle resolver style} has no effect on instant parsing.
* The end-of-day time of '24:00' is handled as midnight at the start of the following day.
- * The leap-second time of '23:59:59' is handled to some degree, see
+ * The leap-second time of '23:59:60' is handled to some degree, see
* {@link DateTimeFormatter#parsedLeapSecond()} for full details.
* <p>
* An alternative to this method is to format/parse the instant as a single
@@ -864,7 +863,7 @@
* Appends the zone offset, such as '+01:00', to the formatter.
* <p>
* This appends an instruction to format/parse the offset ID to the builder.
- * This is equivalent to calling {@code appendOffset("HH:MM:ss", "Z")}.
+ * This is equivalent to calling {@code appendOffset("+HH:MM:ss", "Z")}.
*
* @return this, for chaining, not null
*/
@@ -1049,7 +1048,7 @@
* "GMT+01:30" -- ZoneOffset.of("+01:30")
* </pre>
* <p>
- * Note that this method is is identical to {@code appendZoneId()} except
+ * Note that this method is identical to {@code appendZoneId()} except
* in the mechanism used to obtain the zone.
* Note also that parsing accepts offsets, whereas formatting will never
* produce one.
@@ -1107,7 +1106,7 @@
* "GMT+01:30" -- ZoneOffset.of("GMT+01:30")
* </pre>
* <p>
- * Note that this method is is identical to {@code appendZoneId()} except
+ * Note that this method is identical to {@code appendZoneId()} except
* in the mechanism used to obtain the zone.
*
* @return this, for chaining, not null
@@ -1132,7 +1131,7 @@
* for the locale set in the {@link DateTimeFormatter}.
* If the temporal object being printed represents an instant, then the text
* will be the summer or winter time text as appropriate.
- * If the lookup for text does not find any suitable reuslt, then the
+ * If the lookup for text does not find any suitable result, then the
* {@link ZoneId#getId() ID} will be printed instead.
* If the zone cannot be obtained then an exception is thrown unless the
* section of the formatter is optional.
@@ -1168,7 +1167,7 @@
* for the locale set in the {@link DateTimeFormatter}.
* If the temporal object being printed represents an instant, then the text
* will be the summer or winter time text as appropriate.
- * If the lookup for text does not find any suitable reuslt, then the
+ * If the lookup for text does not find any suitable result, then the
* {@link ZoneId#getId() ID} will be printed instead.
* If the zone cannot be obtained then an exception is thrown unless the
* section of the formatter is optional.
@@ -1182,7 +1181,7 @@
* zone. This method also allows a set of preferred {@link ZoneId} to be
* specified for parsing. The matched preferred zone id will be used if the
* textural zone name being parsed is not unique.
- *
+ * <p>
* If the zone cannot be parsed then an exception is thrown unless the
* section of the formatter is optional.
*
@@ -1227,7 +1226,6 @@
* <p>
* The calendar system name will be output during a format.
* If the chronology cannot be obtained then an exception will be thrown.
- * The calendar system name is obtained from the Chronology.
*
* @param textStyle the text style to use, not null
* @return this, for chaining, not null
@@ -1453,7 +1451,7 @@
* LLLLL 5 appendText(ChronoField.MONTH_OF_YEAR, TextStyle.NARROW_STANDALONE)
*
* w 1 append special localized WeekFields element for numeric week-of-year
- * ww 1 append special localized WeekFields element for numeric week-of-year, zero-padded
+ * ww 2 append special localized WeekFields element for numeric week-of-year, zero-padded
* W 1 append special localized WeekFields element for numeric week-of-month
* d 1 appendValue(ChronoField.DAY_OF_MONTH)
* dd 2 appendValue(ChronoField.DAY_OF_MONTH, 2)
@@ -1880,7 +1878,6 @@
* <p>
* During parsing, the padding and decorated element are parsed.
* If parsing is lenient, then the pad width is treated as a maximum.
- * If parsing is case insensitive, then the pad character is matched ignoring case.
* The padding is parsed greedily. Thus, if the decorated element starts with
* the pad character, it will not be parsed.
*
--- a/jdk/src/share/classes/java/time/format/DecimalStyle.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/format/DecimalStyle.java Thu May 08 15:27:38 2014 -0700
@@ -62,7 +62,6 @@
package java.time.format;
import java.text.DecimalFormatSymbols;
-import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Locale;
@@ -138,7 +137,7 @@
* of(Locale.getDefault(Locale.Category.FORMAT))}.
*
* @see java.util.Locale.Category#FORMAT
- * @return the info, not null
+ * @return the decimal style, not null
*/
public static DecimalStyle ofDefaultLocale() {
return of(Locale.getDefault(Locale.Category.FORMAT));
@@ -150,7 +149,7 @@
* This method provides access to locale sensitive decimal style symbols.
*
* @param locale the locale, not null
- * @return the info, not null
+ * @return the decimal style, not null
*/
public static DecimalStyle of(Locale locale) {
Objects.requireNonNull(locale, "locale");
@@ -340,7 +339,7 @@
//-----------------------------------------------------------------------
/**
- * Checks if this DecimalStyle is equal another DecimalStyle.
+ * Checks if this DecimalStyle is equal to another DecimalStyle.
*
* @param obj the object to check, null returns false
* @return true if this is equal to the other date
--- a/jdk/src/share/classes/java/time/temporal/IsoFields.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/temporal/IsoFields.java Thu May 08 15:27:38 2014 -0700
@@ -638,7 +638,7 @@
//-----------------------------------------------------------------------
/**
- * Implementation of the period unit.
+ * Implementation of the unit.
*/
private static enum Unit implements TemporalUnit {
--- a/jdk/src/share/classes/java/time/temporal/Temporal.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/temporal/Temporal.java Thu May 08 15:27:38 2014 -0700
@@ -157,7 +157,8 @@
* This adjusts this date-time according to the rules of the specified adjuster.
* A simple adjuster might simply set the one of the fields, such as the year field.
* A more complex adjuster might set the date to the last day of the month.
- * A selection of common adjustments is provided in {@link TemporalAdjuster}.
+ * A selection of common adjustments is provided in
+ * {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}.
* These include finding the "last day of the month" and "next Wednesday".
* The adjuster is responsible for handling special cases, such as the varying
* lengths of month and leap years.
@@ -287,7 +288,7 @@
* This provides equivalent, safe behavior for immutable and mutable implementations.
*
* @param amountToAdd the amount of the specified unit to add, may be negative
- * @param unit the unit of the period to add, not null
+ * @param unit the unit of the amount to add, not null
* @return an object of the same type with the specified period added, not null
* @throws DateTimeException if the unit cannot be added
* @throws UnsupportedTemporalTypeException if the unit is not supported
@@ -359,7 +360,7 @@
* </pre>
*
* @param amountToSubtract the amount of the specified unit to subtract, may be negative
- * @param unit the unit of the period to subtract, not null
+ * @param unit the unit of the amount to subtract, not null
* @return an object of the same type with the specified period subtracted, not null
* @throws DateTimeException if the unit cannot be subtracted
* @throws UnsupportedTemporalTypeException if the unit is not supported
@@ -378,12 +379,12 @@
* The start and end points are {@code this} and the specified temporal.
* The end point is converted to be of the same type as the start point if different.
* The result will be negative if the end is before the start.
- * For example, the period in hours between two temporal objects can be
+ * For example, the amount in hours between two temporal objects can be
* calculated using {@code startTime.until(endTime, HOURS)}.
* <p>
* The calculation returns a whole number, representing the number of
* complete units between the two temporals.
- * For example, the period in hours between the times 11:30 and 13:29
+ * For example, the amount in hours between the times 11:30 and 13:29
* will only be one hour as it is one minute short of two hours.
* <p>
* There are two equivalent ways of using this method.
--- a/jdk/src/share/classes/java/time/temporal/TemporalAccessor.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/temporal/TemporalAccessor.java Thu May 08 15:27:38 2014 -0700
@@ -180,7 +180,7 @@
/**
* Gets the value of the specified field as an {@code int}.
* <p>
- * This queries the date-time for the value for the specified field.
+ * This queries the date-time for the value of the specified field.
* The returned value will always be within the valid range of values for the field.
* If the date-time cannot return the value, because the field is unsupported or for
* some other reason, an exception will be thrown.
@@ -229,7 +229,7 @@
/**
* Gets the value of the specified field as a {@code long}.
* <p>
- * This queries the date-time for the value for the specified field.
+ * This queries the date-time for the value of the specified field.
* The returned value may be outside the valid range of values for the field.
* If the date-time cannot return the value, because the field is unsupported or for
* some other reason, an exception will be thrown.
--- a/jdk/src/share/classes/java/time/temporal/TemporalField.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/temporal/TemporalField.java Thu May 08 15:27:38 2014 -0700
@@ -116,7 +116,7 @@
* For example, in the field 'MonthOfYear', the unit is 'Months'.
* See also {@link #getRangeUnit()}.
*
- * @return the period unit defining the base unit of the field, not null
+ * @return the unit defining the base unit of the field, not null
*/
TemporalUnit getBaseUnit();
@@ -130,7 +130,7 @@
* The range is never null. For example, the 'Year' field is shorthand for
* 'YearOfForever'. It therefore has a unit of 'Years' and a range of 'Forever'.
*
- * @return the period unit defining the range of the field, not null
+ * @return the unit defining the range of the field, not null
*/
TemporalUnit getRangeUnit();
@@ -179,7 +179,7 @@
* Checks if this field is supported by the temporal object.
* <p>
* This determines whether the temporal accessor supports this field.
- * If this returns false, the the temporal cannot be queried for this field.
+ * If this returns false, then the temporal cannot be queried for this field.
* <p>
* There are two equivalent ways of using this method.
* The first is to invoke this method directly.
--- a/jdk/src/share/classes/java/time/temporal/TemporalUnit.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/temporal/TemporalUnit.java Thu May 08 15:27:38 2014 -0700
@@ -221,7 +221,7 @@
* @param temporal the temporal object to adjust, not null
* @param amount the amount of this unit to add, positive or negative
* @return the adjusted temporal object, not null
- * @throws DateTimeException if the period cannot be added
+ * @throws DateTimeException if the amount cannot be added
* @throws UnsupportedTemporalTypeException if the unit is not supported by the temporal
*/
<R extends Temporal> R addTo(R temporal, long amount);
--- a/jdk/src/share/classes/java/time/zone/ZoneOffsetTransition.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/time/zone/ZoneOffsetTransition.java Thu May 08 15:27:38 2014 -0700
@@ -83,7 +83,7 @@
* The discontinuity is normally a gap in spring and an overlap in autumn.
* {@code ZoneOffsetTransition} models the transition between the two offsets.
* <p>
- * Gaps occur where there are local date-times that simply do not not exist.
+ * Gaps occur where there are local date-times that simply do not exist.
* An example would be when the offset changes from {@code +03:00} to {@code +04:00}.
* This might be described as 'the clocks will move forward one hour tonight at 1am'.
* <p>
@@ -334,7 +334,7 @@
/**
* Does this transition represent a gap in the local time-line.
* <p>
- * Gaps occur where there are local date-times that simply do not not exist.
+ * Gaps occur where there are local date-times that simply do not exist.
* An example would be when the offset changes from {@code +01:00} to {@code +02:00}.
* This might be described as 'the clocks will move forward one hour tonight at 1am'.
*
--- a/jdk/src/share/classes/java/util/BitSet.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/util/BitSet.java Thu May 08 15:27:38 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -696,6 +696,9 @@
* <pre> {@code
* for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i+1)) {
* // operate on index i here
+ * if (i == Integer.MAX_VALUE) {
+ * break; // or (i+1) would overflow
+ * }
* }}</pre>
*
* @param fromIndex the index to start checking from (inclusive)
@@ -1186,10 +1189,12 @@
int i = nextSetBit(0);
if (i != -1) {
b.append(i);
- for (i = nextSetBit(i+1); i >= 0; i = nextSetBit(i+1)) {
+ while (true) {
+ if (++i < 0) break;
+ if ((i = nextSetBit(i)) < 0) break;
int endOfRun = nextClearBit(i);
do { b.append(", ").append(i); }
- while (++i < endOfRun);
+ while (++i != endOfRun);
}
}
--- a/jdk/src/share/classes/java/util/Hashtable.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/util/Hashtable.java Thu May 08 15:27:38 2014 -0700
@@ -26,7 +26,6 @@
package java.util;
import java.io.*;
-import java.util.concurrent.ThreadLocalRandom;
import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.function.BiFunction;
@@ -92,8 +91,10 @@
* ConcurrentModificationException}. Thus, in the face of concurrent
* modification, the iterator fails quickly and cleanly, rather than risking
* arbitrary, non-deterministic behavior at an undetermined time in the future.
- * The Enumerations returned by Hashtable's keys and elements methods are
- * <em>not</em> fail-fast.
+ * The Enumerations returned by Hashtable's {@link #keys keys} and
+ * {@link #elements elements} methods are <em>not</em> fail-fast; if the
+ * Hashtable is structurally modified at any time after the enumeration is
+ * created then the results of enumerating are undefined.
*
* <p>Note that the fail-fast behavior of an iterator cannot be guaranteed
* as it is, generally speaking, impossible to make any hard guarantees in the
@@ -115,6 +116,9 @@
* to use {@link java.util.concurrent.ConcurrentHashMap} in place of
* {@code Hashtable}.
*
+ * @param <K> the type of keys maintained by this map
+ * @param <V> the type of mapped values
+ *
* @author Arthur van Hoff
* @author Josh Bloch
* @author Neal Gafter
@@ -246,6 +250,9 @@
/**
* Returns an enumeration of the keys in this hashtable.
+ * Use the Enumeration methods on the returned object to fetch the keys
+ * sequentially. If the hashtable is structurally modified while enumerating
+ * over the keys then the results of enumerating are undefined.
*
* @return an enumeration of the keys in this hashtable.
* @see Enumeration
@@ -260,7 +267,8 @@
/**
* Returns an enumeration of the values in this hashtable.
* Use the Enumeration methods on the returned object to fetch the elements
- * sequentially.
+ * sequentially. If the hashtable is structurally modified while enumerating
+ * over the values then the results of enumerating are undefined.
*
* @return an enumeration of the values in this hashtable.
* @see java.util.Enumeration
@@ -417,8 +425,6 @@
}
private void addEntry(int hash, K key, V value, int index) {
- modCount++;
-
Entry<?,?> tab[] = table;
if (count >= threshold) {
// Rehash the table if the threshold is exceeded
@@ -434,6 +440,7 @@
Entry<K,V> e = (Entry<K,V>) tab[index];
tab[index] = new Entry<>(hash, key, value, e);
count++;
+ modCount++;
}
/**
@@ -494,12 +501,12 @@
Entry<K,V> e = (Entry<K,V>)tab[index];
for(Entry<K,V> prev = null ; e != null ; prev = e, e = e.next) {
if ((e.hash == hash) && e.key.equals(key)) {
- modCount++;
if (prev != null) {
prev.next = e.next;
} else {
tab[index] = e.next;
}
+ modCount++;
count--;
V oldValue = e.value;
e.value = null;
@@ -528,9 +535,9 @@
*/
public synchronized void clear() {
Entry<?,?> tab[] = table;
- modCount++;
for (int index = tab.length; --index >= 0; )
tab[index] = null;
+ modCount++;
count = 0;
}
@@ -719,14 +726,14 @@
Entry<K,V> e = (Entry<K,V>)tab[index];
for(Entry<K,V> prev = null; e != null; prev = e, e = e.next) {
if (e.hash==hash && e.equals(entry)) {
- modCount++;
if (prev != null)
prev.next = e.next;
else
tab[index] = e.next;
+ e.value = null; // clear for gc.
+ modCount++;
count--;
- e.value = null;
return true;
}
}
@@ -939,14 +946,14 @@
Entry<K,V> e = (Entry<K,V>)tab[index];
for (Entry<K,V> prev = null; e != null; prev = e, e = e.next) {
if ((e.hash == hash) && e.key.equals(key) && e.value.equals(value)) {
- modCount++;
if (prev != null) {
prev.next = e.next;
} else {
tab[index] = e.next;
}
+ e.value = null; // clear for gc
+ modCount++;
count--;
- e.value = null;
return true;
}
}
@@ -1030,12 +1037,12 @@
if (e.hash == hash && e.key.equals(key)) {
V newValue = remappingFunction.apply(key, e.value);
if (newValue == null) {
- modCount++;
if (prev != null) {
prev.next = e.next;
} else {
tab[index] = e.next;
}
+ modCount++;
count--;
} else {
e.value = newValue;
@@ -1059,12 +1066,12 @@
if (e.hash == hash && Objects.equals(e.key, key)) {
V newValue = remappingFunction.apply(key, e.value);
if (newValue == null) {
- modCount++;
if (prev != null) {
prev.next = e.next;
} else {
tab[index] = e.next;
}
+ modCount++;
count--;
} else {
e.value = newValue;
@@ -1094,12 +1101,12 @@
if (e.hash == hash && e.key.equals(key)) {
V newValue = remappingFunction.apply(e.value, value);
if (newValue == null) {
- modCount++;
if (prev != null) {
prev.next = e.next;
} else {
tab[index] = e.next;
}
+ modCount++;
count--;
} else {
e.value = newValue;
@@ -1298,24 +1305,24 @@
* by passing an Enumeration.
*/
private class Enumerator<T> implements Enumeration<T>, Iterator<T> {
- Entry<?,?>[] table = Hashtable.this.table;
+ final Entry<?,?>[] table = Hashtable.this.table;
int index = table.length;
Entry<?,?> entry;
Entry<?,?> lastReturned;
- int type;
+ final int type;
/**
* Indicates whether this Enumerator is serving as an Iterator
* or an Enumeration. (true -> Iterator).
*/
- boolean iterator;
+ final boolean iterator;
/**
* The modCount value that the iterator believes that the backing
* Hashtable should have. If this expectation is violated, the iterator
* has detected concurrent modification.
*/
- protected int expectedModCount = modCount;
+ protected int expectedModCount = Hashtable.this.modCount;
Enumerator(int type, boolean iterator) {
this.type = type;
@@ -1360,7 +1367,7 @@
}
public T next() {
- if (modCount != expectedModCount)
+ if (Hashtable.this.modCount != expectedModCount)
throw new ConcurrentModificationException();
return nextElement();
}
@@ -1381,14 +1388,14 @@
Entry<K,V> e = (Entry<K,V>)tab[index];
for(Entry<K,V> prev = null; e != null; prev = e, e = e.next) {
if (e == lastReturned) {
- modCount++;
- expectedModCount++;
if (prev == null)
tab[index] = e.next;
else
prev.next = e.next;
- count--;
+ expectedModCount++;
lastReturned = null;
+ Hashtable.this.modCount++;
+ Hashtable.this.count--;
return;
}
}
--- a/jdk/src/share/classes/java/util/Locale.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/util/Locale.java Thu May 08 15:27:38 2014 -0700
@@ -2904,8 +2904,8 @@
for (int i = 1; i < subtags.length; i++) {
if (isSubtagIllFormed(subtags[i], false)) {
isIllFormed = true;
+ break;
}
- break;
}
}
if (isIllFormed) {
--- a/jdk/src/share/classes/java/util/Vector.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/util/Vector.java Thu May 08 15:27:38 2014 -0700
@@ -56,7 +56,9 @@
* concurrent modification, the iterator fails quickly and cleanly, rather
* than risking arbitrary, non-deterministic behavior at an undetermined
* time in the future. The {@link Enumeration Enumerations} returned by
- * the {@link #elements() elements} method are <em>not</em> fail-fast.
+ * the {@link #elements() elements} method are <em>not</em> fail-fast; if the
+ * Vector is structurally modified at any time after the enumeration is
+ * created then the results of enumerating are undefined.
*
* <p>Note that the fail-fast behavior of an iterator cannot be guaranteed
* as it is, generally speaking, impossible to make any hard guarantees in the
@@ -74,6 +76,8 @@
* implementation is not needed, it is recommended to use {@link
* ArrayList} in place of {@code Vector}.
*
+ * @param <E> Type of component elements
+ *
* @author Lee Boynton
* @author Jonathan Payne
* @see Collection
@@ -330,7 +334,9 @@
* Returns an enumeration of the components of this vector. The
* returned {@code Enumeration} object will generate all items in
* this vector. The first item generated is the item at index {@code 0},
- * then the item at index {@code 1}, and so on.
+ * then the item at index {@code 1}, and so on. If the vector is
+ * structurally modified while enumerating over the elements then the
+ * results of enumerating are undefined.
*
* @return an enumeration of the components of this vector
* @see Iterator
@@ -553,7 +559,6 @@
* ({@code index < 0 || index >= size()})
*/
public synchronized void removeElementAt(int index) {
- modCount++;
if (index >= elementCount) {
throw new ArrayIndexOutOfBoundsException(index + " >= " +
elementCount);
@@ -565,6 +570,7 @@
if (j > 0) {
System.arraycopy(elementData, index + 1, elementData, index, j);
}
+ modCount++;
elementCount--;
elementData[elementCount] = null; /* to let gc do its work */
}
@@ -593,7 +599,6 @@
* ({@code index < 0 || index > size()})
*/
public synchronized void insertElementAt(E obj, int index) {
- modCount++;
if (index > elementCount) {
throw new ArrayIndexOutOfBoundsException(index
+ " > " + elementCount);
@@ -601,6 +606,7 @@
ensureCapacityHelper(elementCount + 1);
System.arraycopy(elementData, index, elementData, index + 1, elementCount - index);
elementData[index] = obj;
+ modCount++;
elementCount++;
}
@@ -616,8 +622,8 @@
* @param obj the component to be added
*/
public synchronized void addElement(E obj) {
+ ensureCapacityHelper(elementCount + 1);
modCount++;
- ensureCapacityHelper(elementCount + 1);
elementData[elementCount++] = obj;
}
@@ -653,11 +659,11 @@
* method (which is part of the {@link List} interface).
*/
public synchronized void removeAllElements() {
- modCount++;
// Let gc do its work
for (int i = 0; i < elementCount; i++)
elementData[i] = null;
+ modCount++;
elementCount = 0;
}
@@ -705,12 +711,15 @@
* of the Vector <em>only</em> if the caller knows that the Vector
* does not contain any null elements.)
*
+ * @param <T> type of array elements. The same type as {@code <E>} or a
+ * supertype of {@code <E>}.
* @param a the array into which the elements of the Vector are to
* be stored, if it is big enough; otherwise, a new array of the
* same runtime type is allocated for this purpose.
* @return an array containing the elements of the Vector
- * @throws ArrayStoreException if the runtime type of a is not a supertype
- * of the runtime type of every element in this Vector
+ * @throws ArrayStoreException if the runtime type of a, {@code <T>}, is not
+ * a supertype of the runtime type, {@code <E>}, of every element in this
+ * Vector
* @throws NullPointerException if the given array is null
* @since 1.2
*/
@@ -778,8 +787,8 @@
* @since 1.2
*/
public synchronized boolean add(E e) {
+ ensureCapacityHelper(elementCount + 1);
modCount++;
- ensureCapacityHelper(elementCount + 1);
elementData[elementCount++] = e;
return true;
}
@@ -879,14 +888,18 @@
* @throws NullPointerException if the specified collection is null
* @since 1.2
*/
- public synchronized boolean addAll(Collection<? extends E> c) {
- modCount++;
+ public boolean addAll(Collection<? extends E> c) {
Object[] a = c.toArray();
int numNew = a.length;
- ensureCapacityHelper(elementCount + numNew);
- System.arraycopy(a, 0, elementData, elementCount, numNew);
- elementCount += numNew;
- return numNew != 0;
+ if (numNew > 0) {
+ synchronized (this) {
+ ensureCapacityHelper(elementCount + numNew);
+ System.arraycopy(a, 0, elementData, elementCount, numNew);
+ modCount++;
+ elementCount += numNew;
+ }
+ }
+ return numNew > 0;
}
/**
@@ -951,22 +964,25 @@
* @since 1.2
*/
public synchronized boolean addAll(int index, Collection<? extends E> c) {
- modCount++;
if (index < 0 || index > elementCount)
throw new ArrayIndexOutOfBoundsException(index);
Object[] a = c.toArray();
int numNew = a.length;
- ensureCapacityHelper(elementCount + numNew);
+
+ if (numNew > 0) {
+ ensureCapacityHelper(elementCount + numNew);
- int numMoved = elementCount - index;
- if (numMoved > 0)
- System.arraycopy(elementData, index, elementData, index + numNew,
- numMoved);
+ int numMoved = elementCount - index;
+ if (numMoved > 0)
+ System.arraycopy(elementData, index, elementData,
+ index + numNew, numMoved);
- System.arraycopy(a, 0, elementData, index, numNew);
- elementCount += numNew;
- return numNew != 0;
+ System.arraycopy(a, 0, elementData, index, numNew);
+ elementCount += numNew;
+ modCount++;
+ }
+ return numNew > 0;
}
/**
@@ -1047,12 +1063,12 @@
* (If {@code toIndex==fromIndex}, this operation has no effect.)
*/
protected synchronized void removeRange(int fromIndex, int toIndex) {
- modCount++;
int numMoved = elementCount - toIndex;
System.arraycopy(elementData, toIndex, elementData, fromIndex,
numMoved);
// Let gc do its work
+ modCount++;
int newElementCount = elementCount - (toIndex-fromIndex);
while (elementCount != newElementCount)
elementData[--elementCount] = null;
@@ -1420,7 +1436,7 @@
}
public long estimateSize() {
- return (long) (getFence() - index);
+ return getFence() - index;
}
public int characteristics() {
--- a/jdk/src/share/classes/java/util/stream/SortedOps.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/util/stream/SortedOps.java Thu May 08 15:27:38 2014 -0700
@@ -279,16 +279,60 @@
}
/**
+ * Abstract {@link Sink} for implementing sort on reference streams.
+ *
+ * <p>
+ * Note: documentation below applies to reference and all primitive sinks.
+ * <p>
+ * Sorting sinks first accept all elements, buffering then into an array
+ * or a re-sizable data structure, if the size of the pipeline is known or
+ * unknown respectively. At the end of the sink protocol those elements are
+ * sorted and then pushed downstream.
+ * This class records if {@link #cancellationRequested} is called. If so it
+ * can be inferred that the source pushing source elements into the pipeline
+ * knows that the pipeline is short-circuiting. In such cases sub-classes
+ * pushing elements downstream will preserve the short-circuiting protocol
+ * by calling {@code downstream.cancellationRequested()} and checking the
+ * result is {@code false} before an element is pushed.
+ * <p>
+ * Note that the above behaviour is an optimization for sorting with
+ * sequential streams. It is not an error that more elements, than strictly
+ * required to produce a result, may flow through the pipeline. This can
+ * occur, in general (not restricted to just sorting), for short-circuiting
+ * parallel pipelines.
+ */
+ private static abstract class AbstractRefSortingSink<T> extends Sink.ChainedReference<T, T> {
+ protected final Comparator<? super T> comparator;
+ // @@@ could be a lazy final value, if/when support is added
+ protected boolean cancellationWasRequested;
+
+ AbstractRefSortingSink(Sink<? super T> downstream, Comparator<? super T> comparator) {
+ super(downstream);
+ this.comparator = comparator;
+ }
+
+ /**
+ * Records is cancellation is requested so short-circuiting behaviour
+ * can be preserved when the sorted elements are pushed downstream.
+ *
+ * @return false, as this sink never short-circuits.
+ */
+ @Override
+ public final boolean cancellationRequested() {
+ cancellationWasRequested = true;
+ return false;
+ }
+ }
+
+ /**
* {@link Sink} for implementing sort on SIZED reference streams.
*/
- private static final class SizedRefSortingSink<T> extends Sink.ChainedReference<T, T> {
- private final Comparator<? super T> comparator;
+ private static final class SizedRefSortingSink<T> extends AbstractRefSortingSink<T> {
private T[] array;
private int offset;
SizedRefSortingSink(Sink<? super T> sink, Comparator<? super T> comparator) {
- super(sink);
- this.comparator = comparator;
+ super(sink, comparator);
}
@Override
@@ -303,8 +347,14 @@
public void end() {
Arrays.sort(array, 0, offset, comparator);
downstream.begin(offset);
- for (int i = 0; i < offset; i++)
- downstream.accept(array[i]);
+ if (!cancellationWasRequested) {
+ for (int i = 0; i < offset; i++)
+ downstream.accept(array[i]);
+ }
+ else {
+ for (int i = 0; i < offset && !downstream.cancellationRequested(); i++)
+ downstream.accept(array[i]);
+ }
downstream.end();
array = null;
}
@@ -318,13 +368,11 @@
/**
* {@link Sink} for implementing sort on reference streams.
*/
- private static final class RefSortingSink<T> extends Sink.ChainedReference<T, T> {
- private final Comparator<? super T> comparator;
+ private static final class RefSortingSink<T> extends AbstractRefSortingSink<T> {
private ArrayList<T> list;
RefSortingSink(Sink<? super T> sink, Comparator<? super T> comparator) {
- super(sink);
- this.comparator = comparator;
+ super(sink, comparator);
}
@Override
@@ -338,7 +386,15 @@
public void end() {
list.sort(comparator);
downstream.begin(list.size());
- list.forEach(downstream::accept);
+ if (!cancellationWasRequested) {
+ list.forEach(downstream::accept);
+ }
+ else {
+ for (T t : list) {
+ if (downstream.cancellationRequested()) break;
+ downstream.accept(t);
+ }
+ }
downstream.end();
list = null;
}
@@ -350,9 +406,26 @@
}
/**
+ * Abstract {@link Sink} for implementing sort on int streams.
+ */
+ private static abstract class AbstractIntSortingSink extends Sink.ChainedInt<Integer> {
+ protected boolean cancellationWasRequested;
+
+ AbstractIntSortingSink(Sink<? super Integer> downstream) {
+ super(downstream);
+ }
+
+ @Override
+ public final boolean cancellationRequested() {
+ cancellationWasRequested = true;
+ return false;
+ }
+ }
+
+ /**
* {@link Sink} for implementing sort on SIZED int streams.
*/
- private static final class SizedIntSortingSink extends Sink.ChainedInt<Integer> {
+ private static final class SizedIntSortingSink extends AbstractIntSortingSink {
private int[] array;
private int offset;
@@ -371,8 +444,14 @@
public void end() {
Arrays.sort(array, 0, offset);
downstream.begin(offset);
- for (int i = 0; i < offset; i++)
- downstream.accept(array[i]);
+ if (!cancellationWasRequested) {
+ for (int i = 0; i < offset; i++)
+ downstream.accept(array[i]);
+ }
+ else {
+ for (int i = 0; i < offset && !downstream.cancellationRequested(); i++)
+ downstream.accept(array[i]);
+ }
downstream.end();
array = null;
}
@@ -386,7 +465,7 @@
/**
* {@link Sink} for implementing sort on int streams.
*/
- private static final class IntSortingSink extends Sink.ChainedInt<Integer> {
+ private static final class IntSortingSink extends AbstractIntSortingSink {
private SpinedBuffer.OfInt b;
IntSortingSink(Sink<? super Integer> sink) {
@@ -405,8 +484,16 @@
int[] ints = b.asPrimitiveArray();
Arrays.sort(ints);
downstream.begin(ints.length);
- for (int anInt : ints)
- downstream.accept(anInt);
+ if (!cancellationWasRequested) {
+ for (int anInt : ints)
+ downstream.accept(anInt);
+ }
+ else {
+ for (int anInt : ints) {
+ if (downstream.cancellationRequested()) break;
+ downstream.accept(anInt);
+ }
+ }
downstream.end();
}
@@ -417,9 +504,26 @@
}
/**
+ * Abstract {@link Sink} for implementing sort on long streams.
+ */
+ private static abstract class AbstractLongSortingSink extends Sink.ChainedLong<Long> {
+ protected boolean cancellationWasRequested;
+
+ AbstractLongSortingSink(Sink<? super Long> downstream) {
+ super(downstream);
+ }
+
+ @Override
+ public final boolean cancellationRequested() {
+ cancellationWasRequested = true;
+ return false;
+ }
+ }
+
+ /**
* {@link Sink} for implementing sort on SIZED long streams.
*/
- private static final class SizedLongSortingSink extends Sink.ChainedLong<Long> {
+ private static final class SizedLongSortingSink extends AbstractLongSortingSink {
private long[] array;
private int offset;
@@ -438,8 +542,14 @@
public void end() {
Arrays.sort(array, 0, offset);
downstream.begin(offset);
- for (int i = 0; i < offset; i++)
- downstream.accept(array[i]);
+ if (!cancellationWasRequested) {
+ for (int i = 0; i < offset; i++)
+ downstream.accept(array[i]);
+ }
+ else {
+ for (int i = 0; i < offset && !downstream.cancellationRequested(); i++)
+ downstream.accept(array[i]);
+ }
downstream.end();
array = null;
}
@@ -453,7 +563,7 @@
/**
* {@link Sink} for implementing sort on long streams.
*/
- private static final class LongSortingSink extends Sink.ChainedLong<Long> {
+ private static final class LongSortingSink extends AbstractLongSortingSink {
private SpinedBuffer.OfLong b;
LongSortingSink(Sink<? super Long> sink) {
@@ -472,8 +582,16 @@
long[] longs = b.asPrimitiveArray();
Arrays.sort(longs);
downstream.begin(longs.length);
- for (long aLong : longs)
- downstream.accept(aLong);
+ if (!cancellationWasRequested) {
+ for (long aLong : longs)
+ downstream.accept(aLong);
+ }
+ else {
+ for (long aLong : longs) {
+ if (downstream.cancellationRequested()) break;
+ downstream.accept(aLong);
+ }
+ }
downstream.end();
}
@@ -484,9 +602,26 @@
}
/**
+ * Abstract {@link Sink} for implementing sort on long streams.
+ */
+ private static abstract class AbstractDoubleSortingSink extends Sink.ChainedDouble<Double> {
+ protected boolean cancellationWasRequested;
+
+ AbstractDoubleSortingSink(Sink<? super Double> downstream) {
+ super(downstream);
+ }
+
+ @Override
+ public final boolean cancellationRequested() {
+ cancellationWasRequested = true;
+ return false;
+ }
+ }
+
+ /**
* {@link Sink} for implementing sort on SIZED double streams.
*/
- private static final class SizedDoubleSortingSink extends Sink.ChainedDouble<Double> {
+ private static final class SizedDoubleSortingSink extends AbstractDoubleSortingSink {
private double[] array;
private int offset;
@@ -505,8 +640,14 @@
public void end() {
Arrays.sort(array, 0, offset);
downstream.begin(offset);
- for (int i = 0; i < offset; i++)
- downstream.accept(array[i]);
+ if (!cancellationWasRequested) {
+ for (int i = 0; i < offset; i++)
+ downstream.accept(array[i]);
+ }
+ else {
+ for (int i = 0; i < offset && !downstream.cancellationRequested(); i++)
+ downstream.accept(array[i]);
+ }
downstream.end();
array = null;
}
@@ -520,7 +661,7 @@
/**
* {@link Sink} for implementing sort on double streams.
*/
- private static final class DoubleSortingSink extends Sink.ChainedDouble<Double> {
+ private static final class DoubleSortingSink extends AbstractDoubleSortingSink {
private SpinedBuffer.OfDouble b;
DoubleSortingSink(Sink<? super Double> sink) {
@@ -539,8 +680,16 @@
double[] doubles = b.asPrimitiveArray();
Arrays.sort(doubles);
downstream.begin(doubles.length);
- for (double aDouble : doubles)
- downstream.accept(aDouble);
+ if (!cancellationWasRequested) {
+ for (double aDouble : doubles)
+ downstream.accept(aDouble);
+ }
+ else {
+ for (double aDouble : doubles) {
+ if (downstream.cancellationRequested()) break;
+ downstream.accept(aDouble);
+ }
+ }
downstream.end();
}
--- a/jdk/src/share/classes/javax/swing/text/html/CSS.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/CSS.java Thu May 08 15:27:38 2014 -0700
@@ -153,6 +153,8 @@
* Fetch the default value for the attribute.
* If there is no default value (such as for
* composite attributes), null will be returned.
+ *
+ * @return default value for the attribute
*/
public String getDefaultValue() {
return defaultValue;
@@ -161,6 +163,8 @@
/**
* Indicates if the attribute should be inherited
* from the parent or not.
+ *
+ * @return true if the attribute should be inherited from the parent
*/
public boolean isInherited() {
return inherited;
@@ -1036,6 +1040,8 @@
/**
* Return the set of all possible CSS attribute keys.
+ *
+ * @return the set of all possible CSS attribute keys
*/
public static Attribute[] getAllAttributeKeys() {
Attribute[] keys = new Attribute[Attribute.allAttributes.length];
--- a/jdk/src/share/classes/javax/swing/text/html/FormView.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/FormView.java Thu May 08 15:27:38 2014 -0700
@@ -448,6 +448,8 @@
/**
* This method is responsible for submitting the form data.
* A thread is forked to undertake the submission.
+ *
+ * @param data data to submit
*/
protected void submitData(String data) {
Element form = getFormElement();
--- a/jdk/src/share/classes/javax/swing/text/html/HTML.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/HTML.java Thu May 08 15:27:38 2014 -0700
@@ -571,6 +571,9 @@
* are recognized by the default HTML reader.
* This set does not include tags that are
* manufactured by the reader.
+ *
+ * @return the set of actual HTML tags that
+ * are recognized by the default HTML reader
*/
public static Tag[] getAllTags() {
Tag[] tags = new Tag[Tag.allTags.length];
@@ -626,6 +629,7 @@
* @param key the key to use to fetch the value
* @param def the default value to use if the attribute isn't
* defined or there is an error converting to an integer
+ * @return an attribute value
*/
public static int getIntegerAttributeValue(AttributeSet attr,
Attribute key, int def) {
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java Thu May 08 15:27:38 2014 -0700
@@ -339,6 +339,7 @@
* <p>This is a convenience method for
* <code>getReader(int, int, int, HTML.Tag, TRUE)</code>.
*
+ * @param pos the starting position
* @param popDepth the number of <code>ElementSpec.EndTagTypes</code>
* to generate before inserting
* @param pushDepth the number of <code>ElementSpec.StartTagTypes</code>
@@ -1022,6 +1023,9 @@
* @throws IllegalArgumentException if <code>elem</code> is a leaf
* @throws IllegalStateException if an <code>HTMLEditorKit.Parser</code>
* has not been defined
+ * @throws BadLocationException if replacement is impossible because of
+ * a structural issue
+ * @throws IOException if an I/O exception occurs
* @since 1.3
*/
public void setInnerHTML(Element elem, String htmlText) throws
@@ -1099,6 +1103,9 @@
* @param htmlText the string to be parsed and inserted in place of <code>elem</code>
* @throws IllegalStateException if an HTMLEditorKit.Parser has not
* been set
+ * @throws BadLocationException if replacement is impossible because of
+ * a structural issue
+ * @throws IOException if an I/O exception occurs
* @since 1.3
*/
public void setOuterHTML(Element elem, String htmlText) throws
@@ -1177,6 +1184,9 @@
* @throws IllegalArgumentException if <code>elem</code> is a leaf
* @throws IllegalStateException if an HTMLEditorKit.Parser has not
* been set on the document
+ * @throws BadLocationException if insertion is impossible because of
+ * a structural issue
+ * @throws IOException if an I/O exception occurs
* @since 1.3
*/
public void insertAfterStart(Element elem, String htmlText) throws
@@ -1247,6 +1257,9 @@
* @throws IllegalArgumentException if <code>elem</code> is a leaf
* @throws IllegalStateException if an HTMLEditorKit.Parser has not
* been set on the document
+ * @throws BadLocationException if insertion is impossible because of
+ * a structural issue
+ * @throws IOException if an I/O exception occurs
* @since 1.3
*/
public void insertBeforeEnd(Element elem, String htmlText) throws
@@ -1310,6 +1323,9 @@
* @param htmlText the string to be parsed and inserted before <code>elem</code>
* @throws IllegalStateException if an HTMLEditorKit.Parser has not
* been set on the document
+ * @throws BadLocationException if insertion is impossible because of
+ * a structural issue
+ * @throws IOException if an I/O exception occurs
* @since 1.3
*/
public void insertBeforeStart(Element elem, String htmlText) throws
@@ -1368,6 +1384,9 @@
* @param htmlText the string to be parsed and inserted after <code>elem</code>
* @throws IllegalStateException if an HTMLEditorKit.Parser has not
* been set on the document
+ * @throws BadLocationException if insertion is impossible because of
+ * a structural issue
+ * @throws IOException if an I/O exception occurs
* @since 1.3
*/
public void insertAfterEnd(Element elem, String htmlText) throws
@@ -1890,6 +1909,7 @@
/**
* Type of tag this iterator represents.
+ * @return the tag
*/
public abstract HTML.Tag getTag();
}
@@ -2171,10 +2191,24 @@
*/
public class HTMLReader extends HTMLEditorKit.ParserCallback {
+ /**
+ * Constructs an HTMLReader using default pop and push depth and no tag to insert.
+ *
+ * @param offset the starting offset
+ */
public HTMLReader(int offset) {
this(offset, 0, 0, null);
}
+ /**
+ * Constructs an HTMLReader.
+ *
+ * @param offset the starting offset
+ * @param popDepth how many parents to ascend before insert new element
+ * @param pushDepth how many parents to descend (relative to popDepth) before
+ * inserting
+ * @param insertTag a tag to insert (may be null)
+ */
public HTMLReader(int offset, int popDepth, int pushDepth,
HTML.Tag insertTag) {
this(offset, popDepth, pushDepth, insertTag, true, false, true);
@@ -2742,6 +2776,9 @@
* all of the well-known tags will have been registered.
* This can be used to change the handling of a particular
* tag or to add support for custom tags.
+ *
+ * @param t an HTML tag
+ * @param a tag action handler
*/
protected void registerTag(HTML.Tag t, TagAction a) {
tagMap.put(t, a);
@@ -2762,6 +2799,9 @@
* tag for those actions that are shared across
* many tags. By default this does nothing and
* completely ignores the tag.
+ *
+ * @param t the HTML tag
+ * @param a the attributes
*/
public void start(HTML.Tag t, MutableAttributeSet a) {
}
@@ -2773,12 +2813,17 @@
* tag for those actions that are shared across
* many tags. By default this does nothing and
* completely ignores the tag.
+ *
+ * @param t the HTML tag
*/
public void end(HTML.Tag t) {
}
}
+ /**
+ * Action assigned by default to handle the Block task of the reader.
+ */
public class BlockAction extends TagAction {
public void start(HTML.Tag t, MutableAttributeSet attr) {
@@ -2816,6 +2861,9 @@
}
+ /**
+ * Action assigned by default to handle the Paragraph task of the reader.
+ */
public class ParagraphAction extends BlockAction {
public void start(HTML.Tag t, MutableAttributeSet a) {
@@ -2829,6 +2877,9 @@
}
}
+ /**
+ * Action assigned by default to handle the Special task of the reader.
+ */
public class SpecialAction extends TagAction {
public void start(HTML.Tag t, MutableAttributeSet a) {
@@ -2848,6 +2899,9 @@
}
+ /**
+ * Action assigned by default to handle the Hidden task of the reader.
+ */
public class HiddenAction extends TagAction {
public void start(HTML.Tag t, MutableAttributeSet a) {
@@ -3093,6 +3147,9 @@
}
}
+ /**
+ * Action assigned by default to handle the Character task of the reader.
+ */
public class CharacterAction extends TagAction {
public void start(HTML.Tag t, MutableAttributeSet attr) {
@@ -3515,6 +3572,8 @@
* context. Therefore all text that is seen belongs
* to the text area and is hence added to the
* TextAreaDocument associated with the text area.
+ *
+ * @param data the given content
*/
protected void textAreaContent(char[] data) {
try {
@@ -3529,6 +3588,8 @@
* PRE element. This synthesizes lines to hold the
* runs of text, and makes calls to addContent to
* actually add the text.
+ *
+ * @param data the given content
*/
protected void preContent(char[] data) {
int last = 0;
@@ -3550,6 +3611,9 @@
/**
* Adds an instruction to the parse buffer to create a
* block element with the given attributes.
+ *
+ * @param t an HTML tag
+ * @param attr the attribute set
*/
protected void blockOpen(HTML.Tag t, MutableAttributeSet attr) {
if (impliedP) {
@@ -3574,6 +3638,8 @@
/**
* Adds an instruction to the parse buffer to close out
* a block element of the given type.
+ *
+ * @param t the HTML tag
*/
protected void blockClose(HTML.Tag t) {
inBlock--;
@@ -3672,6 +3738,9 @@
/**
* Adds content that is basically specified entirely
* in the attribute set.
+ *
+ * @param t an HTML tag
+ * @param a the attribute set
*/
protected void addSpecialElement(HTML.Tag t, MutableAttributeSet a) {
if ((t != HTML.Tag.FRAME) && (! inParagraph) && (! inPre)) {
@@ -4049,7 +4118,13 @@
*/
Option option;
+ /**
+ * Buffer to keep building elements.
+ */
protected Vector<ElementSpec> parseBuffer = new Vector<ElementSpec>();
+ /**
+ * Current character attribute set.
+ */
protected MutableAttributeSet charAttr = new TaggedAttributeSet();
Stack<AttributeSet> charAttrStack = new Stack<AttributeSet>();
Hashtable<HTML.Tag, TagAction> tagMap;
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLEditorKit.java Thu May 08 15:27:38 2014 -0700
@@ -971,6 +971,8 @@
* Parse the given stream and drive the given callback
* with the results of the parse. This method should
* be implemented to be thread-safe.
+ *
+ * @throws IOException if an I/O exception occurs
*/
public abstract void parse(Reader r, ParserCallback cb, boolean ignoreCharSet) throws IOException;
@@ -1026,6 +1028,8 @@
* or \r\n, which ever is encountered the most in parsing the
* stream.
*
+ * @param eol value of eol
+ *
* @since 1.3
*/
public void handleEndOfLineString(String eol) {
@@ -1490,6 +1494,7 @@
}
/**
+ * @param e the JEditorPane
* @return HTMLDocument of <code>e</code>.
*/
protected HTMLDocument getHTMLDocument(JEditorPane e) {
@@ -1501,6 +1506,7 @@
}
/**
+ * @param e the JEditorPane
* @return HTMLEditorKit for <code>e</code>.
*/
protected HTMLEditorKit getHTMLEditorKit(JEditorPane e) {
@@ -1514,6 +1520,10 @@
/**
* Returns an array of the Elements that contain <code>offset</code>.
* The first elements corresponds to the root.
+ *
+ * @param doc an instance of HTMLDocument
+ * @param offset value of offset
+ * @return an array of the Elements that contain <code>offset</code>
*/
protected Element[] getElementsAt(HTMLDocument doc, int offset) {
return getElementsAt(doc.getDefaultRootElement(), offset, 0);
@@ -1541,6 +1551,11 @@
* return -1 if no elements is found representing <code>tag</code>,
* or 0 if the parent of the leaf at <code>offset</code> represents
* <code>tag</code>.
+ *
+ * @param doc an instance of HTMLDocument
+ * @param offset an offset to start from
+ * @param tag tag to represent
+ * @return number of elements
*/
protected int elementCountToTag(HTMLDocument doc, int offset,
HTML.Tag tag) {
--- a/jdk/src/share/classes/javax/swing/text/html/HTMLFrameHyperlinkEvent.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/text/html/HTMLFrameHyperlinkEvent.java Thu May 08 15:27:38 2014 -0700
@@ -125,6 +125,8 @@
/**
* returns the target for the link.
+ *
+ * @return the target for the link
*/
public String getTarget() {
return targetFrame;
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureMethod.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureMethod.java Thu May 08 15:27:38 2014 -0700
@@ -21,7 +21,7 @@
* under the License.
*/
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
*/
/*
* $Id: DOMSignatureMethod.java 1333415 2012-05-03 12:03:51Z coheigea $
@@ -34,10 +34,12 @@
import java.io.IOException;
import java.security.*;
+import java.security.interfaces.DSAKey;
import java.security.spec.AlgorithmParameterSpec;
import org.w3c.dom.Element;
import com.sun.org.apache.xml.internal.security.algorithms.implementations.SignatureECDSA;
+import com.sun.org.apache.xml.internal.security.utils.JavaUtils;
import org.jcp.xml.dsig.internal.SignerOutputStream;
/**
@@ -68,6 +70,8 @@
"http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha384";
static final String ECDSA_SHA512 =
"http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha512";
+ static final String DSA_SHA256 =
+ "http://www.w3.org/2009/xmldsig11#dsa-sha256";
/**
* Creates a <code>DOMSignatureMethod</code>.
@@ -119,6 +123,8 @@
return new SHA512withRSA(smElem);
} else if (alg.equals(SignatureMethod.DSA_SHA1)) {
return new SHA1withDSA(smElem);
+ } else if (alg.equals(DSA_SHA256)) {
+ return new SHA256withDSA(smElem);
} else if (alg.equals(ECDSA_SHA1)) {
return new SHA1withECDSA(smElem);
} else if (alg.equals(ECDSA_SHA256)) {
@@ -178,7 +184,9 @@
try {
Type type = getAlgorithmType();
if (type == Type.DSA) {
- return signature.verify(convertXMLDSIGtoASN1(sig));
+ int size = ((DSAKey)key).getParams().getQ().bitLength();
+ return signature.verify(JavaUtils.convertDsaXMLDSIGtoASN1(sig,
+ size/8));
} else if (type == Type.ECDSA) {
return signature.verify(SignatureECDSA.convertXMLDSIGtoASN1(sig));
} else {
@@ -222,7 +230,9 @@
try {
Type type = getAlgorithmType();
if (type == Type.DSA) {
- return convertASN1toXMLDSIG(signature.sign());
+ int size = ((DSAKey)key).getParams().getQ().bitLength();
+ return JavaUtils.convertDsaASN1toXMLDSIG(signature.sign(),
+ size/8);
} else if (type == Type.ECDSA) {
return SignatureECDSA.convertASN1toXMLDSIG(signature.sign());
} else {
@@ -235,101 +245,6 @@
}
}
- /**
- * Converts an ASN.1 DSA value to a XML Signature DSA Value.
- *
- * The JAVA JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
- * pairs; the XML Signature requires the core BigInteger values.
- *
- * @param asn1Bytes
- *
- * @throws IOException
- * @see <A HREF="http://www.w3.org/TR/xmldsig-core/#dsa-sha1">6.4.1 DSA</A>
- */
- private static byte[] convertASN1toXMLDSIG(byte asn1Bytes[])
- throws IOException
- {
- byte rLength = asn1Bytes[3];
- int i;
-
- for (i = rLength; (i > 0) && (asn1Bytes[(4 + rLength) - i] == 0); i--);
-
- byte sLength = asn1Bytes[5 + rLength];
- int j;
-
- for (j = sLength;
- (j > 0) && (asn1Bytes[(6 + rLength + sLength) - j] == 0); j--);
-
- if ((asn1Bytes[0] != 48) || (asn1Bytes[1] != asn1Bytes.length - 2)
- || (asn1Bytes[2] != 2) || (i > 20)
- || (asn1Bytes[4 + rLength] != 2) || (j > 20)) {
- throw new IOException("Invalid ASN.1 format of DSA signature");
- } else {
- byte xmldsigBytes[] = new byte[40];
-
- System.arraycopy(asn1Bytes, (4+rLength)-i, xmldsigBytes, 20-i, i);
- System.arraycopy(asn1Bytes, (6+rLength+sLength)-j, xmldsigBytes,
- 40 - j, j);
-
- return xmldsigBytes;
- }
- }
-
- /**
- * Converts a XML Signature DSA Value to an ASN.1 DSA value.
- *
- * The JAVA JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
- * pairs; the XML Signature requires the core BigInteger values.
- *
- * @param xmldsigBytes
- *
- * @throws IOException
- * @see <A HREF="http://www.w3.org/TR/xmldsig-core/#dsa-sha1">6.4.1 DSA</A>
- */
- private static byte[] convertXMLDSIGtoASN1(byte xmldsigBytes[])
- throws IOException
- {
- if (xmldsigBytes.length != 40) {
- throw new IOException("Invalid XMLDSIG format of DSA signature");
- }
-
- int i;
-
- for (i = 20; (i > 0) && (xmldsigBytes[20 - i] == 0); i--);
-
- int j = i;
-
- if (xmldsigBytes[20 - i] < 0) {
- j += 1;
- }
-
- int k;
-
- for (k = 20; (k > 0) && (xmldsigBytes[40 - k] == 0); k--);
-
- int l = k;
-
- if (xmldsigBytes[40 - k] < 0) {
- l += 1;
- }
-
- byte asn1Bytes[] = new byte[6 + j + l];
-
- asn1Bytes[0] = 48;
- asn1Bytes[1] = (byte)(4 + j + l);
- asn1Bytes[2] = 2;
- asn1Bytes[3] = (byte)j;
-
- System.arraycopy(xmldsigBytes, 20 - i, asn1Bytes, (4 + j) - i, i);
-
- asn1Bytes[4 + j] = 2;
- asn1Bytes[5 + j] = (byte) l;
-
- System.arraycopy(xmldsigBytes, 40 - k, asn1Bytes, (6 + j + l) - k, k);
-
- return asn1Bytes;
- }
-
static final class SHA1withRSA extends DOMSignatureMethod {
SHA1withRSA(AlgorithmParameterSpec params)
throws InvalidAlgorithmParameterException {
@@ -425,6 +340,25 @@
}
}
+ static final class SHA256withDSA extends DOMSignatureMethod {
+ SHA256withDSA(AlgorithmParameterSpec params)
+ throws InvalidAlgorithmParameterException {
+ super(params);
+ }
+ SHA256withDSA(Element dmElem) throws MarshalException {
+ super(dmElem);
+ }
+ public String getAlgorithm() {
+ return DSA_SHA256;
+ }
+ String getJCAAlgorithm() {
+ return "SHA256withDSA";
+ }
+ Type getAlgorithmType() {
+ return Type.DSA;
+ }
+ }
+
static final class SHA1withECDSA extends DOMSignatureMethod {
SHA1withECDSA(AlgorithmParameterSpec params)
throws InvalidAlgorithmParameterException {
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java Thu May 08 15:27:38 2014 -0700
@@ -21,7 +21,7 @@
* under the License.
*/
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
*/
/*
* $Id: DOMXMLSignatureFactory.java 1333869 2012-05-04 10:42:44Z coheigea $
@@ -239,6 +239,8 @@
return new DOMSignatureMethod.SHA512withRSA(params);
} else if (algorithm.equals(SignatureMethod.DSA_SHA1)) {
return new DOMSignatureMethod.SHA1withDSA(params);
+ } else if (algorithm.equals(DOMSignatureMethod.DSA_SHA256)) {
+ return new DOMSignatureMethod.SHA256withDSA(params);
} else if (algorithm.equals(SignatureMethod.HMAC_SHA1)) {
return new DOMHMACSignatureMethod.SHA1(params);
} else if (algorithm.equals(DOMHMACSignatureMethod.HMAC_SHA256)) {
--- a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/PerfDataFile.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/PerfDataFile.java Thu May 08 15:27:38 2014 -0700
@@ -233,8 +233,6 @@
* does not conform to the expected pattern
*/
public static int getLocalVmId(File file) {
- int lvmid = 0;
-
try {
// try 1.4.2 and later format first
return Integer.parseInt(file.getName());
@@ -287,31 +285,13 @@
return tmpDirName + dirNamePrefix + user + File.separator;
}
- /*
- * this static initializer would not be necessary if the
- * Solaris java.io.tmpdir property were set to /tmp by default
- */
static {
/*
- * Why is java.io.tmpdir on Solaris set to "/var/tmp/" when the
- * HotSpot JVM os:get_temp_path() method returns "/tmp/"
- *
- * Why do Solaris and Windows return a string with a trailing
- * file separator character where as Linix does not? (this change
- * seems to have occurred sometime during hopper beta)
+ * For this to work, the target VM and this code need to use
+ * the same directory. Instead of guessing which directory the
+ * VM is using, we will ask.
*/
- String tmpdir = System.getProperty("java.io.tmpdir");
-
- if (tmpdir.compareTo("/var/tmp/") == 0) {
- /*
- * shared memory files are created in /tmp. Interestingly,
- * java.io.tmpdir is set to "/var/tmp/" on Solaris and Linux,
- * but os::get_temp_directory() is set to "/tmp/" on these
- * platforms. the java.io.logging packages also makes reference
- * to java.io.tmpdir.
- */
- tmpdir = "/tmp/";
- }
+ String tmpdir = sun.misc.VMSupport.getVMTemporaryDirectory();
/*
* Assure that the string returned has a trailing File.separator
--- a/jdk/src/share/classes/sun/launcher/LauncherHelper.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/sun/launcher/LauncherHelper.java Thu May 08 15:27:38 2014 -0700
@@ -69,6 +69,14 @@
public enum LauncherHelper {
INSTANCE;
+
+ // used to identify JavaFX applications
+ private static final String JAVAFX_APPLICATION_MARKER =
+ "JavaFX-Application-Class";
+ private static final String JAVAFX_APPLICATION_CLASS_NAME =
+ "javafx.application.Application";
+ private static final String JAVAFX_FXHELPER_CLASS_NAME_SUFFIX =
+ "sun.launcher.LauncherHelper$FXHelper";
private static final String MAIN_CLASS = "Main-Class";
private static StringBuilder outBuf = new StringBuilder();
@@ -418,7 +426,8 @@
* exists to enforce compliance with the jar specification
*/
if (mainAttrs.containsKey(
- new Attributes.Name(FXHelper.JAVAFX_APPLICATION_MARKER))) {
+ new Attributes.Name(JAVAFX_APPLICATION_MARKER))) {
+ FXHelper.setFXLaunchParameters(jarname, LM_JAR);
return FXHelper.class.getName();
}
@@ -516,9 +525,9 @@
* the main class may or may not have a main method, so do this before
* validating the main class.
*/
- if (mainClass.equals(FXHelper.class) ||
- FXHelper.doesExtendFXApplication(mainClass)) {
- // Will abort() if there are problems with the FX runtime
+ if (JAVAFX_FXHELPER_CLASS_NAME_SUFFIX.equals(mainClass.getName()) ||
+ doesExtendFXApplication(mainClass)) {
+ // Will abort() if there are problems with FX runtime
FXHelper.setFXLaunchParameters(what, mode);
return FXHelper.class;
}
@@ -537,6 +546,21 @@
return appClass;
}
+ /*
+ * Check if the given class is a JavaFX Application class. This is done
+ * in a way that does not cause the Application class to load or throw
+ * ClassNotFoundException if the JavaFX runtime is not available.
+ */
+ private static boolean doesExtendFXApplication(Class<?> mainClass) {
+ for (Class<?> sc = mainClass.getSuperclass(); sc != null;
+ sc = sc.getSuperclass()) {
+ if (sc.getName().equals(JAVAFX_APPLICATION_CLASS_NAME)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
// Check the existence and signature of main and abort if incorrect
static void validateMainClass(Class<?> mainClass) {
Method mainMethod;
@@ -545,7 +569,7 @@
} catch (NoSuchMethodException nsme) {
// invalid main or not FX application, abort with an error
abort(null, "java.launcher.cls.error4", mainClass.getName(),
- FXHelper.JAVAFX_APPLICATION_CLASS_NAME);
+ JAVAFX_APPLICATION_CLASS_NAME);
return; // Avoid compiler issues
}
@@ -668,11 +692,7 @@
}
static final class FXHelper {
- // Marker entry in jar manifest that designates a JavaFX application jar
- private static final String JAVAFX_APPLICATION_MARKER =
- "JavaFX-Application-Class";
- private static final String JAVAFX_APPLICATION_CLASS_NAME =
- "javafx.application.Application";
+
private static final String JAVAFX_LAUNCHER_CLASS_NAME =
"com.sun.javafx.application.LauncherImpl";
@@ -742,21 +762,6 @@
}
}
- /*
- * Check if the given class is a JavaFX Application class. This is done
- * in a way that does not cause the Application class to load or throw
- * ClassNotFoundException if the JavaFX runtime is not available.
- */
- private static boolean doesExtendFXApplication(Class<?> mainClass) {
- for (Class<?> sc = mainClass.getSuperclass(); sc != null;
- sc = sc.getSuperclass()) {
- if (sc.getName().equals(JAVAFX_APPLICATION_CLASS_NAME)) {
- return true;
- }
- }
- return false;
- }
-
public static void main(String... args) throws Exception {
if (fxLauncherMethod == null
|| fxLaunchMode == null
--- a/jdk/src/share/classes/sun/misc/VMSupport.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/sun/misc/VMSupport.java Thu May 08 15:27:38 2014 -0700
@@ -97,4 +97,14 @@
throw new RuntimeException(ioe.getMessage());
}
}
+
+ /*
+ * Return the temporary directory that the VM uses for the attach
+ * and perf data files.
+ *
+ * It is important that this directory is well-known and the
+ * same for all VM instances. It cannot be affected by configuration
+ * variables such as java.io.tmpdir.
+ */
+ public static native String getVMTemporaryDirectory();
}
--- a/jdk/src/share/classes/sun/nio/fs/AbstractPoller.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/sun/nio/fs/AbstractPoller.java Thu May 08 15:27:38 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -100,8 +100,6 @@
// validate arguments before request to poller
if (dir == null)
throw new NullPointerException();
- if (events.length == 0)
- throw new IllegalArgumentException("No events to register");
Set<WatchEvent.Kind<?>> eventSet = new HashSet<>(events.length);
for (WatchEvent.Kind<?> event: events) {
// standard events
@@ -114,17 +112,16 @@
}
// OVERFLOW is ignored
- if (event == StandardWatchEventKinds.OVERFLOW) {
- if (events.length == 1)
- throw new IllegalArgumentException("No events to register");
+ if (event == StandardWatchEventKinds.OVERFLOW)
continue;
- }
// null/unsupported
if (event == null)
throw new NullPointerException("An element in event set is 'null'");
throw new UnsupportedOperationException(event.name());
}
+ if (eventSet.isEmpty())
+ throw new IllegalArgumentException("No events to register");
return (WatchKey)invoke(RequestType.REGISTER, dir, eventSet, modifiers);
}
@@ -192,14 +189,17 @@
* the request.
*/
Object awaitResult() {
+ boolean interrupted = false;
synchronized (this) {
while (!completed) {
try {
wait();
} catch (InterruptedException x) {
- // ignore
+ interrupted = true;
}
}
+ if (interrupted)
+ Thread.currentThread().interrupt();
return result;
}
}
--- a/jdk/src/share/classes/sun/security/krb5/internal/rcache/DflCache.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/sun/security/krb5/internal/rcache/DflCache.java Thu May 08 15:27:38 2014 -0700
@@ -39,6 +39,7 @@
import java.security.AccessController;
import java.util.*;
+import com.sun.security.auth.module.UnixSystem;
import sun.security.action.GetPropertyAction;
import sun.security.krb5.internal.KerberosTime;
import sun.security.krb5.internal.Krb5;
@@ -105,14 +106,14 @@
private final String source;
- private static int uid;
+ private static long uid;
static {
try {
// Available on Solaris, Linux and Mac. Otherwise, no _euid suffix
- Class<?> clazz = Class.forName("com.sun.security.auth.module.UnixSystem");
- uid = (int)(long)(Long)
- clazz.getMethod("getUid").invoke(clazz.newInstance());
- } catch (Exception e) {
+ UnixSystem us = new com.sun.security.auth.module.UnixSystem();
+ uid = us.getUid();
+ } catch (Throwable e) {
+ // Cannot be only Exception, might be UnsatisfiedLinkError
uid = -1;
}
}
--- a/jdk/src/share/classes/sun/security/ssl/ByteBufferInputStream.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/ByteBufferInputStream.java Thu May 08 15:27:38 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -60,7 +60,8 @@
if (bb.remaining() == 0) {
return -1;
}
- return bb.get();
+
+ return (bb.get() & 0xFF); // need to be in the range 0 to 255
}
/**
--- a/jdk/src/share/classes/sun/security/ssl/EngineInputRecord.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/EngineInputRecord.java Thu May 08 15:27:38 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -109,14 +109,8 @@
ProtocolVersion recordVersion =
ProtocolVersion.valueOf(buf.get(pos + 1), buf.get(pos + 2));
- // Check if too old (currently not possible)
- // or if the major version does not match.
- // The actual version negotiation is in the handshaker classes
- if ((recordVersion.v < ProtocolVersion.MIN.v)
- || (recordVersion.major > ProtocolVersion.MAX.major)) {
- throw new SSLException(
- "Unsupported record version " + recordVersion);
- }
+ // check the record version
+ checkRecordVersion(recordVersion, false);
/*
* Reasonably sure this is a V3, disable further checks.
@@ -147,18 +141,8 @@
ProtocolVersion recordVersion =
ProtocolVersion.valueOf(buf.get(pos + 3), buf.get(pos + 4));
- // Check if too old (currently not possible)
- // or if the major version does not match.
- // The actual version negotiation is in the handshaker classes
- if ((recordVersion.v < ProtocolVersion.MIN.v)
- || (recordVersion.major > ProtocolVersion.MAX.major)) {
-
- // if it's not SSLv2, we're out of here.
- if (recordVersion.v != ProtocolVersion.SSL20Hello.v) {
- throw new SSLException(
- "Unsupported record version " + recordVersion);
- }
- }
+ // check the record version
+ checkRecordVersion(recordVersion, true);
/*
* Client or Server Hello
@@ -406,14 +390,9 @@
ProtocolVersion recordVersion = ProtocolVersion.valueOf(
srcBB.get(srcPos + 1), srcBB.get(srcPos + 2));
- // Check if too old (currently not possible)
- // or if the major version does not match.
- // The actual version negotiation is in the handshaker classes
- if ((recordVersion.v < ProtocolVersion.MIN.v)
- || (recordVersion.major > ProtocolVersion.MAX.major)) {
- throw new SSLException(
- "Unsupported record version " + recordVersion);
- }
+
+ // check the record version
+ checkRecordVersion(recordVersion, false);
/*
* It's really application data. How much to consume?
--- a/jdk/src/share/classes/sun/security/ssl/InputRecord.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/InputRecord.java Thu May 08 15:27:38 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -534,19 +534,35 @@
}
/**
+ * Return true if the specified record protocol version is out of the
+ * range of the possible supported versions.
+ */
+ static void checkRecordVersion(ProtocolVersion version,
+ boolean allowSSL20Hello) throws SSLException {
+ // Check if the record version is too old (currently not possible)
+ // or if the major version does not match.
+ //
+ // The actual version negotiation is in the handshaker classes
+ if ((version.v < ProtocolVersion.MIN.v) ||
+ ((version.major & 0xFF) > (ProtocolVersion.MAX.major & 0xFF))) {
+
+ // if it's not SSLv2, we're out of here.
+ if (!allowSSL20Hello ||
+ (version.v != ProtocolVersion.SSL20Hello.v)) {
+ throw new SSLException("Unsupported record version " + version);
+ }
+ }
+ }
+
+ /**
* Read a SSL/TLS record. Throw an IOException if the format is invalid.
*/
private void readV3Record(InputStream s, OutputStream o)
throws IOException {
ProtocolVersion recordVersion = ProtocolVersion.valueOf(buf[1], buf[2]);
- // Check if too old (currently not possible)
- // or if the major version does not match.
- // The actual version negotiation is in the handshaker classes
- if ((recordVersion.v < ProtocolVersion.MIN.v)
- || (recordVersion.major > ProtocolVersion.MAX.major)) {
- throw new SSLException(
- "Unsupported record version " + recordVersion);
- }
+
+ // check the record version
+ checkRecordVersion(recordVersion, false);
/*
* Get and check length, then the data.
--- a/jdk/src/share/classes/sun/security/ssl/ProtocolVersion.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/ProtocolVersion.java Thu May 08 15:27:38 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -101,7 +101,7 @@
this.v = v;
this.name = name;
major = (byte)(v >>> 8);
- minor = (byte)(v & 0xff);
+ minor = (byte)(v & 0xFF);
}
// private
@@ -117,8 +117,8 @@
} else if (v == SSL20Hello.v) {
return SSL20Hello;
} else {
- int major = (v >>> 8) & 0xff;
- int minor = v & 0xff;
+ int major = (v >>> 8) & 0xFF;
+ int minor = v & 0xFF;
return new ProtocolVersion(v, "Unknown-" + major + "." + minor);
}
}
@@ -128,10 +128,7 @@
* numbers. Never throws exceptions.
*/
public static ProtocolVersion valueOf(int major, int minor) {
- major &= 0xff;
- minor &= 0xff;
- int v = (major << 8) | minor;
- return valueOf(v);
+ return valueOf(((major & 0xFF) << 8) | (minor & 0xFF));
}
/**
--- a/jdk/src/share/javavm/export/jvm.h Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/javavm/export/jvm.h Thu May 08 15:27:38 2014 -0700
@@ -1331,6 +1331,9 @@
JNIEXPORT jobject JNICALL
JVM_InitAgentProperties(JNIEnv *env, jobject agent_props);
+JNIEXPORT jstring JNICALL
+JVM_GetTemporaryDirectory(JNIEnv *env);
+
/* Generics reflection support.
*
* Returns information about the given class's EnclosingMethod
--- a/jdk/src/share/native/sun/misc/VMSupport.c Thu May 08 01:05:24 2014 -0700
+++ b/jdk/src/share/native/sun/misc/VMSupport.c Thu May 08 15:27:38 2014 -0700
@@ -53,3 +53,9 @@
}
return (*InitAgentProperties_fp)(env, props);
}
+
+JNIEXPORT jstring JNICALL
+Java_sun_misc_VMSupport_getVMTemporaryDirectory(JNIEnv *env, jclass cls)
+{
+ return JVM_GetTemporaryDirectory(env);
+}
--- a/jdk/test/ProblemList.txt Thu May 08 01:05:24 2014 -0700
+++ b/jdk/test/ProblemList.txt Thu May 08 15:27:38 2014 -0700
@@ -249,6 +249,18 @@
# jdk_jdi
+# 6983531
+com/sun/jdi/BadHandshakeTest.java linux-all, windows-all
+
+# 8004127
+com/sun/jdi/RedefineImplementor.sh generic-all
+
+# 8031555
+com/sun/jdi/JdbMethodExitTest.sh generic-all
+
+# 8041934
+com/sun/jdi/RepStep.java generic-all
+
############################################################################
# jdk_util
@@ -270,4 +282,10 @@
# 8033104
sun/jvmstat/monitor/MonitoredVm/CR6672135.java generic-all
+# 8041989
+sun/tools/jstatd/TestJstatdDefaults.java generic-all
+
+# 8037285
+sun/tools/jstatd/TestJstatdServer.java generic-all
+
############################################################################
--- a/jdk/test/TEST.groups Thu May 08 01:05:24 2014 -0700
+++ b/jdk/test/TEST.groups Thu May 08 15:27:38 2014 -0700
@@ -1,4 +1,4 @@
-# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 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
@@ -155,6 +155,15 @@
jdk_jdi = \
com/sun/jdi
+# java launcher specific tests, Note: do not include this group into any groups
+# that potentially could be included into a jprt test rule, as the complementary
+# closed group includes awt SplashScreen and these tests may not run
+# satisfacotorily on all platforms and profiles thus this group must always
+# be a stand-alone group
+jdk_launcher = \
+ tools/launcher \
+ sun/tools
+
#
# Tool (and tool API) tests are split into core and svc groups
#
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/security/auth/module/AllPlatforms.java Thu May 08 15:27:38 2014 -0700
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8039951
+ * @summary com.sun.security.auth.module missing classes on some platforms
+ * @run main/othervm AllPlatforms
+ */
+
+import javax.security.auth.login.Configuration;
+import javax.security.auth.login.LoginContext;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+public class AllPlatforms {
+ public static void main(String[] args) throws Exception {
+ login("cross-platform",
+ "UnixLoginModule", "optional",
+ "NTLoginModule", "optional",
+ "SolarisLoginModule", "optional");
+ try {
+ login("windows", "NTLoginModule", "required");
+ login("unix", "UnixLoginModule", "required");
+ login("solaris", "SolarisLoginModule", "required");
+ } catch (Exception e) {
+ e.printStackTrace(System.out);
+ if (e.toString().contains("UnsatisfiedLinkError")) {
+ throw new Exception("This is ugly");
+ }
+ }
+ }
+
+ static void login(String test, String... conf) throws Exception {
+ System.out.println("Testing " + test + "...");
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("hello {\n");
+ for (int i=0; i<conf.length; i+=2) {
+ sb.append(" com.sun.security.auth.module." + conf[i]
+ + " " + conf[i+1] + ";\n");
+ }
+ sb.append("};\n");
+ Files.write(Paths.get(test), sb.toString().getBytes());
+
+ // Must be called. Configuration has an internal static field.
+ Configuration.setConfiguration(null);
+ System.setProperty("java.security.auth.login.config", test);
+
+ LoginContext lc = new LoginContext("hello");
+ lc.login();
+ System.out.println(lc.getSubject());
+ }
+}
--- a/jdk/test/com/sun/tools/attach/BasicTests.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/test/com/sun/tools/attach/BasicTests.java Thu May 08 15:27:38 2014 -0700
@@ -38,7 +38,7 @@
* @bug 6173612 6273707 6277253 6335921 6348630 6342019 6381757
* @summary Basic unit tests for the VM attach mechanism.
* @library /lib/testlibrary
- * @run build Agent BadAgent RedefineAgent Application Shutdown RedefineDummy
+ * @run build Agent BadAgent RedefineAgent Application Shutdown RedefineDummy RunnerUtil
* @run main BasicTests
*
* This test will perform a number of basic attach tests.
@@ -238,19 +238,17 @@
// Test 6 - list method should list the target VM
System.out.println(" - Test: VirtualMachine.list");
List<VirtualMachineDescriptor> l = VirtualMachine.list();
- if (!l.isEmpty()) {
- boolean found = false;
- for (VirtualMachineDescriptor vmd: l) {
- if (vmd.id().equals(pid)) {
- found = true;
- break;
- }
+ boolean found = false;
+ for (VirtualMachineDescriptor vmd: l) {
+ if (vmd.id().equals(pid)) {
+ found = true;
+ break;
}
- if (found) {
- System.out.println(" - " + pid + " found.");
- } else {
- throw new RuntimeException(pid + " not found in VM list");
- }
+ }
+ if (found) {
+ System.out.println(" - " + pid + " found.");
+ } else {
+ throw new RuntimeException(pid + " not found in VM list");
}
// test 7 - basic hashCode/equals tests
--- a/jdk/test/com/sun/tools/attach/RunnerUtil.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/test/com/sun/tools/attach/RunnerUtil.java Thu May 08 15:27:38 2014 -0700
@@ -24,12 +24,11 @@
import java.io.IOException;
import java.io.File;
import java.nio.file.Files;
-import java.nio.file.Path;
import java.util.Arrays;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
+
import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JDKToolLauncher;
import jdk.testlibrary.ProcessTools;
import jdk.testlibrary.Utils;
import jdk.testlibrary.ProcessThread;
@@ -39,6 +38,7 @@
* (Test runner = class that launch a test)
*/
public class RunnerUtil {
+
/**
* The Application process must be run concurrently with our tests since
* the tests will attach to the Application.
@@ -49,16 +49,31 @@
*
* The Application will write its pid and shutdownPort in the given outFile.
*/
- public static ProcessThread startApplication(String outFile) throws Throwable {
+ public static ProcessThread startApplication(String outFile, String... additionalOpts) throws Throwable {
String classpath = System.getProperty("test.class.path", ".");
- String[] args = Utils.addTestJavaOpts(
- "-Dattach.test=true", "-classpath", classpath, "Application", outFile);
+ String[] myArgs = concat(additionalOpts, new String [] { "-Dattach.test=true", "-classpath", classpath, "Application", outFile });
+ String[] args = Utils.addTestJavaOpts(myArgs);
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args);
ProcessThread pt = new ProcessThread("runApplication", pb);
pt.start();
return pt;
}
+ public static String[] concat(String[] a, String[] b) {
+ if (a == null) {
+ return b;
+ }
+ if (b == null) {
+ return a;
+ }
+ int aLen = a.length;
+ int bLen = b.length;
+ String[] c = new String[aLen + bLen];
+ System.arraycopy(a, 0, c, 0, aLen);
+ System.arraycopy(b, 0, c, aLen, bLen);
+ return c;
+ }
+
/**
* Will stop the running Application.
* First tries to shutdown nicely by connecting to the shut down port.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/tools/attach/TempDirTest.java Thu May 08 15:27:38 2014 -0700
@@ -0,0 +1,169 @@
+/*
+ * 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.
+ */
+
+import com.sun.tools.attach.*;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Properties;
+import java.util.List;
+import java.io.File;
+
+import jdk.testlibrary.OutputAnalyzer;
+import jdk.testlibrary.ProcessTools;
+import jdk.testlibrary.ProcessThread;
+
+/*
+ * @test
+ * @bug 8033104
+ * @summary Test to make sure attach and jvmstat works correctly when java.io.tmpdir is set
+ * @library /lib/testlibrary
+ * @run build Application Shutdown RunnerUtil
+ * @run main/timeout=10 TempDirTest
+ */
+
+public class TempDirTest {
+
+ public static void main(String args[]) throws Throwable {
+
+ Path clientTmpDir = Files.createTempDirectory("TempDirTest-client");
+ clientTmpDir.toFile().deleteOnExit();
+ Path targetTmpDir = Files.createTempDirectory("TempDirTest-target");
+ targetTmpDir.toFile().deleteOnExit();
+
+ // run the test with all possible combinations of setting java.io.tmpdir
+ runExperiment(null, null);
+ runExperiment(clientTmpDir, null);
+ runExperiment(clientTmpDir, targetTmpDir);
+ runExperiment(null, targetTmpDir);
+
+ }
+
+ private static int counter = 0;
+
+ /*
+ * The actual test is in the nested class TestMain.
+ * The responsibility of this class is to:
+ * 1. Start the Application class in a separate process.
+ * 2. Find the pid and shutdown port of the running Application.
+ * 3. Launches the tests in nested class TestMain that will attach to the Application.
+ * 4. Shut down the Application.
+ */
+ public static void runExperiment(Path clientTmpDir, Path targetTmpDir) throws Throwable {
+
+ System.out.print("### Running tests with overridden tmpdir for");
+ System.out.print(" client: " + (clientTmpDir == null ? "no" : "yes"));
+ System.out.print(" target: " + (targetTmpDir == null ? "no" : "yes"));
+ System.out.println(" ###");
+
+ final String pidFile = "TempDirTest.Application.pid-" + counter++;
+ ProcessThread processThread = null;
+ RunnerUtil.ProcessInfo info = null;
+ try {
+ String[] tmpDirArg = null;
+ if (targetTmpDir != null) {
+ tmpDirArg = new String[] {"-Djava.io.tmpdir=" + targetTmpDir};
+ }
+ processThread = RunnerUtil.startApplication(pidFile, tmpDirArg);
+ info = RunnerUtil.readProcessInfo(pidFile);
+ launchTests(info.pid, clientTmpDir);
+ } catch (Throwable t) {
+ System.out.println("TempDirTest got unexpected exception: " + t);
+ t.printStackTrace();
+ throw t;
+ } finally {
+ // Make sure the Application process is stopped.
+ RunnerUtil.stopApplication(info.shutdownPort, processThread);
+ }
+ }
+
+ /**
+ * Runs the actual tests in nested class TestMain.
+ * The reason for running the tests in a separate process
+ * is that we need to modify the class path and
+ * the -Djava.io.tmpdir property.
+ */
+ private static void launchTests(int pid, Path clientTmpDir) throws Throwable {
+ final String sep = File.separator;
+
+ // Need to add jdk/lib/tools.jar to classpath.
+ String classpath =
+ System.getProperty("test.class.path", "") + File.pathSeparator +
+ System.getProperty("test.jdk", ".") + sep + "lib" + sep + "tools.jar";
+
+ String[] tmpDirArg = null;
+ if (clientTmpDir != null) {
+ tmpDirArg = new String [] {"-Djava.io.tmpdir=" + clientTmpDir};
+ }
+
+ // Arguments : [-Djava.io.tmpdir=] -classpath cp TempDirTest$TestMain pid
+ String[] args = RunnerUtil.concat(
+ tmpDirArg,
+ new String[] {
+ "-classpath",
+ classpath,
+ "TempDirTest$TestMain",
+ Integer.toString(pid) });
+ OutputAnalyzer output = ProcessTools.executeTestJvm(args);
+ output.shouldHaveExitValue(0);
+ }
+
+ /**
+ * This is the actual test. It will attach to the running Application
+ * and perform a number of basic attach tests.
+ */
+ public static class TestMain {
+ public static void main(String args[]) throws Exception {
+ String pid = args[0];
+
+ // Test 1 - list method should list the target VM
+ System.out.println(" - Test: VirtualMachine.list");
+ List<VirtualMachineDescriptor> l = VirtualMachine.list();
+ boolean found = false;
+ for (VirtualMachineDescriptor vmd: l) {
+ if (vmd.id().equals(pid)) {
+ found = true;
+ break;
+ }
+ }
+ if (found) {
+ System.out.println(" - " + pid + " found.");
+ } else {
+ throw new RuntimeException(pid + " not found in VM list");
+ }
+
+ // Test 2 - try to attach and verify connection
+
+ System.out.println(" - Attaching to application ...");
+ VirtualMachine vm = VirtualMachine.attach(pid);
+
+ System.out.println(" - Test: system properties in target VM");
+ Properties props = vm.getSystemProperties();
+ String value = props.getProperty("attach.test");
+ if (value == null || !value.equals("true")) {
+ throw new RuntimeException("attach.test property not set");
+ }
+ System.out.println(" - attach.test property set as expected");
+ }
+ }
+}
--- a/jdk/test/com/sun/tools/attach/java.policy.allow Thu May 08 01:05:24 2014 -0700
+++ b/jdk/test/com/sun/tools/attach/java.policy.allow Thu May 08 15:27:38 2014 -0700
@@ -13,7 +13,6 @@
permission java.lang.RuntimePermission "accessClassInPackage.sun.jvmstat.monitor";
permission java.lang.RuntimePermission "loadLibrary.attach";
permission java.util.PropertyPermission "sun.jvmstat.*", "read";
- permission java.util.PropertyPermission "java.io.tmpdir", "read";
/* to read configuration file in META-INF/services, and write/delete .attach_pid<pid> */
permission java.io.FilePermission "<<ALL FILES>>", "read,write,delete";
--- a/jdk/test/com/sun/tools/attach/java.policy.deny Thu May 08 01:05:24 2014 -0700
+++ b/jdk/test/com/sun/tools/attach/java.policy.deny Thu May 08 15:27:38 2014 -0700
@@ -11,7 +11,6 @@
permission java.lang.RuntimePermission "accessClassInPackage.sun.tools.attach";
permission java.lang.RuntimePermission "loadLibrary.attach";
permission java.util.PropertyPermission "sun.jvmstat.*", "read";
- permission java.util.PropertyPermission "java.io.tmpdir", "read";
/* to read configuration file in META-INF/services, and write/delete .attach_pid<pid> */
permission java.io.FilePermission "<<ALL FILES>>", "read,write,delete";
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/math/BigInteger/PrimeTest.java Thu May 08 15:27:38 2014 -0700
@@ -0,0 +1,196 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8026236
+ * @summary test primality verification methods in BigInteger
+ * @author bpb
+ */
+import java.math.BigInteger;
+import java.util.BitSet;
+import java.util.List;
+import java.util.NavigableSet;
+import java.util.SplittableRandom;
+import java.util.TreeSet;
+import static java.util.stream.Collectors.toCollection;
+import static java.util.stream.Collectors.toList;
+import java.util.stream.IntStream;
+import java.util.stream.Stream;
+
+public class PrimeTest {
+
+ private static final int DEFAULT_UPPER_BOUND = 1299709; // 100000th prime
+ private static final int DEFAULT_CERTAINTY = 100;
+ private static final int NUM_NON_PRIMES = 10000;
+
+ /**
+ * Run the test.
+ *
+ * @param args The parameters.
+ * @throws Exception on failure
+ */
+ public static void main(String[] args) throws Exception {
+ // Prepare arguments
+ int upperBound = args.length > 0 ? Integer.valueOf(args[0]) : DEFAULT_UPPER_BOUND;
+ int certainty = args.length > 1 ? Integer.valueOf(args[1]) : DEFAULT_CERTAINTY;
+ boolean parallel = args.length > 2 ? Boolean.valueOf(args[2]) : true;
+
+ // Echo parameter settings
+ System.out.println("Upper bound = " + upperBound
+ + "\nCertainty = " + certainty
+ + "\nParallel = " + parallel);
+
+ // Get primes through specified bound (inclusive) and Integer.MAX_VALUE
+ NavigableSet<BigInteger> primes = getPrimes(upperBound);
+
+ // Check whether known primes are identified as such
+ boolean primeTest = checkPrime(primes, certainty, parallel);
+ System.out.println("Prime test result: " + (primeTest ? "SUCCESS" : "FAILURE"));
+ if (!primeTest) {
+ System.err.println("Prime test failed");
+ }
+
+ // Check whether known non-primes are not identified as primes
+ boolean nonPrimeTest = checkNonPrime(primes, certainty);
+ System.out.println("Non-prime test result: " + (nonPrimeTest ? "SUCCESS" : "FAILURE"));
+
+ if (!primeTest || !nonPrimeTest) {
+ throw new Exception("PrimeTest FAILED!");
+ }
+
+ System.out.println("PrimeTest succeeded!");
+ }
+
+ /**
+ * Create a {@code BitSet} wherein a set bit indicates the corresponding
+ * index plus 2 is prime. That is, if bit N is set, then the integer N + 2
+ * is prime. The values 0 and 1 are intentionally excluded. See the
+ * <a
+ * href="http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes#Algorithm_description">
+ * Sieve of Eratosthenes</a> algorithm description for more information.
+ *
+ * @param upperBound The maximum prime to allow
+ * @return bits indicating which indexes represent primes
+ */
+ private static BitSet createPrimes(int upperBound) {
+ int nbits = upperBound - 1;
+ BitSet bs = new BitSet(nbits);
+ for (int p = 2; p * p < upperBound;) {
+ for (int i = p * p; i < nbits + 2; i += p) {
+ bs.set(i - 2, true);
+ }
+ do {
+ ++p;
+ } while (p > 1 && bs.get(p - 2));
+ }
+ bs.flip(0, nbits);
+ return bs;
+ }
+
+ /**
+ * Load the primes up to the specified bound (inclusive) into a
+ * {@code NavigableSet}, appending the prime {@code Integer.MAX_VALUE}.
+ *
+ * @param upperBound The maximum prime to allow
+ * @return a set of primes
+ */
+ private static NavigableSet<BigInteger> getPrimes(int upperBound) {
+ BitSet bs = createPrimes(upperBound);
+ NavigableSet<BigInteger> primes = bs.stream()
+ .mapToObj(p -> BigInteger.valueOf(p + 2))
+ .collect(toCollection(TreeSet::new));
+ primes.add(BigInteger.valueOf(Integer.MAX_VALUE));
+ System.out.println(String.format("Created %d primes", primes.size()));
+ return primes;
+ }
+
+ /**
+ * Verifies whether the fraction of probable primes detected is at least 1 -
+ * 1/2^certainty.
+ *
+ * @return true if and only if the test succeeds
+ */
+ private static boolean checkPrime(NavigableSet<BigInteger> primes,
+ int certainty,
+ boolean parallel) {
+ long probablePrimes = (parallel ? primes.parallelStream() : primes.stream())
+ .filter(bi -> bi.isProbablePrime(certainty))
+ .count();
+
+ // N = certainty / 2
+ // Success if p/t >= 1 - 1/4^N
+ // or (p/t)*4^N >= 4^N - 1
+ // or p*4^N >= t*(4^N - 1)
+ BigInteger p = BigInteger.valueOf(probablePrimes);
+ BigInteger t = BigInteger.valueOf(primes.size());
+ BigInteger fourToTheC = BigInteger.valueOf(4).pow(certainty / 2);
+ BigInteger fourToTheCMinusOne = fourToTheC.subtract(BigInteger.ONE);
+ BigInteger left = p.multiply(fourToTheC);
+ BigInteger right = t.multiply(fourToTheCMinusOne);
+
+ if (left.compareTo(right) < 0) {
+ System.err.println("Probable prime certainty test failed.");
+ }
+
+ return left.compareTo(right) >= 0;
+ }
+
+ /**
+ * Verifies whether all {@code BigInteger}s in the tested range for which
+ * {@code isProbablePrime()} returns {@code false} are <i>not</i>
+ * prime numbers.
+ *
+ * @return true if and only if the test succeeds
+ */
+ private static boolean checkNonPrime(NavigableSet<BigInteger> primes,
+ int certainty) {
+ int maxPrime = DEFAULT_UPPER_BOUND;
+ try {
+ maxPrime = primes.last().intValueExact();
+ } catch (ArithmeticException e) {
+ // ignore it
+ }
+
+ // Create a list of non-prime BigIntegers.
+ List<BigInteger> nonPrimeBigInts = (new SplittableRandom())
+ .ints(NUM_NON_PRIMES, 2, maxPrime).mapToObj(BigInteger::valueOf)
+ .filter(b -> !b.isProbablePrime(certainty)).collect(toList());
+
+ // If there are any non-probable primes also in the primes list then fail.
+ boolean failed = nonPrimeBigInts.stream().anyMatch(primes::contains);
+
+ // In the event, print which purported non-primes were actually prime.
+ if (failed) {
+ for (BigInteger bigInt : nonPrimeBigInts) {
+ if (primes.contains(bigInt)) {
+ System.err.println("Prime value thought to be non-prime: " + bigInt);
+ }
+ }
+ }
+
+ return !failed;
+ }
+}
--- a/jdk/test/java/nio/file/WatchService/Basic.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/test/java/nio/file/WatchService/Basic.java Thu May 08 15:27:38 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -22,7 +22,7 @@
*/
/* @test
- * @bug 4313887 6838333 7017446
+ * @bug 4313887 6838333 7017446 8011537 8042470
* @summary Unit test for java.nio.file.WatchService
* @library ..
* @run main Basic
@@ -295,24 +295,31 @@
// IllegalArgumentException
System.out.println("IllegalArgumentException tests...");
try {
- dir.register(watcher, new WatchEvent.Kind<?>[]{ } );
+ dir.register(watcher /*empty event list*/);
throw new RuntimeException("IllegalArgumentException not thrown");
} catch (IllegalArgumentException x) {
}
try {
// OVERFLOW is ignored so this is equivalent to the empty set
- dir.register(watcher, new WatchEvent.Kind<?>[]{ OVERFLOW });
+ dir.register(watcher, OVERFLOW);
+ throw new RuntimeException("IllegalArgumentException not thrown");
+ } catch (IllegalArgumentException x) {
+ }
+ try {
+ // OVERFLOW is ignored even if specified multiple times
+ dir.register(watcher, OVERFLOW, OVERFLOW);
throw new RuntimeException("IllegalArgumentException not thrown");
} catch (IllegalArgumentException x) {
}
// UnsupportedOperationException
try {
- dir.register(watcher, new WatchEvent.Kind<?>[]{
+ dir.register(watcher,
new WatchEvent.Kind<Object>() {
@Override public String name() { return "custom"; }
@Override public Class<Object> type() { return Object.class; }
- }});
+ });
+ throw new RuntimeException("UnsupportedOperationException not thrown");
} catch (UnsupportedOperationException x) {
}
try {
@@ -328,7 +335,7 @@
// NullPointerException
System.out.println("NullPointerException tests...");
try {
- dir.register(null, new WatchEvent.Kind<?>[]{ ENTRY_CREATE });
+ dir.register(null, ENTRY_CREATE);
throw new RuntimeException("NullPointerException not thrown");
} catch (NullPointerException x) {
}
@@ -380,7 +387,7 @@
try {
dir.register(watcher, new WatchEvent.Kind<?>[]{ ENTRY_CREATE });
- throw new RuntimeException("ClosedWatchServiceException not thrown");
+ throw new RuntimeException("ClosedWatchServiceException not thrown");
} catch (ClosedWatchServiceException x) {
}
@@ -468,6 +475,28 @@
}
}
+ /**
+ * Test that thread interruped status is preserved upon a call
+ * to register()
+ */
+ static void testThreadInterrupt(Path dir) throws IOException {
+ System.out.println("-- Thread interrupted status test --");
+
+ FileSystem fs = FileSystems.getDefault();
+ Thread curr = Thread.currentThread();
+ try (WatchService watcher = fs.newWatchService()) {
+ System.out.println("interrupting current thread");
+ curr.interrupt();
+ dir.register(watcher, ENTRY_CREATE);
+ if (!curr.isInterrupted())
+ throw new RuntimeException("thread should remain interrupted");
+ System.out.println("current thread is still interrupted");
+ System.out.println("OKAY");
+ } finally {
+ curr.interrupted();
+ }
+ }
+
public static void main(String[] args) throws IOException {
Path dir = TestUtil.createTemporaryDirectory();
try {
@@ -478,6 +507,7 @@
testWakeup(dir);
testExceptions(dir);
testTwoWatchers(dir);
+ testThreadInterrupt(dir);
} finally {
TestUtil.removeAll(dir);
--- a/jdk/test/java/util/BitSet/BSMethods.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/test/java/util/BitSet/BSMethods.java Thu May 08 15:27:38 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/* @test
* @bug 4098239 4107540 4080736 4261102 4274710 4305272
- * 4979017 4979028 4979031 5030267 6222207
+ * 4979017 4979028 4979031 5030267 6222207 8040806
* @summary Test the operation of the methods of BitSet class
* @author Mike McCloskey, Martin Buchholz
*/
@@ -897,6 +897,16 @@
private static void testToString() {
check(new BitSet().toString().equals("{}"));
check(makeSet(2,3,42,43,234).toString().equals("{2, 3, 42, 43, 234}"));
+ try {
+ check(makeSet(Integer.MAX_VALUE-1).toString().equals(
+ "{" + (Integer.MAX_VALUE-1) + "}"));
+ check(makeSet(Integer.MAX_VALUE).toString().equals(
+ "{" + Integer.MAX_VALUE + "}"));
+ check(makeSet(0, 1, Integer.MAX_VALUE-1, Integer.MAX_VALUE).toString().equals(
+ "{0, 1, " + (Integer.MAX_VALUE-1) + ", " + Integer.MAX_VALUE + "}"));
+ } catch (IndexOutOfBoundsException exc) {
+ fail("toString() with indices near MAX_VALUE");
+ }
}
private static void testLogicalIdentities() {
--- a/jdk/test/java/util/Locale/Bug7069824.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/test/java/util/Locale/Bug7069824.java Thu May 08 15:27:38 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 7069824
+ * @bug 7069824 8042360
* @summary Verify implementation for Locale matching.
* @run main Bug7069824
*/
@@ -91,6 +91,17 @@
String range;
double weight;
+ // Testcase for 8042360
+ range = "en-Latn-1234567890";
+ try {
+ lr = new LanguageRange(range);
+ error = true;
+ System.err.println(" IAE should be thrown for LanguageRange("
+ + range + ").");
+ }
+ catch (IllegalArgumentException ex) {
+ }
+
range = null;
try {
lr = new LanguageRange(range);
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/SortedOpTest.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/SortedOpTest.java Thu May 08 15:27:38 2014 -0700
@@ -26,6 +26,9 @@
import java.util.*;
import java.util.Spliterators;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.BiFunction;
+import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.*;
@@ -122,24 +125,33 @@
@Test(groups = { "serialization-hostile" })
public void testSequentialShortCircuitTerminal() {
- // The sorted op for sequential evaluation will buffer all elements when accepting
- // then at the end sort those elements and push those elements downstream
+ // The sorted op for sequential evaluation will buffer all elements when
+ // accepting then at the end sort those elements and push those elements
+ // downstream
+ // A peek operation is added in-between the sorted() and terminal
+ // operation that counts the number of calls to its consumer and
+ // asserts that the number of calls is at most the required quantity
List<Integer> l = Arrays.asList(5, 4, 3, 2, 1);
+ Function<Integer, Stream<Integer>> knownSize = i -> assertNCallsOnly(
+ l.stream().sorted(), Stream::peek, i);
+ Function<Integer, Stream<Integer>> unknownSize = i -> assertNCallsOnly
+ (unknownSizeStream(l).sorted(), Stream::peek, i);
+
// Find
- assertEquals(l.stream().sorted().findFirst(), Optional.of(1));
- assertEquals(l.stream().sorted().findAny(), Optional.of(1));
- assertEquals(unknownSizeStream(l).sorted().findFirst(), Optional.of(1));
- assertEquals(unknownSizeStream(l).sorted().findAny(), Optional.of(1));
+ assertEquals(knownSize.apply(1).findFirst(), Optional.of(1));
+ assertEquals(knownSize.apply(1).findAny(), Optional.of(1));
+ assertEquals(unknownSize.apply(1).findFirst(), Optional.of(1));
+ assertEquals(unknownSize.apply(1).findAny(), Optional.of(1));
// Match
- assertEquals(l.stream().sorted().anyMatch(i -> i == 2), true);
- assertEquals(l.stream().sorted().noneMatch(i -> i == 2), false);
- assertEquals(l.stream().sorted().allMatch(i -> i == 2), false);
- assertEquals(unknownSizeStream(l).sorted().anyMatch(i -> i == 2), true);
- assertEquals(unknownSizeStream(l).sorted().noneMatch(i -> i == 2), false);
- assertEquals(unknownSizeStream(l).sorted().allMatch(i -> i == 2), false);
+ assertEquals(knownSize.apply(2).anyMatch(i -> i == 2), true);
+ assertEquals(knownSize.apply(2).noneMatch(i -> i == 2), false);
+ assertEquals(knownSize.apply(2).allMatch(i -> i == 2), false);
+ assertEquals(unknownSize.apply(2).anyMatch(i -> i == 2), true);
+ assertEquals(unknownSize.apply(2).noneMatch(i -> i == 2), false);
+ assertEquals(unknownSize.apply(2).allMatch(i -> i == 2), false);
}
private <T> Stream<T> unknownSizeStream(List<T> l) {
@@ -199,19 +211,24 @@
public void testIntSequentialShortCircuitTerminal() {
int[] a = new int[]{5, 4, 3, 2, 1};
+ Function<Integer, IntStream> knownSize = i -> assertNCallsOnly(
+ Arrays.stream(a).sorted(), (s, c) -> s.peek(c::accept), i);
+ Function<Integer, IntStream> unknownSize = i -> assertNCallsOnly
+ (unknownSizeIntStream(a).sorted(), (s, c) -> s.peek(c::accept), i);
+
// Find
- assertEquals(Arrays.stream(a).sorted().findFirst(), OptionalInt.of(1));
- assertEquals(Arrays.stream(a).sorted().findAny(), OptionalInt.of(1));
- assertEquals(unknownSizeIntStream(a).sorted().findFirst(), OptionalInt.of(1));
- assertEquals(unknownSizeIntStream(a).sorted().findAny(), OptionalInt.of(1));
+ assertEquals(knownSize.apply(1).findFirst(), OptionalInt.of(1));
+ assertEquals(knownSize.apply(1).findAny(), OptionalInt.of(1));
+ assertEquals(unknownSize.apply(1).findFirst(), OptionalInt.of(1));
+ assertEquals(unknownSize.apply(1).findAny(), OptionalInt.of(1));
// Match
- assertEquals(Arrays.stream(a).sorted().anyMatch(i -> i == 2), true);
- assertEquals(Arrays.stream(a).sorted().noneMatch(i -> i == 2), false);
- assertEquals(Arrays.stream(a).sorted().allMatch(i -> i == 2), false);
- assertEquals(unknownSizeIntStream(a).sorted().anyMatch(i -> i == 2), true);
- assertEquals(unknownSizeIntStream(a).sorted().noneMatch(i -> i == 2), false);
- assertEquals(unknownSizeIntStream(a).sorted().allMatch(i -> i == 2), false);
+ assertEquals(knownSize.apply(2).anyMatch(i -> i == 2), true);
+ assertEquals(knownSize.apply(2).noneMatch(i -> i == 2), false);
+ assertEquals(knownSize.apply(2).allMatch(i -> i == 2), false);
+ assertEquals(unknownSize.apply(2).anyMatch(i -> i == 2), true);
+ assertEquals(unknownSize.apply(2).noneMatch(i -> i == 2), false);
+ assertEquals(unknownSize.apply(2).allMatch(i -> i == 2), false);
}
private IntStream unknownSizeIntStream(int[] a) {
@@ -242,19 +259,24 @@
public void testLongSequentialShortCircuitTerminal() {
long[] a = new long[]{5, 4, 3, 2, 1};
+ Function<Integer, LongStream> knownSize = i -> assertNCallsOnly(
+ Arrays.stream(a).sorted(), (s, c) -> s.peek(c::accept), i);
+ Function<Integer, LongStream> unknownSize = i -> assertNCallsOnly
+ (unknownSizeLongStream(a).sorted(), (s, c) -> s.peek(c::accept), i);
+
// Find
- assertEquals(Arrays.stream(a).sorted().findFirst(), OptionalLong.of(1));
- assertEquals(Arrays.stream(a).sorted().findAny(), OptionalLong.of(1));
- assertEquals(unknownSizeLongStream(a).sorted().findFirst(), OptionalLong.of(1));
- assertEquals(unknownSizeLongStream(a).sorted().findAny(), OptionalLong.of(1));
+ assertEquals(knownSize.apply(1).findFirst(), OptionalLong.of(1));
+ assertEquals(knownSize.apply(1).findAny(), OptionalLong.of(1));
+ assertEquals(unknownSize.apply(1).findFirst(), OptionalLong.of(1));
+ assertEquals(unknownSize.apply(1).findAny(), OptionalLong.of(1));
// Match
- assertEquals(Arrays.stream(a).sorted().anyMatch(i -> i == 2), true);
- assertEquals(Arrays.stream(a).sorted().noneMatch(i -> i == 2), false);
- assertEquals(Arrays.stream(a).sorted().allMatch(i -> i == 2), false);
- assertEquals(unknownSizeLongStream(a).sorted().anyMatch(i -> i == 2), true);
- assertEquals(unknownSizeLongStream(a).sorted().noneMatch(i -> i == 2), false);
- assertEquals(unknownSizeLongStream(a).sorted().allMatch(i -> i == 2), false);
+ assertEquals(knownSize.apply(2).anyMatch(i -> i == 2), true);
+ assertEquals(knownSize.apply(2).noneMatch(i -> i == 2), false);
+ assertEquals(knownSize.apply(2).allMatch(i -> i == 2), false);
+ assertEquals(unknownSize.apply(2).anyMatch(i -> i == 2), true);
+ assertEquals(unknownSize.apply(2).noneMatch(i -> i == 2), false);
+ assertEquals(unknownSize.apply(2).allMatch(i -> i == 2), false);
}
private LongStream unknownSizeLongStream(long[] a) {
@@ -285,19 +307,24 @@
public void testDoubleSequentialShortCircuitTerminal() {
double[] a = new double[]{5.0, 4.0, 3.0, 2.0, 1.0};
+ Function<Integer, DoubleStream> knownSize = i -> assertNCallsOnly(
+ Arrays.stream(a).sorted(), (s, c) -> s.peek(c::accept), i);
+ Function<Integer, DoubleStream> unknownSize = i -> assertNCallsOnly
+ (unknownSizeDoubleStream(a).sorted(), (s, c) -> s.peek(c::accept), i);
+
// Find
- assertEquals(Arrays.stream(a).sorted().findFirst(), OptionalDouble.of(1));
- assertEquals(Arrays.stream(a).sorted().findAny(), OptionalDouble.of(1));
- assertEquals(unknownSizeDoubleStream(a).sorted().findFirst(), OptionalDouble.of(1));
- assertEquals(unknownSizeDoubleStream(a).sorted().findAny(), OptionalDouble.of(1));
+ assertEquals(knownSize.apply(1).findFirst(), OptionalDouble.of(1));
+ assertEquals(knownSize.apply(1).findAny(), OptionalDouble.of(1));
+ assertEquals(unknownSize.apply(1).findFirst(), OptionalDouble.of(1));
+ assertEquals(unknownSize.apply(1).findAny(), OptionalDouble.of(1));
// Match
- assertEquals(Arrays.stream(a).sorted().anyMatch(i -> i == 2.0), true);
- assertEquals(Arrays.stream(a).sorted().noneMatch(i -> i == 2.0), false);
- assertEquals(Arrays.stream(a).sorted().allMatch(i -> i == 2.0), false);
- assertEquals(unknownSizeDoubleStream(a).sorted().anyMatch(i -> i == 2.0), true);
- assertEquals(unknownSizeDoubleStream(a).sorted().noneMatch(i -> i == 2.0), false);
- assertEquals(unknownSizeDoubleStream(a).sorted().allMatch(i -> i == 2.0), false);
+ assertEquals(knownSize.apply(2).anyMatch(i -> i == 2.0), true);
+ assertEquals(knownSize.apply(2).noneMatch(i -> i == 2.0), false);
+ assertEquals(knownSize.apply(2).allMatch(i -> i == 2.0), false);
+ assertEquals(unknownSize.apply(2).anyMatch(i -> i == 2.0), true);
+ assertEquals(unknownSize.apply(2).noneMatch(i -> i == 2.0), false);
+ assertEquals(unknownSize.apply(2).allMatch(i -> i == 2.0), false);
}
private DoubleStream unknownSizeDoubleStream(double[] a) {
@@ -321,4 +348,14 @@
assertSorted(result);
assertContentsUnordered(data, result);
}
+
+ /**
+ * Interpose a consumer that asserts it is called at most N times.
+ */
+ <T, S extends BaseStream<T, S>, R> S assertNCallsOnly(S s, BiFunction<S, Consumer<T>, S> pf, int n) {
+ AtomicInteger boxedInt = new AtomicInteger();
+ return pf.apply(s, i -> {
+ assertFalse(boxedInt.incrementAndGet() > n, "Intermediate op called more than " + n + " time(s)");
+ });
+ }
}
--- a/jdk/test/javax/management/monitor/CounterMonitorDeadlockTest.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/test/javax/management/monitor/CounterMonitorDeadlockTest.java Thu May 08 15:27:38 2014 -0700
@@ -98,13 +98,13 @@
monitorProxy.start();
final int initGetCount = observedProxy.getGetCount();
- int getCount = initGetCount;
- for (int i = 0; i < 500; i++) { // 500 * 10 = 5 seconds
- getCount = observedProxy.getGetCount();
- if (getCount != initGetCount)
- break;
- Thread.sleep(10);
- }
+ int getCount;
+ System.out.println("Checking GetCount, possible deadlock if timeout.");
+ do { // 8038322. Until timeout of testing harness
+ Thread.sleep(200);
+ } while ((getCount=observedProxy.getGetCount()) == initGetCount);
+ System.out.println("Done!");
+
if (getCount <= initGetCount)
throw new Exception("Test failed: presumable deadlock");
// This won't show up as a deadlock in CTRL-\ or in
@@ -131,10 +131,11 @@
};
mbs.addNotificationListener(monitorName, listener, null, null);
observedProxy.setThing(1000);
- for (int i = 0; i < 500 && notifCount.get() == 0; i++)
- Thread.sleep(10);
- if (notifCount.get() == 0)
- throw new Exception("Test failed: presumable deadlock");
+ System.out.println("Waiting notifCount.get() != 0, possible deadlock if timeout.");
+ do {
+ Thread.sleep(200);
+ } while(notifCount.get() == 0); // 8038322. Until timeout of testing harness
+ System.out.println("Done");
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/net/ssl/SSLEngine/IllegalRecordVersion.java Thu May 08 15:27:38 2014 -0700
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+
+// This test case relies on updated static security property, no way to re-use
+// security property in samevm/agentvm mode.
+
+/*
+ * @test
+ * @bug 8042449
+ * @summary Issue for negative byte major record version
+ *
+ * @run main/othervm IllegalRecordVersion
+ */
+
+import javax.net.ssl.*;
+import javax.net.ssl.SSLEngineResult.*;
+import java.io.*;
+import java.security.*;
+import java.nio.*;
+
+public class IllegalRecordVersion {
+
+ public static void main(String args[]) throws Exception {
+ SSLContext context = SSLContext.getDefault();
+
+ SSLEngine cliEngine = context.createSSLEngine();
+ cliEngine.setUseClientMode(true);
+ SSLEngine srvEngine = context.createSSLEngine();
+ srvEngine.setUseClientMode(false);
+
+ SSLSession session = cliEngine.getSession();
+ int netBufferMax = session.getPacketBufferSize();
+ int appBufferMax = session.getApplicationBufferSize();
+
+ ByteBuffer cliToSrv = ByteBuffer.allocateDirect(netBufferMax);
+ ByteBuffer srvIBuff = ByteBuffer.allocateDirect(appBufferMax + 50);
+ ByteBuffer cliOBuff = ByteBuffer.wrap("I'm client".getBytes());
+
+
+ System.out.println("client hello (record version(0xa9, 0xa2))");
+ SSLEngineResult cliRes = cliEngine.wrap(cliOBuff, cliToSrv);
+ System.out.println("Client wrap result: " + cliRes);
+ cliToSrv.flip();
+ if (cliToSrv.limit() > 5) {
+ cliToSrv.put(1, (byte)0xa9);
+ cliToSrv.put(2, (byte)0xa2);
+ }
+
+ try {
+ srvEngine.unwrap(cliToSrv, srvIBuff);
+ throw new Exception(
+ "Cannot catch the unsupported record version issue");
+ } catch (SSLException e) {
+ // get the expected exception
+ }
+ }
+}
--- a/jdk/test/javax/xml/crypto/dsig/GenerationTests.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/test/javax/xml/crypto/dsig/GenerationTests.java Thu May 08 15:27:38 2014 -0700
@@ -23,7 +23,7 @@
/**
* @test
- * @bug 4635230 6283345 6303830 6824440 6867348 7094155 8038184
+ * @bug 4635230 6283345 6303830 6824440 6867348 7094155 8038184 8038349
* @summary Basic unit tests for generating XML Signatures with JSR 105
* @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java
* X509KeySelector.java GenerationTests.java
@@ -80,9 +80,10 @@
private static KeyInfoFactory kifac;
private static DocumentBuilder db;
private static CanonicalizationMethod withoutComments;
- private static SignatureMethod dsaSha1, rsaSha1, rsaSha256, rsaSha384, rsaSha512;
+ private static SignatureMethod dsaSha1, dsaSha256, rsaSha1,
+ rsaSha256, rsaSha384, rsaSha512;
private static DigestMethod sha1, sha256, sha384, sha512;
- private static KeyInfo dsa, rsa, rsa1024;
+ private static KeyInfo dsa1024, dsa2048, rsa, rsa1024;
private static KeySelector kvks = new KeySelectors.KeyValueKeySelector();
private static KeySelector sks;
private static Key signingKey;
@@ -106,10 +107,13 @@
"http://www.w3.org/TR/xml-stylesheet";
private final static String STYLESHEET_B64 =
"http://www.w3.org/Signature/2002/04/xml-stylesheet.b64";
+ private final static String DSA_SHA256 =
+ "http://www.w3.org/2009/xmldsig11#dsa-sha256";
public static void main(String args[]) throws Exception {
setup();
- test_create_signature_enveloped_dsa();
+ test_create_signature_enveloped_dsa(1024);
+ test_create_signature_enveloped_dsa(2048);
test_create_signature_enveloping_b64_dsa();
test_create_signature_enveloping_dsa();
test_create_signature_enveloping_hmac_sha1_40();
@@ -157,15 +161,18 @@
withoutComments = fac.newCanonicalizationMethod
(CanonicalizationMethod.INCLUSIVE, (C14NMethodParameterSpec)null);
dsaSha1 = fac.newSignatureMethod(SignatureMethod.DSA_SHA1, null);
+ dsaSha256 = fac.newSignatureMethod(DSA_SHA256, null);
sha1 = fac.newDigestMethod(DigestMethod.SHA1, null);
sha256 = fac.newDigestMethod(DigestMethod.SHA256, null);
sha384 = fac.newDigestMethod
("http://www.w3.org/2001/04/xmldsig-more#sha384", null);
sha512 = fac.newDigestMethod(DigestMethod.SHA512, null);
- dsa = kifac.newKeyInfo(Collections.singletonList
+ dsa1024 = kifac.newKeyInfo(Collections.singletonList
(kifac.newKeyValue(validatingKey)));
+ dsa2048 = kifac.newKeyInfo(Collections.singletonList
+ (kifac.newKeyValue(getPublicKey("DSA", 2048))));
rsa = kifac.newKeyInfo(Collections.singletonList
- (kifac.newKeyValue(getPublicKey("RSA"))));
+ (kifac.newKeyValue(getPublicKey("RSA", 512))));
rsa1024 = kifac.newKeyInfo(Collections.singletonList
(kifac.newKeyValue(getPublicKey("RSA", 1024))));
rsaSha1 = fac.newSignatureMethod(SignatureMethod.RSA_SHA1, null);
@@ -180,11 +187,25 @@
httpUd = new HttpURIDereferencer();
}
- static void test_create_signature_enveloped_dsa() throws Exception {
- System.out.println("* Generating signature-enveloped-dsa.xml");
+ static void test_create_signature_enveloped_dsa(int size) throws Exception {
+ System.out.println("* Generating signature-enveloped-dsa-"
+ + size + ".xml");
+ SignatureMethod sm = null;
+ KeyInfo ki = null;
+ Key privKey;
+ if (size == 1024) {
+ sm = dsaSha1;
+ ki = dsa1024;
+ privKey = signingKey;
+ } else if (size == 2048) {
+ sm = dsaSha256;
+ ki = dsa2048;
+ privKey = getPrivateKey("DSA", 2048);
+ } else throw new RuntimeException("unsupported keysize:" + size);
+
// create SignedInfo
SignedInfo si = fac.newSignedInfo
- (withoutComments, dsaSha1, Collections.singletonList
+ (withoutComments, sm, Collections.singletonList
(fac.newReference
("", sha1, Collections.singletonList
(fac.newTransform(Transform.ENVELOPED,
@@ -192,7 +213,7 @@
null, null)));
// create XMLSignature
- XMLSignature sig = fac.newXMLSignature(si, dsa);
+ XMLSignature sig = fac.newXMLSignature(si, ki);
Document doc = db.newDocument();
Element envelope = doc.createElementNS
@@ -201,12 +222,12 @@
"xmlns", "http://example.org/envelope");
doc.appendChild(envelope);
- DOMSignContext dsc = new DOMSignContext(signingKey, envelope);
+ DOMSignContext dsc = new DOMSignContext(privKey, envelope);
sig.sign(dsc);
-// StringWriter sw = new StringWriter();
-// dumpDocument(doc, sw);
-// System.out.println(sw.toString());
+// StringWriter sw = new StringWriter();
+// dumpDocument(doc, sw);
+// System.out.println(sw.toString());
DOMValidateContext dvc = new DOMValidateContext
(kvks, envelope.getFirstChild());
@@ -226,21 +247,21 @@
static void test_create_signature_enveloping_b64_dsa() throws Exception {
System.out.println("* Generating signature-enveloping-b64-dsa.xml");
test_create_signature_enveloping
- (sha1, dsaSha1, dsa, signingKey, kvks, true);
+ (sha1, dsaSha1, dsa1024, signingKey, kvks, true);
System.out.println();
}
static void test_create_signature_enveloping_dsa() throws Exception {
System.out.println("* Generating signature-enveloping-dsa.xml");
test_create_signature_enveloping
- (sha1, dsaSha1, dsa, signingKey, kvks, false);
+ (sha1, dsaSha1, dsa1024, signingKey, kvks, false);
System.out.println();
}
static void test_create_signature_enveloping_sha256_dsa() throws Exception {
System.out.println("* Generating signature-enveloping-sha256-dsa.xml");
test_create_signature_enveloping
- (sha256, dsaSha1, dsa, signingKey, kvks, false);
+ (sha256, dsaSha1, dsa1024, signingKey, kvks, false);
System.out.println();
}
@@ -293,7 +314,7 @@
static void test_create_signature_enveloping_rsa() throws Exception {
System.out.println("* Generating signature-enveloping-rsa.xml");
test_create_signature_enveloping(sha1, rsaSha1, rsa,
- getPrivateKey("RSA"), kvks, false);
+ getPrivateKey("RSA", 512), kvks, false);
System.out.println();
}
@@ -301,7 +322,7 @@
throws Exception {
System.out.println("* Generating signature-enveloping-sha384-rsa_sha256.xml");
test_create_signature_enveloping(sha384, rsaSha256, rsa,
- getPrivateKey("RSA"), kvks, false);
+ getPrivateKey("RSA", 512), kvks, false);
System.out.println();
}
@@ -323,13 +344,13 @@
static void test_create_signature_external_b64_dsa() throws Exception {
System.out.println("* Generating signature-external-b64-dsa.xml");
- test_create_signature_external(dsaSha1, dsa, signingKey, kvks, true);
+ test_create_signature_external(dsaSha1, dsa1024, signingKey, kvks, true);
System.out.println();
}
static void test_create_signature_external_dsa() throws Exception {
System.out.println("* Generating signature-external-dsa.xml");
- test_create_signature_external(dsaSha1, dsa, signingKey, kvks, false);
+ test_create_signature_external(dsaSha1, dsa1024, signingKey, kvks, false);
System.out.println();
}
@@ -441,7 +462,7 @@
// create XMLSignature
XMLSignature sig = fac.newXMLSignature(si, rsa, objs, "signature", null);
- DOMSignContext dsc = new DOMSignContext(getPrivateKey("RSA"), doc);
+ DOMSignContext dsc = new DOMSignContext(getPrivateKey("RSA", 512), doc);
sig.sign(dsc);
@@ -487,7 +508,7 @@
XMLSignature sig = fac.newXMLSignature(si, rsa,
Collections.singletonList(obj),
"signature", null);
- DOMSignContext dsc = new DOMSignContext(getPrivateKey("RSA"), doc);
+ DOMSignContext dsc = new DOMSignContext(getPrivateKey("RSA", 512), doc);
dsc.setIdAttributeNS(nc, null, "Id");
sig.sign(dsc);
@@ -530,7 +551,7 @@
XMLSignature sig = fac.newXMLSignature(si, rsa,
Collections.singletonList(obj),
"signature", null);
- DOMSignContext dsc = new DOMSignContext(getPrivateKey("RSA"), doc);
+ DOMSignContext dsc = new DOMSignContext(getPrivateKey("RSA", 512), doc);
sig.sign(dsc);
}
@@ -1116,6 +1137,16 @@
"90670890367185141189796";
private static final String DSA_X =
"0527140396812450214498055937934275626078768840117";
+ private static final String DSA_2048_Y =
+ "15119007057343785981993995134621348945077524760182795513668325877793414638620983617627033248732235626178802906346261435991040697338468329634416089753032362617771631199351767336660070462291411472735835843440140283101463231807789628656218830720378705090795271104661936237385140354825159080766174663596286149653433914842868551355716015585570827642835307073681358328172009941968323702291677280809277843998510864653406122348712345584706761165794179850728091522094227603562280855104749858249588234915206290448353957550635709520273178475097150818955098638774564910092913714625772708285992586894795017709678223469405896699928";
+ private static final String DSA_2048_P =
+ "18111848663142005571178770624881214696591339256823507023544605891411707081617152319519180201250440615163700426054396403795303435564101919053459832890139496933938670005799610981765220283775567361483662648340339405220348871308593627647076689407931875483406244310337925809427432681864623551598136302441690546585427193224254314088256212718983105131138772434658820375111735710449331518776858786793875865418124429269409118756812841019074631004956409706877081612616347900606555802111224022921017725537417047242635829949739109274666495826205002104010355456981211025738812433088757102520562459649777989718122219159982614304359";
+ private static final String DSA_2048_Q =
+ "19689526866605154788513693571065914024068069442724893395618704484701";
+ private static final String DSA_2048_G =
+ "2859278237642201956931085611015389087970918161297522023542900348087718063098423976428252369340967506010054236052095950169272612831491902295835660747775572934757474194739347115870723217560530672532404847508798651915566434553729839971841903983916294692452760249019857108409189016993380919900231322610083060784269299257074905043636029708121288037909739559605347853174853410208334242027740275688698461842637641566056165699733710043802697192696426360843173620679214131951400148855611740858610821913573088059404459364892373027492936037789337011875710759208498486908611261954026964574111219599568903257472567764789616958430";
+ private static final String DSA_2048_X =
+ "14562787764977288900757387442281559936279834964901963465277698843172";
private static final String RSA_MOD =
"010800185049102889923150759252557522305032794699952150943573164381" +
"936603255999071981574575044810461362008102247767482738822150129277" +
@@ -1138,43 +1169,48 @@
"204903524890556839550490384015324575598723478554854070823335021842" +
"210112348400928769";
- private static PublicKey getPublicKey(String algo) throws Exception {
- return getPublicKey(algo, 512);
- }
-
private static PublicKey getPublicKey(String algo, int keysize)
throws Exception {
KeyFactory kf = KeyFactory.getInstance(algo);
KeySpec kspec;
if (algo.equalsIgnoreCase("DSA")) {
- kspec = new DSAPublicKeySpec(new BigInteger(DSA_Y),
- new BigInteger(DSA_P),
- new BigInteger(DSA_Q),
- new BigInteger(DSA_G));
+ if (keysize == 1024) {
+ kspec = new DSAPublicKeySpec(new BigInteger(DSA_Y),
+ new BigInteger(DSA_P),
+ new BigInteger(DSA_Q),
+ new BigInteger(DSA_G));
+ } else if (keysize == 2048) {
+ kspec = new DSAPublicKeySpec(new BigInteger(DSA_2048_Y),
+ new BigInteger(DSA_2048_P),
+ new BigInteger(DSA_2048_Q),
+ new BigInteger(DSA_2048_G));
+ } else throw new RuntimeException("Unsupported keysize:" + keysize);
} else if (algo.equalsIgnoreCase("RSA")) {
if (keysize == 512) {
kspec = new RSAPublicKeySpec(new BigInteger(RSA_MOD),
new BigInteger(RSA_PUB));
- } else {
+ } else if (keysize == 1024) {
kspec = new RSAPublicKeySpec(new BigInteger(RSA_1024_MOD),
new BigInteger(RSA_PUB));
- }
+ } else throw new RuntimeException("Unsupported keysize:" + keysize);
} else throw new RuntimeException("Unsupported key algorithm " + algo);
return kf.generatePublic(kspec);
}
- private static PrivateKey getPrivateKey(String algo) throws Exception {
- return getPrivateKey(algo, 512);
- }
-
private static PrivateKey getPrivateKey(String algo, int keysize)
throws Exception {
KeyFactory kf = KeyFactory.getInstance(algo);
KeySpec kspec;
if (algo.equalsIgnoreCase("DSA")) {
- kspec = new DSAPrivateKeySpec
- (new BigInteger(DSA_X), new BigInteger(DSA_P),
- new BigInteger(DSA_Q), new BigInteger(DSA_G));
+ if (keysize == 1024) {
+ kspec = new DSAPrivateKeySpec
+ (new BigInteger(DSA_X), new BigInteger(DSA_P),
+ new BigInteger(DSA_Q), new BigInteger(DSA_G));
+ } else if (keysize == 2048) {
+ kspec = new DSAPrivateKeySpec
+ (new BigInteger(DSA_2048_X), new BigInteger(DSA_2048_P),
+ new BigInteger(DSA_2048_Q), new BigInteger(DSA_2048_G));
+ } else throw new RuntimeException("Unsupported keysize:" + keysize);
} else if (algo.equalsIgnoreCase("RSA")) {
if (keysize == 512) {
kspec = new RSAPrivateKeySpec
--- a/jdk/test/javax/xml/crypto/dsig/KeySelectors.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/test/javax/xml/crypto/dsig/KeySelectors.java Thu May 08 15:27:38 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -175,7 +175,8 @@
//@@@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)) {
+ algURI.equals(SignatureMethod.DSA_SHA1) ||
+ algURI.equals("http://www.w3.org/2009/xmldsig11#dsa-sha256")) {
return true;
} else if (algName.equalsIgnoreCase("RSA") &&
(algURI.equals(SignatureMethod.RSA_SHA1) ||
--- a/jdk/test/sun/security/krb5/auto/ReplayCacheTestProc.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/test/sun/security/krb5/auto/ReplayCacheTestProc.java Thu May 08 15:27:38 2014 -0700
@@ -39,6 +39,8 @@
import java.nio.file.StandardOpenOption;
import java.security.MessageDigest;
import java.util.*;
+
+import com.sun.security.auth.module.UnixSystem;
import sun.security.jgss.GSSUtil;
import sun.security.krb5.internal.APReq;
import sun.security.krb5.internal.rcache.AuthTime;
@@ -59,7 +61,7 @@
System.getProperty("user.dir");
- private static int uid;
+ private static long uid;
public static void main0(String[] args) throws Exception {
System.setProperty("java.security.krb5.conf", OneKDC.KRB5_CONF);
@@ -78,11 +80,10 @@
}
try {
- Class<?> clazz = Class.forName(
- "com.sun.security.auth.module.UnixSystem");
- uid = (int)(long)(Long)
- clazz.getMethod("getUid").invoke(clazz.newInstance());
- } catch (Exception e) {
+ UnixSystem us = new com.sun.security.auth.module.UnixSystem();
+ uid = us.getUid();
+ } catch (Throwable e) {
+ // Cannot be only Exception, might be UnsatisfiedLinkError
uid = -1;
}
--- a/jdk/test/tools/launcher/FXLauncherTest.java Thu May 08 01:05:24 2014 -0700
+++ b/jdk/test/tools/launcher/FXLauncherTest.java Thu May 08 15:27:38 2014 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8001533 8004547
+ * @bug 8001533 8004547 8035782
* @summary Test launching FX application with java -jar
* Test uses main method and blank main method, a jfx app class and an incorrest
* jfx app class, a main-class for the manifest, a bogus one and none.
@@ -373,6 +373,11 @@
System.out.println(tr);
throw new Exception("jfxrt.jar is being loaded, it should not be!");
}
+ if (!tr.notContains("sun.launcher.LauncherHelper$FXHelper")) {
+ System.out.println("testing for extraneous 'sun.launcher.LauncherHelper$FXHelper'");
+ System.out.println(tr);
+ throw new Exception("FXHelper is being loaded, it should not be!");
+ }
for (String p : APP_PARMS) {
if (!tr.contains(p)) {
System.err.println("ERROR: Did not find "