connect
connect copied to clipboard
[BUG] Hardcoded null in ChannelTableNode will ALWAYS throw an exception
Describe the bug See - https://github.com/nextgenhealthcare/connect/blob/e66d1122dbeebfcf5a8939beb93d720b2d5071fb/client/src/com/mirth/connect/client/ui/ChannelTableNode.java#L58-L88
Line 58 sets this.channelStatus = null;
then on line 85 row[i++] = plugin.getTableData(channelStatus.getChannel());
will always throw an NPE.
The solution is to change line 85 to plugin.getTableData(groupStatus.getChannelGroup());
which will call the existing plugin method com.mirth.connect.plugins.ChannelColumnPlugin#getTableData(com.mirth.connect.model.ChannelGroup)
.
To Reproduce
- Implement a
com.mirth.connect.plugins.ChannelColumnPlugin
or grab the one from https://github.com/jonbartels/mirth-connect-dashboard-count - Load the plugin
- Launch MC from the Launcher with console enabled
- View the Channels view
- You'll see the NPE in console.
Environment (please complete the following information):
- OS: Any
- Java Distribution/Version Any
- Connect Version - Any version where
com.mirth.connect.client.ui.ChannelTableNode
exists. Dates back to 2016 and issue ["MIRTH-1243"] (https://github.com/nextgenhealthcare/connect/issues/1243)
Workaround(s) Are there one or more workarounds for this issue currently? - No.
Additional context
Fixing this is required to make https://github.com/nextgenhealthcare/connect/issues/5152 implementable. Once this bug is fixed then implmenting a ChannelColumnPlugin
to show listening ports becomes trivial.
https://github.com/nextgenhealthcare/connect/issues/1571 introduced the idea and it was rolled into #1243
Are you good if you set your plugin to "display first"?
I tried "display first"
This might be solvable but I suspect its got something hardcoded for the first column or index order. It may also be expecting the Image renderer too.
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
at com.mirth.connect.client.ui.ChannelPanel$15.isHighlighted(ChannelPanel.java:3346)
at org.jdesktop.swingx.decorator.AbstractHighlighter.highlight(AbstractHighlighter.java:170)
at org.jdesktop.swingx.decorator.CompoundHighlighter.doHighlight(CompoundHighlighter.java:235)
at org.jdesktop.swingx.decorator.AbstractHighlighter.highlight(AbstractHighlighter.java:172)
at org.jdesktop.swingx.JXTable.prepareRenderer(JXTable.java:3555)
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.String cannot be cast to com.mirth.connect.client.ui.CellData
at com.mirth.connect.client.ui.ImageCellRenderer.getTableCellRendererComponent(ImageCellRenderer.java:44)
at javax.swing.JTable.prepareRenderer(JTable.java:5729)
at org.jdesktop.swingx.JXTable.prepareRenderer(JXTable.java:3545)
at org.jdesktop.swingx.JXTreeTable.prepareRenderer(JXTreeTable.java:1385)
We are taking a look at the dashboard for 4.3 in March. I have bubbled this one up for the team to look into.
The fix is pushed to the development branch
I did some testing with my plugin. I no longer encounter the error, however my plugin also does not add columns to the Channel list view. I suspect this is a bug in my plugin.
Are there any implementations of com.mirth.connect.plugins.ChannelColumnPlugin
that I can review?
I am doing my best to provide testing and updates for this bug since NG devs took the time to fix it!!