--- a/jdk/src/java.base/share/classes/java/lang/ArrayIndexOutOfBoundsException.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/ArrayIndexOutOfBoundsException.java Fri Oct 09 10:22:53 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,42 +26,58 @@
package java.lang;
/**
- * Thrown to indicate that an array has been accessed with an
- * illegal index. The index is either negative or greater than or
- * equal to the size of the array.
+ * Thrown to indicate that an array has been accessed with an illegal index. The
+ * index is either negative or greater than or equal to the size of the array.
*
- * @author unascribed
- * @since 1.0
+ * @since 1.0
*/
-public
-class ArrayIndexOutOfBoundsException extends IndexOutOfBoundsException {
+public class ArrayIndexOutOfBoundsException extends IndexOutOfBoundsException {
private static final long serialVersionUID = -5116101128118950844L;
/**
- * Constructs an <code>ArrayIndexOutOfBoundsException</code> with no
- * detail message.
+ * Constructs an {@code ArrayIndexOutOfBoundsException} with no detail
+ * message.
*/
public ArrayIndexOutOfBoundsException() {
super();
}
/**
- * Constructs a new <code>ArrayIndexOutOfBoundsException</code>
- * class with an argument indicating the illegal index.
+ * Constructs an {@code ArrayIndexOutOfBoundsException} class with the
+ * specified detail message.
*
- * @param index the illegal index.
+ * @param s the detail message.
+ */
+ public ArrayIndexOutOfBoundsException(String s) {
+ super(s);
+ }
+
+ /**
+ * Constructs a new {@code ArrayIndexOutOfBoundsException} class with an
+ * argument indicating the illegal index.
+ *
+ * <p>The index is included in this exception's detail message. The
+ * exact presentation format of the detail message is unspecified.
+ *
+ * @param index the illegal index.
*/
public ArrayIndexOutOfBoundsException(int index) {
super("Array index out of range: " + index);
}
/**
- * Constructs an <code>ArrayIndexOutOfBoundsException</code> class
- * with the specified detail message.
+ * Constructs a new {@code ArrayIndexOutOfBoundsException} class with
+ * arguments indicating two out of bound values.
+ *
+ * <p>The out of bound values are included in this exception's detail
+ * message. The exact presentation format of the detail message is
+ * unspecified.
*
- * @param s the detail message.
+ * @param a the first out of bound value.
+ * @param b the second out of bound value.
+ * @since 9
*/
- public ArrayIndexOutOfBoundsException(String s) {
- super(s);
+ public ArrayIndexOutOfBoundsException(int a, int b) {
+ super("Array indexed access out of bounds: " + a + ", " + b);
}
}
--- a/jdk/src/java.base/share/classes/java/lang/FdLibm.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/FdLibm.java Fri Oct 09 10:22:53 2015 -0700
@@ -182,7 +182,7 @@
}
int k = 0;
- if (a > 0x1.0p500) { // a > 2**500
+ if (a > 0x1.00000_ffff_ffffp500) { // a > ~2**500
// scale a and b by 2**-600
ha -= 0x25800000;
hb -= 0x25800000;
--- a/jdk/src/java.base/share/classes/java/lang/IndexOutOfBoundsException.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/IndexOutOfBoundsException.java Fri Oct 09 10:22:53 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,28 +31,57 @@
* <p>
* Applications can subclass this class to indicate similar exceptions.
*
- * @author Frank Yellin
- * @since 1.0
+ * @author Frank Yellin
+ * @since 1.0
*/
-public
-class IndexOutOfBoundsException extends RuntimeException {
+public class IndexOutOfBoundsException extends RuntimeException {
private static final long serialVersionUID = 234122996006267687L;
/**
- * Constructs an <code>IndexOutOfBoundsException</code> with no
- * detail message.
+ * Constructs an {@code IndexOutOfBoundsException} with no detail message.
*/
public IndexOutOfBoundsException() {
super();
}
/**
- * Constructs an <code>IndexOutOfBoundsException</code> with the
- * specified detail message.
+ * Constructs an {@code IndexOutOfBoundsException} with the specified detail
+ * message.
*
- * @param s the detail message.
+ * @param s the detail message
*/
public IndexOutOfBoundsException(String s) {
super(s);
}
+
+ /**
+ * Constructs a new {@code IndexOutOfBoundsException} class with an
+ * argument indicating the illegal index.
+ *
+ * <p>The index is included in this exception's detail message. The
+ * exact presentation format of the detail message is unspecified.
+ *
+ * @param index the illegal index.
+ * @since 9
+ */
+ public IndexOutOfBoundsException(int index) {
+ super("Index out of range: " + index);
+ }
+
+ /**
+ * Constructs an {@code IndexOutOfBoundsException} with arguments indicating
+ * two out of bound values.
+ *
+ * <p>The out of bound values are included in this exception's detail
+ * message. The exact presentation format of the detail message is
+ * unspecified.
+ *
+ * @param a the first out of bound value
+ * @param b the second out of bound value
+ * @since 9
+ */
+ public IndexOutOfBoundsException(int a, int b) {
+ super("Indexed access out of bounds: " + a + ", " + b);
+ }
+
}
--- a/jdk/src/java.base/share/classes/java/lang/StringIndexOutOfBoundsException.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/StringIndexOutOfBoundsException.java Fri Oct 09 10:22:53 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,44 +26,61 @@
package java.lang;
/**
- * Thrown by {@code String} methods to indicate that an index
- * is either negative or greater than the size of the string. For
- * some methods such as the charAt method, this exception also is
- * thrown when the index is equal to the size of the string.
+ * Thrown by {@code String} methods to indicate that an index is either negative
+ * or greater than the size of the string. For some methods such as the
+ * {@link String#charAt charAt} method, this exception also is thrown when the
+ * index is equal to the size of the string.
*
- * @author unascribed
- * @see java.lang.String#charAt(int)
- * @since 1.0
+ * @see java.lang.String#charAt(int)
+ * @since 1.0
*/
-public
-class StringIndexOutOfBoundsException extends IndexOutOfBoundsException {
+public class StringIndexOutOfBoundsException extends IndexOutOfBoundsException {
private static final long serialVersionUID = -6762910422159637258L;
/**
- * Constructs a {@code StringIndexOutOfBoundsException} with no
- * detail message.
+ * Constructs a {@code StringIndexOutOfBoundsException} with no detail
+ * message.
*/
public StringIndexOutOfBoundsException() {
super();
}
/**
- * Constructs a {@code StringIndexOutOfBoundsException} with
- * the specified detail message.
+ * Constructs a {@code StringIndexOutOfBoundsException} with the specified
+ * detail message.
*
- * @param s the detail message.
+ * @param s the detail message.
*/
public StringIndexOutOfBoundsException(String s) {
super(s);
}
/**
- * Constructs a new {@code StringIndexOutOfBoundsException}
- * class with an argument indicating the illegal index.
+ * Constructs a new {@code StringIndexOutOfBoundsException} class with an
+ * argument indicating the illegal index.
*
- * @param index the illegal index.
+ * <p>The index is included in this exception's detail message. The
+ * exact presentation format of the detail message is unspecified.
+ *
+ * @param index the illegal index.
*/
public StringIndexOutOfBoundsException(int index) {
super("String index out of range: " + index);
}
+
+ /**
+ * Constructs a new {@code StringIndexOutOfBoundsException} class with
+ * arguments indicating two out of bound values.
+ *
+ * <p>The out of bound values are included in this exception's detail
+ * message. The exact presentation format of the detail message is
+ * unspecified.
+ *
+ * @param a the first out of bound value.
+ * @param b the second out of bound value.
+ * @since 9
+ */
+ public StringIndexOutOfBoundsException(int a, int b) {
+ super("String indexed access out of bounds: " + a + ", " + b);
+ }
}
--- a/jdk/src/java.base/share/classes/java/security/AuthProvider.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/security/AuthProvider.java Fri Oct 09 10:22:53 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -79,8 +79,10 @@
* this provider to obtain authentication information
* from the caller, which may be {@code null}
*
- * @exception LoginException if the login operation fails
- * @exception SecurityException if the caller does not pass a
+ * @throws IllegalStateException if the provider requires configuration
+ * and {@link configure} has not been called
+ * @throws LoginException if the login operation fails
+ * @throws SecurityException if the caller does not pass a
* security check for
* {@code SecurityPermission("authProvider.name")},
* where {@code name} is the value returned by
@@ -92,8 +94,10 @@
/**
* Log out from this provider.
*
- * @exception LoginException if the logout operation fails
- * @exception SecurityException if the caller does not pass a
+ * @throws IllegalStateException if the provider requires configuration
+ * and {@link configure} has not been called
+ * @throws LoginException if the logout operation fails
+ * @throws SecurityException if the caller does not pass a
* security check for
* {@code SecurityPermission("authProvider.name")},
* where {@code name} is the value returned by
@@ -118,7 +122,9 @@
* @param handler a {@code CallbackHandler} for obtaining
* authentication information, which may be {@code null}
*
- * @exception SecurityException if the caller does not pass a
+ * @throws IllegalStateException if the provider requires configuration
+ * and {@link configure} has not been called
+ * @throws SecurityException if the caller does not pass a
* security check for
* {@code SecurityPermission("authProvider.name")},
* where {@code name} is the value returned by
--- a/jdk/src/java.base/share/classes/java/security/Provider.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/security/Provider.java Fri Oct 09 10:22:53 2015 -0700
@@ -187,13 +187,30 @@
* is invalid.
* @return a provider configured with the supplied configuration argument.
*
- * @since 1.9
+ * @since 9
*/
public Provider configure(String configArg) {
throw new UnsupportedOperationException("configure is not supported");
}
/**
+ * Check if this provider instance has been configured.
+ *
+ * @implSpec
+ * The default implementation returns true.
+ * Subclasses should override this method if the provider instance requires
+ * an explicit {@code configure} call after being constructed.
+ *
+ * @return true if no further configuration is needed, false otherwise.
+ *
+ * @since 9
+ */
+ public boolean isConfigured() {
+ return true;
+ }
+
+
+ /**
* Returns the name of this provider.
*
* @return the name of this provider.
--- a/jdk/src/java.base/share/classes/java/security/SecurityPermission.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/security/SecurityPermission.java Fri Oct 09 10:22:53 2015 -0700
@@ -53,6 +53,17 @@
* </tr>
*
* <tr>
+ * <td>authProvider.{provider name}</td>
+ * <td>Allow the named provider to be an AuthProvider for login and
+ * logout operations. </td>
+ * <td>This allows the named provider to perform login and logout
+ * operations. The named provider must extend {@code AuthProvider}
+ * and care must be taken to grant to a trusted provider since
+ * login operations involve sensitive authentication information
+ * such as PINs and passwords. </td>
+ * </tr>
+ *
+ * <tr>
* <td>createAccessControlContext</td>
* <td>Creation of an AccessControlContext</td>
* <td>This allows someone to instantiate an AccessControlContext
--- a/jdk/src/java.base/share/classes/java/util/Currency.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/Currency.java Fri Oct 09 10:22:53 2015 -0700
@@ -371,8 +371,8 @@
* instance is needed
* @return the <code>Currency</code> instance for the country of the given
* locale, or {@code null}
- * @exception NullPointerException if <code>locale</code> or its country
- * code is {@code null}
+ * @exception NullPointerException if <code>locale</code>
+ * is {@code null}
* @exception IllegalArgumentException if the country of the given {@code locale}
* is not a supported ISO 3166 country code.
*/
--- a/jdk/src/java.base/share/classes/java/util/Objects.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/Objects.java Fri Oct 09 10:22:53 2015 -0700
@@ -25,13 +25,29 @@
package java.util;
+import java.util.function.BiFunction;
import java.util.function.Supplier;
/**
* This class consists of {@code static} utility methods for operating
- * on objects. These utilities include {@code null}-safe or {@code
- * null}-tolerant methods for computing the hash code of an object,
- * returning a string for an object, and comparing two objects.
+ * on objects, or checking certain conditions before operation. These utilities
+ * include {@code null}-safe or {@code null}-tolerant methods for computing the
+ * hash code of an object, returning a string for an object, comparing two
+ * objects, and checking if indexes or sub-range values are out of bounds.
+ *
+ * @apiNote
+ * Static methods such as {@link Objects#checkIndex},
+ * {@link Objects#checkFromToIndex}, and {@link Objects#checkFromIndexSize} are
+ * provided for the convenience of checking if values corresponding to indexes
+ * and sub-ranges are out of bounds.
+ * Variations of these static methods support customization of the runtime
+ * exception, and corresponding exception detail message, that is thrown when
+ * values are out of bounds. Such methods accept a functional interface
+ * argument, instances of {@code BiFunction}, that maps out of bound values to a
+ * runtime exception. Care should be taken when using such methods in
+ * combination with an argument that is a lambda expression, method reference or
+ * class that capture values. In such cases the cost of capture, related to
+ * functional interface allocation, may exceed the cost of checking bounds.
*
* @since 1.7
*/
@@ -290,4 +306,230 @@
throw new NullPointerException(messageSupplier.get());
return obj;
}
+
+ /**
+ * Maps out of bounds values to a runtime exception.
+ *
+ * @param a the first out of bound value
+ * @param b the second out of bound value
+ * @param oobe the exception mapping function that when applied with out of
+ * bounds arguments returns a runtime exception. If {@code null}
+ * then, it's as if an exception mapping function was supplied that
+ * returns {@link IndexOutOfBoundsException} for any given arguments.
+ * @return the runtime exception
+ */
+ private static RuntimeException outOfBounds(
+ int a, int b, BiFunction<Integer, Integer, ? extends RuntimeException> oobe) {
+ return oobe == null
+ ? new IndexOutOfBoundsException(a, b)
+ : oobe.apply(a, b);
+ }
+
+ /**
+ * Checks if the {@code index} is within the bounds of the range from
+ * {@code 0} (inclusive) to {@code length} (exclusive).
+ *
+ * <p>The {@code index} is defined to be out of bounds if any of the
+ * following inequalities is true:
+ * <ul>
+ * <li>{@code index < 0}</li>
+ * <li>{@code index >= length}</li>
+ * <li>{@code length < 0}, which is implied from the former inequalities</li>
+ * </ul>
+ *
+ * @param index the index
+ * @param length the upper-bound (exclusive) of the range
+ * @return {@code index} if it is within bounds of the range
+ * @throws IndexOutOfBoundsException if the {@code index} is out of bounds
+ * @since 9
+ */
+ public static
+ int checkIndex(int index, int length) throws IndexOutOfBoundsException {
+ return checkIndex(index, length, null);
+ }
+
+ /**
+ * Checks if the {@code index} is within the bounds of the range from
+ * {@code 0} (inclusive) to {@code length} (exclusive).
+ *
+ * <p>The {@code index} is defined to be out of bounds if any of the
+ * following inequalities is true:
+ * <ul>
+ * <li>{@code index < 0}</li>
+ * <li>{@code index >= length}</li>
+ * <li>{@code length < 0}, which is implied from the former inequalities</li>
+ * </ul>
+ *
+ * <p>If the {@code index} is out of bounds, then a runtime exception is
+ * thrown that is the result of applying the arguments {@code index} and
+ * {@code length} to the given exception mapping function.
+ *
+ * @param <T> the type of runtime exception to throw if the arguments are
+ * out of bounds
+ * @param index the index
+ * @param length the upper-bound (exclusive) of the range
+ * @param oobe the exception mapping function that when applied with out
+ * of bounds arguments returns a runtime exception. If {@code null}
+ * then, it's as if an exception mapping function was supplied that
+ * returns {@link IndexOutOfBoundsException} for any given arguments.
+ * @return {@code index} if it is within bounds of the range
+ * @throws T if the {@code index} is out of bounds, then a runtime exception
+ * is thrown that is the result of applying the out of bounds
+ * arguments to the exception mapping function.
+ * @throws IndexOutOfBoundsException if the {@code index} is out of bounds
+ * and the exception mapping function is {@code null}
+ * @since 9
+ */
+ /*
+ @HotSpotIntrinsicCandidate
+ This method will be made intrinsic in C2 to guide HotSpot to perform
+ unsigned comparisons of the index and length when it is known the length is
+ a non-negative value (such as that of an array length or from the upper
+ bound of a loop)
+ */
+ public static <T extends RuntimeException>
+ int checkIndex(int index, int length,
+ BiFunction<Integer, Integer, T> oobe) throws T, IndexOutOfBoundsException {
+ if (index < 0 || index >= length)
+ throw outOfBounds(index, length, oobe);
+ return index;
+ }
+
+ /**
+ * Checks if the sub-range from {@code fromIndex} (inclusive) to
+ * {@code toIndex} (exclusive) is within the bounds of range from {@code 0}
+ * (inclusive) to {@code length} (exclusive).
+ *
+ * <p>The sub-range is defined to be out of bounds if any of the following
+ * inequalities is true:
+ * <ul>
+ * <li>{@code fromIndex < 0}</li>
+ * <li>{@code fromIndex > toIndex}</li>
+ * <li>{@code toIndex > length}</li>
+ * <li>{@code length < 0}, which is implied from the former inequalities</li>
+ * </ul>
+ *
+ * @param fromIndex the lower-bound (inclusive) of the sub-range
+ * @param toIndex the upper-bound (exclusive) of the sub-range
+ * @param length the upper-bound (exclusive) the range
+ * @return {@code fromIndex} if the sub-range within bounds of the range
+ * @throws IndexOutOfBoundsException if the sub-range is out of bounds
+ * @since 9
+ */
+ public static
+ int checkFromToIndex(int fromIndex, int toIndex, int length) throws IndexOutOfBoundsException {
+ return checkFromToIndex(fromIndex, toIndex, length, null);
+ }
+
+ /**
+ * Checks if the sub-range from {@code fromIndex} (inclusive) to
+ * {@code toIndex} (exclusive) is within the bounds of range from {@code 0}
+ * (inclusive) to {@code length} (exclusive).
+ *
+ * <p>The sub-range is defined to be out of bounds if any of the following
+ * inequalities is true:
+ * <ul>
+ * <li>{@code fromIndex < 0}</li>
+ * <li>{@code fromIndex > toIndex}</li>
+ * <li>{@code toIndex > length}</li>
+ * <li>{@code length < 0}, which is implied from the former inequalities</li>
+ * </ul>
+ *
+ * <p>If the sub-range is out of bounds, then a runtime exception is thrown
+ * that is the result of applying the arguments {@code fromIndex} and
+ * {@code toIndex} to the given exception mapping function.
+ *
+ * @param <T> the type of runtime exception to throw if the arguments are
+ * out of bounds
+ * @param fromIndex the lower-bound (inclusive) of the sub-range
+ * @param toIndex the upper-bound (exclusive) of the sub-range
+ * @param length the upper-bound (exclusive) the range
+ * @param oobe the exception mapping function that when applied with out
+ * of bounds arguments returns a runtime exception. If {@code null}
+ * then, it's as if an exception mapping function was supplied that
+ * returns {@link IndexOutOfBoundsException} for any given arguments.
+ * @return {@code fromIndex} if the sub-range within bounds of the range
+ * @throws T if the sub-range is out of bounds, then a runtime exception is
+ * thrown that is the result of applying the out of bounds arguments
+ * to the exception mapping function.
+ * @throws IndexOutOfBoundsException if the sub-range is out of bounds and
+ * the exception mapping function is {@code null}
+ * @since 9
+ */
+ public static <T extends RuntimeException>
+ int checkFromToIndex(int fromIndex, int toIndex, int length,
+ BiFunction<Integer, Integer, T> oobe) throws T, IndexOutOfBoundsException {
+ if (fromIndex < 0 || fromIndex > toIndex || toIndex > length)
+ throw outOfBounds(fromIndex, toIndex, oobe);
+ return fromIndex;
+ }
+
+ /**
+ * Checks if the sub-range from {@code fromIndex} (inclusive) to
+ * {@code fromIndex + size} (exclusive) is within the bounds of range from
+ * {@code 0} (inclusive) to {@code length} (exclusive).
+ *
+ * <p>The sub-range is defined to be out of bounds if any of the following
+ * inequalities is true:
+ * <ul>
+ * <li>{@code fromIndex < 0}</li>
+ * <li>{@code size < 0}</li>
+ * <li>{@code fromIndex + size > length}, taking into account integer overflow</li>
+ * <li>{@code length < 0}, which is implied from the former inequalities</li>
+ * </ul>
+ *
+ * @param fromIndex the lower-bound (inclusive) of the sub-interval
+ * @param size the size of the sub-range
+ * @param length the upper-bound (exclusive) of the range
+ * @return {@code fromIndex} if the sub-range within bounds of the range
+ * @throws IndexOutOfBoundsException if the sub-range is out of bounds
+ * @since 9
+ */
+ public static
+ int checkFromIndexSize(int fromIndex, int size, int length) throws IndexOutOfBoundsException {
+ return checkFromIndexSize(fromIndex, size, length, null);
+ }
+
+ /**
+ * Checks if the sub-range from {@code fromIndex} (inclusive) to
+ * {@code fromIndex + size} (exclusive) is within the bounds of range from
+ * {@code 0} (inclusive) to {@code length} (exclusive).
+ *
+ * <p>The sub-range is defined to be out of bounds if any of the following
+ * inequalities is true:
+ * <ul>
+ * <li>{@code fromIndex < 0}</li>
+ * <li>{@code size < 0}</li>
+ * <li>{@code fromIndex + size > length}, taking into account integer overflow</li>
+ * <li>{@code length < 0}, which is implied from the former inequalities</li>
+ * </ul>
+ *
+ * <p>If the sub-range is out of bounds then, a runtime exception is thrown
+ * that is the result of applying the arguments {@code fromIndex} and
+ * {@code size} to the given exception mapping function.
+ *
+ * @param <T> the type of runtime exception to throw if the arguments are
+ * out of bounds
+ * @param fromIndex the lower-bound (inclusive) of the sub-interval
+ * @param size the size of the sub-range
+ * @param length the upper-bound (exclusive) of the range
+ * @param oobe the exception mapping function that when applied with out
+ * of bounds arguments returns a runtime exception. If {@code null}
+ * then, it's as if an exception mapping function was supplied that
+ * returns {@link IndexOutOfBoundsException} for any given arguments.
+ * @return {@code fromIndex} if the sub-range within bounds of the range
+ * @throws T if the sub-range is out of bounds, then a runtime exception is
+ * thrown that is the result of applying the out of bounds arguments
+ * to the exception mapping function.
+ * @throws IndexOutOfBoundsException if the sub-range is out of bounds and
+ * the exception mapping function is {@code null}
+ * @since 9
+ */
+ public static <T extends RuntimeException>
+ int checkFromIndexSize(int fromIndex, int size, int length,
+ BiFunction<Integer, Integer, T> oobe) throws T, IndexOutOfBoundsException {
+ if ((length | fromIndex | size) < 0 || size > length - fromIndex)
+ throw outOfBounds(fromIndex, size, oobe);
+ return fromIndex;
+ }
}
--- a/jdk/src/java.base/share/classes/java/util/jar/JarFile.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/jar/JarFile.java Fri Oct 09 10:22:53 2015 -0700
@@ -37,7 +37,6 @@
import java.security.AccessController;
import java.security.CodeSource;
import jdk.internal.misc.SharedSecrets;
-import sun.misc.IOUtils;
import sun.security.action.GetPropertyAction;
import sun.security.util.ManifestEntryVerifier;
import sun.security.util.SignatureFileVerifier;
@@ -438,7 +437,12 @@
*/
private byte[] getBytes(ZipEntry ze) throws IOException {
try (InputStream is = super.getInputStream(ze)) {
- return IOUtils.readFully(is, (int)ze.getSize(), true);
+ int len = (int)ze.getSize();
+ byte[] b = is.readAllBytes();
+ if (len != -1 && b.length != len)
+ throw new EOFException("Expected:" + len + ", read:" + b.length);
+
+ return b;
}
}
--- a/jdk/src/java.base/share/classes/sun/invoke/anon/AnonymousClassLoader.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/invoke/anon/AnonymousClassLoader.java Fri Oct 09 10:22:53 2015 -0700
@@ -25,10 +25,10 @@
package sun.invoke.anon;
+import java.io.EOFException;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import sun.misc.IOUtils;
/**
* Anonymous class loader. Will load any valid classfile, producing
@@ -225,6 +225,10 @@
if (contentLength < 0)
throw new IOException("invalid content length "+contentLength);
- return IOUtils.readFully(connection.getInputStream(), contentLength, true);
+ byte[] b = connection.getInputStream().readAllBytes();
+ if (b.length != contentLength)
+ throw new EOFException("Expected:" + contentLength + ", read:" + b.length);
+
+ return b;
}
}
--- a/jdk/src/java.base/share/classes/sun/misc/IOUtils.java Thu Oct 08 22:30:42 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2009, 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.
- */
-
-/**
- * IOUtils: A collection of IO-related public static methods.
- */
-
-package sun.misc;
-
-import java.io.EOFException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Arrays;
-
-public class IOUtils {
-
- /**
- * Read up to <code>length</code> of bytes from <code>in</code>
- * until EOF is detected.
- * @param is input stream, must not be null
- * @param length number of bytes to read, -1 or Integer.MAX_VALUE means
- * read as much as possible
- * @param readAll if true, an EOFException will be thrown if not enough
- * bytes are read. Ignored when length is -1 or Integer.MAX_VALUE
- * @return bytes read
- * @throws IOException Any IO error or a premature EOF is detected
- */
- public static byte[] readFully(InputStream is, int length, boolean readAll)
- throws IOException {
- byte[] output = {};
- if (length == -1) length = Integer.MAX_VALUE;
- int pos = 0;
- while (pos < length) {
- int bytesToRead;
- if (pos >= output.length) { // Only expand when there's no room
- bytesToRead = Math.min(length - pos, output.length + 1024);
- if (output.length < pos + bytesToRead) {
- output = Arrays.copyOf(output, pos + bytesToRead);
- }
- } else {
- bytesToRead = output.length - pos;
- }
- int cc = is.read(output, pos, bytesToRead);
- if (cc < 0) {
- if (readAll && length != Integer.MAX_VALUE) {
- throw new EOFException("Detect premature EOF");
- } else {
- if (output.length != pos) {
- output = Arrays.copyOf(output, pos);
- }
- break;
- }
- }
- pos += cc;
- }
- return output;
- }
-}
--- a/jdk/src/java.base/share/classes/sun/reflect/misc/MethodUtil.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/reflect/misc/MethodUtil.java Fri Oct 09 10:22:53 2015 -0700
@@ -25,6 +25,7 @@
package sun.reflect.misc;
+import java.io.EOFException;
import java.security.AllPermission;
import java.security.AccessController;
import java.security.PermissionCollection;
@@ -43,7 +44,6 @@
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
-import sun.misc.IOUtils;
class Trampoline {
@@ -368,15 +368,12 @@
}
}
int len = uc.getContentLength();
- InputStream in = new BufferedInputStream(uc.getInputStream());
-
- byte[] b;
- try {
- b = IOUtils.readFully(in, len, true);
- } finally {
- in.close();
+ try (InputStream in = new BufferedInputStream(uc.getInputStream())) {
+ byte[] b = in.readAllBytes();
+ if (len != -1 && b.length != len)
+ throw new EOFException("Expected:" + len + ", read:" + b.length);
+ return b;
}
- return b;
}
--- a/jdk/src/java.base/share/classes/sun/security/provider/DomainKeyStore.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/provider/DomainKeyStore.java Fri Oct 09 10:22:53 2015 -0700
@@ -33,7 +33,6 @@
import java.security.cert.CertificateException;
import java.util.*;
-import sun.misc.IOUtils;
import sun.security.pkcs.EncryptedPrivateKeyInfo;
import sun.security.util.PolicyUtil;
--- a/jdk/src/java.base/share/classes/sun/security/provider/JavaKeyStore.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/provider/JavaKeyStore.java Fri Oct 09 10:22:53 2015 -0700
@@ -32,9 +32,9 @@
import java.security.cert.CertificateException;
import java.util.*;
-import sun.misc.IOUtils;
import sun.security.pkcs.EncryptedPrivateKeyInfo;
import sun.security.pkcs12.PKCS12KeyStore;
+import sun.security.util.IOUtils;
import sun.security.util.KeyStoreDelegator;
/**
--- a/jdk/src/java.base/share/classes/sun/security/timestamp/HttpTimestamper.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/timestamp/HttpTimestamper.java Fri Oct 09 10:22:53 2015 -0700
@@ -27,13 +27,13 @@
import java.io.BufferedInputStream;
import java.io.DataOutputStream;
+import java.io.EOFException;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.net.HttpURLConnection;
import java.util.*;
-import sun.misc.IOUtils;
import sun.security.util.Debug;
/**
@@ -147,8 +147,11 @@
}
verifyMimeType(connection.getContentType());
- int contentLength = connection.getContentLength();
- replyBuffer = IOUtils.readFully(input, contentLength, false);
+ int clen = connection.getContentLength();
+ replyBuffer = input.readAllBytes();
+ if (clen != -1 && replyBuffer.length != clen)
+ throw new EOFException("Expected:" + clen +
+ ", read:" + replyBuffer.length);
if (debug != null) {
debug.println("received timestamp response (length=" +
--- a/jdk/src/java.base/share/classes/sun/security/util/DerValue.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/util/DerValue.java Fri Oct 09 10:22:53 2015 -0700
@@ -28,7 +28,6 @@
import java.io.*;
import java.math.BigInteger;
import java.util.Date;
-import sun.misc.IOUtils;
/**
* Represents a single DER-encoded value. DER encoding rules are a subset
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/sun/security/util/IOUtils.java Fri Oct 09 10:22:53 2015 -0700
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2009, 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.
+ */
+
+/**
+ * IOUtils: A collection of IO-related public static methods.
+ */
+
+package sun.security.util;
+
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+
+public class IOUtils {
+
+ /**
+ * Read up to <code>length</code> of bytes from <code>in</code>
+ * until EOF is detected.
+ * @param is input stream, must not be null
+ * @param length number of bytes to read, -1 or Integer.MAX_VALUE means
+ * read as much as possible
+ * @param readAll if true, an EOFException will be thrown if not enough
+ * bytes are read. Ignored when length is -1 or Integer.MAX_VALUE
+ * @return bytes read
+ * @throws IOException Any IO error or a premature EOF is detected
+ */
+ public static byte[] readFully(InputStream is, int length, boolean readAll)
+ throws IOException {
+ byte[] output = {};
+ if (length == -1) length = Integer.MAX_VALUE;
+ int pos = 0;
+ while (pos < length) {
+ int bytesToRead;
+ if (pos >= output.length) { // Only expand when there's no room
+ bytesToRead = Math.min(length - pos, output.length + 1024);
+ if (output.length < pos + bytesToRead) {
+ output = Arrays.copyOf(output, pos + bytesToRead);
+ }
+ } else {
+ bytesToRead = output.length - pos;
+ }
+ int cc = is.read(output, pos, bytesToRead);
+ if (cc < 0) {
+ if (readAll && length != Integer.MAX_VALUE) {
+ throw new EOFException("Detect premature EOF");
+ } else {
+ if (output.length != pos) {
+ output = Arrays.copyOf(output, pos);
+ }
+ break;
+ }
+ }
+ pos += cc;
+ }
+ return output;
+ }
+}
--- a/jdk/src/java.desktop/share/classes/sun/applet/AppletClassLoader.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletClassLoader.java Fri Oct 09 10:22:53 2015 -0700
@@ -33,6 +33,7 @@
import java.net.MalformedURLException;
import java.net.InetAddress;
import java.net.UnknownHostException;
+import java.io.EOFException;
import java.io.File;
import java.io.FilePermission;
import java.io.IOException;
@@ -51,7 +52,6 @@
import java.security.PermissionCollection;
import sun.awt.AppContext;
import sun.awt.SunToolkit;
-import sun.misc.IOUtils;
import sun.misc.ManagedLocalsThread;
import sun.net.www.ParseUtil;
import sun.security.util.SecurityConstants;
@@ -334,7 +334,9 @@
byte[] b;
try {
- b = IOUtils.readFully(in, len, true);
+ b = in.readAllBytes();
+ if (len != -1 && b.length != len)
+ throw new EOFException("Expected:" + len + ", read:" + b.length);
} finally {
in.close();
}
--- a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java Fri Oct 09 10:22:53 2015 -0700
@@ -45,7 +45,6 @@
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
-import sun.misc.IOUtils;
import javax.net.SocketFactory;
/**
@@ -862,7 +861,7 @@
}
// read in seqlen bytes
- byte[] left = IOUtils.readFully(in, seqlen, false);
+ byte[] left = readFully(in, seqlen);
inbuf = Arrays.copyOf(inbuf, offset + left.length);
System.arraycopy(left, 0, inbuf, offset, left.length);
offset += left.length;
@@ -957,6 +956,31 @@
}
}
+ private static byte[] readFully(InputStream is, int length)
+ throws IOException
+ {
+ byte[] buf = new byte[Math.min(length, 8192)];
+ int nread = 0;
+ while (nread < length) {
+ int bytesToRead;
+ if (nread >= buf.length) { // need to allocate a larger buffer
+ bytesToRead = Math.min(length - nread, buf.length + 8192);
+ if (buf.length < nread + bytesToRead) {
+ buf = Arrays.copyOf(buf, nread + bytesToRead);
+ }
+ } else {
+ bytesToRead = buf.length - nread;
+ }
+ int count = is.read(buf, nread, bytesToRead);
+ if (count < 0) {
+ if (buf.length != nread)
+ buf = Arrays.copyOf(buf, nread);
+ break;
+ }
+ nread += count;
+ }
+ return buf;
+ }
// This code must be uncommented to run the LdapAbandonTest.
/*public void sendSearchReqs(String dn, int numReqs) {
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/NetClient.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/NetClient.java Fri Oct 09 10:22:53 2015 -0700
@@ -31,10 +31,9 @@
package sun.security.krb5.internal;
-import sun.misc.IOUtils;
-
import java.io.*;
import java.net.*;
+import sun.security.util.IOUtils;
public abstract class NetClient implements AutoCloseable {
public static NetClient getInstance(String protocol, String hostname, int port,
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/ccache/CCacheInputStream.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/ccache/CCacheInputStream.java Fri Oct 09 10:22:53 2015 -0700
@@ -36,10 +36,10 @@
import java.util.List;
import java.util.StringTokenizer;
-import sun.misc.IOUtils;
import sun.security.krb5.*;
import sun.security.krb5.internal.*;
import sun.security.krb5.internal.util.KrbDataInputStream;
+import sun.security.util.IOUtils;
/**
* This class extends KrbDataInputStream. It is used for parsing FCC-format
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/SunPKCS11.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/SunPKCS11.java Fri Oct 09 10:22:53 2015 -0700
@@ -106,9 +106,9 @@
public Provider configure(String configArg) throws InvalidParameterException {
final String newConfigName = checkNull(configArg);
try {
- return AccessController.doPrivileged(new PrivilegedExceptionAction<Provider>() {
+ return AccessController.doPrivileged(new PrivilegedExceptionAction<>() {
@Override
- public Provider run() throws Exception {
+ public SunPKCS11 run() throws Exception {
return new SunPKCS11(new Config(newConfigName));
}
});
@@ -119,6 +119,11 @@
}
}
+ @Override
+ public boolean isConfigured() {
+ return (config != null);
+ }
+
private static <T> T checkNull(T obj) {
if (obj == null) {
throw new NullPointerException();
@@ -1142,8 +1147,10 @@
* @param handler the <code>CallbackHandler</code> used by
* this provider to communicate with the caller
*
- * @exception LoginException if the login operation fails
- * @exception SecurityException if the does not pass a security check for
+ * @throws IllegalStateException if the provider requires configuration
+ * and Provider.configure has not been called
+ * @throws LoginException if the login operation fails
+ * @throws SecurityException if the does not pass a security check for
* <code>SecurityPermission("authProvider.<i>name</i>")</code>,
* where <i>name</i> is the value returned by
* this provider's <code>getName</code> method
@@ -1151,8 +1158,11 @@
public void login(Subject subject, CallbackHandler handler)
throws LoginException {
+ if (!isConfigured()) {
+ throw new IllegalStateException("Configuration is required");
+ }
+
// security check
-
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
if (debug != null) {
@@ -1271,16 +1281,21 @@
/**
* Log out from this provider
*
- * @exception LoginException if the logout operation fails
- * @exception SecurityException if the does not pass a security check for
+ * @throws IllegalStateException if the provider requires configuration
+ * and Provider.configure has not been called
+ * @throws LoginException if the logout operation fails
+ * @throws SecurityException if the does not pass a security check for
* <code>SecurityPermission("authProvider.<i>name</i>")</code>,
* where <i>name</i> is the value returned by
* this provider's <code>getName</code> method
*/
public void logout() throws LoginException {
+ if (!isConfigured()) {
+ throw new IllegalStateException("Configuration is required");
+ }
+
// security check
-
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission
@@ -1353,7 +1368,9 @@
* @param handler a <code>CallbackHandler</code> for obtaining
* authentication information, which may be <code>null</code>
*
- * @exception SecurityException if the caller does not pass a
+ * @throws IllegalStateException if the provider requires configuration
+ * and Provider.configure has not been called
+ * @throws SecurityException if the caller does not pass a
* security check for
* <code>SecurityPermission("authProvider.<i>name</i>")</code>,
* where <i>name</i> is the value returned by
@@ -1361,8 +1378,11 @@
*/
public void setCallbackHandler(CallbackHandler handler) {
+ if (!isConfigured()) {
+ throw new IllegalStateException("Configuration is required");
+ }
+
// security check
-
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/StrictMath/FdlibmTranslit.java Fri Oct 09 10:22:53 2015 -0700
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+/**
+ * A transliteration of the "Freely Distributable Math Library"
+ * algorithms from C into Java. That is, this port of the algorithms
+ * is as close to the C originals as possible while still being
+ * readable legal Java.
+ */
+public class FdlibmTranslit {
+ private FdlibmTranslit() {
+ throw new UnsupportedOperationException("No FdLibmTranslit instances for you.");
+ }
+
+ /**
+ * Return the low-order 32 bits of the double argument as an int.
+ */
+ private static int __LO(double x) {
+ long transducer = Double.doubleToRawLongBits(x);
+ return (int)transducer;
+ }
+
+ /**
+ * Return a double with its low-order bits of the second argument
+ * and the high-order bits of the first argument..
+ */
+ private static double __LO(double x, int low) {
+ long transX = Double.doubleToRawLongBits(x);
+ return Double.longBitsToDouble((transX & 0xFFFF_FFFF_0000_0000L)|low );
+ }
+
+ /**
+ * Return the high-order 32 bits of the double argument as an int.
+ */
+ private static int __HI(double x) {
+ long transducer = Double.doubleToRawLongBits(x);
+ return (int)(transducer >> 32);
+ }
+
+ /**
+ * Return a double with its high-order bits of the second argument
+ * and the low-order bits of the first argument..
+ */
+ private static double __HI(double x, int high) {
+ long transX = Double.doubleToRawLongBits(x);
+ return Double.longBitsToDouble((transX & 0x0000_0000_FFFF_FFFFL)|( ((long)high)) << 32 );
+ }
+
+ public static double hypot(double x, double y) {
+ return Hypot.compute(x, y);
+ }
+
+ /**
+ * hypot(x,y)
+ *
+ * Method :
+ * If (assume round-to-nearest) z = x*x + y*y
+ * has error less than sqrt(2)/2 ulp, than
+ * sqrt(z) has error less than 1 ulp (exercise).
+ *
+ * So, compute sqrt(x*x + y*y) with some care as
+ * follows to get the error below 1 ulp:
+ *
+ * Assume x > y > 0;
+ * (if possible, set rounding to round-to-nearest)
+ * 1. if x > 2y use
+ * x1*x1 + (y*y + (x2*(x + x1))) for x*x + y*y
+ * where x1 = x with lower 32 bits cleared, x2 = x - x1; else
+ * 2. if x <= 2y use
+ * t1*y1 + ((x-y) * (x-y) + (t1*y2 + t2*y))
+ * where t1 = 2x with lower 32 bits cleared, t2 = 2x - t1,
+ * y1= y with lower 32 bits chopped, y2 = y - y1.
+ *
+ * NOTE: scaling may be necessary if some argument is too
+ * large or too tiny
+ *
+ * Special cases:
+ * hypot(x,y) is INF if x or y is +INF or -INF; else
+ * hypot(x,y) is NAN if x or y is NAN.
+ *
+ * Accuracy:
+ * hypot(x,y) returns sqrt(x^2 + y^2) with error less
+ * than 1 ulps (units in the last place)
+ */
+ static class Hypot {
+ public static double compute(double x, double y) {
+ double a = x;
+ double b = y;
+ double t1, t2, y1, y2, w;
+ int j, k, ha, hb;
+
+ ha = __HI(x) & 0x7fffffff; // high word of x
+ hb = __HI(y) & 0x7fffffff; // high word of y
+ if(hb > ha) {
+ a = y;
+ b = x;
+ j = ha;
+ ha = hb;
+ hb = j;
+ } else {
+ a = x;
+ b = y;
+ }
+ a = __HI(a, ha); // a <- |a|
+ b = __HI(b, hb); // b <- |b|
+ if ((ha - hb) > 0x3c00000) {
+ return a + b; // x / y > 2**60
+ }
+ k=0;
+ if (ha > 0x5f300000) { // a>2**500
+ if (ha >= 0x7ff00000) { // Inf or NaN
+ w = a + b; // for sNaN
+ if (((ha & 0xfffff) | __LO(a)) == 0)
+ w = a;
+ if (((hb ^ 0x7ff00000) | __LO(b)) == 0)
+ w = b;
+ return w;
+ }
+ // scale a and b by 2**-600
+ ha -= 0x25800000;
+ hb -= 0x25800000;
+ k += 600;
+ a = __HI(a, ha);
+ b = __HI(b, hb);
+ }
+ if (hb < 0x20b00000) { // b < 2**-500
+ if (hb <= 0x000fffff) { // subnormal b or 0 */
+ if ((hb | (__LO(b))) == 0)
+ return a;
+ t1 = 0;
+ t1 = __HI(t1, 0x7fd00000); // t1=2^1022
+ b *= t1;
+ a *= t1;
+ k -= 1022;
+ } else { // scale a and b by 2^600
+ ha += 0x25800000; // a *= 2^600
+ hb += 0x25800000; // b *= 2^600
+ k -= 600;
+ a = __HI(a, ha);
+ b = __HI(b, hb);
+ }
+ }
+ // medium size a and b
+ w = a - b;
+ if (w > b) {
+ t1 = 0;
+ t1 = __HI(t1, ha);
+ t2 = a - t1;
+ w = Math.sqrt(t1*t1 - (b*(-b) - t2 * (a + t1)));
+ } else {
+ a = a + a;
+ y1 = 0;
+ y1 = __HI(y1, hb);
+ y2 = b - y1;
+ t1 = 0;
+ t1 = __HI(t1, ha + 0x00100000);
+ t2 = a - t1;
+ w = Math.sqrt(t1*y1 - (w*(-w) - (t1*y2 + t2*b)));
+ }
+ if (k != 0) {
+ t1 = 1.0;
+ int t1_hi = __HI(t1);
+ t1_hi += (k << 20);
+ t1 = __HI(t1, t1_hi);
+ return t1 * w;
+ } else
+ return w;
+ }
+ }
+}
--- a/jdk/test/java/lang/StrictMath/HypotTests.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/test/java/lang/StrictMath/HypotTests.java Fri Oct 09 10:22:53 2015 -0700
@@ -24,10 +24,19 @@
/*
* @test
* @bug 4851638
+ * @key randomness
* @summary Tests for StrictMath.hypot
+ * @library /lib/testlibrary/
+ * @build jdk.testlibrary.*
+ * @build Tests
+ * @build FdlibmTranslit
+ * @build HypotTests
+ * @run main HypotTests
* @author Joseph D. Darcy
*/
+import jdk.testlibrary.RandomFactory;
+
/**
* The tests in ../Math/HypotTests.java test properties that should
* hold for any hypot implementation, including the FDLIBM-based one
@@ -42,6 +51,19 @@
public class HypotTests {
private HypotTests(){}
+ public static void main(String... args) {
+ int failures = 0;
+
+ failures += testHypot();
+ failures += testAgainstTranslit();
+
+ if (failures > 0) {
+ System.err.println("Testing hypot incurred "
+ + failures + " failures.");
+ throw new RuntimeException();
+ }
+ }
+
/**
* The hypot implementation is commutative, {@code hypot(a, b) ==
* hypot(b, a)}, and independent of sign, {@code hypot(a, b) ==
@@ -663,6 +685,12 @@
{0x1.0p-450, 0x1.fffffffffffffp-499, 0x1.0p-450},
{0x1.0000000000001p-450, 0x1.fffffffffffffp-499, 0x1.0000000000001p-450},
+ {0x1.00000_ffff_0000p500, 0x1.fffffffffffffp499, 0x1.6a09f1b837ccfp500},
+ {0x1.00000_0000_0001p500, 0x1.fffffffffffffp499, 0x1.6a09e667f3bcdp500},
+ {0x1.00000_ffff_ffffp500, 0x1.fffffffffffffp499, 0x1.6a09f1b8431d3p500},
+ {0x1.00001_0000_0000p500, 0x1.fffffffffffffp499, 0x1.6a09f1b8431d5p500},
+
+
// 0x1.0p-1022 is MIN_NORMAL
{0x1.0000000000001p-1022, 0x1.0000000000001p-1022, 0x1.6a09e667f3bcep-1022},
{0x1.0000000000001p-1022, 0x1.0p-1022, 0x1.6a09e667f3bcdp-1022},
@@ -686,15 +714,30 @@
return failures;
}
- public static void main(String... args) {
+ // Initialize shared random number generator
+ private static java.util.Random random = RandomFactory.getRandom();
+
+ /**
+ * Test StrictMath.hypot against transliteration port of hypot.
+ */
+ private static int testAgainstTranslit() {
int failures = 0;
-
- failures += testHypot();
+ double x = Tests.createRandomDouble(random);
+ double y = Tests.createRandomDouble(random);
- if (failures > 0) {
- System.err.println("Testing hypot incurred "
- + failures + " failures.");
- throw new RuntimeException();
+ // Make the increment twice the ulp value in case the random
+ // value is near an exponent threshold.
+ double increment_x = 2.0 * Math.ulp(x);
+ double increment_y = 2.0 * Math.ulp(y);
+
+ // Don't worry about x or y overflowing to infinity if their
+ // exponent is MAX_EXPONENT.
+ for (int i = 0; i < 200; i++, x += increment_x) {
+ for (int j = 0; j < 200; j++, y += increment_y) {
+ failures += testHypotCase(x, y, FdlibmTranslit.hypot(x, y));
+ }
}
+
+ return failures;
}
}
--- a/jdk/test/java/lang/StrictMath/Tests.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/test/java/lang/StrictMath/Tests.java Fri Oct 09 10:22:53 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -60,6 +60,16 @@
return 0;
}
-
+ /**
+ * Returns a double over the normalized range of floating-point values.
+ * @return a double over the normalized range of floating-point values
+ */
+ static double createRandomDouble(java.util.Random random) {
+ final int EXPONENT_RANGE = Double.MAX_EXPONENT - Double.MIN_EXPONENT + 1;
+ int targetExponent = Double.MIN_EXPONENT + random.nextInt(EXPONENT_RANGE + 1);
+ double tmp = random.nextDouble(); // Double in the range of [0.0, 1.0)
+ int tmpExponent = Math.getExponent(tmp);
+ return Math.scalb(tmp, targetExponent - tmpExponent);
+ }
}
--- a/jdk/test/java/security/PermissionCollection/AddToReadOnlyPermissionCollection.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/test/java/security/PermissionCollection/AddToReadOnlyPermissionCollection.java Fri Oct 09 10:22:53 2015 -0700
@@ -107,11 +107,11 @@
static void tryFilePC() throws Exception {
try {
- FilePermission p0 = new FilePermission("/home/foobar","read");
+ FilePermission p0 = new FilePermission("/tmp/foobar","read");
PermissionCollection pc = p0.newPermissionCollection();
pc.setReadOnly(); // this should lock out future adds
//
- FilePermission p1 = new FilePermission("/home/quux","read");
+ FilePermission p1 = new FilePermission("/tmp/quux","read");
pc.add(p1);
throw new
Exception("Failed...FilePermission added to readonly FilePermissionCollection.");
--- a/jdk/test/java/security/PermissionCollection/Concurrent.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/test/java/security/PermissionCollection/Concurrent.java Fri Oct 09 10:22:53 2015 -0700
@@ -166,9 +166,9 @@
new AllPermission(), new AllPermission()};
private static final Permission[] filep = new Permission[]{
- new FilePermission("/home/foobar", "read"),
- new FilePermission("/home/foo", "write"),
- new FilePermission("/home/foobar", "read,write"),
+ new FilePermission("/tmp/foobar", "read"),
+ new FilePermission("/tmp/foo", "write"),
+ new FilePermission("/tmp/foobar", "read,write"),
};
private static final Permission[] sockp = new Permission[]{
--- a/jdk/test/java/security/PermissionCollection/PermissionCollectionStreamTest.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/test/java/security/PermissionCollection/PermissionCollectionStreamTest.java Fri Oct 09 10:22:53 2015 -0700
@@ -50,9 +50,9 @@
{
"FilePermission",
new Permission[]{
- new FilePermission("/home/foobar", "read"),
- new FilePermission("/home/foo", "write"),
- new FilePermission("/home/foobar", "read,write"),
+ new FilePermission("/tmp/foobar", "read"),
+ new FilePermission("/tmp/foo", "write"),
+ new FilePermission("/tmp/foobar", "read,write"),
}
},
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Objects/CheckIndex.java Fri Oct 09 10:22:53 2015 -0700
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @summary IndexOutOfBoundsException check index tests
+ * @run testng CheckIndex
+ * @bug 8135248
+ */
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.function.BiConsumer;
+import java.util.function.BiFunction;
+import java.util.function.IntSupplier;
+
+import static org.testng.Assert.*;
+
+public class CheckIndex {
+
+ static class AssertingOutOfBoundsException extends RuntimeException {
+ }
+
+ static BiFunction<Integer, Integer, AssertingOutOfBoundsException> assertingOutOfBounds(
+ int expFromIndex, int expToIndexOrSizeOrLength) {
+ return (fromIndex, toIndexOrSizeorLength) -> {
+ assertEquals(fromIndex, Integer.valueOf(expFromIndex));
+ assertEquals(toIndexOrSizeorLength, Integer.valueOf(expToIndexOrSizeOrLength));
+ return new AssertingOutOfBoundsException();
+ };
+ }
+
+ static final int[] VALUES = {0, 1, Integer.MAX_VALUE - 1, Integer.MAX_VALUE, -1, Integer.MIN_VALUE + 1, Integer.MIN_VALUE};
+
+ @DataProvider
+ static Object[][] checkIndexProvider() {
+ List<Object[]> l = new ArrayList<>();
+ for (int index : VALUES) {
+ for (int length : VALUES) {
+ boolean withinBounds = index >= 0 &&
+ length >= 0 &&
+ index < length;
+ l.add(new Object[]{index, length, withinBounds});
+ }
+ }
+ return l.toArray(new Object[0][0]);
+ }
+
+ interface X {
+ int apply(int a, int b, int c);
+ }
+
+ @Test(dataProvider = "checkIndexProvider")
+ public void testCheckIndex(int index, int length, boolean withinBounds) {
+ BiConsumer<Class<? extends RuntimeException>, IntSupplier> check = (ec, s) -> {
+ try {
+ int rIndex = s.getAsInt();
+ if (!withinBounds)
+ fail(String.format(
+ "Index %d is out of bounds of [0, %d), but was reported to be within bounds", index, length));
+ assertEquals(rIndex, index);
+ }
+ catch (RuntimeException e) {
+ assertTrue(ec.isInstance(e));
+ if (withinBounds)
+ fail(String.format(
+ "Index %d is within bounds of [0, %d), but was reported to be out of bounds", index, length));
+ }
+ };
+
+ check.accept(AssertingOutOfBoundsException.class,
+ () -> Objects.checkIndex(index, length, assertingOutOfBounds(index, length)));
+ check.accept(IndexOutOfBoundsException.class,
+ () -> Objects.checkIndex(index, length, null));
+ check.accept(IndexOutOfBoundsException.class,
+ () -> Objects.checkIndex(index, length));
+ }
+
+
+ @DataProvider
+ static Object[][] checkFromToIndexProvider() {
+ List<Object[]> l = new ArrayList<>();
+ for (int fromIndex : VALUES) {
+ for (int toIndex : VALUES) {
+ for (int length : VALUES) {
+ boolean withinBounds = fromIndex >= 0 &&
+ toIndex >= 0 &&
+ length >= 0 &&
+ fromIndex <= toIndex &&
+ toIndex <= length;
+ l.add(new Object[]{fromIndex, toIndex, length, withinBounds});
+ }
+ }
+ }
+ return l.toArray(new Object[0][0]);
+ }
+
+ @Test(dataProvider = "checkFromToIndexProvider")
+ public void testCheckFromToIndex(int fromIndex, int toIndex, int length, boolean withinBounds) {
+ BiConsumer<Class<? extends RuntimeException>, IntSupplier> check = (ec, s) -> {
+ try {
+ int rIndex = s.getAsInt();
+ if (!withinBounds)
+ fail(String.format(
+ "Range [%d, %d) is out of bounds of [0, %d), but was reported to be withing bounds", fromIndex, toIndex, length));
+ assertEquals(rIndex, fromIndex);
+ }
+ catch (RuntimeException e) {
+ assertTrue(ec.isInstance(e));
+ if (withinBounds)
+ fail(String.format(
+ "Range [%d, %d) is within bounds of [0, %d), but was reported to be out of bounds", fromIndex, toIndex, length));
+ }
+ };
+
+ check.accept(AssertingOutOfBoundsException.class,
+ () -> Objects.checkFromToIndex(fromIndex, toIndex, length, assertingOutOfBounds(fromIndex, toIndex)));
+ check.accept(IndexOutOfBoundsException.class,
+ () -> Objects.checkFromToIndex(fromIndex, toIndex, length, null));
+ check.accept(IndexOutOfBoundsException.class,
+ () -> Objects.checkFromToIndex(fromIndex, toIndex, length));
+ }
+
+
+ @DataProvider
+ static Object[][] checkFromIndexSizeProvider() {
+ List<Object[]> l = new ArrayList<>();
+ for (int fromIndex : VALUES) {
+ for (int size : VALUES) {
+ for (int length : VALUES) {
+ // Explicitly convert to long
+ long lFromIndex = fromIndex;
+ long lSize = size;
+ long lLength = length;
+ // Avoid overflow
+ long lToIndex = lFromIndex + lSize;
+
+ boolean withinBounds = lFromIndex >= 0L &&
+ lSize >= 0L &&
+ lLength >= 0L &&
+ lFromIndex <= lToIndex &&
+ lToIndex <= lLength;
+ l.add(new Object[]{fromIndex, size, length, withinBounds});
+ }
+ }
+ }
+ return l.toArray(new Object[0][0]);
+ }
+
+ @Test(dataProvider = "checkFromIndexSizeProvider")
+ public void testCheckFromIndexSize(int fromIndex, int size, int length, boolean withinBounds) {
+ BiConsumer<Class<? extends RuntimeException>, IntSupplier> check = (ec, s) -> {
+ try {
+ int rIndex = s.getAsInt();
+ if (!withinBounds)
+ fail(String.format(
+ "Range [%d, %d + %d) is out of bounds of [0, %d), but was reported to be withing bounds", fromIndex, fromIndex, size, length));
+ assertEquals(rIndex, fromIndex);
+ }
+ catch (RuntimeException e) {
+ assertTrue(ec.isInstance(e));
+ if (withinBounds)
+ fail(String.format(
+ "Range [%d, %d + %d) is within bounds of [0, %d), but was reported to be out of bounds", fromIndex, fromIndex, size, length));
+ }
+ };
+
+ check.accept(AssertingOutOfBoundsException.class,
+ () -> Objects.checkFromIndexSize(fromIndex, size, length, assertingOutOfBounds(fromIndex, size)));
+ check.accept(IndexOutOfBoundsException.class,
+ () -> Objects.checkFromIndexSize(fromIndex, size, length, null));
+ check.accept(IndexOutOfBoundsException.class,
+ () -> Objects.checkFromIndexSize(fromIndex, size, length));
+ }
+
+ @Test
+ public void checkIndexOutOfBoundsExceptionConstructors() {
+ BiConsumer<Class<? extends RuntimeException>, IntSupplier> check = (ec, s) -> {
+ try {
+ s.getAsInt();
+ fail("Runtime exception expected");
+ }
+ catch (RuntimeException e) {
+ assertTrue(ec.isInstance(e));
+ }
+ };
+
+ check.accept(IndexOutOfBoundsException.class,
+ () -> Objects.checkIndex(1, 0, IndexOutOfBoundsException::new));
+ check.accept(StringIndexOutOfBoundsException.class,
+ () -> Objects.checkIndex(1, 0, StringIndexOutOfBoundsException::new));
+ check.accept(ArrayIndexOutOfBoundsException.class,
+ () -> Objects.checkIndex(1, 0, ArrayIndexOutOfBoundsException::new));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/pkcs11/Provider/LoginISE.java Fri Oct 09 10:22:53 2015 -0700
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.*;
+import java.util.*;
+import java.security.*;
+import javax.security.auth.callback.*;
+
+/**
+ * @test
+ * @bug 8130648
+ * @summary make sure IllegalStateException is thrown for uninitialized
+ * SunPKCS11 provider instance
+ */
+public class LoginISE {
+
+ public static void main(String[] args) throws Exception {
+
+ Provider p = Security.getProvider("SunPKCS11");
+ if (p == null) {
+ System.out.println("No un-initialized PKCS11 provider available; skip");
+ return;
+ }
+ if (!(p instanceof AuthProvider)) {
+ throw new RuntimeException("Error: expect AuthProvider!");
+ }
+ AuthProvider ap = (AuthProvider) p;
+ if (ap.isConfigured()) {
+ throw new RuntimeException("Fail: isConfigured() should return false");
+ }
+ try {
+ ap.login(null, null);
+ throw new RuntimeException("Fail: expected ISE not thrown!");
+ } catch (IllegalStateException ise) {
+ System.out.println("Expected ISE thrown for login call");
+ }
+ try {
+ ap.logout();
+ throw new RuntimeException("Fail: expected ISE not thrown!");
+ } catch (IllegalStateException ise) {
+ System.out.println("Expected ISE thrown for logout call");
+ }
+ try {
+ ap.setCallbackHandler(new PasswordCallbackHandler());
+ throw new RuntimeException("Fail: expected ISE not thrown!");
+ } catch (IllegalStateException ise) {
+ System.out.println("Expected ISE thrown for logout call");
+ }
+
+ System.out.println("Test Passed");
+ }
+
+ public static class PasswordCallbackHandler implements CallbackHandler {
+ public void handle(Callback[] callbacks)
+ throws IOException, UnsupportedCallbackException {
+ }
+ }
+}
--- a/jdk/test/sun/security/provider/PolicyFile/CombinedPerms.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/test/sun/security/provider/PolicyFile/CombinedPerms.java Fri Oct 09 10:22:53 2015 -0700
@@ -39,7 +39,7 @@
String host = "localhost";
- URL u = new URL("file:/home/duke");
+ URL u = new URL("file:/tmp/duke");
CodeSource cs =
new CodeSource(u, (java.security.cert.Certificate[]) null);
Permissions p = new Permissions();
--- a/jdk/test/sun/security/provider/PolicyFile/CombinedPerms.policy Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/test/sun/security/provider/PolicyFile/CombinedPerms.policy Fri Oct 09 10:22:53 2015 -0700
@@ -1,3 +1,3 @@
-grant codebase "file:/home/duke" {
+grant codebase "file:/tmp/duke" {
permission java.net.SocketPermission "localhost", "accept";
};
--- a/jdk/test/sun/security/tools/jarsigner/TimestampCheck.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/test/sun/security/tools/jarsigner/TimestampCheck.java Fri Oct 09 10:22:53 2015 -0700
@@ -40,7 +40,6 @@
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
-import sun.misc.IOUtils;
import sun.security.pkcs.ContentInfo;
import sun.security.pkcs.PKCS7;
import sun.security.pkcs.PKCS9Attribute;
@@ -343,7 +342,7 @@
try (JarFile jf = new JarFile(file)) {
JarEntry je = jf.getJarEntry("META-INF/OLD.RSA");
try (InputStream is = jf.getInputStream(je)) {
- byte[] content = IOUtils.readFully(is, -1, true);
+ byte[] content = is.readAllBytes();
PKCS7 p7 = new PKCS7(content);
SignerInfo[] si = p7.getSignerInfos();
if (si == null || si.length == 0) {
--- a/jdk/test/sun/security/util/DerValue/BadValue.java Thu Oct 08 22:30:42 2015 -0700
+++ b/jdk/test/sun/security/util/DerValue/BadValue.java Fri Oct 09 10:22:53 2015 -0700
@@ -25,13 +25,11 @@
* @test
* @bug 6864911
* @summary ASN.1/DER input stream parser needs more work
- * @modules java.base/sun.misc
- * java.base/sun.security.util
+ * @modules java.base/sun.security.util
*/
import java.io.*;
import sun.security.util.*;
-import sun.misc.IOUtils;
public class BadValue {