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

Fix conference browser #870

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

stokito
Copy link
Contributor

@stokito stokito commented Aug 11, 2024

I tested conferences browser with the yax.im (the latest stable release of Prasody) and had an error when tried to get list of rooms for ircnet.yax.im service:

SEVERE: Unable to retrieve list of rooms.
org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPP error reply received from ircnet.yax.im: XMPPError: feature-not-implemented - cancel
	at org.jivesoftware.smack.XMPPException$XMPPErrorException.ifHasErrorThenThrow(XMPPException.java:171)
	at org.jivesoftware.smack.XMPPException$XMPPErrorException.ifHasErrorThenThrow(XMPPException.java:165)
	at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:284)
	at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:228)
	at org.jivesoftware.smackx.disco.ServiceDiscoveryManager.discoverItems(ServiceDiscoveryManager.java:645)
	at org.jivesoftware.smackx.disco.ServiceDiscoveryManager.discoverItems(ServiceDiscoveryManager.java:622)
	at org.jivesoftware.smackx.muc.MultiUserChatManager.getRoomsHostedBy(MultiUserChatManager.java:453)
	at org.jivesoftware.spark.ui.conferences.ConferenceRoomBrowser$6.run(ConferenceRoomBrowser.java:506)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
	at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:317)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)

So here I added an ignore for such errors.

When I tried to get open the chat.yax.im I saw a lot of errors in logs like:

java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.toString()" because "this.val$roomName" is null
	at org.jivesoftware.spark.ui.conferences.ConferenceRoomBrowser$10.construct(ConferenceRoomBrowser.java:942)
	at org.jivesoftware.spark.util.SwingWorker.lambda$new$0(SwingWorker.java:139)
	at java.base/java.lang.Thread.run(Thread.java:1583)

Some rooms doesn't have a name. For some reason just changing the roomName param to String helped. Can't say why, but anyway this change makes code easier to understand.

@stokito stokito force-pushed the fix_conference_browser branch from 7093c1c to bd34a83 Compare August 15, 2024 19:46
@Plyha
Copy link
Member

Plyha commented Aug 21, 2024

Aug 21, 2024 10:32:59 PM org.jivesoftware.spark.util.log.Log error
SEVERE:
java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.toString()" because "this.val$roomName" is null
at org.jivesoftware.spark.ui.conferences.ConferenceRoomBrowser$10.construct(ConferenceRoomBrowser.java:942)
at org.jivesoftware.spark.util.SwingWorker.lambda$new$0(SwingWorker.java:139)
at java.base/java.lang.Thread.run(Unknown Source)

I can reproduce this, but it seems to me that the problem is not with Spark but with the XMPP server.
Rooms on the server must have at least an address.
For example, if the name is empty then this will not be an error in Spark, I just checked.

@stokito
Copy link
Contributor Author

stokito commented Aug 21, 2024

See, I just tried to use the Spark with my existing account on yax.im and check for conferences. The yax.im uses latest stable Prosody so a similar problem may happen on other servers.

@stokito
Copy link
Contributor Author

stokito commented Aug 24, 2024

but it seems to me that the problem is not with Spark but with the XMPP server.

I can't get the full log in the Spark but from the Gajim I was able to see the whole stanza that caused the error. The conference had empty <nick /> i.e. my own nickname. The Gajim didn't shown the conference in the list so the Gajim probably also has a similar problem.

Anyway, the Smack library itself should be ok with empty nicknames and I sent a PR with a fix
igniterealtime/Smack#617

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants