Skip to content

Commit

Permalink
fix checkstyle warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Hans Böhm <h.boehm@gmx.at>
  • Loading branch information
boehan committed Aug 15, 2020
1 parent e6bc676 commit 482b038
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,6 @@ public int getReadReplyDataBits() {
* ComfoAirCommand named by key
*/
public static Collection<ComfoAirCommand> getAffectedReadCommands(String key, Set<String> usedKeys) {

Map<Integer, ComfoAirCommand> commands = new HashMap<>();

ComfoAirCommandType commandType = getCommandTypeByKey(key);
Expand All @@ -849,7 +848,6 @@ public static Collection<ComfoAirCommand> getAffectedReadCommands(String key, Se
* @return all ComfoAirCommand's identified by keys
*/
public static Collection<ComfoAirCommand> getReadCommandsByEventTypes(List<String> keys) {

Map<Integer, ComfoAirCommand> commands = new HashMap<>();
for (ComfoAirCommandType entry : values()) {
if (keys.contains(entry.key)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ public class ComfoAirSerialConnector {

private final Logger logger = LoggerFactory.getLogger(ComfoAirSerialConnector.class);

private static byte CTRL = (byte) 0x07;
private static byte[] START = { CTRL, (byte) 0xf0 };
private static byte[] END = { CTRL, (byte) 0x0f };
private static byte[] ACK = { CTRL, (byte) 0xf3 };
private static final byte CTRL = (byte) 0x07;
private static final byte[] START = { CTRL, (byte) 0xf0 };
private static final byte[] END = { CTRL, (byte) 0x0f };
private static final byte[] ACK = { CTRL, (byte) 0xf3 };

private static int RS232_ENABLED_VALUE = 0x03;
private static int RS232_DISABLED_VALUE = 0x00;
private static final int RS232_ENABLED_VALUE = 0x03;
private static final int RS232_DISABLED_VALUE = 0x00;

private boolean isSuspended = true;

Expand Down Expand Up @@ -233,7 +233,6 @@ public synchronized int[] sendCommand(ComfoAirCommand command, int[] preRequestD
&& responseBlock[responseBlock.length - 2] == END[0]
&& responseBlock[responseBlock.length - 1] == END[1]
&& (responseBlock[5] & 0xff) == command.getReplyCmd()) {

if (logger.isTraceEnabled()) {
logger.trace("receive RAW DATA: {}", dumpData(responseBlock));
}
Expand All @@ -245,18 +244,17 @@ public synchronized int[] sendCommand(ComfoAirCommand command, int[] preRequestD
// the cleanedBlock size should equal dataSize + 2 cmd
// bytes and + 1 checksum byte
if (dataSize + 3 == cleanedBlock.length - 1) {

byte checksum = cleanedBlock[dataSize + 3];
int[] replyData = new int[dataSize];
for (int i = 0; i < dataSize; i++) {
replyData[i] = cleanedBlock[i + 3] & 0xff;
}

byte[] _block = Arrays.copyOf(cleanedBlock, 3 + dataSize);
byte[] block = Arrays.copyOf(cleanedBlock, 3 + dataSize);

// validate calculated checksum against submitted
// checksum
if (calculateChecksum(_block) == checksum) {
if (calculateChecksum(block) == checksum) {
if (logger.isTraceEnabled()) {
logger.trace("receive CMD: {} DATA: {}",
String.format("%02x", command.getReplyCmd()), dumpData(replyData));
Expand All @@ -277,13 +275,12 @@ public synchronized int[] sendCommand(ComfoAirCommand command, int[] preRequestD
}
}
}
} catch (IOException ioe) {
if (ioe instanceof InterruptedIOException) {
Thread.currentThread().interrupt();
logger.warn("Transmission was interrupted: {}", ioe.getMessage());
throw new RuntimeException(ioe);
}
logger.debug("IO error: {}", ioe.getMessage());
} catch (InterruptedIOException e) {
Thread.currentThread().interrupt();
logger.warn("Transmission was interrupted: {}", e.getMessage());
throw new RuntimeException(e);
} catch (IOException e) {
logger.debug("IO error: {}", e.getMessage());
}

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
@NonNullByDefault
public class DataTypeBoolean implements ComfoAirDataType {
private static DataTypeBoolean SINGLETON_INSTANCE = new DataTypeBoolean();
private static final DataTypeBoolean SINGLETON_INSTANCE = new DataTypeBoolean();

private DataTypeBoolean() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/
@NonNullByDefault
public class DataTypeMessage implements ComfoAirDataType {
private static DataTypeMessage SINGLETON_INSTANCE = new DataTypeMessage();
private static final DataTypeMessage SINGLETON_INSTANCE = new DataTypeMessage();

private DataTypeMessage() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/
@NonNullByDefault
public class DataTypeNumber implements ComfoAirDataType {
private static DataTypeNumber SINGLETON_INSTANCE = new DataTypeNumber();
private static final DataTypeNumber SINGLETON_INSTANCE = new DataTypeNumber();

private DataTypeNumber() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/
@NonNullByDefault
public class DataTypeRPM implements ComfoAirDataType {
private static DataTypeRPM SINGLETON_INSTANCE = new DataTypeRPM();
private static final DataTypeRPM SINGLETON_INSTANCE = new DataTypeRPM();

private DataTypeRPM() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
@NonNullByDefault
public class DataTypeTemperature implements ComfoAirDataType {
private static DataTypeTemperature SINGLETON_INSTANCE = new DataTypeTemperature();
private static final DataTypeTemperature SINGLETON_INSTANCE = new DataTypeTemperature();

private DataTypeTemperature() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/
@NonNullByDefault
public class DataTypeTime implements ComfoAirDataType {
private static DataTypeTime SINGLETON_INSTANCE = new DataTypeTime();
private static final DataTypeTime SINGLETON_INSTANCE = new DataTypeTime();

private DataTypeTime() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
@NonNullByDefault
public class DataTypeVolt implements ComfoAirDataType {
private static DataTypeVolt SINGLETON_INSTANCE = new DataTypeVolt();
private static final DataTypeVolt SINGLETON_INSTANCE = new DataTypeVolt();

private DataTypeVolt() {
}
Expand Down

0 comments on commit 482b038

Please sign in to comment.