Auties00 / Cobalt

Standalone unofficial fully-featured Whatsapp Web and Mobile API for Java and Kotlin
MIT License
625 stars 183 forks source link

UnsupportedOperationException while calling the "queryGroupMetadata" method #296

Closed tomlux closed 1 year ago

tomlux commented 1 year ago

Hy, I have problems with using the "queryGroupMetadata" method. I have tested it against the latest git version.

While running this:

    Set<Chat> groups = api.store().findChatsByName("xxyyzz");
    Chat group = groups.stream().findFirst().get()
    System.out.println("group.isGroup = " + group.isGroup());
    System.out.println("group.name = " + group.name());
    GroupMetadata groupMetadata = api.queryGroupMetadata(group.toJid()).join();
    System.out.println("groupMetadata = " + groupMetadata);

I'm getting an "UnsupportedOperationException" exception:

group.isGroup = true group.name = xxyyzz Exception in thread "main" java.util.concurrent.CompletionException: java.lang.UnsupportedOperationException at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315) at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320) at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:649) at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) Caused by: java.lang.UnsupportedOperationException at java.base/java.util.concurrent.ConcurrentHashMap$ValuesView.addAll(ConcurrentHashMap.java:4747) at it.auties.whatsapp.socket.SocketHandler.handleGroupMetadata(SocketHandler.java:484) at it.auties.whatsapp.socket.SocketHandler.lambda$queryGroupMetadata$19(SocketHandler.java:472) at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646) ... 6 more

GDB4J commented 1 year ago

@Auties00 Got the same problem (windows or linux) Version 3.4.1

Auties00 commented 1 year ago

this is a bug, I'll fix it asap

Auties00 commented 1 year ago

should be already fixed on master

tomlux commented 1 year ago

it's working. Thanks 👍

GDB4J commented 1 year ago

@Auties00 Any ETA when this fix should available on next version?

Auties00 commented 1 year ago

@Auties00 Any ETA when this fix should available on next version?

might take a while because I'm working on a lot of features

GDB4J commented 1 year ago

Problem seems fixed in version 3.4.4

Thanks!

@Auties00 This issue can be closed i think