Convert to and from UTF-8 without catching impossible exceptions.

All JVMs must support UTF-8 encoding.
This commit is contained in:
akwizgran
2014-02-07 22:02:02 +00:00
parent f6360c09d4
commit 4154119ea5
6 changed files with 15 additions and 19 deletions

View File

@@ -307,6 +307,7 @@ class ModemImpl implements Modem, WriteHandler, SerialPortEventListener {
for(int i = 0; i < b.length; i++) {
line[lineLen] = b[i];
if(b[i] == '\n') {
// FIXME: Use CharsetDecoder to catch invalid ASCII
String s = new String(line, 0, lineLen, "US-ASCII").trim();
lineLen = 0;
if(LOG.isLoggable(INFO)) LOG.info("Modem status: " + s);