Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tr064] Duplicate phonebook entries lead to exception #9738

Closed
t2000 opened this issue Jan 7, 2021 · 0 comments · Fixed by #9739
Closed

[tr064] Duplicate phonebook entries lead to exception #9738

t2000 opened this issue Jan 7, 2021 · 0 comments · Fixed by #9739
Labels
bug An unexpected problem or unintended behavior of an add-on

Comments

@t2000
Copy link
Contributor

t2000 commented Jan 7, 2021

I have encountered this exception with my fritzbox phone book:

2021-01-07 20:58:55.015 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception: 
java.lang.IllegalStateException: Duplicate key +4917XXXXXXX (attempted merging values Some Name and Some Name)
        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) ~[?:?]
        at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655) ~[?:?]
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
        at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[?:?]
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
        at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[?:?]
        at org.openhab.binding.tr064.internal.phonebook.Tr064PhonebookImpl.lambda$0(Tr064PhonebookImpl.java:76) ~[?:?]
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[?:?]
        at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655) ~[?:?]
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
        at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[?:?]
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
        at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:589) ~[?:?]
        at org.openhab.binding.tr064.internal.phonebook.Tr064PhonebookImpl.getPhonebook(Tr064PhonebookImpl.java:77) ~[?:?]
        at org.openhab.binding.tr064.internal.phonebook.Tr064PhonebookImpl.<init>(Tr064PhonebookImpl.java:58) ~[?:?]
        at org.openhab.binding.tr064.internal.Tr064RootHandler.lambda$21(Tr064RootHandler.java:340) ~[?:?]
        at java.util.Optional.map(Optional.java:265) ~[?:?]
        at org.openhab.binding.tr064.internal.Tr064RootHandler.lambda$20(Tr064RootHandler.java:340) ~[?:?]
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[?:?]
        at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) ~[?:?]
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
        at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[?:?]
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
        at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[?:?]
        at org.openhab.binding.tr064.internal.Tr064RootHandler.processPhonebookList(Tr064RootHandler.java:345) ~[?:?]
        at org.openhab.binding.tr064.internal.Tr064RootHandler.lambda$26(Tr064RootHandler.java:360) ~[?:?]
        at java.util.Optional.map(Optional.java:265) ~[?:?]
        at org.openhab.binding.tr064.internal.Tr064RootHandler.retrievePhonebooks(Tr064RootHandler.java:358) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:834) [?:?]

Apparently the problem is that the phonebook is an export from my mobile phone.

My mobile phone has multiple accounts where it creates the full phone book from. There is the phone internal phone book, one from a carddav server, one from telegram, one from signal, etc.

If there people that I have added in the carddav phonebook, apps like telegram will create a copy of this contact in a "telegram phone book". The mobile phone correctly merges these 2 contacts from the 2 accounts back into one for a list for the user to scroll through without seeing duplicates.

However, If I export such a phonebook that contains these multiple accounts I get. And here the part in "()" refers to the type of the entry, so its not part of the name string!:

Firstname LastName (mobile) +49123456789
Firstname LastName (other) +49123456789

The fritzbox understands the fact that one number belongs to "mobile" and one belongs to "other". So this is a valid phonebook for the fritzbox as well.

The problem is the mapping function in Tr064PhonebookImpl.lambda$0(Tr064PhonebookImpl.java:76, it throws the aforementioned exception. And I think it is right when throwing such an exception IFF there are two or more DIFFERENT names for the same number. But it should NOT throw an exception if there are multiple entries for one number, all pointing to the the very same name.

@t2000 t2000 added the bug An unexpected problem or unintended behavior of an add-on label Jan 7, 2021
t2000 added a commit to t2000/openhab2-addons that referenced this issue Jan 7, 2021
cweitkamp pushed a commit that referenced this issue Jan 9, 2021
* [tr064] Merge duplicate phone book entries

Fixes #9738

Signed-off-by: Stefan Triller <[email protected]>
themillhousegroup pushed a commit to themillhousegroup/openhab2-addons that referenced this issue May 10, 2021
* [tr064] Merge duplicate phone book entries

Fixes openhab#9738

Signed-off-by: Stefan Triller <[email protected]>
Signed-off-by: John Marshall <[email protected]>
thinkingstone pushed a commit to thinkingstone/openhab-addons that referenced this issue Nov 7, 2021
* [tr064] Merge duplicate phone book entries

Fixes openhab#9738

Signed-off-by: Stefan Triller <[email protected]>
marcfischerboschio pushed a commit to bosch-io/openhab-addons that referenced this issue May 5, 2022
* [tr064] Merge duplicate phone book entries

Fixes openhab#9738

Signed-off-by: Stefan Triller <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant