mirror of
https://github.com/danieldemus/openhab-core.git
synced 2026-07-29 12:34:22 +02:00
Fix JavaDoc, SAT and depreacation warnings (#4598)
* Fix SAT and depreacation warnings * Fix JavaDoc build Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
-1
@@ -79,7 +79,6 @@ public final class ConfigParser {
|
|||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
public static <T> @Nullable T configurationAs(Map<String, @Nullable Object> properties,
|
public static <T> @Nullable T configurationAs(Map<String, @Nullable Object> properties,
|
||||||
Class<T> configurationClass) {
|
Class<T> configurationClass) {
|
||||||
|
|
||||||
Constructor<T> constructor;
|
Constructor<T> constructor;
|
||||||
T configuration = null;
|
T configuration = null;
|
||||||
try {
|
try {
|
||||||
|
|||||||
+2
-2
@@ -43,8 +43,8 @@ public class ConfigValidationExceptionTest {
|
|||||||
private static final String PARAM1 = "param1";
|
private static final String PARAM1 = "param1";
|
||||||
private static final String PARAM2 = "param2";
|
private static final String PARAM2 = "param2";
|
||||||
|
|
||||||
private static final Locale DE = new Locale("de");
|
private static final Locale DE = Locale.GERMAN;
|
||||||
private static final Locale EN = new Locale("en");
|
private static final Locale EN = Locale.ENGLISH;
|
||||||
|
|
||||||
private static final int MAX = 3;
|
private static final int MAX = 3;
|
||||||
private static final String TXT_DE1 = "German 1";
|
private static final String TXT_DE1 = "German 1";
|
||||||
|
|||||||
+2
-1
@@ -106,6 +106,7 @@ import org.openhab.core.model.sitemap.sitemap.Widget;
|
|||||||
import org.openhab.core.types.State;
|
import org.openhab.core.types.State;
|
||||||
import org.openhab.core.ui.items.ItemUIRegistry;
|
import org.openhab.core.ui.items.ItemUIRegistry;
|
||||||
import org.openhab.core.ui.items.ItemUIRegistry.WidgetLabelSource;
|
import org.openhab.core.ui.items.ItemUIRegistry.WidgetLabelSource;
|
||||||
|
import org.openhab.core.util.ColorUtil;
|
||||||
import org.osgi.service.component.annotations.Activate;
|
import org.osgi.service.component.annotations.Activate;
|
||||||
import org.osgi.service.component.annotations.Component;
|
import org.osgi.service.component.annotations.Component;
|
||||||
import org.osgi.service.component.annotations.Deactivate;
|
import org.osgi.service.component.annotations.Deactivate;
|
||||||
@@ -745,7 +746,7 @@ public class SitemapResource
|
|||||||
public static @Nullable String convertItemValueColor(@Nullable String color, @Nullable State itemState) {
|
public static @Nullable String convertItemValueColor(@Nullable String color, @Nullable State itemState) {
|
||||||
if ("itemValue".equals(color)) {
|
if ("itemValue".equals(color)) {
|
||||||
if (itemState instanceof HSBType hsbState) {
|
if (itemState instanceof HSBType hsbState) {
|
||||||
return "#" + Integer.toHexString(hsbState.getRGB()).substring(2);
|
return "#" + Integer.toHexString(ColorUtil.hsbTosRgb(hsbState)).substring(2);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -12,6 +12,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.openhab.core.io.transport.modbus.internal;
|
package org.openhab.core.io.transport.modbus.internal;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
|
||||||
import org.apache.commons.pool2.impl.DefaultEvictionPolicy;
|
import org.apache.commons.pool2.impl.DefaultEvictionPolicy;
|
||||||
import org.apache.commons.pool2.impl.EvictionPolicy;
|
import org.apache.commons.pool2.impl.EvictionPolicy;
|
||||||
import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig;
|
import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig;
|
||||||
@@ -51,7 +53,7 @@ public class ModbusPoolConfig extends GenericKeyedObjectPoolConfig<@Nullable Mod
|
|||||||
setMaxTotalPerKey(1);
|
setMaxTotalPerKey(1);
|
||||||
|
|
||||||
// block infinitely when exhausted
|
// block infinitely when exhausted
|
||||||
setMaxWaitMillis(-1);
|
setMaxWait(Duration.ofMillis(-1));
|
||||||
|
|
||||||
// Connections are "tested" on return. Effectively, disconnected connections are destroyed when returning on
|
// Connections are "tested" on return. Effectively, disconnected connections are destroyed when returning on
|
||||||
// pool
|
// pool
|
||||||
@@ -65,7 +67,7 @@ public class ModbusPoolConfig extends GenericKeyedObjectPoolConfig<@Nullable Mod
|
|||||||
|
|
||||||
// Evict idle connections every 10 seconds
|
// Evict idle connections every 10 seconds
|
||||||
setEvictionPolicy(new ModbusSlaveConnectionEvictionPolicy());
|
setEvictionPolicy(new ModbusSlaveConnectionEvictionPolicy());
|
||||||
setTimeBetweenEvictionRunsMillis(10000);
|
setTimeBetweenEvictionRuns(Duration.ofMillis(10000));
|
||||||
// Let eviction re-create ready-to-use idle (=unconnected) connections
|
// Let eviction re-create ready-to-use idle (=unconnected) connections
|
||||||
// This is to avoid occasional / rare deadlocks seen with pool 2.8.1 & 2.4.3 when
|
// This is to avoid occasional / rare deadlocks seen with pool 2.8.1 & 2.4.3 when
|
||||||
// borrow hangs (waiting indefinitely for idle object to appear in the pool)
|
// borrow hangs (waiting indefinitely for idle object to appear in the pool)
|
||||||
|
|||||||
+3
-3
@@ -67,8 +67,8 @@ public class LogWebSocket implements LogListener {
|
|||||||
private static final TypeToken<List<String>> STRING_LIST_TYPE = (TypeToken<List<String>>) TypeToken
|
private static final TypeToken<List<String>> STRING_LIST_TYPE = (TypeToken<List<String>>) TypeToken
|
||||||
.getParameterized(List.class, String.class);
|
.getParameterized(List.class, String.class);
|
||||||
|
|
||||||
private final static int SEND_PERIOD = 100; // Minimum allowable time between log packets (in milliseconds)
|
private static final int SEND_PERIOD = 100; // Minimum allowable time between log packets (in milliseconds)
|
||||||
private final static long FIRST_SEQUENCE = 0;
|
private static final long FIRST_SEQUENCE = 0;
|
||||||
|
|
||||||
private final Logger logger = LoggerFactory.getLogger(LogWebSocket.class);
|
private final Logger logger = LoggerFactory.getLogger(LogWebSocket.class);
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ public class LogWebSocket implements LogListener {
|
|||||||
@OnWebSocketMessage
|
@OnWebSocketMessage
|
||||||
public void onText(String message) {
|
public void onText(String message) {
|
||||||
// Detect empty message (keepalive) and ignore
|
// Detect empty message (keepalive) and ignore
|
||||||
if (message.equals("{}")) {
|
if ("{}".equals(message)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-8
@@ -332,7 +332,7 @@ public class PersistenceExtensions {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Query the last historic update time of a given <code>item</code>. The default persistence service is used.
|
* Query the last historic update time of a given <code>item</code>. The default persistence service is used.
|
||||||
* Note the {@link Item.getLastStateUpdate()} is generally preferred to get the last update time of an item.
|
* Note the {@link Item#getLastStateUpdate()} is generally preferred to get the last update time of an item.
|
||||||
*
|
*
|
||||||
* @param item the item for which the last historic update time is to be returned
|
* @param item the item for which the last historic update time is to be returned
|
||||||
* @return point in time of the last historic update to <code>item</code>, <code>null</code> if there are no
|
* @return point in time of the last historic update to <code>item</code>, <code>null</code> if there are no
|
||||||
@@ -345,7 +345,7 @@ public class PersistenceExtensions {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Query for the last historic update time of a given <code>item</code>.
|
* Query for the last historic update time of a given <code>item</code>.
|
||||||
* Note the {@link Item.getLastStateUpdate()} is generally preferred to get the last update time of an item.
|
* Note the {@link Item#getLastStateUpdate()} is generally preferred to get the last update time of an item.
|
||||||
*
|
*
|
||||||
* @param item the item for which the last historic update time is to be returned
|
* @param item the item for which the last historic update time is to be returned
|
||||||
* @param serviceId the name of the {@link PersistenceService} to use
|
* @param serviceId the name of the {@link PersistenceService} to use
|
||||||
@@ -389,7 +389,7 @@ public class PersistenceExtensions {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Query the last historic change time of a given <code>item</code>. The default persistence service is used.
|
* Query the last historic change time of a given <code>item</code>. The default persistence service is used.
|
||||||
* Note the {@link Item.getLastStateChange()} is generally preferred to get the last state change time of an item.
|
* Note the {@link Item#getLastStateChange()} is generally preferred to get the last state change time of an item.
|
||||||
*
|
*
|
||||||
* @param item the item for which the last historic change time is to be returned
|
* @param item the item for which the last historic change time is to be returned
|
||||||
* @return point in time of the last historic change to <code>item</code>, <code>null</code> if there are no
|
* @return point in time of the last historic change to <code>item</code>, <code>null</code> if there are no
|
||||||
@@ -402,7 +402,7 @@ public class PersistenceExtensions {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Query for the last historic change time of a given <code>item</code>.
|
* Query for the last historic change time of a given <code>item</code>.
|
||||||
* Note the {@link Item.getLastStateChange()} is generally preferred to get the last state change time of an item.
|
* Note the {@link Item#getLastStateChange()} is generally preferred to get the last state change time of an item.
|
||||||
*
|
*
|
||||||
* @param item the item for which the last historic change time is to be returned
|
* @param item the item for which the last historic change time is to be returned
|
||||||
* @param serviceId the name of the {@link PersistenceService} to use
|
* @param serviceId the name of the {@link PersistenceService} to use
|
||||||
@@ -512,7 +512,7 @@ public class PersistenceExtensions {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the previous state of a given <code>item</code>.
|
* Returns the previous state of a given <code>item</code>.
|
||||||
* Note the {@link Item.getLastState()} is generally preferred to get the previous state of an item.
|
* Note the {@link Item#getLastState()} is generally preferred to get the previous state of an item.
|
||||||
*
|
*
|
||||||
* @param item the item to get the previous state value for
|
* @param item the item to get the previous state value for
|
||||||
* @return the previous state or <code>null</code> if no previous state could be found, or if the default
|
* @return the previous state or <code>null</code> if no previous state could be found, or if the default
|
||||||
@@ -524,7 +524,7 @@ public class PersistenceExtensions {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the previous state of a given <code>item</code>.
|
* Returns the previous state of a given <code>item</code>.
|
||||||
* Note the {@link Item.getLastState()} is generally preferred to get the previous state of an item.
|
* Note the {@link Item#getLastState()} is generally preferred to get the previous state of an item.
|
||||||
*
|
*
|
||||||
* @param item the item to get the previous state value for
|
* @param item the item to get the previous state value for
|
||||||
* @param skipEqual if true, skips equal state values and searches the first state not equal the current state
|
* @param skipEqual if true, skips equal state values and searches the first state not equal the current state
|
||||||
@@ -538,7 +538,7 @@ public class PersistenceExtensions {
|
|||||||
/**
|
/**
|
||||||
* Returns the previous state of a given <code>item</code>.
|
* Returns the previous state of a given <code>item</code>.
|
||||||
* The {@link PersistenceService} identified by the <code>serviceId</code> is used.
|
* The {@link PersistenceService} identified by the <code>serviceId</code> is used.
|
||||||
* Note the {@link Item.getLastState()} is generally preferred to get the previous state of an item.
|
* Note the {@link Item#getLastState()} is generally preferred to get the previous state of an item.
|
||||||
*
|
*
|
||||||
* @param item the item to get the previous state value for
|
* @param item the item to get the previous state value for
|
||||||
* @param serviceId the name of the {@link PersistenceService} to use
|
* @param serviceId the name of the {@link PersistenceService} to use
|
||||||
@@ -552,7 +552,7 @@ public class PersistenceExtensions {
|
|||||||
/**
|
/**
|
||||||
* Returns the previous state of a given <code>item</code>.
|
* Returns the previous state of a given <code>item</code>.
|
||||||
* The {@link PersistenceService} identified by the <code>serviceId</code> is used.
|
* The {@link PersistenceService} identified by the <code>serviceId</code> is used.
|
||||||
* Note the {@link Item.getLastState()} is generally preferred to get the previous state of an item.
|
* Note the {@link Item#getLastState()} is generally preferred to get the previous state of an item.
|
||||||
*
|
*
|
||||||
* @param item the item to get the previous state value for
|
* @param item the item to get the previous state value for
|
||||||
* @param skipEqual if <code>true</code>, skips equal state values and searches the first state not equal the
|
* @param skipEqual if <code>true</code>, skips equal state values and searches the first state not equal the
|
||||||
|
|||||||
+2
-1
@@ -28,6 +28,7 @@ import org.openhab.core.thing.internal.binding.generic.converter.AbstractTransfo
|
|||||||
import org.openhab.core.types.Command;
|
import org.openhab.core.types.Command;
|
||||||
import org.openhab.core.types.State;
|
import org.openhab.core.types.State;
|
||||||
import org.openhab.core.types.UnDefType;
|
import org.openhab.core.types.UnDefType;
|
||||||
|
import org.openhab.core.util.ColorUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link ColorChannelHandler} implements {@link org.openhab.core.library.items.ColorItem} conversions
|
* The {@link ColorChannelHandler} implements {@link org.openhab.core.library.items.ColorItem} conversions
|
||||||
@@ -122,7 +123,7 @@ public class ColorChannelHandler extends AbstractTransformingChannelHandler {
|
|||||||
private String hsbToString(HSBType state) {
|
private String hsbToString(HSBType state) {
|
||||||
switch (channelConfig.colorMode) {
|
switch (channelConfig.colorMode) {
|
||||||
case RGB:
|
case RGB:
|
||||||
PercentType[] rgb = state.toRGB();
|
PercentType[] rgb = ColorUtil.hsbToRgbPercent(state);
|
||||||
return String.format("%1$d,%2$d,%3$d", rgb[0].toBigDecimal().multiply(BYTE_FACTOR).intValue(),
|
return String.format("%1$d,%2$d,%3$d", rgb[0].toBigDecimal().multiply(BYTE_FACTOR).intValue(),
|
||||||
rgb[1].toBigDecimal().multiply(BYTE_FACTOR).intValue(),
|
rgb[1].toBigDecimal().multiply(BYTE_FACTOR).intValue(),
|
||||||
rgb[2].toBigDecimal().multiply(BYTE_FACTOR).intValue());
|
rgb[2].toBigDecimal().multiply(BYTE_FACTOR).intValue());
|
||||||
|
|||||||
+1
-3
@@ -17,7 +17,6 @@ import org.eclipse.jdt.annotation.Nullable;
|
|||||||
import org.openhab.core.transform.TransformationException;
|
import org.openhab.core.transform.TransformationException;
|
||||||
import org.openhab.core.transform.TransformationHelper;
|
import org.openhab.core.transform.TransformationHelper;
|
||||||
import org.openhab.core.transform.TransformationService;
|
import org.openhab.core.transform.TransformationService;
|
||||||
import org.openhab.core.transform.internal.TransformationActivator;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -32,8 +31,7 @@ public class Transformation {
|
|||||||
|
|
||||||
private static @Nullable String trans(String type, String function, String value) throws TransformationException {
|
private static @Nullable String trans(String type, String function, String value) throws TransformationException {
|
||||||
String result;
|
String result;
|
||||||
TransformationService service = TransformationHelper
|
TransformationService service = TransformationHelper.getTransformationService(type);
|
||||||
.getTransformationService(TransformationActivator.getContext(), type);
|
|
||||||
if (service != null) {
|
if (service != null) {
|
||||||
result = service.transform(function, value);
|
result = service.transform(function, value);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+2
-2
@@ -108,14 +108,14 @@ abstract class AbstractInvocationHandler<T> {
|
|||||||
void handleDuplicate(Method method, DuplicateExecutionException e) {
|
void handleDuplicate(Method method, DuplicateExecutionException e) {
|
||||||
Thread thread = Objects.requireNonNull(e.getCallable().getThread());
|
Thread thread = Objects.requireNonNull(e.getCallable().getThread());
|
||||||
logger.debug(MSG_DUPLICATE, toString(method), target, toString(e.getCallable().getMethod()), thread.getName(),
|
logger.debug(MSG_DUPLICATE, toString(method), target, toString(e.getCallable().getMethod()), thread.getName(),
|
||||||
thread.getId(), thread.getState().toString(), getStacktrace(thread));
|
thread.threadId(), thread.getState().toString(), getStacktrace(thread));
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleTimeout(Method method, Invocation invocation) {
|
void handleTimeout(Method method, Invocation invocation) {
|
||||||
final Thread thread = invocation.getThread();
|
final Thread thread = invocation.getThread();
|
||||||
if (thread != null) {
|
if (thread != null) {
|
||||||
logger.debug(MSG_TIMEOUT_R, timeout, toString(invocation.getInvocationStack()), thread.getName(),
|
logger.debug(MSG_TIMEOUT_R, timeout, toString(invocation.getInvocationStack()), thread.getName(),
|
||||||
thread.getId(), thread.getState().toString(), getStacktrace(thread));
|
thread.threadId(), thread.getState().toString(), getStacktrace(thread));
|
||||||
} else {
|
} else {
|
||||||
logger.debug(MSG_TIMEOUT_Q, timeout, toString(invocation.getInvocationStack()));
|
logger.debug(MSG_TIMEOUT_Q, timeout, toString(invocation.getInvocationStack()));
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -146,7 +146,7 @@ public interface QuantityTypeArithmeticGroupFunction extends GroupFunction {
|
|||||||
/**
|
/**
|
||||||
* Calculates the sum of a set of item states whose value could be converted to the 'referenceUnit'.
|
* Calculates the sum of a set of item states whose value could be converted to the 'referenceUnit'.
|
||||||
*
|
*
|
||||||
* Uses the {@link QuanitityType.add()} method so the result is an incremental sum based on the 'referenceUnit'. As
|
* Uses the {@link QuantityType#add} method so the result is an incremental sum based on the 'referenceUnit'. As
|
||||||
* a general rule this class is instantiated with a 'referenceUnit' that is a "system unit" (which are zero based)
|
* a general rule this class is instantiated with a 'referenceUnit' that is a "system unit" (which are zero based)
|
||||||
* so such incremental sum is in fact also an absolute sum. However the class COULD be instantiated with a "non-
|
* so such incremental sum is in fact also an absolute sum. However the class COULD be instantiated with a "non-
|
||||||
* system unit" (e.g. °C, °F) in which case the result would be an incremental sum based on that unit.
|
* system unit" (e.g. °C, °F) in which case the result would be an incremental sum based on that unit.
|
||||||
|
|||||||
Reference in New Issue
Block a user