Javadoc.
Add for parameter null checks.
Better private method name.
Format nits.
MODIFY
src/main/java/org/apache/commons/io/IOExceptionList.java
src/main/java/org/apache/commons/io/IOExceptionList.java
@@ -57,7 +57,7 @@ public IOExceptionList(final List<? extends Throwable> causeList) {
}
/**
- * Gets the cause list.
+ * Gets the cause exception at the given index.
*
* @param <T> type of exception to return.
* @param index index in the cause list.
@@ -68,7 +68,7 @@ public IOExceptionList(final List<? extends Throwable> causeList) {
}
/**
- * Gets the cause list.
+ * Gets the cause exception at the given index.
*
* @param <T> type of exception to return.
* @param index index in the cause list.

MODIFY
src/main/java/org/apache/commons/io/IOUtils.java
src/main/java/org/apache/commons/io/IOUtils.java
* @throws NullPointerException if the input parameter is null
* @since 2.5
*/
+ @SuppressWarnings("resource") // parameter null check
public static BufferedInputStream buffer(final InputStream inputStream) {
// reject null early on rather than waiting for IO operation to fail
// not checked by BufferedInputStream
@@ -196,6 +197,7 @@ public static BufferedInputStream buffer(final InputStream inputStream) {
* @throws NullPointerException if the input parameter is null
* @since 2.5
*/
+ @SuppressWarnings("resource") // parameter null check
public static BufferedInputStream buffer(final InputStream inputStream, final int size) {
// reject null early on rather than waiting for IO operation to fail
// not checked by BufferedInputStream
@@ -213,6 +215,7 @@ public static BufferedInputStream buffer(final InputStream inputStream, final in
* @throws NullPointerException if the input parameter is null
* @since 2.5
*/
+ @SuppressWarnings("resource") // parameter null check
public static BufferedOutputStream buffer(final OutputStream outputStream) {
// reject null early on rather than waiting for IO operation to fail
// not checked by BufferedInputStream
@@ -231,6 +234,7 @@ public static BufferedOutputStream buffer(final OutputStream outputStream) {
* @throws NullPointerException if the input parameter is null
* @since 2.5
*/
+ @SuppressWarnings("resource") // parameter null check
public static BufferedOutputStream buffer(final OutputStream outputStream, final int size) {
// reject null early on rather than waiting for IO operation to fail
// not checked by BufferedInputStream

MODIFY
src/main/java/org/apache/commons/io/input/DemuxInputStream.java
src/main/java/org/apache/commons/io/input/DemuxInputStream.java
private final InheritableThreadLocal<InputStream> inputStream = new InheritableThreadLocal<>();
/**
- * Bind the specified stream to the current thread.
+ * Binds the specified stream to the current thread.
*
* @param input the stream to bind
* @return the InputStream that was previously active
@@ -52,7 +52,7 @@ public void close() throws IOException {
}
/**
- * Read byte from stream associated with current thread.
+ * Reads byte from stream associated with current thread.
*
* @return the byte read from stream
* @throws IOException if an error occurs

MODIFY
src/main/java/org/apache/commons/io/input/XmlStreamReader.java
src/main/java/org/apache/commons/io/input/XmlStreamReader.java
@@ -277,7 +277,7 @@ public XmlStreamReader(final URLConnection conn, final String defaultEncoding) t
final BOMInputStream bom = new BOMInputStream(new BufferedInputStream(inputStream, BUFFER_SIZE), false, BOMS);
final BOMInputStream pis = new BOMInputStream(bom, true, XML_GUESS_BYTES);
if (conn instanceof HttpURLConnection || contentType != null) {
- this.encoding = doHttpStream(bom, pis, contentType, lenient);
+ this.encoding = processHttpStream(bom, pis, contentType, lenient);
} else {
this.encoding = doRawStream(bom, pis, lenient);
}
@@ -346,7 +346,7 @@ public XmlStreamReader(final InputStream inputStream, final String httpContentTy
this.defaultEncoding = defaultEncoding;
final BOMInputStream bom = new BOMInputStream(new BufferedInputStream(inputStream, BUFFER_SIZE), false, BOMS);
final BOMInputStream pis = new BOMInputStream(bom, true, XML_GUESS_BYTES);
- this.encoding = doHttpStream(bom, pis, httpContentType, lenient);
+ this.encoding = processHttpStream(bom, pis, httpContentType, lenient);
this.reader = new InputStreamReader(pis, encoding);
}
@@ -456,14 +456,13 @@ private String doRawStream(final BOMInputStream bom, final BOMInputStream pis, f
* @return the encoding to be used
* @throws IOException thrown if there is a problem reading the stream.
*/
- private String doHttpStream(final BOMInputStream bom, final BOMInputStream pis, final String httpContentType,
+ private String processHttpStream(final BOMInputStream bom, final BOMInputStream pis, final String httpContentType,
final boolean lenient) throws IOException {
final String bomEnc = bom.getBOMCharsetName();
final String xmlGuessEnc = pis.getBOMCharsetName();
final String xmlEnc = getXmlProlog(pis, xmlGuessEnc);
try {
- return calculateHttpEncoding(httpContentType, bomEnc,
- xmlGuessEnc, xmlEnc, lenient);
+ return calculateHttpEncoding(httpContentType, bomEnc, xmlGuessEnc, xmlEnc, lenient);
} catch (final XmlStreamReaderException ex) {
if (lenient) {
return doLenientDetection(httpContentType, ex);

- Javadoc.
- Add @SuppressWarnings("resource") for parameter null checks.
- Better private method name.
- Format nits.