openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.86k stars 3.57k forks source link

[tr064] Address book unavailable due to "IllegalStateException: Duplicate key" when phone numbers are not unique #10327

Closed LuiSauberhorn closed 1 year ago

LuiSauberhorn commented 3 years ago

Hi guys,

I am using openhab3 and tr046 binding and the phonebook feature for fritzbox. In principle all works fine. However, there is a challenge for my setup that is certainly relevant for others.

In my address book, I have the same phone number in two entries. There are two cases:

These cases, here shown for the second case, lead to a warning:

2021-03-14 13:00:15.924 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception: 
java.lang.IllegalStateException: Duplicate key +491XXXXXXXXXX (attempted merging values Doe, John and Doe, John)
    at java.util.stream.Collectors.duplicateKeyException(Collectors.java:133) ~[?:?]
    at java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:180) ~[?:?]
    at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) ~[?:?]
...

Reason for this error is that the number +491XXXXXXXXXX is configured as both, mobile and work number of John Doe. Unfortunately I cannot change that because it is coming from the exchange server at my work.

The result is that the address book is not available at all. I think it would be reasonable that the value (name) for the key (phone number) is simply overwritten by the last entry.

lsiepel commented 1 year ago

If this is still an issue, I might try to get this fixed. Could you run it with trace enabled and send me the file?