eclipse-paho / paho.mqtt.java

Eclipse Paho Java MQTT client library. Paho is an Eclipse IoT project.
https://eclipse.org/paho
Other
2.15k stars 893 forks source link

java.lang.RuntimeException: java.nio.charset.IllegalCharsetNameException: java.nio.charset.CharsetICU[UTF-8] #688

Open galla-devlop opened 5 years ago

galla-devlop commented 5 years ago

OS and version used: Android 6.0.1 Java runtime used: Java 8 SDK version used: IOT service client 1.17.1 (implementation group: 'com.microsoft.azure.sdk.iot', name: 'iot-service-client', version: '1.17.1')

twinClient.getTwin(device) throws the following exception

java.lang.RuntimeException: java.nio.charset.IllegalCharsetNameException: java.nio.charset.CharsetICU[UTF-8] at com.microsoft.azure.sdk.iot.service.auth.IotHubServiceSasToken.buildToken(IotHubServiceSasToken.java:107) at com.microsoft.azure.sdk.iot.service.auth.IotHubServiceSasToken.(IotHubServiceSasToken.java:66) at com.microsoft.azure.sdk.iot.service.devicetwin.DeviceOperations.request(DeviceOperations.java:90) at com.microsoft.azure.sdk.iot.service.devicetwin.DeviceTwin.getTwinOperation(DeviceTwin.java:107) at com.microsoft.azure.sdk.iot.service.devicetwin.DeviceTwin.getTwin(DeviceTwin.java:88) The crash occurs only for Java 8. The exception is caused at line number 80 in the class IotHubServiceSasToken.java due to the following statement: String.valueOf(StandardCharsets.UTF_8)); Using StandardCharsets.UTF_8.displayName() would prevent the exception.

However since I need to use Java 8, is there a work around to get this working?

miketran78727 commented 5 years ago

This problem is within the Microsoft package that you are using:

com.microsoft.azure.sdk.iot.service.auth.IotHubServiceSasToken.buildToken(IotHubServiceSasToken.java:107)