方法调用失败取决于Java版本

时间:2019-02-19 09:00:26

标签: java swing

我必须将旧的Java 7项目迁移到Java11。
我只能通过使用 java 11 运行程序来获得异常,但不能通过Java 8运行它。

tableControl是 org.jdesktop.swingx.JXTable JXTable 的实例。
表格不为空。

发生异常:

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

这是使用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

0 个答案:

没有答案