JDK-8261077 : TextAreaSkin.dispose() throws UnsupportedOperationException
  • Type: Bug
  • Component: javafx
  • Sub-Component: controls
  • Affected Version:
    openjfx11,openjfx12,openjfx15,openjfx16 openjfx11,openjfx12,openjfx15,openjfx16
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2021-01-31
  • Updated: 2021-02-03
  • Resolved: 2021-02-03
Related Reports
Duplicate :  
Description
A DESCRIPTION OF THE PROBLEM :
The method always fails due to throwing hardcoded exception

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Calling TextAreaSkin.dispose() directly, or by calling textArea.setSkin(null or some skin)

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Should never fail
ACTUAL -
Always fails

---------- BEGIN SOURCE ----------

import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.scene.control.TextArea;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

/** Showcasing javafx bug */
class JavaFxBugTextAreaDispose extends Application {

	public static void main(String[] args) {
		launch(args);
	}

	@Override
	public void start(Stage stage) {
		final TextArea textArea = new TextArea();
		final StackPane background = new StackPane(textArea);
		final Scene scene = new Scene(background, 600, 500);

		stage.setScene(scene);
		stage.show();

		Platform.runLater(() -> {
			background.getChildren().clear();
			textArea.setSkin(null);
		});
	}

}
---------- END SOURCE ----------

FREQUENCY : always



Comments
Duplicate of JDK-8244419.
03-02-2021

Relevant Discussion : https://github.com/javafxports/openjdk-jfx/issues/405
03-02-2021

Checked with attached testcase in Windows 10, Issue is reproducible, Exception is thrown. Exception in thread "JavaFX Application Thread" java.lang.UnsupportedOperationException at javafx.controls/javafx.scene.control.skin.TextAreaSkin.dispose(TextAreaSkin.java:842) at javafx.controls/javafx.scene.control.Control$2.invalidated(Control.java:267) at javafx.base/javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:112) at javafx.base/javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:147) at javafx.graphics/javafx.css.StyleableObjectProperty.set(StyleableObjectProperty.java:82) at javafx.controls/javafx.scene.control.Control$2.set(Control.java:250) at javafx.controls/javafx.scene.control.Control$2.set(Control.java:233) at javafx.controls/javafx.scene.control.Control.setSkin(Control.java:230) at JavaFxBugTextAreaDispose.lambda$start$0(JavaFxBugTextAreaDispose.java:26) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428) at java.base/java.security.AccessController.doPrivileged(AccessController.java:391) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427) at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96) 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:174) at java.base/java.lang.Thread.run(Thread.java:832) Test Result: ========= openjfx_11 : Fail openjfx_15 : Fail openjfx_16_ea : Fail
03-02-2021