Skip to content

Commit

Permalink
Switched to static analysis tool 0.0.3 (openhab#2104)
Browse files Browse the repository at this point in the history
Removed further logger messages that are not constants (related to openhab#2088)

Signed-off-by: Kai Kreuzer <kai@openhab.org>
  • Loading branch information
kaikreuzer authored and Markinus committed Jul 2, 2017
1 parent 8334102 commit 7bde585
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ private void handleMatrixResetResponse(String resp) {
* @param resp the possibly null, possibly empty actual response
*/
private void handleCommandFailure(String resp) {
logger.info(resp);
logger.info("{}", resp);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ private void sendDiscoveryMessage(String discoverString) {
} catch (IOException e) {
logger.debug("IO error during HarmonyHub discovery: {}", e.getMessage());
} catch (Exception e) {
logger.debug(e.getMessage(), e);
logger.debug("{}", e.getMessage(), e);
}
logger.trace("Request packet sent to: {} Interface: {}", bc.getHostAddress(),
networkInterface.getDisplayName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ private void updateChannel() {

updateThing(thingBuilder.build());
} catch (Exception e) {
logger.debug("Could not add button channels to device " + logName, e);
logger.debug("Could not add button channels to device {}", logName, e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public void run() {
updateStatus(ThingStatus.ONLINE);
buildChannel();
} catch (Exception e) {
logger.error("Could not connect to HarmonyHub at " + host, e);
logger.debug("Could not connect to HarmonyHub at {}", host, e);
setOfflineAndReconnect("Could not connect: " + e.getMessage());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private void receiveUdpCommandResponse() {
bcReceipt.close();
}
} catch (Exception e) {
logger.debug(e.toString());
logger.debug("{}", e.getMessage());
}
}
}
Expand Down Expand Up @@ -205,7 +205,7 @@ private void sendUdpCommand(String commandString, String ipAddress) {
} catch (IOException e) {
logger.debug("IO error during MAX! Cube UDP command sending: {}", e.getMessage());
} catch (Exception e) {
logger.info(e.getMessage(), e);
logger.info("{}", e.getMessage(), e);
}
logger.trace("Request packet sent to: {} Interface: {}", bc.getHostAddress(),
networkInterface.getDisplayName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public static Device update(byte[] raw, List<DeviceConfiguration> configurations

break;
default:
logger.debug("Unhandled Device. DataBytes: " + Utils.getHex(raw));
logger.debug("Unhandled Device. DataBytes: {}", Utils.getHex(raw));
break;

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ private void receiveDiscoveryMessage() {
bcReceipt.close();
}
} catch (Exception e) {
logger.debug(e.toString());
logger.debug("{}", e.toString());
}
}
}
Expand Down Expand Up @@ -231,7 +231,7 @@ private void sendDiscoveryMessage(String discoverString) {
} catch (IOException e) {
logger.debug("IO error during MAX! Cube discovery: {}", e.getMessage());
} catch (Exception e) {
logger.info(e.getMessage(), e);
logger.info("{}", e.getMessage(), e);
}
logger.trace("Request packet sent to: {} Interface: {}", bc.getHostAddress(),
networkInterface.getDisplayName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private String parseData(byte[] bytes) {
for (int i = 0; i < sn.length; i++) {
sn[i] = bytes[i + DataStart];
}
logger.trace("DataBytes: " + Utils.getHex(sn));
logger.trace("DataBytes: {}", Utils.getHex(sn));
try {
return new String(sn, "UTF-8");
} catch (UnsupportedEncodingException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public Collection<? extends Device> updateDevices(List<Device> devices, List<Dev
@Override
public void debug(Logger logger) {
logger.trace("=== L_Message === ");
logger.trace("\tRAW:" + this.getPayload());
logger.trace("\tRAW: {}", this.getPayload());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,28 @@
import org.eclipse.smarthome.core.types.State;
import org.openhab.io.imperihome.internal.ImperiHomeConfig;
import org.openhab.io.imperihome.internal.action.ActionRegistry;
import org.openhab.io.imperihome.internal.model.device.*;
import org.openhab.io.imperihome.internal.model.device.AbstractDevice;
import org.openhab.io.imperihome.internal.model.device.AbstractNumericValueDevice;
import org.openhab.io.imperihome.internal.model.device.Co2SensorDevice;
import org.openhab.io.imperihome.internal.model.device.DeviceType;
import org.openhab.io.imperihome.internal.model.device.DimmerDevice;
import org.openhab.io.imperihome.internal.model.device.ElectricityDevice;
import org.openhab.io.imperihome.internal.model.device.GenericSensorDevice;
import org.openhab.io.imperihome.internal.model.device.HygrometryDevice;
import org.openhab.io.imperihome.internal.model.device.LockDevice;
import org.openhab.io.imperihome.internal.model.device.LuminosityDevice;
import org.openhab.io.imperihome.internal.model.device.MultiSwitchDevice;
import org.openhab.io.imperihome.internal.model.device.NoiseDevice;
import org.openhab.io.imperihome.internal.model.device.PressureDevice;
import org.openhab.io.imperihome.internal.model.device.RainDevice;
import org.openhab.io.imperihome.internal.model.device.RgbLightDevice;
import org.openhab.io.imperihome.internal.model.device.SceneDevice;
import org.openhab.io.imperihome.internal.model.device.SwitchDevice;
import org.openhab.io.imperihome.internal.model.device.TempHygroDevice;
import org.openhab.io.imperihome.internal.model.device.TemperatureDevice;
import org.openhab.io.imperihome.internal.model.device.TrippableDevice;
import org.openhab.io.imperihome.internal.model.device.UvDevice;
import org.openhab.io.imperihome.internal.model.device.WindDevice;
import org.openhab.io.imperihome.internal.model.param.DeviceParam;
import org.openhab.io.imperihome.internal.model.param.ParamType;
import org.openhab.io.imperihome.internal.util.DigestUtil;
Expand All @@ -51,7 +72,8 @@ public class ItemProcessor implements ItemRegistryChangeListener {
private final ActionRegistry actionRegistry;
private final ImperiHomeConfig config;

public ItemProcessor(ItemRegistry itemRegistry, DeviceRegistry deviceRegistry, ActionRegistry actionRegistry, ImperiHomeConfig config) {
public ItemProcessor(ItemRegistry itemRegistry, DeviceRegistry deviceRegistry, ActionRegistry actionRegistry,
ImperiHomeConfig config) {
this.itemRegistry = itemRegistry;
this.deviceRegistry = deviceRegistry;
this.actionRegistry = actionRegistry;
Expand Down Expand Up @@ -305,8 +327,8 @@ private Map<TagType, List<String>> getIssTags(Item item) {
if (!tags.containsKey(tagType)) {
tags.put(tagType, new LinkedList<String>());
} else if (!tagType.isMultiValue()) {
logger.error("Found multiple values for tag " + tagType.getPrefix()
+ " - only first value is used");
logger.error("Found multiple values for tag {} - only first value is used",
tagType.getPrefix());
}
tags.get(tagType).add(tagValue);
break;
Expand Down Expand Up @@ -379,8 +401,8 @@ public void allItemsChanged(Collection<String> oldItems) {
}

if (deviceRegistry.hasDevices()) {
logger.warn("There are still Devices left after processing all Items from allItemsChanged(): "
+ deviceRegistry.getDevices());
logger.warn("There are still Devices left after processing all Items from allItemsChanged(): {}",
deviceRegistry.getDevices());
deviceRegistry.clear();
}

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<ohc.version>2.1.0-SNAPSHOT</ohc.version>
<ohcp2.version>2.1.x</ohcp2.version>
<ohdr.version>1.0.10</ohdr.version>
<sat.version>0.0.2</sat.version>
<sat.version>0.0.3</sat.version>
<karaf.version>4.0.8</karaf.version>
<jackson.version>1.9.13</jackson.version>
<tycho-version>1.0.0</tycho-version>
Expand Down

0 comments on commit 7bde585

Please sign in to comment.