java.nio.charset.IllegalCharsetNameException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • RestTemplate in android
    via Stack Overflow by Bartosz Czyżowski
    ,
  • Fetching URL response through coding in java
    via Stack Overflow by Phoenix
    ,
  • Accoring to RFC 2045, the following is a valid content type response header: ---- Content-Type: application/xml;charset="utf-8" ---- Trying to access a resource that serves such a header (through RestTemplate) throws the following exception: ---- Exception in thread "main" java.nio.charset.IllegalCharsetNameException: "utf-8" at java.nio.charset.Charset.checkName(Charset.java:284) at java.nio.charset.Charset.lookup2(Charset.java:458) at java.nio.charset.Charset.lookup(Charset.java:437) at java.nio.charset.Charset.forName(Charset.java:502) at org.springframework.http.MediaType.checkParameters(MediaType.java:300) at org.springframework.http.MediaType.<init>(MediaType.java:266) at org.springframework.http.MediaType.parseMediaType(MediaType.java:570) at org.springframework.http.HttpHeaders.getContentType(HttpHeaders.java:286) at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:64) at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:619) at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:1) at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:446) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:401) at org.springframework.web.client.RestTemplate.getForEntity(RestTemplate.java:221) <...user code...> ---- I assume MediaType is simply missing the logic to optionally unwrap the value.
    via by Taras Tielkes,
  • Accoring to RFC 2045, the following is a valid content type response header: ---- Content-Type: application/xml;charset="utf-8" ---- Trying to access a resource that serves such a header (through RestTemplate) throws the following exception: ---- Exception in thread "main" java.nio.charset.IllegalCharsetNameException: "utf-8" at java.nio.charset.Charset.checkName(Charset.java:284) at java.nio.charset.Charset.lookup2(Charset.java:458) at java.nio.charset.Charset.lookup(Charset.java:437) at java.nio.charset.Charset.forName(Charset.java:502) at org.springframework.http.MediaType.checkParameters(MediaType.java:300) at org.springframework.http.MediaType.<init>(MediaType.java:266) at org.springframework.http.MediaType.parseMediaType(MediaType.java:570) at org.springframework.http.HttpHeaders.getContentType(HttpHeaders.java:286) at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:64) at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:619) at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:1) at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:446) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:401) at org.springframework.web.client.RestTemplate.getForEntity(RestTemplate.java:221) <...user code...> ---- I assume MediaType is simply missing the logic to optionally unwrap the value.
    via by Taras Tielkes,
    • java.nio.charset.IllegalCharsetNameException: java.nio.charset.CharsetICU[ISO-8859-1] at java.nio.charset.Charset.checkCharsetName(Charset.java:201) at java.nio.charset.Charset.forName(Charset.java:295) at org.springframework.http.MediaType.checkParameters(MediaType.java:300) at org.springframework.http.MediaType.<init>(MediaType.java:266) at org.springframework.http.MediaType.<init>(MediaType.java:219) at org.springframework.http.converter.StringHttpMessageConverter.<init>(StringHttpMessageConverter.java:51) at org.springframework.web.client.RestTemplate.<init>(RestTemplate.java:139) at com.bczyzowski.locator.MainActivity.authorization(MainActivity.java:51) at com.bczyzowski.locator.MainActivity.access$200(MainActivity.java:22) at com.bczyzowski.locator.MainActivity$1.onClick(MainActivity.java:41) at android.view.View.performClick(View.java:5198) at android.view.View$PerformClick.run(View.java:21147) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

    Users with the same issue

    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,