summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/charset/CharsetEncoderTest.java6
-rw-r--r--luni/src/test/java/libcore/java/util/TimeZoneTest.java61
-rw-r--r--ojluni/src/main/java/java/nio/charset/Charset.java74
-rw-r--r--ojluni/src/main/java/java/nio/charset/CharsetDecoder.java74
-rw-r--r--ojluni/src/main/java/java/nio/charset/CharsetEncoder.java86
-rw-r--r--ojluni/src/main/java/java/nio/charset/CoderResult.java30
-rw-r--r--ojluni/src/main/java/java/nio/charset/CodingErrorAction.java8
-rw-r--r--ojluni/src/main/java/java/nio/charset/MalformedInputException.java15
-rw-r--r--ojluni/src/main/java/java/nio/charset/UnmappableCharacterException.java17
-rw-r--r--ojluni/src/main/java/java/nio/charset/spi/CharsetProvider.java12
-rw-r--r--ojluni/src/main/java/sun/security/jca/GetInstance.java24
-rw-r--r--ojluni/src/main/java/sun/security/jca/Providers.java7
12 files changed, 267 insertions, 147 deletions
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/charset/CharsetEncoderTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/charset/CharsetEncoderTest.java
index 5226ed6887..c1c1e93a0f 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/charset/CharsetEncoderTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/charset/CharsetEncoderTest.java
@@ -178,7 +178,7 @@ public class CharsetEncoderTest extends TestCase {
assertSame(ec.charset(), cs);
assertEquals(1.0, ec.averageBytesPerChar(), 0.0);
assertTrue(ec.maxBytesPerChar() == MAX_BYTES);
- assertSame(ba, ec.replacement());
+ assertTrue(Arrays.equals(ba, ec.replacement()));
/*
* ------------------------ Exceptional cases -------------------------
@@ -996,7 +996,7 @@ public class CharsetEncoderTest extends TestCase {
byte[] nr = getLegalByteArray();
assertSame(encoder, encoder.replaceWith(nr));
- assertSame(nr, encoder.replacement());
+ assertTrue(Arrays.equals(nr, encoder.replacement()));
nr = getIllegalByteArray();
try {
@@ -1099,7 +1099,7 @@ public class CharsetEncoderTest extends TestCase {
}
protected void implReplaceWith(byte[] ba) {
- assertSame(ba, replacement());
+ assertTrue(Arrays.equals(ba, replacement()));
}
}
diff --git a/luni/src/test/java/libcore/java/util/TimeZoneTest.java b/luni/src/test/java/libcore/java/util/TimeZoneTest.java
index d0342e2f68..97545269e0 100644
--- a/luni/src/test/java/libcore/java/util/TimeZoneTest.java
+++ b/luni/src/test/java/libcore/java/util/TimeZoneTest.java
@@ -16,13 +16,17 @@
package libcore.java.util;
+import junit.framework.TestCase;
+
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.SimpleTimeZone;
import java.util.TimeZone;
-import junit.framework.TestCase;
+import java.util.concurrent.BrokenBarrierException;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.atomic.AtomicInteger;
public class TimeZoneTest extends TestCase {
// http://code.google.com/p/android/issues/detail?id=877
@@ -365,4 +369,59 @@ public class TimeZoneTest extends TestCase {
TimeZone.setDefault(origTz);
}
}
+
+ // http://b/30937209
+ public void testSetDefaultDeadlock() throws InterruptedException, BrokenBarrierException {
+ // Since this tests a deadlock, the test has two fundamental problems:
+ // - it is probabilistic: it's not guaranteed to fail if the problem exists
+ // - if it fails, it will effectively hang the current runtime, as no other thread will
+ // be able to call TimeZone.getDefault()/setDefault() successfully any more.
+
+ // 10 was too low to be reliable, 100 failed more than half the time (on a bullhead).
+ final int iterations = 100;
+ TimeZone otherTimeZone = TimeZone.getTimeZone("Europe/London");
+ AtomicInteger setterCount = new AtomicInteger();
+ CyclicBarrier startBarrier = new CyclicBarrier(2);
+ Thread setter = new Thread(() -> {
+ waitFor(startBarrier);
+ for (int i = 0; i < iterations; i++) {
+ TimeZone.setDefault(otherTimeZone);
+ TimeZone.setDefault(null);
+ setterCount.set(i+1);
+ }
+ });
+ setter.setName("testSetDefaultDeadlock setter");
+
+ AtomicInteger getterCount = new AtomicInteger();
+ Thread getter = new Thread(() -> {
+ waitFor(startBarrier);
+ for (int i = 0; i < iterations; i++) {
+ android.icu.util.TimeZone.getDefault();
+ getterCount.set(i+1);
+ }
+ });
+ getter.setName("testSetDefaultDeadlock getter");
+
+ setter.start();
+ getter.start();
+
+ // 2 seconds is plenty: If successful, we usually complete much faster.
+ setter.join(1000);
+ getter.join(1000);
+ if (setter.isAlive() || getter.isAlive()) {
+ fail("Threads are still alive. Getter iteration count: " + getterCount.get()
+ + ", setter iteration count: " + setterCount.get());
+ }
+ // Guard against unexpected uncaught exceptions.
+ assertEquals("Setter iterations", iterations, setterCount.get());
+ assertEquals("Getter iterations", iterations, getterCount.get());
+ }
+
+ private static void waitFor(CyclicBarrier barrier) {
+ try {
+ barrier.await();
+ } catch (InterruptedException | BrokenBarrierException e) {
+ throw new RuntimeException(e);
+ }
+ }
}
diff --git a/ojluni/src/main/java/java/nio/charset/Charset.java b/ojluni/src/main/java/java/nio/charset/Charset.java
index f85b82bce2..24bc995623 100644
--- a/ojluni/src/main/java/java/nio/charset/Charset.java
+++ b/ojluni/src/main/java/java/nio/charset/Charset.java
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, 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
@@ -70,8 +70,8 @@ import sun.security.action.GetPropertyAction;
* concurrent threads.
*
*
- * <a name="names"><a name="charenc">
- * <h4>Charset names</h4>
+ * <a name="names"></a><a name="charenc"></a>
+ * <h2>Charset names</h2>
*
* <p> Charsets are named by strings composed of the following characters:
*
@@ -116,21 +116,17 @@ import sun.security.action.GetPropertyAction;
* The aliases of a charset are returned by the {@link #aliases() aliases}
* method.
*
- * <a name="hn">
- *
- * <p> Some charsets have an <i>historical name</i> that is defined for
- * compatibility with previous versions of the Java platform. A charset's
+ * <p><a name="hn">Some charsets have an <i>historical name</i> that is defined for
+ * compatibility with previous versions of the Java platform.</a> A charset's
* historical name is either its canonical name or one of its aliases. The
* historical name is returned by the <tt>getEncoding()</tt> methods of the
* {@link java.io.InputStreamReader#getEncoding InputStreamReader} and {@link
* java.io.OutputStreamWriter#getEncoding OutputStreamWriter} classes.
*
- * <a name="iana">
- *
- * <p> If a charset listed in the <a
+ * <p><a name="iana"> </a>If a charset listed in the <a
* href="http://www.iana.org/assignments/character-sets"><i>IANA Charset
* Registry</i></a> is supported by an implementation of the Java platform then
- * its canonical name must be the name listed in the registry. Many charsets
+ * its canonical name must be the name listed in the registry. Many charsets
* are given more than one name in the registry, in which case the registry
* identifies one of the names as <i>MIME-preferred</i>. If a charset has more
* than one registry name then its canonical name must be the MIME-preferred
@@ -145,17 +141,17 @@ import sun.security.action.GetPropertyAction;
* previous canonical name be made into an alias.
*
*
- * <h4>Standard charsets</h4>
+ * <h2>Standard charsets</h2>
+ *
*
- * <a name="standard">
*
- * <p> Every implementation of the Java platform is required to support the
- * following standard charsets. Consult the release documentation for your
+ * <p><a name="standard">Every implementation of the Java platform is required to support the
+ * following standard charsets.</a> Consult the release documentation for your
* implementation to see if any other charsets are supported. The behavior
* of such optional charsets may differ between implementations.
*
* <blockquote><table width="80%" summary="Description of standard charsets">
- * <tr><th><p align="left">Charset</p></th><th><p align="left">Description</p></th></tr>
+ * <tr><th align="left">Charset</th><th align="left">Description</th></tr>
* <tr><td valign=top><tt>US-ASCII</tt></td>
* <td>Seven-bit ASCII, a.k.a. <tt>ISO646-US</tt>,
* a.k.a. the Basic Latin block of the Unicode character set</td></tr>
@@ -210,7 +206,7 @@ import sun.security.action.GetPropertyAction;
*
* </ul>
*
- * In any case, byte order marks occuring after the first element of an
+ * In any case, byte order marks occurring after the first element of an
* input sequence are not omitted since the same code is used to represent
* <small>ZERO-WIDTH NON-BREAKING SPACE</small>.
*
@@ -222,7 +218,7 @@ import sun.security.action.GetPropertyAction;
* <p>The {@link StandardCharsets} class defines constants for each of the
* standard charsets.
*
- * <h4>Terminology</h4>
+ * <h2>Terminology</h2>
*
* <p> The name of this class is taken from the terms used in
* <a href="http://www.ietf.org/rfc/rfc2278.txt"><i>RFC&nbsp;2278</i></a>.
@@ -362,14 +358,14 @@ public abstract class Charset
// those whose lookup or instantiation causes a security exception to be
// thrown. Should be invoked with full privileges.
//
- private static Iterator providers() {
- return new Iterator() {
+ private static Iterator<CharsetProvider> providers() {
+ return new Iterator<CharsetProvider>() {
ServiceLoader<CharsetProvider> sl =
ServiceLoader.load(CharsetProvider.class);
Iterator<CharsetProvider> i = sl.iterator();
- Object next = null;
+ CharsetProvider next = null;
private boolean getNext() {
while (next == null) {
@@ -392,10 +388,10 @@ public abstract class Charset
return getNext();
}
- public Object next() {
+ public CharsetProvider next() {
if (!getNext())
throw new NoSuchElementException();
- Object n = next;
+ CharsetProvider n = next;
next = null;
return n;
}
@@ -408,7 +404,8 @@ public abstract class Charset
}
// Thread-local gate to prevent recursive provider lookups
- private static ThreadLocal<ThreadLocal> gate = new ThreadLocal<ThreadLocal>();
+ private static ThreadLocal<ThreadLocal<?>> gate =
+ new ThreadLocal<ThreadLocal<?>>();
private static Charset lookupViaProviders(final String charsetName) {
@@ -432,8 +429,9 @@ public abstract class Charset
return AccessController.doPrivileged(
new PrivilegedAction<Charset>() {
public Charset run() {
- for (Iterator i = providers(); i.hasNext();) {
- CharsetProvider cp = (CharsetProvider)i.next();
+ for (Iterator<CharsetProvider> i = providers();
+ i.hasNext();) {
+ CharsetProvider cp = i.next();
Charset cs = cp.charsetForName(charsetName);
if (cs != null)
return cs;
@@ -526,7 +524,7 @@ public abstract class Charset
}
/**
- * Tells whether the named charset is supported. </p>
+ * Tells whether the named charset is supported.
*
* @param charsetName
* The name of the requested charset; may be either
@@ -546,7 +544,7 @@ public abstract class Charset
}
/**
- * Returns a charset object for the named charset. </p>
+ * Returns a charset object for the named charset.
*
* @param charsetName
* The name of the requested charset; may be either
@@ -681,7 +679,7 @@ public abstract class Charset
/**
* Initializes a new charset with the given canonical name and alias
- * set. </p>
+ * set.
*
* @param canonicalName
* The canonical name of this charset
@@ -702,7 +700,7 @@ public abstract class Charset
}
/**
- * Returns this charset's canonical name. </p>
+ * Returns this charset's canonical name.
*
* @return The canonical name of this charset
*/
@@ -711,7 +709,7 @@ public abstract class Charset
}
/**
- * Returns a set containing this charset's aliases. </p>
+ * Returns a set containing this charset's aliases.
*
* @return An immutable set of this charset's aliases
*/
@@ -742,7 +740,7 @@ public abstract class Charset
/**
* Tells whether or not this charset is registered in the <a
* href="http://www.iana.org/assignments/character-sets">IANA Charset
- * Registry</a>. </p>
+ * Registry</a>.
*
* @return <tt>true</tt> if, and only if, this charset is known by its
* implementor to be registered with the IANA
@@ -789,19 +787,22 @@ public abstract class Charset
* it is not necessarily the case that the given charset is not contained
* in this charset.
*
+ * @param cs
+ * The given charset
+ *
* @return <tt>true</tt> if the given charset is contained in this charset
*/
public abstract boolean contains(Charset cs);
/**
- * Constructs a new decoder for this charset. </p>
+ * Constructs a new decoder for this charset.
*
* @return A new decoder for this charset
*/
public abstract CharsetDecoder newDecoder();
/**
- * Constructs a new encoder for this charset. </p>
+ * Constructs a new encoder for this charset.
*
* @return A new encoder for this charset
*
@@ -933,7 +934,7 @@ public abstract class Charset
}
/**
- * Computes a hashcode for this charset. </p>
+ * Computes a hashcode for this charset.
*
* @return An integer hashcode
*/
@@ -959,11 +960,12 @@ public abstract class Charset
}
/**
- * Returns a string describing this charset. </p>
+ * Returns a string describing this charset.
*
* @return A string describing this charset
*/
public final String toString() {
return name();
}
+
}
diff --git a/ojluni/src/main/java/java/nio/charset/CharsetDecoder.java b/ojluni/src/main/java/java/nio/charset/CharsetDecoder.java
index 653f44bba6..9bfb760b76 100644
--- a/ojluni/src/main/java/java/nio/charset/CharsetDecoder.java
+++ b/ojluni/src/main/java/java/nio/charset/CharsetDecoder.java
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, 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
@@ -35,13 +35,14 @@ import java.nio.BufferOverflowException;
import java.nio.BufferUnderflowException;
import java.lang.ref.WeakReference;
import java.nio.charset.CoderMalfunctionError; // javadoc
+import java.util.Arrays;
/**
* An engine that can transform a sequence of bytes in a specific charset into a sequence of
* sixteen-bit Unicode characters.
*
- * <a name="steps">
+ * <a name="steps"></a>
*
* <p> The input byte sequence is provided in a byte buffer or a series
* of such buffers. The output character sequence is written to a character buffer
@@ -76,22 +77,22 @@ import java.nio.charset.CoderMalfunctionError; // javadoc
* examine this object and fill the input buffer, flush the output buffer, or
* attempt to recover from a decoding error, as appropriate, and try again.
*
- * <a name="ce">
+ * <a name="ce"></a>
*
* <p> There are two general types of decoding errors. If the input byte
* sequence is not legal for this charset then the input is considered <i>malformed</i>. If
* the input byte sequence is legal but cannot be mapped to a valid
* Unicode character then an <i>unmappable character</i> has been encountered.
*
- * <a name="cae">
+ * <a name="cae"></a>
*
* <p> How a decoding error is handled depends upon the action requested for
- * that type of error, which is described by an instance of the {@link
- * CodingErrorAction} class. The possible error actions are to {@link
- * CodingErrorAction#IGNORE </code>ignore<code>} the erroneous input, {@link
- * CodingErrorAction#REPORT </code>report<code>} the error to the invoker via
- * the returned {@link CoderResult} object, or {@link CodingErrorAction#REPLACE
- * </code>replace<code>} the erroneous input with the current value of the
+ * that type of error, which is described by an instance of the {@linkplain
+ * CodingErrorAction} class. The possible error actions are to {@linkplain
+ * CodingErrorAction#IGNORE ignore} the erroneous input, {@link
+ * CodingErrorAction#REPORT report} the error to the invoker via
+ * the returned {@link CoderResult} object, or {@linkplain CodingErrorAction#REPLACE
+ * replace} the erroneous input with the current value of the
* replacement string. The replacement
*
@@ -106,7 +107,7 @@ import java.nio.charset.CoderMalfunctionError; // javadoc
* replaceWith} method.
*
* <p> The default action for malformed-input and unmappable-character errors
- * is to {@link CodingErrorAction#REPORT </code>report<code>} them. The
+ * is to {@linkplain CodingErrorAction#REPORT report} them. The
* malformed-input error action may be changed via the {@link
* #onMalformedInput(CodingErrorAction) onMalformedInput} method; the
* unmappable-character action may be changed via the {@link
@@ -161,7 +162,10 @@ public abstract class CharsetDecoder {
/**
* Initializes a new decoder. The new decoder will have the given
- * chars-per-byte and replacement values. </p>
+ * chars-per-byte and replacement values.
+ *
+ * * @param cs
+ * The charset that created this decoder
*
* @param averageCharsPerByte
* A positive float value indicating the expected number of
@@ -174,7 +178,7 @@ public abstract class CharsetDecoder {
* @param replacement
* The initial replacement; must not be <tt>null</tt>, must have
* non-zero length, must not be longer than maxCharsPerByte,
- * and must be {@link #isLegalReplacement </code>legal<code>}
+ * and must be {@linkplain #isLegalReplacement legal}
*
* @throws IllegalArgumentException
* If the preconditions on the parameters do not hold
@@ -209,7 +213,10 @@ public abstract class CharsetDecoder {
/**
* Initializes a new decoder. The new decoder will have the given
* chars-per-byte values and its replacement will be the
- * string <tt>"&#92;uFFFD"</tt>. </p>
+ * string <tt>"&#92;uFFFD"</tt>.
+ *
+ * @param cs
+ * The charset that created this decoder
*
* @param averageCharsPerByte
* A positive float value indicating the expected number of
@@ -232,7 +239,7 @@ public abstract class CharsetDecoder {
}
/**
- * Returns the charset that created this decoder. </p>
+ * Returns the charset that created this decoder.
*
* @return This decoder's charset
*/
@@ -241,7 +248,7 @@ public abstract class CharsetDecoder {
}
/**
- * Returns this decoder's replacement value. </p>
+ * Returns this decoder's replacement value.
*
* @return This decoder's current replacement,
* which is never <tt>null</tt> and is never empty
@@ -257,7 +264,7 @@ public abstract class CharsetDecoder {
* method, passing the new replacement, after checking that the new
* replacement is acceptable. </p>
*
- * @param newReplacement
+ * @param newReplacement The replacement value
*
* The new replacement; must not be <tt>null</tt>
@@ -284,11 +291,13 @@ public abstract class CharsetDecoder {
if (len > maxCharsPerByte)
throw new IllegalArgumentException("Replacement too long");
+ this.replacement = newReplacement;
- this.replacement = newReplacement;
- implReplaceWith(newReplacement);
+
+
+ implReplaceWith(this.replacement);
return this;
}
@@ -299,7 +308,7 @@ public abstract class CharsetDecoder {
* should be overridden by decoders that require notification of changes to
* the replacement. </p>
*
- * @param newReplacement
+ * @param newReplacement The replacement value
*/
protected void implReplaceWith(String newReplacement) {
}
@@ -345,7 +354,7 @@ public abstract class CharsetDecoder {
/**
- * Returns this decoder's current action for malformed-input errors. </p>
+ * Returns this decoder's current action for malformed-input errors.
*
* @return The current malformed-input action, which is never <tt>null</tt>
*/
@@ -354,7 +363,7 @@ public abstract class CharsetDecoder {
}
/**
- * Changes this decoder's action for malformed-input errors. </p>
+ * Changes this decoder's action for malformed-input errors.
*
* <p> This method invokes the {@link #implOnMalformedInput
* implOnMalformedInput} method, passing the new action. </p>
@@ -380,12 +389,13 @@ public abstract class CharsetDecoder {
* <p> The default implementation of this method does nothing. This method
* should be overridden by decoders that require notification of changes to
* the malformed-input action. </p>
+ *
+ * @param newAction The new action
*/
protected void implOnMalformedInput(CodingErrorAction newAction) { }
/**
* Returns this decoder's current action for unmappable-character errors.
- * </p>
*
* @return The current unmappable-character action, which is never
* <tt>null</tt>
@@ -423,13 +433,15 @@ public abstract class CharsetDecoder {
* <p> The default implementation of this method does nothing. This method
* should be overridden by decoders that require notification of changes to
* the unmappable-character action. </p>
+ *
+ * @param newAction The new action
*/
protected void implOnUnmappableCharacter(CodingErrorAction newAction) { }
/**
* Returns the average number of characters that will be produced for each
* byte of input. This heuristic value may be used to estimate the size
- * of the output buffer required for a given input sequence. </p>
+ * of the output buffer required for a given input sequence.
*
* @return The average number of characters produced
* per byte of input
@@ -480,24 +492,24 @@ public abstract class CharsetDecoder {
* typically done by draining any decoded characters from the output
* buffer. </p></li>
*
- * <li><p> A {@link CoderResult#malformedForLength
- * </code>malformed-input<code>} result indicates that a malformed-input
+ * <li><p> A {@linkplain CoderResult#malformedForLength
+ * malformed-input} result indicates that a malformed-input
* error has been detected. The malformed bytes begin at the input
* buffer's (possibly incremented) position; the number of malformed
* bytes may be determined by invoking the result object's {@link
* CoderResult#length() length} method. This case applies only if the
- * {@link #onMalformedInput </code>malformed action<code>} of this decoder
+ * {@linkplain #onMalformedInput malformed action} of this decoder
* is {@link CodingErrorAction#REPORT}; otherwise the malformed input
* will be ignored or replaced, as requested. </p></li>
*
- * <li><p> An {@link CoderResult#unmappableForLength
- * </code>unmappable-character<code>} result indicates that an
+ * <li><p> An {@linkplain CoderResult#unmappableForLength
+ * unmappable-character} result indicates that an
* unmappable-character error has been detected. The bytes that
* decode the unmappable character begin at the input buffer's (possibly
* incremented) position; the number of such bytes may be determined
* by invoking the result object's {@link CoderResult#length() length}
- * method. This case applies only if the {@link #onUnmappableCharacter
- * </code>unmappable action<code>} of this decoder is {@link
+ * method. This case applies only if the {@linkplain #onUnmappableCharacter
+ * unmappable action} of this decoder is {@link
* CodingErrorAction#REPORT}; otherwise the unmappable character will be
* ignored or replaced, as requested. </p></li>
*
diff --git a/ojluni/src/main/java/java/nio/charset/CharsetEncoder.java b/ojluni/src/main/java/java/nio/charset/CharsetEncoder.java
index 5632993560..041e1f17a1 100644
--- a/ojluni/src/main/java/java/nio/charset/CharsetEncoder.java
+++ b/ojluni/src/main/java/java/nio/charset/CharsetEncoder.java
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, 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
@@ -35,13 +35,14 @@ import java.nio.BufferOverflowException;
import java.nio.BufferUnderflowException;
import java.lang.ref.WeakReference;
import java.nio.charset.CoderMalfunctionError; // javadoc
+import java.util.Arrays;
/**
* An engine that can transform a sequence of sixteen-bit Unicode characters into a sequence of
* bytes in a specific charset.
*
- * <a name="steps">
+ * <a name="steps"></a>
*
* <p> The input character sequence is provided in a character buffer or a series
* of such buffers. The output byte sequence is written to a byte buffer
@@ -76,22 +77,22 @@ import java.nio.charset.CoderMalfunctionError; // javadoc
* examine this object and fill the input buffer, flush the output buffer, or
* attempt to recover from an encoding error, as appropriate, and try again.
*
- * <a name="ce">
+ * <a name="ce"></a>
*
* <p> There are two general types of encoding errors. If the input character
* sequence is not a legal sixteen-bit Unicode sequence then the input is considered <i>malformed</i>. If
* the input character sequence is legal but cannot be mapped to a valid
* byte sequence in the given charset then an <i>unmappable character</i> has been encountered.
*
- * <a name="cae">
+ * <a name="cae"></a>
*
* <p> How an encoding error is handled depends upon the action requested for
- * that type of error, which is described by an instance of the {@link
- * CodingErrorAction} class. The possible error actions are to {@link
- * CodingErrorAction#IGNORE </code>ignore<code>} the erroneous input, {@link
- * CodingErrorAction#REPORT </code>report<code>} the error to the invoker via
- * the returned {@link CoderResult} object, or {@link CodingErrorAction#REPLACE
- * </code>replace<code>} the erroneous input with the current value of the
+ * that type of error, which is described by an instance of the {@linkplain
+ * CodingErrorAction} class. The possible error actions are to {@linkplain
+ * CodingErrorAction#IGNORE ignore} the erroneous input, {@link
+ * CodingErrorAction#REPORT report} the error to the invoker via
+ * the returned {@link CoderResult} object, or {@linkplain CodingErrorAction#REPLACE
+ * replace} the erroneous input with the current value of the
* replacement byte array. The replacement
*
@@ -106,7 +107,7 @@ import java.nio.charset.CoderMalfunctionError; // javadoc
* replaceWith} method.
*
* <p> The default action for malformed-input and unmappable-character errors
- * is to {@link CodingErrorAction#REPORT </code>report<code>} them. The
+ * is to {@linkplain CodingErrorAction#REPORT report} them. The
* malformed-input error action may be changed via the {@link
* #onMalformedInput(CodingErrorAction) onMalformedInput} method; the
* unmappable-character action may be changed via the {@link
@@ -161,7 +162,10 @@ public abstract class CharsetEncoder {
/**
* Initializes a new encoder. The new encoder will have the given
- * bytes-per-char and replacement values. </p>
+ * bytes-per-char and replacement values.
+ *
+ * @param cs
+ * The charset that created this encoder
*
* @param averageBytesPerChar
* A positive float value indicating the expected number of
@@ -174,7 +178,7 @@ public abstract class CharsetEncoder {
* @param replacement
* The initial replacement; must not be <tt>null</tt>, must have
* non-zero length, must not be longer than maxBytesPerChar,
- * and must be {@link #isLegalReplacement </code>legal<code>}
+ * and must be {@linkplain #isLegalReplacement legal}
*
* @throws IllegalArgumentException
* If the preconditions on the parameters do not hold
@@ -224,7 +228,10 @@ public abstract class CharsetEncoder {
/**
* Initializes a new encoder. The new encoder will have the given
* bytes-per-char values and its replacement will be the
- * byte array <tt>{</tt>&nbsp;<tt>(byte)'?'</tt>&nbsp;<tt>}</tt>. </p>
+ * byte array <tt>{</tt>&nbsp;<tt>(byte)'?'</tt>&nbsp;<tt>}</tt>.
+ *
+ * @param cs
+ * The charset that created this encoder
*
* @param averageBytesPerChar
* A positive float value indicating the expected number of
@@ -247,7 +254,7 @@ public abstract class CharsetEncoder {
}
/**
- * Returns the charset that created this encoder. </p>
+ * Returns the charset that created this encoder.
*
* @return This encoder's charset
*/
@@ -256,13 +263,13 @@ public abstract class CharsetEncoder {
}
/**
- * Returns this encoder's replacement value. </p>
+ * Returns this encoder's replacement value.
*
* @return This encoder's current replacement,
* which is never <tt>null</tt> and is never empty
*/
public final byte[] replacement() {
- return replacement;
+ return Arrays.copyOf(replacement, replacement.length);
}
/**
@@ -272,7 +279,7 @@ public abstract class CharsetEncoder {
* method, passing the new replacement, after checking that the new
* replacement is acceptable. </p>
*
- * @param newReplacement
+ * @param newReplacement The replacement value
*
@@ -282,7 +289,7 @@ public abstract class CharsetEncoder {
* The new replacement; must not be <tt>null</tt>, must have
* non-zero length, must not be longer than the value returned by
* the {@link #maxBytesPerChar() maxBytesPerChar} method, and
- * must be {@link #isLegalReplacement </code>legal<code>}
+ * must be {@link #isLegalReplacement legal}
*
* @return This encoder
@@ -299,11 +306,15 @@ public abstract class CharsetEncoder {
if (len > maxBytesPerChar)
throw new IllegalArgumentException("Replacement too long");
+
+
+
if (!isLegalReplacement(newReplacement))
throw new IllegalArgumentException("Illegal replacement");
+ this.replacement = Arrays.copyOf(newReplacement, newReplacement.length);
this.replacement = newReplacement;
- implReplaceWith(newReplacement);
+ implReplaceWith(this.replacement);
return this;
}
@@ -314,7 +325,7 @@ public abstract class CharsetEncoder {
* should be overridden by encoders that require notification of changes to
* the replacement. </p>
*
- * @param newReplacement
+ * @param newReplacement The replacement value
*/
protected void implReplaceWith(byte[] newReplacement) {
}
@@ -360,7 +371,7 @@ public abstract class CharsetEncoder {
/**
- * Returns this encoder's current action for malformed-input errors. </p>
+ * Returns this encoder's current action for malformed-input errors.
*
* @return The current malformed-input action, which is never <tt>null</tt>
*/
@@ -369,7 +380,7 @@ public abstract class CharsetEncoder {
}
/**
- * Changes this encoder's action for malformed-input errors. </p>
+ * Changes this encoder's action for malformed-input errors.
*
* <p> This method invokes the {@link #implOnMalformedInput
* implOnMalformedInput} method, passing the new action. </p>
@@ -395,12 +406,13 @@ public abstract class CharsetEncoder {
* <p> The default implementation of this method does nothing. This method
* should be overridden by encoders that require notification of changes to
* the malformed-input action. </p>
+ *
+ * @param newAction The new action
*/
protected void implOnMalformedInput(CodingErrorAction newAction) { }
/**
* Returns this encoder's current action for unmappable-character errors.
- * </p>
*
* @return The current unmappable-character action, which is never
* <tt>null</tt>
@@ -438,13 +450,15 @@ public abstract class CharsetEncoder {
* <p> The default implementation of this method does nothing. This method
* should be overridden by encoders that require notification of changes to
* the unmappable-character action. </p>
+ *
+ * @param newAction The new action
*/
protected void implOnUnmappableCharacter(CodingErrorAction newAction) { }
/**
* Returns the average number of bytes that will be produced for each
* character of input. This heuristic value may be used to estimate the size
- * of the output buffer required for a given input sequence. </p>
+ * of the output buffer required for a given input sequence.
*
* @return The average number of bytes produced
* per character of input
@@ -456,7 +470,7 @@ public abstract class CharsetEncoder {
/**
* Returns the maximum number of bytes that will be produced for each
* character of input. This value may be used to compute the worst-case size
- * of the output buffer required for a given input sequence. </p>
+ * of the output buffer required for a given input sequence.
*
* @return The maximum number of bytes that will be produced per
* character of input
@@ -495,24 +509,24 @@ public abstract class CharsetEncoder {
* typically done by draining any encoded bytes from the output
* buffer. </p></li>
*
- * <li><p> A {@link CoderResult#malformedForLength
- * </code>malformed-input<code>} result indicates that a malformed-input
+ * <li><p> A {@linkplain CoderResult#malformedForLength
+ * malformed-input} result indicates that a malformed-input
* error has been detected. The malformed characters begin at the input
* buffer's (possibly incremented) position; the number of malformed
* characters may be determined by invoking the result object's {@link
* CoderResult#length() length} method. This case applies only if the
- * {@link #onMalformedInput </code>malformed action<code>} of this encoder
+ * {@linkplain #onMalformedInput malformed action} of this encoder
* is {@link CodingErrorAction#REPORT}; otherwise the malformed input
* will be ignored or replaced, as requested. </p></li>
*
- * <li><p> An {@link CoderResult#unmappableForLength
- * </code>unmappable-character<code>} result indicates that an
+ * <li><p> An {@linkplain CoderResult#unmappableForLength
+ * unmappable-character} result indicates that an
* unmappable-character error has been detected. The characters that
* encode the unmappable character begin at the input buffer's (possibly
* incremented) position; the number of such characters may be determined
* by invoking the result object's {@link CoderResult#length() length}
- * method. This case applies only if the {@link #onUnmappableCharacter
- * </code>unmappable action<code>} of this encoder is {@link
+ * method. This case applies only if the {@linkplain #onUnmappableCharacter
+ * unmappable action} of this encoder is {@link
* CodingErrorAction#REPORT}; otherwise the unmappable character will be
* ignored or replaced, as requested. </p></li>
*
@@ -943,6 +957,9 @@ public abstract class CharsetEncoder {
* <p> The default implementation of this method is not very efficient; it
* should generally be overridden to improve performance. </p>
*
+ * @param c
+ * The given character
+ *
* @return <tt>true</tt> if, and only if, this encoder can encode
* the given character
*
@@ -971,6 +988,9 @@ public abstract class CharsetEncoder {
* <p> The default implementation of this method is not very efficient; it
* should generally be overridden to improve performance. </p>
*
+ * @param cs
+ * The given character sequence
+ *
* @return <tt>true</tt> if, and only if, this encoder can encode
* the given character without throwing any exceptions and without
* performing any replacements
diff --git a/ojluni/src/main/java/java/nio/charset/CoderResult.java b/ojluni/src/main/java/java/nio/charset/CoderResult.java
index 00f29db07e..d087c9799a 100644
--- a/ojluni/src/main/java/java/nio/charset/CoderResult.java
+++ b/ojluni/src/main/java/java/nio/charset/CoderResult.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2013, 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
@@ -71,7 +71,7 @@ import java.util.HashMap;
*
* </ul>
*
- * For convenience, the {@link #isError() isError} method returns <tt>true</tt>
+ * <p> For convenience, the {@link #isError() isError} method returns <tt>true</tt>
* for result objects that describe malformed-input and unmappable-character
* errors but <tt>false</tt> for those that describe underflow or overflow
* conditions. </p>
@@ -112,7 +112,7 @@ public class CoderResult {
}
/**
- * Tells whether or not this object describes an underflow condition. </p>
+ * Tells whether or not this object describes an underflow condition.
*
* @return <tt>true</tt> if, and only if, this object denotes underflow
*/
@@ -121,7 +121,7 @@ public class CoderResult {
}
/**
- * Tells whether or not this object describes an overflow condition. </p>
+ * Tells whether or not this object describes an overflow condition.
*
* @return <tt>true</tt> if, and only if, this object denotes overflow
*/
@@ -130,7 +130,7 @@ public class CoderResult {
}
/**
- * Tells whether or not this object describes an error condition. </p>
+ * Tells whether or not this object describes an error condition.
*
* @return <tt>true</tt> if, and only if, this object denotes either a
* malformed-input error or an unmappable-character error
@@ -141,7 +141,6 @@ public class CoderResult {
/**
* Tells whether or not this object describes a malformed-input error.
- * </p>
*
* @return <tt>true</tt> if, and only if, this object denotes a
* malformed-input error
@@ -152,7 +151,7 @@ public class CoderResult {
/**
* Tells whether or not this object describes an unmappable-character
- * error. </p>
+ * error.
*
* @return <tt>true</tt> if, and only if, this object denotes an
* unmappable-character error
@@ -163,7 +162,7 @@ public class CoderResult {
/**
* Returns the length of the erroneous input described by this
- * object&nbsp;&nbsp;<i>(optional operation)</i>. </p>
+ * object&nbsp;&nbsp;<i>(optional operation)</i>.
*
* @return The length of the erroneous input, a positive integer
*
@@ -180,14 +179,14 @@ public class CoderResult {
/**
* Result object indicating underflow, meaning that either the input buffer
* has been completely consumed or, if the input buffer is not yet empty,
- * that additional input is required. </p>
+ * that additional input is required.
*/
public static final CoderResult UNDERFLOW
= new CoderResult(CR_UNDERFLOW, 0);
/**
* Result object indicating overflow, meaning that there is insufficient
- * room in the output buffer. </p>
+ * room in the output buffer.
*/
public static final CoderResult OVERFLOW
= new CoderResult(CR_OVERFLOW, 0);
@@ -226,7 +225,10 @@ public class CoderResult {
/**
* Static factory method that returns the unique object describing a
- * malformed-input error of the given length. </p>
+ * malformed-input error of the given length.
+ *
+ * @param length
+ * The given length
*
* @return The requested coder-result object
*/
@@ -242,7 +244,10 @@ public class CoderResult {
/**
* Static factory method that returns the unique result object describing
- * an unmappable-character error of the given length. </p>
+ * an unmappable-character error of the given length.
+ *
+ * @param length
+ * The given length
*
* @return The requested coder-result object
*/
@@ -252,7 +257,6 @@ public class CoderResult {
/**
* Throws an exception appropriate to the result described by this object.
- * </p>
*
* @throws BufferUnderflowException
* If this object is {@link #UNDERFLOW}
diff --git a/ojluni/src/main/java/java/nio/charset/CodingErrorAction.java b/ojluni/src/main/java/java/nio/charset/CodingErrorAction.java
index 8c9cb2193b..c708e634de 100644
--- a/ojluni/src/main/java/java/nio/charset/CodingErrorAction.java
+++ b/ojluni/src/main/java/java/nio/charset/CodingErrorAction.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2013, 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
@@ -50,7 +50,7 @@ public class CodingErrorAction {
/**
* Action indicating that a coding error is to be handled by dropping the
- * erroneous input and resuming the coding operation. </p>
+ * erroneous input and resuming the coding operation.
*/
public static final CodingErrorAction IGNORE
= new CodingErrorAction("IGNORE");
@@ -58,7 +58,7 @@ public class CodingErrorAction {
/**
* Action indicating that a coding error is to be handled by dropping the
* erroneous input, appending the coder's replacement value to the output
- * buffer, and resuming the coding operation. </p>
+ * buffer, and resuming the coding operation.
*/
public static final CodingErrorAction REPLACE
= new CodingErrorAction("REPLACE");
@@ -73,7 +73,7 @@ public class CodingErrorAction {
= new CodingErrorAction("REPORT");
/**
- * Returns a string describing this action. </p>
+ * Returns a string describing this action.
*
* @return A descriptive string
*/
diff --git a/ojluni/src/main/java/java/nio/charset/MalformedInputException.java b/ojluni/src/main/java/java/nio/charset/MalformedInputException.java
index ba1d1018a5..aadbadccc2 100644
--- a/ojluni/src/main/java/java/nio/charset/MalformedInputException.java
+++ b/ojluni/src/main/java/java/nio/charset/MalformedInputException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, 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
@@ -42,14 +42,27 @@ public class MalformedInputException
private int inputLength;
+ /**
+ * Constructs an {@code MalformedInputException} with the given
+ * length.
+ * @param inputLength the length of the input
+ */
public MalformedInputException(int inputLength) {
this.inputLength = inputLength;
}
+ /**
+ * Returns the length of the input.
+ * @return the length of the input
+ */
public int getInputLength() {
return inputLength;
}
+ /**
+ * Returns the message.
+ * @return the message
+ */
public String getMessage() {
return "Input length = " + inputLength;
}
diff --git a/ojluni/src/main/java/java/nio/charset/UnmappableCharacterException.java b/ojluni/src/main/java/java/nio/charset/UnmappableCharacterException.java
index 4af924fd1f..c33f0404b6 100644
--- a/ojluni/src/main/java/java/nio/charset/UnmappableCharacterException.java
+++ b/ojluni/src/main/java/java/nio/charset/UnmappableCharacterException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@ package java.nio.charset;
/**
* Checked exception thrown when an input character (or byte) sequence
* is valid but cannot be mapped to an output byte (or character)
- * sequence. </p>
+ * sequence.
*
* @since 1.4
*/
@@ -42,14 +42,27 @@ public class UnmappableCharacterException
private int inputLength;
+ /**
+ * Constructs an {@code UnmappableCharacterException} with the
+ * given length.
+ * @param inputLength the length of the input
+ */
public UnmappableCharacterException(int inputLength) {
this.inputLength = inputLength;
}
+ /**
+ * Returns the length of the input.
+ * @return the length of the input
+ */
public int getInputLength() {
return inputLength;
}
+ /**
+ * Returns the message.
+ * @return the message
+ */
public String getMessage() {
return "Input length = " + inputLength;
}
diff --git a/ojluni/src/main/java/java/nio/charset/spi/CharsetProvider.java b/ojluni/src/main/java/java/nio/charset/spi/CharsetProvider.java
index a4d646a86e..f7821e71c5 100644
--- a/ojluni/src/main/java/java/nio/charset/spi/CharsetProvider.java
+++ b/ojluni/src/main/java/java/nio/charset/spi/CharsetProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, 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
@@ -39,8 +39,8 @@ import java.util.Iterator;
* the usual extension directories. Providers may also be made available by
* adding them to the applet or application class path or by some other
* platform-specific means. Charset providers are looked up via the current
- * thread's {@link java.lang.Thread#getContextClassLoader() </code>context
- * class loader<code>}.
+ * thread's {@link java.lang.Thread#getContextClassLoader() context class
+ * loader}.
*
* <p> A charset provider identifies itself with a provider-configuration file
* named <tt>java.nio.charset.spi.CharsetProvider</tt> in the resource
@@ -72,7 +72,7 @@ import java.util.Iterator;
public abstract class CharsetProvider {
/**
- * Initializes a new charset provider. </p>
+ * Initializes a new charset provider.
*
* @throws SecurityException
* If a security manager has been installed and it denies
@@ -88,14 +88,14 @@ public abstract class CharsetProvider {
* Creates an iterator that iterates over the charsets supported by this
* provider. This method is used in the implementation of the {@link
* java.nio.charset.Charset#availableCharsets Charset.availableCharsets}
- * method. </p>
+ * method.
*
* @return The new iterator
*/
public abstract Iterator<Charset> charsets();
/**
- * Retrieves a charset for the given charset name. </p>
+ * Retrieves a charset for the given charset name.
*
* @param charsetName
* The name of the requested charset; may be either
diff --git a/ojluni/src/main/java/sun/security/jca/GetInstance.java b/ojluni/src/main/java/sun/security/jca/GetInstance.java
index c1d20ea34c..85ca272edf 100644
--- a/ojluni/src/main/java/sun/security/jca/GetInstance.java
+++ b/ojluni/src/main/java/sun/security/jca/GetInstance.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, 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
@@ -149,7 +149,7 @@ public class GetInstance {
* There are overloaded methods for all the permutations.
*/
- public static Instance getInstance(String type, Class clazz,
+ public static Instance getInstance(String type, Class<?> clazz,
String algorithm) throws NoSuchAlgorithmException {
// in the almost all cases, the first service will work
// avoid taking long path if so
@@ -165,7 +165,7 @@ public class GetInstance {
} catch (NoSuchAlgorithmException e) {
failure = e;
}
- // if we cannot get the service from the prefered provider,
+ // if we cannot get the service from the preferred provider,
// fail over to the next
for (Service s : list.getServices(type, algorithm)) {
if (s == firstService) {
@@ -181,7 +181,7 @@ public class GetInstance {
throw failure;
}
- public static Instance getInstance(String type, Class clazz,
+ public static Instance getInstance(String type, Class<?> clazz,
String algorithm, Object param) throws NoSuchAlgorithmException {
List<Service> services = getServices(type, algorithm);
NoSuchAlgorithmException failure = null;
@@ -200,25 +200,25 @@ public class GetInstance {
}
}
- public static Instance getInstance(String type, Class clazz,
+ public static Instance getInstance(String type, Class<?> clazz,
String algorithm, String provider) throws NoSuchAlgorithmException,
NoSuchProviderException {
return getInstance(getService(type, algorithm, provider), clazz);
}
- public static Instance getInstance(String type, Class clazz,
+ public static Instance getInstance(String type, Class<?> clazz,
String algorithm, Object param, String provider)
throws NoSuchAlgorithmException, NoSuchProviderException {
return getInstance(getService(type, algorithm, provider), clazz, param);
}
- public static Instance getInstance(String type, Class clazz,
+ public static Instance getInstance(String type, Class<?> clazz,
String algorithm, Provider provider)
throws NoSuchAlgorithmException {
return getInstance(getService(type, algorithm, provider), clazz);
}
- public static Instance getInstance(String type, Class clazz,
+ public static Instance getInstance(String type, Class<?> clazz,
String algorithm, Object param, Provider provider)
throws NoSuchAlgorithmException {
return getInstance(getService(type, algorithm, provider), clazz, param);
@@ -231,14 +231,14 @@ public class GetInstance {
* Signature class.
*/
- public static Instance getInstance(Service s, Class clazz)
+ public static Instance getInstance(Service s, Class<?> clazz)
throws NoSuchAlgorithmException {
Object instance = s.newInstance(null);
checkSuperClass(s, instance.getClass(), clazz);
return new Instance(s.getProvider(), instance);
}
- public static Instance getInstance(Service s, Class clazz,
+ public static Instance getInstance(Service s, Class<?> clazz,
Object param) throws NoSuchAlgorithmException {
Object instance = s.newInstance(param);
checkSuperClass(s, instance.getClass(), clazz);
@@ -249,8 +249,8 @@ public class GetInstance {
* Check is subClass is a subclass of superClass. If not,
* throw a NoSuchAlgorithmException.
*/
- public static void checkSuperClass(Service s, Class subClass,
- Class superClass) throws NoSuchAlgorithmException {
+ public static void checkSuperClass(Service s, Class<?> subClass,
+ Class<?> superClass) throws NoSuchAlgorithmException {
if (superClass == null) {
return;
}
diff --git a/ojluni/src/main/java/sun/security/jca/Providers.java b/ojluni/src/main/java/sun/security/jca/Providers.java
index 2212dc2fd0..18e75ce4b4 100644
--- a/ojluni/src/main/java/sun/security/jca/Providers.java
+++ b/ojluni/src/main/java/sun/security/jca/Providers.java
@@ -26,10 +26,7 @@
package sun.security.jca;
-import java.util.*;
-
import java.security.Provider;
-import java.security.Security;
/**
* Collection of methods to get and set provider list. Also includes
@@ -112,11 +109,11 @@ public class Providers {
// sun.security.util.ManifestEntryVerifier and java.security.SecureRandom.
public static Provider getSunProvider() {
try {
- Class clazz = Class.forName(jarVerificationProviders[0]);
+ Class<?> clazz = Class.forName(jarVerificationProviders[0]);
return (Provider)clazz.newInstance();
} catch (Exception e) {
try {
- Class clazz = Class.forName(BACKUP_PROVIDER_CLASSNAME);
+ Class<?> clazz = Class.forName(BACKUP_PROVIDER_CLASSNAME);
return (Provider)clazz.newInstance();
} catch (Exception ee) {
throw new RuntimeException("Sun provider not found", e);