开云体育

Locked java Exception when try to add a second internal sensor


 

Hi
I've noticed a problem for a while (I cannot remember exactly when it started) when trying to add multiple internal sensors. The situation can be created as follows:
  • Open PanelPro (no panel required)
  • Use MERG CAN Simulation connection
  • Go to Tables->Sensors and click "Add"
  • Enter internal sensor with hardware address "sensor1", click Create (NB It's odd that the term "Hardware address" is used for an internal sensor rather than "user name")
  • Note: Dialog disappears and sensor created as expected
  • Click Add
  • Note: No dialog appears and java exception thrown in console window (see below)
  • Click Add again
  • Dialog appears but it only has menu items "Window" and "Help", but is otherwise blank (no entry fields)
  • No more exceptions at this stage
  • Pressing Add again results in the same result
  • Close Tables and reopen again
  • A single new internal sensor can now be added
The situation seems to be similar for turnouts.
It is different for Memory Variables as in this case the dialog remains open (much easier to use!) and new variables can be edited/added.

I've included my startup log so that you can see some profile details.

JMRI 4.17.6
Ubuntu 19.10
Java 11.0.5-ea (en)

Initially I put it down to finger trouble, and I had a work around by closing and opening the Tables dialog - but clearly all is not well!

Looking at the exception it's obviously related to CBUS, but I'm not sure why any validation is going on when I open the dialog for the second time. In this case I was going to create a new 'internal'? sensor, whereas it seems to be validating the previous sensor and concluding that the name is invalid in MERG/CBUS terms (which it is since it's an internal sensor).

If I add a MERG/CBUS sensor with a valid hardware address and create, I can then add new ones successfully i.e. the problem only occurs after adding an internal sensor.

Regards
Andy

Startup Log:

2019-11-25 10:15:52,466 apps.Apps???????????????????????????? INFO? - Starting with profile DefaultIconIssue.3f0a07d9 [main]
2019-11-25 10:15:52,556 node.NodeIdentity???????????????????? INFO? - Using f481328e-da9a-11e8-8000-001372e824b0 as the JMRI storage identity for profile id 3f0a07d9 [AWT-EventQueue-0]
2019-11-25 10:15:52,700 configurexml.ConnectionConfigXml????? INFO? - CAN Simulator Started [main]
2019-11-25 10:15:52,721 simulator.CbusSimulator?????????????? INFO? - Starting CBUS Network Simulation Tools [AWT-EventQueue-0]
2019-11-25 10:15:52,728 simulator.CbusDummyCS???????????????? INFO? - Simulated Command Station: Standard Command Station [AWT-EventQueue-0]
2019-11-25 10:15:52,740 simulator.CbusDummyNode?????????????? INFO? - Simulated CBUS Node: SLIM [AWT-EventQueue-0]
2019-11-25 10:15:52,743 simulator.CbusEventResponder????????? INFO? - Simulated Event Responses: Random On / Off [AWT-EventQueue-0]
2019-11-25 10:15:52,748 eventtable.CbusEventTableDataModel??? INFO? - Starting MERG CBUS Event Table [main]
2019-11-25 10:15:53,040 util.FileUtilSupport????????????????? INFO? - File path program: is /home/andy/Applications/JMRI-4.17.6/ [main]
2019-11-25 10:15:53,040 util.FileUtilSupport????????????????? INFO? - File path preference: is /home/andy/railwayShare/docs/jmri/DefaultIconIssue.jmri/ [main]
2019-11-25 10:15:53,040 util.FileUtilSupport????????????????? INFO? - File path profile: is /home/andy/railwayShare/docs/jmri/DefaultIconIssue.jmri/ [main]
2019-11-25 10:15:53,041 util.FileUtilSupport????????????????? INFO? - File path settings: is /home/andy/.jmri/ [main]
2019-11-25 10:15:53,041 util.FileUtilSupport????????????????? INFO? - File path home: is /home/andy/ [main]
2019-11-25 10:15:53,041 util.FileUtilSupport????????????????? INFO? - File path scripts: is /home/andy/Applications/JMRI-4.17.6/jython/ [main]
2019-11-25 10:15:53,417 server.WebServer????????????????????? INFO? - Starting Web Server on port 12080 [WebServer]
2019-11-25 10:15:53,886 server.WebServer????????????????????? INFO? - Starting ZeroConfService _http._tcp.local for Web Server with properties {path=/, json=5.1.0} [WebServer]
2019-11-25 10:15:53,927 PanelPro.PanelPro???????????????????? INFO? - Main initialization done [main]
2019-11-25 10:17:05,419 audio.JoalAudioFactory??????????????? INFO? - Initialised JOAL using OpenAL: vendor - OpenAL Community version - 1.1 ALSOFT 1.15.1 [Listed Table Generation]


Exception:

2019-11-25 10:18:23,110 ptionhandler.UncaughtExceptionHandler ERROR - Uncaught Exception caught by jmri.util.exceptionhandler.UncaughtExceptionHandler [AWT-EventQueue-0]
java.lang.IllegalArgumentException: Wrong number of events in address: sensor1
??? at jmri.jmrix.can.cbus.CbusAddress.validateSysName(CbusAddress.java:381)
??? at jmri.jmrix.can.cbus.CbusSensorManager.validateAddressFormat(CbusSensorManager.java:162)
??? at jmri.jmrix.can.cbus.CbusSensorManager.validateSystemNameFormat(CbusSensorManager.java:131)
??? at jmri.Manager.makeSystemName(Manager.java:155)
??? at jmri.managers.AbstractManager.makeSystemName(AbstractManager.java:83)
??? at jmri.Manager.makeSystemName(Manager.java:126)
??? at jmri.swing.SystemNameValidator.getValidation(SystemNameValidator.java:77)
??? at com.alexandriasoftware.swing.JInputValidator.verify(JInputValidator.java:195)
??? at jmri.swing.SystemNameValidator.setManager(SystemNameValidator.java:118)
??? at jmri.jmrit.beantable.AddNewHardwareDevicePanel.lambda$1(AddNewHardwareDevicePanel.java:132)
??? at java.desktop/javax.swing.JComboBox.fireActionEvent(JComboBox.java:1264)
??? at java.desktop/javax.swing.JComboBox.setSelectedItem(JComboBox.java:589)
??? at jmri.swing.ManagerComboBox.setManagers(ManagerComboBox.java:63)
??? at jmri.swing.ManagerComboBox.setManagers(ManagerComboBox.java:80)
??? at jmri.jmrit.beantable.AbstractTableAction.configureManagerComboBox(AbstractTableAction.java:232)
??? at jmri.jmrit.beantable.SensorTableAction.addPressed(SensorTableAction.java:134)
??? at jmri.jmrit.beantable.AbstractTableTabAction$TabbedTableItem.lambda$0(AbstractTableTabAction.java:221)
??? at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
??? at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
??? at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
??? at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
??? at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279)
??? at java.desktop/java.awt.Component.processMouseEvent(Component.java:6632)
??? at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
??? at java.desktop/java.awt.Component.processEvent(Component.java:6397)
??? at java.desktop/java.awt.Container.processEvent(Container.java:2263)
??? at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5008)
??? at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
??? at java.desktop/java.awt.Component.dispatchEvent(Component.java:4840)
??? at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
??? at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
??? at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
??? at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
??? at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
??? at java.desktop/java.awt.Component.dispatchEvent(Component.java:4840)
??? at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
??? at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
??? at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
??? at java.base/java.security.AccessController.doPrivileged(Native Method)
??? at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
??? at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
??? at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
??? at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
??? at java.base/java.security.AccessController.doPrivileged(Native Method)
??? at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
??? at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
??? 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)


 

Hi Andy,

Thanks for reporting, have been able to reproduce the same exception.

Will need to do a bit of digging around why any sort of Internal Sensor validation is going via CBUS Sensor validation,

Steve.


 

Steve,

I have identified a possible cause for the unexpected CBUS validation. ?There is a listener left when the first Add window is closed which is triggered when Add is selected again. ?When CBUS is the FIRST connection, it gets called to validate the saved input from the first add. ?The previous value is reused to facilitate entering multiple similar names.

If LocoNet, NCE, etc. are the FIRST connection, they get called instead of CBUS, but their validation is not as comprehensive as CBUS so the error does not occur. ?Creating a virtual LocoNet connection as the first connection is a temporary work around. ?A review of Preferences >> Defaults would be required.

I still need to identify if this is the true problem and figure out a solution. ?Another issue is that there is a change to validation in progress which may or may not affect this particular issue.


Dave Sand



----- Original message -----
From: "steve young via Groups.Io" <icklesteve@...>
Subject: Re: [jmriusers] java Exception when try to add a second internal sensor
Date: Tuesday, November 26, 2019 10:39 AM

Hi Andy,

Thanks for reporting, have been able to reproduce the same exception.

Will need to do a bit of digging around why any sort of Internal Sensor validation is going via CBUS Sensor validation,

Steve.


 

Steve, Andy,

I am still working on this issue. ?The scope has expanded. ?

Start JMRI with CBUS Simulator, open the Sensor table, select Add, select MERG, type the letter a. ?The same java exception that occurs when adding a second internal sensor.

Current issues:
  1. CBUS system name validation is not handling illegal system names properly. ?This is the actual problem.
  2. A residual listener is causing the default connection (first listed) to be invoked before trying the the selected connection.
  3. When the connection is changed, such as from Internal to MERG, the previous value should be reset to empty.

Dave Sand



----- Original message -----
From: Dave Sand <ds@...>
Subject: Re: [jmriusers] java Exception when try to add a second internal sensor
Date: Tuesday, November 26, 2019 2:54 PM

Steve,

I have identified a possible cause for the unexpected CBUS validation. ?There is a listener left when the first Add window is closed which is triggered when Add is selected again. ?When CBUS is the FIRST connection, it gets called to validate the saved input from the first add. ?The previous value is reused to facilitate entering multiple similar names.

If LocoNet, NCE, etc. are the FIRST connection, they get called instead of CBUS, but their validation is not as comprehensive as CBUS so the error does not occur. ?Creating a virtual LocoNet connection as the first connection is a temporary work around. ?A review of Preferences >> Defaults would be required.

I still need to identify if this is the true problem and figure out a solution. ?Another issue is that there is a change to validation in progress which may or may not affect this particular issue.


Dave Sand



----- Original message -----
From: "steve young via Groups.Io" <icklesteve@...>
Subject: Re: [jmriusers] java Exception when try to add a second internal sensor
Date: Tuesday, November 26, 2019 10:39 AM

Hi Andy,

Thanks for reporting, have been able to reproduce the same exception.

Will need to do a bit of digging around why any sort of Internal Sensor validation is going via CBUS Sensor validation,

Steve.



 

Steve, Andy,

The fixes for this problem, along with issue #7458, have been merged. ?They will be included in test release 4.17.7. ?

When the test release is available, please confirm that the fixes work. ?Thanks.

Dave Sand



----- Original message -----
From: Dave Sand <ds@...>
Subject: Re: [jmriusers] java Exception when try to add a second internal sensor
Date: Saturday, November 30, 2019 4:02 PM

Steve, Andy,

I am still working on this issue. ?The scope has expanded. ?

Start JMRI with CBUS Simulator, open the Sensor table, select Add, select MERG, type the letter a. ?The same java exception that occurs when adding a second internal sensor.

Current issues:
  1. CBUS system name validation is not handling illegal system names properly. ?This is the actual problem.
  2. A residual listener is causing the default connection (first listed) to be invoked before trying the the selected connection.
  3. When the connection is changed, such as from Internal to MERG, the previous value should be reset to empty.

Dave Sand



----- Original message -----
From: Dave Sand <ds@...>
Subject: Re: [jmriusers] java Exception when try to add a second internal sensor
Date: Tuesday, November 26, 2019 2:54 PM

Steve,

I have identified a possible cause for the unexpected CBUS validation. ?There is a listener left when the first Add window is closed which is triggered when Add is selected again. ?When CBUS is the FIRST connection, it gets called to validate the saved input from the first add. ?The previous value is reused to facilitate entering multiple similar names.

If LocoNet, NCE, etc. are the FIRST connection, they get called instead of CBUS, but their validation is not as comprehensive as CBUS so the error does not occur. ?Creating a virtual LocoNet connection as the first connection is a temporary work around. ?A review of Preferences >> Defaults would be required.

I still need to identify if this is the true problem and figure out a solution. ?Another issue is that there is a change to validation in progress which may or may not affect this particular issue.


Dave Sand



----- Original message -----
From: "steve young via Groups.Io" <icklesteve@...>
Subject: Re: [jmriusers] java Exception when try to add a second internal sensor
Date: Tuesday, November 26, 2019 10:39 AM

Hi Andy,

Thanks for reporting, have been able to reproduce the same exception.

Will need to do a bit of digging around why any sort of Internal Sensor validation is going via CBUS Sensor validation,

Steve.




 

Hi Dave,

Fix works for me, has also resolved?

Again thanks for your time on this,

Steve.


 

Hi Dave
I've tried dev build and all looks fine to me. Thanks for tracking it down and fixing it!

As a side note, is there a particular reason that some of the 'Tables' Add dialogs close after adding a new item (such as sensors and turnouts) whereas others (such as Memory Variables and block) stay open and allow further additions until they are actively closed?

Thanks
Andy


 

Andy,

The short flippant answer is 'coz that's how it was written' ;-)

However, what should be the case is that each of the 'Add' dialogs provide (at least) three buttons - 'OK', 'Apply', 'Cancel'.

Behaviour of each of these as follows:

'OK' - create/make the changes specified then close
'Apply' - create/make the changes specified but remain open
'Cancel' - discard changes/abort creation then close

It would be good to know which dialogs you've noticed that are not following this convention so that we can sort out consistent behaviour throughout.

Thanks.

Best regards,

Matt H


 

Matt H,
I've tried to go through all the Tables 'create' dialogs and have created a pdf with a summary - /g/jmriusers/files/ProblemsBeingWorkedOn/Andy%20Brown%20-%20161045/JMRI%20Tables%20Create%20dialogs.pdf .

You might wish you hadn't asked as there are quite a few inconsistencies! However, it must be added that non are show stoppers, but rather reflect the incremental nature of development.

  • The dialogs that close after create are turnouts, sensors, signal masts, signal group, reporter and section
  • Only the Audio Source and Audio Buffer dialogs follow your suggested behaviour!
  • Audio dialogs provide a suggested system name, others show an empty field or the last used name
  • Some provide Auto system name generation (e.g. route and signal group)
  • Some provide sequential range option (e.g. sensors and turnouts) -
  • Some provide both (e.g. Blocks and memory variables)
  • Some hide the required system prefix (e.g Sensors, Turnouts and Blocks), whereas others show and require it (e.g. Audio Buffers and Audio Sources)
  • I haven't had chance to go through the validation, but I suspect subtle differences - e.g. Audio Buffer throws an exception when no filename provided, but shows no error dialog. However, duplicate ID Tag, for instance, shows an error dialog. I think analysing this would be a task for another day!!

It looks to me like 'fixing' this would be quite a task, not to mention agreeing on what should be provided. If it's any help I usually prefer dialogs to stay open to allow multiple items to be added, but I can live with how things are! Obviously, your suggest of OK/Apply and Cancel gives both options.

Thanks
Andy


 

Andy,

Oh my - didn't realise that this was going to be quite such a herculean task!

Plus it's no real surprise that the Audio dialogs follow the suggested behaviour given that I was responsible for those ;-)

But thanks again for the analysis - this gives some food for thought...

Best regards,

Matt H