Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8097538

NPE when chaining Lighting effect with other effects

    XMLWordPrintable

    Details

    • Subcomponent:
    • Verification:
      Not verified

      Backports

        Description

        Chaining Lighting to Reflection produces NullPointerException. This is a problem in 8u40 b20, but not an issue in 8u25 and earlier. Here is a sample program that can be used to reproduce exception.

        {code}
        import javafx.application.Application;
        import javafx.collections.ObservableList;
        import javafx.scene.Group;
        import javafx.scene.Node;
        import javafx.scene.Scene;
        import javafx.scene.effect.Lighting;
        import javafx.scene.effect.Reflection;
        import javafx.scene.layout.HBox;
        import javafx.scene.text.Text;
        import javafx.stage.Stage;


        public class HelloFX extends Application {

            @Override
            public void start(Stage stage) throws Exception {
                stage.show();

                Scene scene = new Scene(new Group(), 400, 400);
                ObservableList<Node> content = ((Group) scene.getRoot()).getChildren();

                content.add(chainEffects());
                stage.setScene(scene);

            }

            static Node chainEffects() {

                Text text1 = new Text("Hello");
                text1.setStyle("-fx-font-size: 100pt");

                Lighting lighting = new Lighting();

                Reflection reflection = new Reflection();
                reflection.setInput(lighting);

                HBox hbox = new HBox();
                hbox.getChildren().add(text1);
                hbox.setEffect(reflection);

                return hbox;
            }

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

        Exception stack trace:
        {noformat}
        java.lang.NullPointerException
        at com.sun.javafx.geom.Rectangle.<init>(Rectangle.java:164)
        at com.sun.scenario.effect.PhongLighting$1.getInputClip(PhongLighting.java:329)
        at com.sun.scenario.effect.FilterEffect.filter(FilterEffect.java:186)
        at com.sun.scenario.effect.FilterEffect.filter(FilterEffect.java:185)
        at com.sun.scenario.effect.impl.prism.PrEffectHelper.render(PrEffectHelper.java:166)
        at com.sun.javafx.sg.prism.EffectFilter.render(EffectFilter.java:61)
        at com.sun.javafx.sg.prism.NGNode.renderEffect(NGNode.java:2379)
        at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2064)
        at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1959)
        at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:235)
        at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2067)
        at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1959)
        at com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:474)
        at com.sun.javafx.tk.quantum.ViewPainter.paintImpl(ViewPainter.java:327)
        at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:91)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
        at java.lang.Thread.run(Thread.java:745)
        java.lang.NullPointerException
        at com.sun.javafx.geom.Rectangle.<init>(Rectangle.java:164)
        at com.sun.scenario.effect.PhongLighting$1.getInputClip(PhongLighting.java:329)
        at com.sun.scenario.effect.FilterEffect.filter(FilterEffect.java:186)
        at com.sun.scenario.effect.FilterEffect.filter(FilterEffect.java:185)
        at com.sun.scenario.effect.impl.prism.PrEffectHelper.render(PrEffectHelper.java:166)
        at com.sun.javafx.sg.prism.EffectFilter.render(EffectFilter.java:61)
        at com.sun.javafx.sg.prism.NGNode.renderEffect(NGNode.java:2379)
        at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2064)
        at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1959)
        at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:235)
        at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2067)
        at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1959)
        at com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:474)
        at com.sun.javafx.tk.quantum.ViewPainter.paintImpl(ViewPainter.java:327)
        at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:91)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
        at java.lang.Thread.run(Thread.java:745)
        java.lang.NullPointerException
        at com.sun.javafx.geom.Rectangle.<init>(Rectangle.java:164)
        at com.sun.scenario.effect.PhongLighting$1.getInputClip(PhongLighting.java:329)
        at com.sun.scenario.effect.FilterEffect.filter(FilterEffect.java:186)
        at com.sun.scenario.effect.FilterEffect.filter(FilterEffect.java:185)
        at com.sun.scenario.effect.impl.prism.PrEffectHelper.render(PrEffectHelper.java:166)
        at com.sun.javafx.sg.prism.EffectFilter.render(EffectFilter.java:61)
        at com.sun.javafx.sg.prism.NGNode.renderEffect(NGNode.java:2379)
        at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2064)
        at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1959)
        at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:235)
        at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2067)
        at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1959)
        at com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:474)
        at com.sun.javafx.tk.quantum.ViewPainter.paintImpl(ViewPainter.java:327)
        at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:91)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
        at java.lang.Thread.run(Thread.java:745)
        java.lang.NullPointerException
        at com.sun.javafx.geom.Rectangle.<init>(Rectangle.java:164)
        at com.sun.scenario.effect.PhongLighting$1.getInputClip(PhongLighting.java:329)
        at com.sun.scenario.effect.FilterEffect.filter(FilterEffect.java:186)
        at com.sun.scenario.effect.FilterEffect.filter(FilterEffect.java:185)
        at com.sun.scenario.effect.impl.prism.PrEffectHelper.render(PrEffectHelper.java:166)
        at com.sun.javafx.sg.prism.EffectFilter.render(EffectFilter.java:61)
        at com.sun.javafx.sg.prism.NGNode.renderEffect(NGNode.java:2379)
        at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2064)
        at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1959)
        at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:235)
        at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2067)
        at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1959)
        at com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:474)
        at com.sun.javafx.tk.quantum.ViewPainter.paintImpl(ViewPainter.java:327)
        at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:91)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
        at java.lang.Thread.run(Thread.java:745)
        {noformat}

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                flar Jim Graham
                Reporter:
                duke J. Duke (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported: