Avoid UnsupportedEncodingException & use const from StandardCharsets (#11948)
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
committed by
GitHub
parent
3f54327d5a
commit
167f8ebc49
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
package org.openhab.binding.powermax.internal.state;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
@@ -364,11 +364,7 @@ public class PowermaxPanelSettings {
|
||||
break;
|
||||
default:
|
||||
if ((data[i] & 0x000000FF) >= 0x20) {
|
||||
try {
|
||||
result += new String(data, i, 1, "US-ASCII");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
logger.debug("Unhandled character code {}", data[i]);
|
||||
}
|
||||
result += new String(data, i, 1, StandardCharsets.US_ASCII);
|
||||
} else {
|
||||
logger.debug("Unhandled character code {}", data[i]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user