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 NPE on contact popup #868

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 can't reproduce the NPE but when I first tried the Spark I clicked on empty group or I received a test message that I sent from a phone or something like that. But I saved the log:

SEVERE: A ContactGroupListener (org.jivesoftware.spark.ui.ContactList[,0,0,498x330,layout=java.awt.BorderLayout,alignmentX=0.0,alignmentY=0.0,border=javax.swing.border.EmptyBorder@64e54fe9,flags=393,maximumSize=,minimumSize=,preferredSize=]) threw an exception while processing a 'showPopup' event for item: В этой группе нет контактов, которые в сети, event: java.awt.event.MouseEvent[MOUSE_PRESSED,(60,3),absolute(531,408),button=3,modifiers=Meta+Button3,extModifiers=Button3,clickCount=1] on javax.swing.JList[,0,0,498x16,alignmentX=0.0,alignmentY=0.0,border=com.formdev.flatlaf.ui.FlatEmptyBorder@2587d4ef,flags=33554728,maximumSize=,minimumSize=,preferredSize=,fixedCellHeight=-1,fixedCellWidth=-1,horizontalScrollIncrement=-1,selectionBackground=java.awt.Color[r=217,g=232,b=250],selectionForeground=java.awt.Color[r=0,g=0,b=0],visibleRowCount=8,layoutOrientation=0]
java.lang.NullPointerException: Cannot invoke "org.jivesoftware.spark.ui.ContactGroup.isSharedGroup()" because "contactGroup" is null
	at org.jivesoftware.spark.ui.ContactList.showPopup(ContactList.java:1523)
	at org.jivesoftware.spark.ui.ContactList.showPopup(ContactList.java:1478)
	at org.jivesoftware.spark.ui.ContactGroup.firePopupEvent(ContactGroup.java:693)
	at org.jivesoftware.spark.ui.ContactGroup.checkPopup(ContactGroup.java:644)
	at org.jivesoftware.spark.ui.ContactGroup.mousePressed(ContactGroup.java:610)
	at java.desktop/java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:288)
	at java.desktop/java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:287)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6618)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3398)
	at java.desktop/java.awt.Component.processEvent(Component.java:6386)
	at java.desktop/java.awt.Container.processEvent(Container.java:2266)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4996)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4828)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4572)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4828)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:775)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:98)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:747)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:744)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

As far I remember I had one offline contact in the group В этой группе нет контактов, которые в сети (In this group there are no online contacts).

In the PR I tried to add places were the problem may occur: made the group search case insensitive, add the null check.

@Plyha
Copy link
Member

Plyha commented Aug 21, 2024

I can create through Openfire where there are different groups with the same name but different case. I think with this PR I will merge these two groups into one.

image

@Plyha
Copy link
Member

Plyha commented Aug 21, 2024

With your commit
image

@stokito
Copy link
Contributor Author

stokito commented Aug 21, 2024

well, I don't know what the XEPs says about case sensitive group names but from a user perspective and code simplicity they should be definitely case insensitive.
I hope that at least JIDs are case insensitive, right?

@Plyha
Copy link
Member

Plyha commented Aug 21, 2024

@guusdk can you comment please?

@stokito
Copy link
Contributor Author

stokito commented Aug 21, 2024

I found Modern XMPP project that tries to explain XEPs briefly.
They have the Client UX design guidelines that sounds reasonable for me.
I asked them to clarify the case sensitive groups recommendation modernxmpp/modernxmpp#61

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