janhoy commented on code in PR #4606:
URL: https://github.com/apache/solr/pull/4606#discussion_r3520635719


##########
solr/solrj/src/java/org/apache/solr/common/util/ContentStreamBase.java:
##########
@@ -77,6 +78,23 @@ public static String getCharsetFromContentType(String 
contentType) {
     return null;
   }
 
+  /**
+   * Resolves a charset name (typically from a Content-Type header) to a 
{@link Charset}. Unlike
+   * {@link Charset#forName(String)}, an illegal or unsupported name results 
in a checked {@link
+   * UnsupportedEncodingException}, matching the behavior of the legacy {@code 
String}-based JDK
+   * charset APIs, so callers can treat a bad charset as an I/O error.
+   */
+  public static Charset charsetForName(String charsetName) throws 
UnsupportedEncodingException {

Review Comment:
   I had the same concern in the back of my head. IOUtils sounds good 👍



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to