Uploaded image for project: 'BlueJ'
  1. BlueJ
  2. BLUEJ-1044

Printing problems: many blank pages printed, NullPointerException in log

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Done
    • Affects Version/s: 4.1.0
    • Fix Version/s: 4.1.1
    • Component/s: Java editor
    • Sprint:
      4.1.1

      Description

      There is an issue when printing with BlueJ 4.1.0. This can cause prints to fail or spew out hundreds of blank pages.

      When printing, we create an off-screen editor component with which to do the printing (because JavaFX would only print the visible scroll pane if we used the on-screen editor). However, it seems that we are missing a check against null at one point in the component, which means we can get an NPE from the off-screen version. I'm not 100% sure why it doesn't always occur, but it's to do with when and how JavaFX/RichTextFX/VirtualFlow perform a layout. Regardless of the extra trigger, the fix is clear: add a null check.

      Stack trace:

      {{

      { Exception in thread "JavaFX Application Thread" java.lang.NullPointerException at bluej.editor.moe.MoeEditorPane.lambda$setupRedrawListener$7(MoeEditorPane.java:147) at org.reactfx.collection.ChangeListenerWrapper.onChange(LiveList.java:439) at org.reactfx.collection.ChangeListenerWrapper.onChange(LiveList.java:417) at org.reactfx.util.ListNotifications.lambda$takeHead$0(NotificationAccumulator.java:317) at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68) at org.reactfx.collection.MemoizationListImpl$MemoizedView.publishNotifications(MemoizationList.java:58) at org.reactfx.collection.MemoizationListImpl$MemoizedView.access$300(MemoizationList.java:30) at org.reactfx.collection.MemoizationListImpl.sourceChanged(MemoizationList.java:89) at org.reactfx.util.ListNotifications.lambda$takeHead$0(NotificationAccumulator.java:317) at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68) at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57) at org.reactfx.collection.MappedList.sourceChanged(MappedList.java:41) at org.reactfx.util.ListNotifications.lambda$takeHead$0(NotificationAccumulator.java:317) at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68) at org.reactfx.SuspendableBase.resume(SuspendableBase.java:64) at org.reactfx.CloseableOnceGuard.close(Guard.java:49) at org.reactfx.MultiGuard.close(Guard.java:83) at org.reactfx.Suspendable$1.resumeSource(Suspendable.java:118) at org.reactfx.Suspendable$1.suspendSource(Suspendable.java:104) at org.reactfx.util.NonAccumulativeStreamNotifications.lambda$head$0(NotificationAccumulator.java:134) at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68) at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57) at org.reactfx.ProperEventStream.emit(ProperEventStream.java:18) at org.reactfx.EventStreams$3.lambda$observeInputs$0(EventStreams.java:105) at org.reactfx.value.ChangeListenerWrapper.accept(Val.java:786) at org.reactfx.util.AbstractReducingStreamNotifications.lambda$head$0(NotificationAccumulator.java:248) at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:68) at org.reactfx.ObservableBase.notifyObservers(ObservableBase.java:57) at org.reactfx.value.ValBase.invalidate(ValBase.java:32) at org.reactfx.SuspendableBoolean.release(SuspendableBoolean.java:24) at org.reactfx.CloseableOnceGuard.close(Guard.java:49) at org.reactfx.Suspendable.suspendWhile(Suspendable.java:49) at org.fxmisc.richtext.model.GenericEditableStyledDocumentBase.update(GenericEditableStyledDocumentBase.java:222) at org.reactfx.util.Tuple3.exec(Tuple3.java:43) at org.fxmisc.richtext.model.GenericEditableStyledDocumentBase.setParagraphStyle(GenericEditableStyledDocumentBase.java:179) at org.fxmisc.richtext.model.SimpleEditableStyledDocument.setParagraphStyle(SimpleEditableStyledDocument.java:7) at bluej.editor.moe.MoeEditor.printTo(MoeEditor.java:1631) at bluej.editor.moe.MoeEditor.print(MoeEditor.java:1696) at bluej.editor.moe.MoeActions.lambda$printAction$13(MoeActions.java:1232) at bluej.editor.moe.MoeActions$1.actionPerformed(MoeActions.java:1159) at bluej.utility.javafx.FXAbstractAction.lambda$prepareContextMenuItem$1(FXAbstractAction.java:181) 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.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58) 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:49) at javafx.event.Event.fireEvent(Event.java:198) at javafx.scene.control.MenuItem.fire(MenuItem.java:462) at com.sun.javafx.scene.control.ControlAcceleratorSupport.lambda$doAcceleratorInstall$12(ControlAcceleratorSupport.java:165) at com.sun.javafx.scene.KeyboardShortcutsHandler.processAccelerators(KeyboardShortcutsHandler.java:347) at com.sun.javafx.scene.KeyboardShortcutsHandler.dispatchBubblingEvent(KeyboardShortcutsHandler.java:163) 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.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$KeyHandler.process(Scene.java:3964) at javafx.scene.Scene$KeyHandler.access$1800(Scene.java:3910) at javafx.scene.Scene.impl_processKeyEvent(Scene.java:2040) at javafx.scene.Scene$ScenePeerListener.keyEvent(Scene.java:2501) at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:217) at com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(GlassViewEventHandler.java:149) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleKeyEvent$353(GlassViewEventHandler.java:248) at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389) at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleKeyEvent(GlassViewEventHandler.java:247) at com.sun.glass.ui.View.handleKeyEvent(View.java:546) at com.sun.glass.ui.View.notifyKey(View.java:966) 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:748) }

      }}

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                nccb Neil Brown
                Reporter:
                nccb Neil Brown
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: