2

I have to migrate an old java 7 project to java 11.
An I only get an exception in by running the program with java 11 but not with java 8 it works fine.

tableControl is an instance of JXTable from org.jdesktop.swingx.JXTable.
The Table is not empty.

There the exception occurs:

if (tableControl != null) {
    ((AbstractTableModel) tableControl.getModel()).fireTableDataChanged();
    tableControl.packAll();
    //does not work with jdk-11
    tableControl.setRowSelectionInterval(0, 0);
}

This is the stacktrace using java 11.

org.jdesktop.beansbinding.PropertyResolutionException: Exception invoking method public void org.jdesktop.swingbinding.adapters.JComboBoxAdapterProvider$Adapter.setSelectedItem(java.lang.Object) on org.jdesktop.swingbinding.adapters.JComboBoxAdapterProvider$Adapter@69a109b8
    at org.jdesktop.beansbinding.BeanProperty.invokeMethod(BeanProperty.java:791)
    at org.jdesktop.beansbinding.BeanProperty.write(BeanProperty.java:891)
    at org.jdesktop.beansbinding.BeanProperty.setValue(BeanProperty.java:571)
    at org.jdesktop.beansbinding.Binding.refreshUnmanaged(Binding.java:1229)
    at org.jdesktop.beansbinding.Binding.refresh(Binding.java:1207)
    at org.jdesktop.beansbinding.AutoBinding.tryRefreshThenSave(AutoBinding.java:162)
    at org.jdesktop.beansbinding.AutoBinding.sourceChangedImpl(AutoBinding.java:227)
    at org.jdesktop.beansbinding.Binding.sourceChanged(Binding.java:1411)
    at org.jdesktop.beansbinding.Binding.access$1200(Binding.java:38)
    at org.jdesktop.beansbinding.Binding$PSL.propertyStateChanged(Binding.java:1618)
    at org.jdesktop.beansbinding.PropertyHelper.firePropertyStateChange(PropertyHelper.java:212)
    at org.jdesktop.beansbinding.ELProperty.notifyListeners(ELProperty.java:688)
    at org.jdesktop.beansbinding.ELProperty.access$800(ELProperty.java:155)
    at org.jdesktop.beansbinding.ELProperty$SourceEntry.processSourceChanged(ELProperty.java:312)
    at org.jdesktop.beansbinding.ELProperty$SourceEntry.sourceChanged(ELProperty.java:326)
    at org.jdesktop.beansbinding.ELProperty$SourceEntry.propertyChange(ELProperty.java:333)
    at java.desktop/java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:341)
    at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:333)
    at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:266)
    at net.example.project.entities.ChangeSupportEntity.firePropertyChange(ChangeSupportEntity.java:25)
    at net.example.project.entities.pools.Pool.setLocation(Pool.java:144)
    at net.example.project.entities.pools.Pool.assign(Pool.java:320)
    at net.example.project.gui.controllers.GenericEntityController.assignEditEntity(GenericEntityController.java:113)
    at net.example.project.gui.controllers.GenericEntityController.setCurrentEntity(GenericEntityController.java:63)
    at net.example.project.gui.controllers.GenericEntityController.valueChanged(GenericEntityController.java:501)
    at java.desktop/javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:219)
    at java.desktop/javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:199)
    at java.desktop/javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:246)
    at java.desktop/javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:443)
    at java.desktop/javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:453)
    at java.desktop/javax.swing.DefaultListSelectionModel.setSelectionInterval(DefaultListSelectionModel.java:497)
    at java.desktop/javax.swing.JTable.setRowSelectionInterval(JTable.java:2173)
    at net.example.project.gui.controllers.GenericEntityController.refreshImpl(GenericEntityController.java:266)
    at net.example.project.gui.controllers.PoolController.refreshImpl(PoolController.java:58)
    at net.example.project.gui.controllers.GenericEntityController.refreshInit(GenericEntityController.java:225)
    at net.example.project.gui.forms.PoolManagerForm.<init>(PoolManagerForm.java:55)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at net.example.project.gui.MainForm.showApplication(MainForm.java:181)
    at net.example.project.gui.MainForm.jMenuItemAppPoolMgrActionPerformed(MainForm.java:356)
    at net.example.project.gui.MainForm.access$600(MainForm.java:41)
    at net.example.project.gui.MainForm$7.actionPerformed(MainForm.java:288)
    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.AbstractButton.doClick(AbstractButton.java:369)
    at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1020)
    at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1064)
    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)
Caused by: java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.jdesktop.beansbinding.BeanProperty.invokeMethod(BeanProperty.java:782)
    ... 80 more
Caused by: java.lang.NullPointerException
    at java.desktop/javax.swing.JComboBox.setSelectedItem(JComboBox.java:573)
    at org.jdesktop.swingbinding.adapters.JComboBoxAdapterProvider$Adapter.setSelectedItem(JComboBoxAdapterProvider.java:35)
    ... 85 more
Ace of Spade
  • 388
  • 3
  • 22
  • something goes wrong when `assign` gets invoked. probably a null reference. `net.example.project.entities.pools.Pool.assign(Pool.java:320)` – Vishal_Kotecha Feb 19 '19 at 09:14
  • I am not so sure this is a duplicate @XtremeBaumer the guy clearly states it is working in java8. Something obviously has changed in between. – Alexander Petrov Feb 19 '19 at 09:17
  • @AlexandarPetrov well, it seems pretty clear that it is a NPE as can be seen in the stack trace – XtremeBaumer Feb 19 '19 at 09:19
  • @XtremeBaumer true, still there may be 1000 of flavours for why this is happening. Switching java version is certainly one flavour I would like to learn more about. I will periphrase the question - Why migrating from java8 to java11 would cause incompatability? What has changed ? – Alexander Petrov Feb 19 '19 at 09:22
  • For that we would also need far more code than these 5 lines. Like how its instantianted/filled etc – XtremeBaumer Feb 19 '19 at 09:26
  • @AlexandarPetrov it is an old project that now needs to be extended. And part of this project requirements is also to bring it to the newest java version. – Ace of Spade Feb 19 '19 at 09:27
  • @AceofSpade Can you create a minimal example depicting the bug and post it on github or something like this ? Can you check what is the last java version that is capable of running the source code? Are you able to run on java 9 f.ex. ? The code you have posted is too little two difficult to analyse. – Alexander Petrov Feb 19 '19 at 09:29
  • Probably SwingX lib uses internally some non-public Java-API, which is not accessible since Java-9. As I know the latest version of SwingX is Java-6 compatible. If it so, you can try to grant the full access to all modules. – Sergiy Medvynskyy Feb 19 '19 at 09:49
  • It seams to be a problem with JComboBox. I found setEditor(null). That was the reason for the exception. – Ace of Spade Feb 21 '19 at 08:51

0 Answers0