JDK-8090178 : NPE when rendering FX Canvas if the dimensions are too large
  • Type: Bug
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: 7,8,openjfx11,openjfx14
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2013-08-06
  • Updated: 2021-12-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description
I want to draw many (5000) rectangles using Canvas and GraphicsContext. The Canvas is the content of ScrollPane but it's height get's too big (5000*20) and it seems to be problem to render it. I can draw about 500 with default VM settings, if I force it to j2d, I can draw max 1000. 
The problem might also be between chair and computer...

Here is the error:
java.lang.NullPointerException
	at com.sun.javafx.sg.prism.NGCanvas$RenderBuf.validate(NGCanvas.java:76)
	at com.sun.javafx.sg.prism.NGCanvas.initCanvas(NGCanvas.java:336)
	at com.sun.javafx.sg.prism.NGCanvas.renderContent(NGCanvas.java:316)
	at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:187)
	at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:39)
	at com.sun.javafx.sg.BaseNode.render(BaseNode.java:1145)
	at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:204)
	at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:420)
	at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:187)
	at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:39)
	at com.sun.javafx.sg.BaseNode.render(BaseNode.java:1145)
	at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:204)
	at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:420)
	at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:187)
	at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:39)
	at com.sun.javafx.sg.BaseNode.render(BaseNode.java:1145)
	at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:204)
	at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:420)
	at com.sun.javafx.sg.prism.NGNode.renderForClip(NGNode.java:429)
	at com.sun.javafx.sg.prism.NGNode.renderRectClip(NGNode.java:320)
	at com.sun.javafx.sg.prism.NGNode.renderClip(NGNode.java:346)
	at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:179)
	at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:39)
	at com.sun.javafx.sg.BaseNode.render(BaseNode.java:1145)
	at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:204)
	at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:420)
	at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:187)
	at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:39)
	at com.sun.javafx.sg.BaseNode.render(BaseNode.java:1145)
	at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:204)
	at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:187)
	at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:39)
	at com.sun.javafx.sg.BaseNode.render(BaseNode.java:1145)
	at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:204)
	at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:420)
	at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:187)
	at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:39)
	at com.sun.javafx.sg.BaseNode.render(BaseNode.java:1145)
	at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:204)
	at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:420)
	at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:187)
	at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:39)
	at com.sun.javafx.sg.BaseNode.render(BaseNode.java:1145)
	at com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:117)
	at com.sun.javafx.tk.quantum.AbstractPainter.paintImpl(AbstractPainter.java:181)
	at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:73)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
	at com.sun.prism.render.RenderJob.run(RenderJob.java:37)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:98)
	at java.lang.Thread.run(Thread.java:724)
Comments
See JDK-8174077 and JDK-8252562 for additional information. Attaching the test program from JDK-8252562, since that is a simple, self-contained application that reproduces the bug.
02-09-2020

This is related to the general problem of needing to handle large textures. See RT-22669.
10-08-2013