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

[BUG] NullPointerException in client if clipboard is empty during login #5388

Closed
tonygermano opened this issue Aug 26, 2022 · 1 comment · Fixed by #5658
Closed

[BUG] NullPointerException in client if clipboard is empty during login #5388

tonygermano opened this issue Aug 26, 2022 · 1 comment · Fixed by #5658
Labels
bug Something isn't working Fix-Commited Issue fixed and will be available in milestone Internal-Issue-Created An issue has been created in NextGen's internal issue tracker RS-9267 triaged
Milestone

Comments

@tonygermano
Copy link
Collaborator

Describe the bug
The mirth client throws a NullPointerException if the clipboard is empty during login.

Expected behavior
Login should occur when the clipboard is empty.

Actual behavior

java.lang.NullPointerException
	at com.mirth.connect.client.ui.actions.PasteAction.isEnabled(PasteAction.java:39)
	at java.desktop/javax.swing.AbstractAction.setEnabledFromAction(Unknown Source)
	at java.desktop/javax.swing.AbstractButton.configurePropertiesFromAction(Unknown Source)
	at java.desktop/javax.swing.JMenuItem.configurePropertiesFromAction(Unknown Source)
	at java.desktop/javax.swing.AbstractButton.setAction(Unknown Source)
	at java.desktop/javax.swing.JPopupMenu.add(Unknown Source)
	at com.mirth.connect.client.ui.components.MirthSyntaxTextArea.<init>(MirthSyntaxTextArea.java:80)
	at com.mirth.connect.client.ui.components.MirthSyntaxTextArea.<init>(MirthSyntaxTextArea.java:53)
	at com.mirth.connect.client.ui.EditMessageDialog.initComponents(EditMessageDialog.java:435)
	at com.mirth.connect.client.ui.EditMessageDialog.<init>(EditMessageDialog.java:69)
	at com.mirth.connect.client.ui.Frame.setupFrame(Frame.java:541)
	at com.mirth.connect.client.ui.Mirth.<init>(Mirth.java:66)
	at com.mirth.connect.client.ui.LoginPanel$8.handleSuccess(LoginPanel.java:556)
	at com.mirth.connect.client.ui.LoginPanel$8.doInBackground(LoginPanel.java:445)
	at com.mirth.connect.client.ui.LoginPanel$8.doInBackground(LoginPanel.java:416)
	at java.desktop/javax.swing.SwingWorker$1.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.desktop/javax.swing.SwingWorker.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

Environment (please complete the following information):

  • OS: Linux
  • Java Distribution/Version: OpenJDK 11
  • Connect Version: 4.1.0

Workaround(s)
Copy something to the clipboard before logging in.

Additional context

Transferable contents = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(this);
return contents.isDataFlavorSupported(DataFlavor.stringFlavor);

In line 38, the call to getContents can return null if the clipboard is empty, causing the exception to be thrown on line 39.

Probably just needs to return false if contents is null.

@tonygermano tonygermano added the bug Something isn't working label Aug 26, 2022
@pladesma pladesma added RS-9267 triaged Internal-Issue-Created An issue has been created in NextGen's internal issue tracker labels Sep 7, 2022
@JackieK5
Copy link
Collaborator

@tonygermano, @ChristopherSchultz The Connect dev team is planning to pull this (and the associated PR) into the next sprint but they have some questions about recreating the issue since they have never seen this. Are there steps you can provide that will always reproduce this error, including how to ensure the clipboard is empty? Is there anything else required for this issue to occur? Thanks

@mefrehner mefrehner added the Fix-Commited Issue fixed and will be available in milestone label Mar 15, 2023
@mefrehner mefrehner added this to the 4.3.0 milestone Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Fix-Commited Issue fixed and will be available in milestone Internal-Issue-Created An issue has been created in NextGen's internal issue tracker RS-9267 triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants