Skip to main content



      Home
Home » Archived » Eclipse SmartHome » Duplicate channels on Thing
Duplicate channels on Thing [message #1745076] Tue, 04 October 2016 15:37 Go to next message
Eclipse UserFriend
A thing's channels are stored as a List<Channel> , see

https://github.com/eclipse/smarthome/blob/e0985e90d389350580e59bfbcd7e0adaaccf7519/bundles/core/org.eclipse.smarthome.core.thing/src/main/java/org/eclipse/smarthome/core/thing/internal/ThingImpl.java#L49

Because this is a list, its possible for a Thing to have duplicate channels with the same ID. This also means that calling "getChannel(String id)" will only return the first instance of the duplicate channel. Is this by design or should this be considered a bug? I would think this should rather be a Map structure keyed off the Channel's id.
Re: Duplicate channels on Thing [message #1745114 is a reply to message #1745076] Wed, 05 October 2016 06:45 Go to previous messageGo to next message
Eclipse UserFriend
Afair, a List was only chosen internally for keeping the order of channels stable.
Imho, a SortedSet would have been the better choice (together with a Channel.equals() that checks equality of the UID).

Feel free to add an issue, we should indeed at least ensure that no duplicate channel uids end up in the list.
Re: Duplicate channels on Thing [message #1745132 is a reply to message #1745114] Wed, 05 October 2016 10:10 Go to previous message
Eclipse UserFriend
Will do, thanks.
Previous Topic:Upnp Discovery issue
Next Topic:ThingImpl cannot be cast to org.eclipse.smarthome.core.thing.Bridge
Goto Forum:
  


Current Time: Wed Jul 16 23:59:44 EDT 2025

Powered by FUDForum. Page generated in 0.50164 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top