You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2021/01/11 05:53:00 UTC
[commons-io] 02/02: Add unchecked exception to a method signature
and Javadoc, preserves BC since it is unchecked.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git
commit 09bda53aed9728ccb235fa7622e981e47cd943a0
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jan 11 00:52:53 2021 -0500
Add unchecked exception to a method signature and Javadoc, preserves BC
since it is unchecked.
---
src/main/java/org/apache/commons/io/Charsets.java | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/main/java/org/apache/commons/io/Charsets.java b/src/main/java/org/apache/commons/io/Charsets.java
index ecd408b..12c6b8c 100644
--- a/src/main/java/org/apache/commons/io/Charsets.java
+++ b/src/main/java/org/apache/commons/io/Charsets.java
@@ -18,6 +18,7 @@ package org.apache.commons.io;
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 class Charsets {
/**
* 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);
}