java.lang.ClassCastException: java.lang.String cannot be cast to cache.CodeTableValue

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Bug with JavaFX ComboBox?
    via Stack Overflow by purring pigeon
    ,
  • FULL PRODUCT VERSION : java version "1.8.0_66" Java(TM) SE Runtime Environment (build 1.8.0_66-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode) ADDITIONAL OS VERSION INFORMATION : Linux pc682 3.13.0-68-generic #111-Ubuntu SMP Fri Nov 6 18:17:06 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux A DESCRIPTION OF THE PROBLEM : An JavaFX Spinner<Integer> throws a "java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Integer" exception under Linux whereas it perfectly works under Windows. The problem seems to be that the JVM uses the order of the constructors of Spinner to decide whether to instantiate a Spinner<Double> or Spinner<Integer> and this constructor order seems to be interpreted differently in the Windows JVM and the Linux JVM. That's why a Java program with a Spinner<Integer> that runs nicely under Windows throws an exception under Linux. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Use the example code from the description, start the application and change the spinner value. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - The Spinner should not throw an exception. ACTUAL - The Spinner throws the following exception (under Linux): Exception in thread "JavaFX Application Thread" java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Integer at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:361) at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81) at javafx.beans.property.ReadOnlyObjectWrapper$ReadOnlyPropertyImpl.fireValueChangedEvent(ReadOnlyObjectWrapper.java:176) at javafx.beans.property.ReadOnlyObjectWrapper.fireValueChangedEvent(ReadOnlyObjectWrapper.java:142) at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:112) at javafx.beans.property.ObjectPropertyBase.access$000(ObjectPropertyBase.java:51) at javafx.beans.property.ObjectPropertyBase$Listener.invalidated(ObjectPropertyBase.java:233) at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:349) at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81) at javafx.beans.property.ObjectPropertyBase.fireValueChangedEvent(ObjectPropertyBase.java:105) at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:112) at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:146) at javafx.scene.control.SpinnerValueFactory.setValue(SpinnerValueFactory.java:150) at javafx.scene.control.SpinnerValueFactory$DoubleSpinnerValueFactory.increment(SpinnerValueFactory.java:850) at javafx.scene.control.Spinner.increment(Spinner.java:394) at com.sun.javafx.scene.control.behavior.SpinnerBehavior.increment(SpinnerBehavior.java:132) at com.sun.javafx.scene.control.behavior.SpinnerBehavior.lambda$new$209(SpinnerBehavior.java:62) at com.sun.javafx.scene.control.behavior.SpinnerBehavior.startSpinning(SpinnerBehavior.java:151) at com.sun.javafx.scene.control.skin.SpinnerSkin.lambda$new$468(SpinnerSkin.java:99) at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238) at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191) at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56) at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114) at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74) at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54) at javafx.event.Event.fireEvent(Event.java:198) at javafx.scene.Scene$MouseHandler.process(Scene.java:3757) at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485) at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762) at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494) at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:352) at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:275) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$354(GlassViewEventHandler.java:388) at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389) at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:387) at com.sun.glass.ui.View.handleMouseEvent(View.java:555) at com.sun.glass.ui.View.notifyMouse(View.java:937) at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method) at com.sun.glass.ui.gtk.GtkApplication.lambda$null$49(GtkApplication.java:139) at java.lang.Thread.run(Thread.java:745) REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- Here is a minimal example that shows the bug when you change the Spinner value: TestApplication.java -------------------- import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; import java.net.URL; public class TestApplication extends Application { @Override public void start(Stage stage) throws Exception { URL resource = getClass().getResource("test.fxml"); FXMLLoader loader = new FXMLLoader(resource); Parent root = loader.load(); stage.setScene(new Scene(root)); stage.show(); } public static void main(String[] args) { launch(args); } } TestController.java ------------------- import javafx.fxml.Initializable; import javafx.scene.control.Spinner; import java.net.URL; import java.util.ResourceBundle; public class TestController implements Initializable { public Spinner<Integer> smoothingSpinner; @Override public void initialize(URL location, ResourceBundle resources) { smoothingSpinner.valueProperty().addListener((observable, oldValue, newValue) -> { System.out.println(newValue); }); } } test.fxml --------- <?xml version="1.0" encoding="UTF-8"?> <?import javafx.scene.control.Spinner?> <?import javafx.scene.layout.GridPane?> <?import javafx.scene.layout.VBox?> <VBox prefHeight="200.0" prefWidth="300.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="TestController"> <Spinner fx:id="smoothingSpinner" editable="true" min="0" max="100" initialValue="3" /> </VBox> ---------- END SOURCE ----------
    via by Webbug Group,
    • java.lang.ClassCastException: java.lang.String cannot be cast to cache.CodeTableValue at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:361) at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81) at javafx.beans.property.ReadOnlyObjectPropertyBase.fireValueChangedEvent(ReadOnlyObjectPropertyBase.java:74) at javafx.beans.property.ReadOnlyObjectWrapper.fireValueChangedEvent(ReadOnlyObjectWrapper.java:102) at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:112) at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:146) at javafx.scene.control.SelectionModel.setSelectedItem(SelectionModel.java:102) at javafx.scene.control.ComboBox.lambda$new$152(ComboBox.java:249) at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:361) at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81) at javafx.beans.property.ObjectPropertyBase.fireValueChangedEvent(ObjectPropertyBase.java:105) at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:112) at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:146) at javafx.scene.control.ComboBoxBase.setValue(ComboBoxBase.java:150) at com.sun.javafx.scene.control.skin.ComboBoxPopupControl.setTextFromTextFieldIntoComboBoxValue(ComboBoxPopupControl.java:405) at com.sun.javafx.scene.control.skin.ComboBoxPopupControl.lambda$new$291(ComboBoxPopupControl.java:82) at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:361) at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81) at javafx.beans.property.ReadOnlyBooleanPropertyBase.fireValueChangedEvent(ReadOnlyBooleanPropertyBase.java:72) at javafx.scene.Node$FocusedProperty.notifyListeners(Node.java:7718) at javafx.scene.Node.setFocused(Node.java:7771) at javafx.scene.Scene$KeyHandler.setWindowFocused(Scene.java:3932) at javafx.scene.Scene$KeyHandler.lambda$new$11(Scene.java:3954) at com.sun.javafx.binding.ExpressionHelper$SingleInvalidation.fireValueChangedEvent(ExpressionHelper.java:137) at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81) at javafx.beans.property.ReadOnlyBooleanPropertyBase.fireValueChangedEvent(ReadOnlyBooleanPropertyBase.java:72) at javafx.beans.property.ReadOnlyBooleanWrapper.fireValueChangedEvent(ReadOnlyBooleanWrapper.java:103) at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:110) at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:144) at javafx.stage.Window.setFocused(Window.java:439) at com.sun.javafx.stage.WindowPeerListener.changedFocused(WindowPeerListener.java:59) at com.sun.javafx.tk.quantum.GlassWindowEventHandler.run(GlassWindowEventHandler.java:100) at com.sun.javafx.tk.quantum.GlassWindowEventHandler.run(GlassWindowEventHandler.java:40) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.tk.quantum.GlassWindowEventHandler.lambda$handleWindowEvent$423(GlassWindowEventHandler.java:150) at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389) at com.sun.javafx.tk.quantum.GlassWindowEventHandler.handleWindowEvent(GlassWindowEventHandler.java:148) at com.sun.glass.ui.Window.handleWindowEvent(Window.java:1266) at com.sun.glass.ui.Window.notifyFocus(Window.java:1245) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191) at java.lang.Thread.run(Thread.java:745)
    No Bugmate found.