mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-25 19:55:48 +01:00
Changed comparison from equals() to reference (#1817)
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
parent
8102cffb7f
commit
7cb746ece1
@ -90,7 +90,7 @@ public class ChannelCommandDescriptionProvider implements CommandDescriptionProv
|
|||||||
CommandDescription dynamicCommandDescription = dynamicCommandDescriptionProvider
|
CommandDescription dynamicCommandDescription = dynamicCommandDescriptionProvider
|
||||||
.getCommandDescription(channel, originalCommandDescription, locale);
|
.getCommandDescription(channel, originalCommandDescription, locale);
|
||||||
if (dynamicCommandDescription != null) {
|
if (dynamicCommandDescription != null) {
|
||||||
if (dynamicCommandDescription.equals(originalCommandDescription)) {
|
if (dynamicCommandDescription == originalCommandDescription) {
|
||||||
logger.error(
|
logger.error(
|
||||||
"Dynamic command description matches original command description. DynamicCommandDescriptionProvider implementations must never return the original command description. {} has to be fixed.",
|
"Dynamic command description matches original command description. DynamicCommandDescriptionProvider implementations must never return the original command description. {} has to be fixed.",
|
||||||
dynamicCommandDescription.getClass());
|
dynamicCommandDescription.getClass());
|
||||||
|
@ -100,12 +100,12 @@ public class ChannelStateDescriptionProvider implements StateDescriptionFragment
|
|||||||
ChannelType channelType = thingTypeRegistry.getChannelType(channel, locale);
|
ChannelType channelType = thingTypeRegistry.getChannelType(channel, locale);
|
||||||
if (channelType != null) {
|
if (channelType != null) {
|
||||||
stateDescription = channelType.getState();
|
stateDescription = channelType.getState();
|
||||||
if ((channelType.getItemType() != null)
|
String itemType = channelType.getItemType();
|
||||||
&& ((stateDescription == null) || (stateDescription.getPattern() == null))) {
|
if (itemType != null && (stateDescription == null || stateDescription.getPattern() == null)) {
|
||||||
String pattern = null;
|
String pattern = null;
|
||||||
if (CoreItemFactory.STRING.equalsIgnoreCase(channelType.getItemType())) {
|
if (CoreItemFactory.STRING.equalsIgnoreCase(itemType)) {
|
||||||
pattern = "%s";
|
pattern = "%s";
|
||||||
} else if (channelType.getItemType().startsWith(CoreItemFactory.NUMBER)) {
|
} else if (itemType.startsWith(CoreItemFactory.NUMBER)) {
|
||||||
pattern = "%.0f";
|
pattern = "%.0f";
|
||||||
}
|
}
|
||||||
if (pattern != null) {
|
if (pattern != null) {
|
||||||
@ -131,14 +131,15 @@ public class ChannelStateDescriptionProvider implements StateDescriptionFragment
|
|||||||
private @Nullable StateDescription getDynamicStateDescription(Channel channel,
|
private @Nullable StateDescription getDynamicStateDescription(Channel channel,
|
||||||
@Nullable StateDescription originalStateDescription, @Nullable Locale locale) {
|
@Nullable StateDescription originalStateDescription, @Nullable Locale locale) {
|
||||||
for (DynamicStateDescriptionProvider provider : dynamicStateDescriptionProviders) {
|
for (DynamicStateDescriptionProvider provider : dynamicStateDescriptionProviders) {
|
||||||
StateDescription stateDescription = provider.getStateDescription(channel, originalStateDescription, locale);
|
StateDescription dynamicStateDescription = provider.getStateDescription(channel, originalStateDescription,
|
||||||
if (stateDescription != null) {
|
locale);
|
||||||
if (stateDescription.equals(originalStateDescription)) {
|
if (dynamicStateDescription != null) {
|
||||||
|
if (dynamicStateDescription == originalStateDescription) {
|
||||||
logger.error(
|
logger.error(
|
||||||
"Dynamic state description matches original state description. DynamicStateDescriptionProvider implementations must never return the original state description. {} has to be fixed.",
|
"Dynamic state description matches original state description. DynamicStateDescriptionProvider implementations must never return the original state description. {} has to be fixed.",
|
||||||
provider.getClass());
|
provider.getClass());
|
||||||
} else {
|
} else {
|
||||||
return stateDescription;
|
return dynamicStateDescription;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user