title: java.lang.IllegalArgumentException: Texture must be non-null (CanvasJs and JavaFX)
body: <p>I am currently using JavaFX and CanvasJS to display graphics</p>
  <p>I have several charts that show dots</p>
  <p>I have JS variables which contain the points of each graph
  (you can modify a point one by one by entering a value and a date in an HTML input)</p>
  <p>When the point is modified in the list of JS points
  I update only the Canvas on which we have made a point modification</p>
  <p>(I also tried refreshing all the Canvases by calling the render () function on each of the CanvasJS.Chart instances)
  (Before I only used global variables in JS to contain the points
  Now when I update a graph the points are in a local variable
  that I test if undefined to try not to have the error anymore)</p>
  <p>However when I modify the points on a graph it works
  but when scrolling and putting the dots on other graphics I have the following error:</p>
  <pre><code>java.lang.NullPointerException
      at com.sun.prism.d3d.D3DTexture.getContext(D3DTexture.java:84)
      at com.sun.prism.d3d.D3DTexture.update(D3DTexture.java:207)
      at com.sun.prism.d3d.D3DTexture.update(D3DTexture.java:151)
      at com.sun.prism.impl.BaseContext.flushMask(BaseContext.java:112)
      at com.sun.prism.impl.BaseContext.drawQuads(BaseContext.java:121)
      at com.sun.prism.impl.VertexBuffer.flush(VertexBuffer.java:98)
      at com.sun.prism.impl.BaseContext.flushVertexBuffer(BaseContext.java:104)
      at com.sun.prism.impl.ps.BaseShaderContext.setRenderTarget(BaseShaderContext.java:753)
      at com.sun.prism.impl.BaseContext.setRenderTarget(BaseContext.java:146)
      at com.sun.prism.impl.BaseGraphics.&lt;init&gt;(BaseGraphics.java:106)
      at com.sun.prism.impl.ps.BaseShaderGraphics.&lt;init&gt;(BaseShaderGraphics.java:86)
      at com.sun.prism.d3d.D3DGraphics.&lt;init&gt;(D3DGraphics.java:42)
      at com.sun.prism.d3d.D3DGraphics.create(D3DGraphics.java:65)
      at com.sun.prism.d3d.D3DRTTexture.createGraphics(D3DRTTexture.java:77)
      at com.sun.prism.d3d.D3DResourceFactory.createRTTexture(D3DResourceFactory.java:316)
      at com.sun.prism.d3d.D3DResourceFactory.createRTTexture(D3DResourceFactory.java:270)
      at com.sun.prism.d3d.D3DResourceFactory.createRTTexture(D3DResourceFactory.java:63)
      at com.sun.javafx.webkit.prism.WCGraphicsPrismContext$Layer.&lt;init&gt;(WCGraphicsPrismContext.java:1367)
      at com.sun.javafx.webkit.prism.WCGraphicsPrismContext$ClipLayer.&lt;init&gt;(WCGraphicsPrismContext.java:1442)
      at com.sun.javafx.webkit.prism.WCGraphicsPrismContext$ClipLayer.&lt;init&gt;(WCGraphicsPrismContext.java:1435)
      at com.sun.javafx.webkit.prism.WCGraphicsPrismContext.setClip(WCGraphicsPrismContext.java:328)
      at com.sun.webkit.graphics.GraphicsDecoder.decode(GraphicsDecoder.java:224)
      at com.sun.webkit.graphics.WCRenderQueue.decode(WCRenderQueue.java:92)
      at com.sun.webkit.graphics.WCRenderQueue.decode(WCRenderQueue.java:103)
      at com.sun.webkit.graphics.WCRenderQueue.decode(WCRenderQueue.java:110)
      at com.sun.webkit.graphics.GraphicsDecoder.decode(GraphicsDecoder.java:348)
      at com.sun.webkit.graphics.WCRenderQueue.decode(WCRenderQueue.java:92)
      at com.sun.webkit.WebPage.paint2GC(WebPage.java:741)
      at com.sun.webkit.WebPage.paint(WebPage.java:708)
      at com.sun.javafx.sg.prism.web.NGWebView.renderContent(NGWebView.java:96)
      at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2053)
      at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1945)
      at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:235)
      at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:577)
      at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2053)
      at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1945)
      at com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:477)
      at com.sun.javafx.tk.quantum.ViewPainter.paintImpl(ViewPainter.java:330)
      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:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
      at java.lang.Thread.run(Thread.java:748)
  </code></pre>
  <p>My client has this error when scrolling after modifying points :</p>
  <pre><code>java.lang.IllegalArgumentException: Texture must be non-null
      at com.sun.scenario.effect.impl.prism.PrTexture.&lt;init&gt;(PrTexture.java:38)
      at com.sun.scenario.effect.impl.prism.PrDrawable.&lt;init&gt;(PrDrawable.java:44)
      at com.sun.scenario.effect.impl.prism.ps.PPSDrawable.&lt;init&gt;(PPSDrawable.java:39)
      at com.sun.scenario.effect.impl.prism.ps.PPSDrawable.create(PPSDrawable.java:60)
      at com.sun.scenario.effect.impl.prism.ps.PPSRenderer.createCompatibleImage(PPSRenderer.java:163)
      at com.sun.scenario.effect.impl.prism.ps.PPSRenderer.createCompatibleImage(PPSRenderer.java:67)
      at com.sun.scenario.effect.impl.ImagePool.checkOut(ImagePool.java:183)
      at com.sun.scenario.effect.impl.Renderer.getCompatibleImage(Renderer.java:116)
      at com.sun.scenario.effect.impl.prism.ps.PPSRenderer.getCompatibleImage(PPSRenderer.java:168)
      at com.sun.scenario.effect.impl.prism.ps.PPSRenderer.getCompatibleImage(PPSRenderer.java:67)
      at com.sun.scenario.effect.Effect.getCompatibleImage(Effect.java:479)
      at com.sun.javafx.webkit.prism.WCGraphicsPrismContext$ClipLayer.render(WCGraphicsPrismContext.java:1466)
      at com.sun.javafx.webkit.prism.WCGraphicsPrismContext.renderLayer(WCGraphicsPrismContext.java:203)
      at com.sun.javafx.webkit.prism.WCGraphicsPrismContext.restoreStateInternal(WCGraphicsPrismContext.java:220)
      at com.sun.javafx.webkit.prism.WCGraphicsPrismContext.restoreState(WCGraphicsPrismContext.java:234)
      at com.sun.webkit.graphics.GraphicsDecoder.decode(GraphicsDecoder.java:221)
      at com.sun.webkit.graphics.WCRenderQueue.decode(WCRenderQueue.java:92)
      at com.sun.webkit.graphics.WCRenderQueue.decode(WCRenderQueue.java:103)
      at com.sun.webkit.graphics.WCRenderQueue.decode(WCRenderQueue.java:110)
      at com.sun.webkit.graphics.GraphicsDecoder.decode(GraphicsDecoder.java:348)
      at com.sun.webkit.graphics.WCRenderQueue.decode(WCRenderQueue.java:92)
      at com.sun.webkit.WebPage.paint2GC(WebPage.java:741)
      at com.sun.webkit.WebPage.paint(WebPage.java:708)
      at com.sun.javafx.sg.prism.web.NGWebView.renderContent(NGWebView.java:96)
      at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2053)
      at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1945)
      at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:235)
      at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:577)
      at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2053)
      at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1945)
      at com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:477)
      at com.sun.javafx.tk.quantum.ViewPainter.paintImpl(ViewPainter.java:330)
      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:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
      at java.lang.Thread.run(Thread.java:748)
  java.lang.AssertionError: java.util.concurrent.ExecutionException: java.lang.NullPointerException
      at com.sun.javafx.webkit.prism.PrismInvoker.runOnRenderThread(PrismInvoker.java:91)
      at com.sun.javafx.webkit.prism.RTImage.getPixelBuffer(RTImage.java:162)
      at com.sun.webkit.WebPage.twkProcessMouseEvent(Native Method)
      at com.sun.webkit.WebPage.dispatchMouseEvent(WebPage.java:814)
      at javafx.scene.web.WebView.processMouseEvent(WebView.java:1045)
      at javafx.scene.web.WebView.lambda$registerEventHandlers$32(WebView.java:1168)
      at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
      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.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:394)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$358(GlassViewEventHandler.java:432)
      at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431)
      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.win.WinApplication._runLoop(Native Method)
      at com.sun.glass.ui.win.WinApplication.lambda$null$152(WinApplication.java:177)
      at java.lang.Thread.run(Thread.java:748)
  </code></pre>
  <p>It seems to me these are known errors: <a href="https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8092801" rel="nofollow noreferrer">https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8092801</a></p>
  <p>I don't understand how to fix it though</p>
  <p>The version of Java I am using is jdk1.8.0_202
  (it is indicated on the site that it is fixed from version JDK 8u20)
  (My client tested with the 8u281 and he still had the error)</p>
  <p>My code is the following:</p>
  <p>(This is the JS code for Updating a chart,
  The functions of the other graphs also modify the value of a point then update their graph)</p>
  <pre><code>$(document).on('click','.modifValue1', function()
  {
      var dateValue1 = $('input[name=&quot;dateValue1&quot;]').val();
      var value1 = parseFloat($('input[name=&quot;value1&quot;]').val().replace(&quot;,&quot;, &quot;.&quot;));
  
      // Dans modifyValue1, on parcoure la liste de points
      // et on modifie le point à la date
      dataValue1Json = modifyValue1(valueGlobalAllPointGraph1, dateValue1, value1);
  
      displayValue1Json(dataValue1Json);
  });
  
  // To update graphe 1
  function displayValue1Json(value1){
  
  // As there is a NullPointer error
  if(value1 === undefined){
      return;
  }
  
     var chartValue1 = new CanvasJS.Chart(&quot;chartContainerValue1&quot;,
          {
              zoomEnabled: true,
              legend:
              {
                  verticalAlign : 'top',
                  horizontalAlign : 'right',
              },
              axisX:{
                  valueFormatString: &quot;MM-YYYY&quot; ,
                  labelAngle: -50,
                  labelFontColor: &quot;black&quot;,
                  title: &quot;temps&quot;,
                  gridColor: &quot;#d2d2d2&quot;,
                  gridThickness: 1
              },
              axisY: {
                  labelFontColor: &quot;#328fe1&quot;,
                  title: &quot;valeur&quot;,
                  titleFontColor: &quot;#328fe1&quot;,
                  lineColor: &quot;#328fe1&quot;,
                  valueFormatString: &quot;####&quot;,
                  gridColor: &quot;#d2d2d2&quot;,
                  includeZero: false,
                  valueFormatString: &quot;0.00&quot;,
              },
              data: [
              {
                  type: &quot;line&quot;,
                  click: onClickPointNullGraph,
                  connectNullData: false,
                  legendText: &quot;value1&quot;,
                      showInLegend: true,
                  color: &quot;#328fe1&quot;,
                  markerSize:3,
                  dataPoints:value1
              }
              ]
          });
  
      chartValue1.render();
  
      $('div#chargementPage').fadeOut();
  }
  </code></pre>
  <p>Do you have an idea ?</p>