Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Eclipse SmartHome » Duplicate channels on Thing
Duplicate channels on Thing [message #1745076] Tue, 04 October 2016 19:37 Go to next message
Dan Cunningham is currently offline Dan CunninghamFriend
Messages: 44
Registered: March 2014
Member
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 10:45 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
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 14:10 Go to previous message
Dan Cunningham is currently offline Dan CunninghamFriend
Messages: 44
Registered: March 2014
Member
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: Sat Dec 07 11:51:16 GMT 2024

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

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

Back to the top