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


##########
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:
   The location of this is questionable, as you're adding callers from far 
flung places.  Note ContentStream is deprecated.  I propose 
`org.apache.solr.common.util.IOUtils` as a better home for this.



##########
changelog/unreleased/PR#4606-charset-api-modernization.yml:
##########
@@ -0,0 +1,8 @@
+# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc
+title: Modernize String-based charset APIs to java.nio.charset.Charset; 
invalid client-supplied charset names are still handled as I/O errors
+type: fixed

Review Comment:
   Would a user experience this change as fixed?  If you say so, okay.  
Otherwise I suggest "other".



-- 
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