Add unchecked exception to a method signature and Javadoc, preserves BC
since it is unchecked.
MODIFY
src/main/java/org/apache/commons/io/Charsets.java
src/main/java/org/apache/commons/io/Charsets.java
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
+import java.nio.charset.UnsupportedCharsetException;
import java.util.Collections;
import java.util.SortedMap;
import java.util.TreeMap;
@@ -102,13 +103,11 @@ public static Charset toCharset(final Charset charset) {
/**
* Returns a Charset for the named charset. If the name is null, return the default Charset.
*
- * @param charsetName
- * The name of the requested charset, may be null.
- * @return a Charset for the named charset
- * @throws java.nio.charset.UnsupportedCharsetException
- * If the named charset is unavailable
+ * @param charsetName The name of the requested charset, may be null.
+ * @return a Charset for the named charset.
+ * @throws UnsupportedCharsetException If the named charset is unavailable (unchecked exception).
*/
- public static Charset toCharset(final String charsetName) {
+ public static Charset toCharset(final String charsetName) throws UnsupportedCharsetException {
return charsetName == null ? Charset.defaultCharset() : Charset.forName(charsetName);
}

Add unchecked exception to a method signature and Javadoc, preserves BC
since it is unchecked.