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

TableFilter throws ClassCastException for different Object types in comparison #1535

Open
boraciner opened this issue Jan 12, 2024 · 0 comments

Comments

@boraciner
Copy link

if you have a common object type for a column and store Boolean , Float , Integer etc.. types
TableColumn<TabEntry, Object> valueCol = new TableColumn<>("Value");

It throws exception.

Exception in thread "JavaFX Application Thread" java.lang.ClassCastException: class java.lang.Boolean cannot be cast to class java.lang.Float (java.lang.Boolean and java.lang.Float are in module java.base of loader 'bootstrap')
	at java.base/java.lang.Float.compareTo(Float.java:67)
	at org.controlsfx.control.table.FilterValue.compareTo(FilterValue.java:72)
	at javafx.base/javafx.collections.transformation.SortedList$ElementComparator.compare(SortedList.java:298)
	at javafx.base/javafx.collections.transformation.SortedList$ElementComparator.compare(SortedList.java:288)
	at java.base/java.util.Arrays.binarySearch0(Arrays.java:2340)
	at java.base/java.util.Arrays.binarySearch(Arrays.java:2325)
	at javafx.base/javafx.collections.transformation.SortedList.findPosition(SortedList.java:330)
	at javafx.base/javafx.collections.transformation.SortedList.insertToMapping(SortedList.java:335)
	at javafx.base/javafx.collections.transformation.SortedList.addRemove(SortedList.java:405)
	at javafx.base/javafx.collections.transformation.SortedList.sourceChanged(SortedList.java:108)
	at javafx.base/javafx.collections.transformation.TransformationList.lambda$getListener$0(TransformationList.java:105)
	at javafx.base/javafx.collections.WeakListChangeListener.onChanged(WeakListChangeListener.java:88)
	at javafx.base/com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(ListListenerHelper.java:162)
	at javafx.base/com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:71)
	at javafx.base/javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:238)
	at javafx.base/javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482)
	at javafx.base/javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541)
	at javafx.base/javafx.collections.ObservableListBase.endChange(ObservableListBase.java:210)
	at javafx.base/javafx.collections.transformation.FilteredList.sourceChanged(FilteredList.java:147)
	at javafx.base/javafx.collections.transformation.TransformationList.lambda$getListener$0(TransformationList.java:105)
	at javafx.base/javafx.collections.WeakListChangeListener.onChanged(WeakListChangeListener.java:88)
	at javafx.base/com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(ListListenerHelper.java:162)
	at javafx.base/com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:71)
	at javafx.base/javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:238)
	at javafx.base/javafx.collections.transformation.SortedList.sourceChanged(SortedList.java:114)
	at javafx.base/javafx.collections.transformation.TransformationList.lambda$getListener$0(TransformationList.java:105)
	at javafx.base/javafx.collections.WeakListChangeListener.onChanged(WeakListChangeListener.java:88)
	at javafx.base/com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:327)
	at javafx.base/com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:71)
	at javafx.base/javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:238)
	at javafx.base/javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482)
	at javafx.base/javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541)
	at javafx.base/javafx.collections.ObservableListBase.endChange(ObservableListBase.java:210)
	at javafx.base/javafx.collections.ModifiableObservableListBase.add(ModifiableObservableListBase.java:162)
	at java.base/java.util.AbstractList.add(AbstractList.java:111)
	at org.controlsfx.control.table.ColumnFilter.addBackingItem(ColumnFilter.java:311)
	at org.controlsfx.control.table.ColumnFilter.lambda$initializeValues$17(ColumnFilter.java:300)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at org.controlsfx.control.table.ColumnFilter.initializeValues(ColumnFilter.java:300)
	at org.controlsfx.control.table.ColumnFilter.initialize(ColumnFilter.java:168)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at org.controlsfx.control.table.TableFilter.<init>(TableFilter.java:84)
	at org.controlsfx.control.table.TableFilter$Builder.apply(TableFilter.java:241)
	at com.sag.ae.cm.configurator.ui.view.property.PropertyView.addInputPortParameterTab(PropertyView.java:354)
	at com.sag.ae.cm.configurator.ui.view.property.PropertyView.viewAfInstanceProperties(PropertyView.java:322)
	at com.sag.ae.cm.configurator.ui.view.property.PropertyView.handleViewInstancePropertyEvent(PropertyView.java:264)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:348)
	at org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:233)
	at org.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:165)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:437)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:383)
	
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at com.sun.javafx.reflect.Trampoline.invoke(MethodUtil.java:72)
	at jdk.internal.reflect.GeneratedMethodAccessor188.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at javafx.base/com.sun.javafx.reflect.MethodUtil.invoke(MethodUtil.java:270)
	at javafx.fxml/com.sun.javafx.fxml.MethodHelper.invoke(MethodHelper.java:84)
	at javafx.fxml/javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1853)
	at javafx.fxml/javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1726)
	at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
	at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:232)
	at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:189)
	at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
	at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
	at javafx.graphics/javafx.scene.Scene$ClickGenerator.postProcess(Scene.java:3684)
	at javafx.graphics/javafx.scene.Scene$MouseHandler.process(Scene.java:3989)
	at javafx.graphics/javafx.scene.Scene.processMouseEvent(Scene.java:1890)
	at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2704)
	at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:411)
	at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:301)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:450)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:424)
	at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:449)
	at javafx.graphics/com.sun.glass.ui.View.handleMouseEvent(View.java:551)
	at javafx.graphics/com.sun.glass.ui.View.notifyMouse(View.java:937)
	at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
	at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:185)
	at java.base/java.lang.Thread.run(Thread.java:833)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant